1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-29 16:50:11 +02:00

Handle preferred download format in Results.

This commit is contained in:
Christian Muehlhaeuser
2015-04-01 01:45:52 +02:00
parent 2c8c285c66
commit 5d72c82e01
2 changed files with 16 additions and 1 deletions

View File

@@ -33,6 +33,7 @@
#include "Pipeline.h"
#include "PlaylistInterface.h"
#include "Source.h"
#include "TomahawkSettings.h"
#include "Track.h"
#include "Typedefs.h"
@@ -530,6 +531,20 @@ Result::track() const
}
void
Result::setDownloadFormats( const QList<DownloadFormat>& formats )
{
m_formats.clear();
foreach ( const DownloadFormat& format, formats )
{
if ( format.extension.toLower() == TomahawkSettings::instance()->downloadsPreferredFormat().toLower() )
m_formats.insert( 0, format );
else
m_formats << format;
}
}
downloadjob_ptr
Result::toDownloadJob( const DownloadFormat& format )
{

View File

@@ -132,7 +132,7 @@ public:
track_ptr track() const;
QList<DownloadFormat> downloadFormats() const { return m_formats; }
void setDownloadFormats( const QList<DownloadFormat>& formats ) { m_formats = formats; }
void setDownloadFormats( const QList<DownloadFormat>& formats );
downloadjob_ptr downloadJob() const { return m_downloadJob; }
downloadjob_ptr toDownloadJob( const DownloadFormat& format );