mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
Change preferred download format on the fly when settings have been changed
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2015, Dominik Schmidt <domme@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -538,9 +539,33 @@ Result::setDownloadFormats( const QList<DownloadFormat>& formats )
|
|||||||
foreach ( const DownloadFormat& format, formats )
|
foreach ( const DownloadFormat& format, formats )
|
||||||
{
|
{
|
||||||
if ( format.extension.toLower() == TomahawkSettings::instance()->downloadsPreferredFormat().toLower() )
|
if ( format.extension.toLower() == TomahawkSettings::instance()->downloadsPreferredFormat().toLower() )
|
||||||
|
{
|
||||||
m_formats.insert( 0, format );
|
m_formats.insert( 0, format );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_formats << format;
|
m_formats << format;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !m_formats.isEmpty() )
|
||||||
|
{
|
||||||
|
connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( onSettingsChanged() ), Qt::UniqueConnection );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TomahawkSettings::instance()->disconnect( this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Result::onSettingsChanged()
|
||||||
|
{
|
||||||
|
if ( TomahawkSettings::instance()->downloadsPreferredFormat().toLower() != m_formats.first().extension.toLower() )
|
||||||
|
{
|
||||||
|
setDownloadFormats( downloadFormats() );
|
||||||
|
emit updated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
|
* Copyright 2015, Dominik Schmidt <domme@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -152,6 +153,8 @@ private slots:
|
|||||||
void onResolverRemoved( Tomahawk::Resolver* resolver );
|
void onResolverRemoved( Tomahawk::Resolver* resolver );
|
||||||
void doneEditing();
|
void doneEditing();
|
||||||
|
|
||||||
|
void onSettingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// private constructor
|
// private constructor
|
||||||
explicit Result( const QString& url, const Tomahawk::track_ptr& track );
|
explicit Result( const QString& url, const Tomahawk::track_ptr& track );
|
||||||
|
Reference in New Issue
Block a user