1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01:00

Only show updater icon if updater is actively syncing

This commit is contained in:
Leo Franchi 2012-05-25 17:12:33 -04:00
parent 3710d617a1
commit ac46b080fe
3 changed files with 12 additions and 10 deletions

View File

@ -342,13 +342,16 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist )
// If it's not being synced, allow the option to sync
bool found = false;
bool manuallyDisabled = false;
QList<PlaylistUpdaterInterface*> updaters = playlist->updaters();
foreach ( PlaylistUpdaterInterface* updater, updaters )
{
if ( SpotifyPlaylistUpdater* spotifyUpdater = qobject_cast< SpotifyPlaylistUpdater* >( updater ) )
{
if ( spotifyUpdater->sync() )
found = true;
found = true;
if ( !spotifyUpdater->sync() )
manuallyDisabled = true;
}
}
@ -356,6 +359,10 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist )
{
action->setText( tr( "Sync with Spotify" ) );
}
else if ( manuallyDisabled )
{
action->setText( tr( "Re-enable syncing with Spotify" ) );
}
else
{
action->setText( tr( "Stop syncing with Spotify" ) );

View File

@ -71,6 +71,8 @@ public:
static void registerUpdaterFactory( PlaylistUpdaterFactory* f );
virtual bool sync() const { return true; }
signals:
void changed();

View File

@ -251,13 +251,6 @@ PlaylistItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
void
PlaylistItem::onUpdated()
{
// No work todo
if ( !m_overlaidIcon.isNull() && m_overlaidUpdaters.operator==( m_playlist->updaters() ) )
{
emit updated();
return;
}
const bool newOverlay = createOverlay();
if ( !newOverlay && !m_overlaidIcon.isNull() )
m_overlaidIcon = QIcon();
@ -278,7 +271,7 @@ PlaylistItem::createOverlay()
QList< QPixmap > icons;
foreach ( PlaylistUpdaterInterface* updater, m_playlist->updaters() )
{
if ( !updater->typeIcon().isNull() )
if ( updater->sync() && !updater->typeIcon().isNull() )
icons << updater->typeIcon();
}