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:
@@ -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 )
|
||||
{
|
||||
|
@@ -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 );
|
||||
|
Reference in New Issue
Block a user