1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-28 03:32:27 +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
src
accounts/spotify
libtomahawk/playlist
sourcetree/items

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

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

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