diff --git a/src/libtomahawk/audio/audioengine.h b/src/libtomahawk/audio/audioengine.h index e34864ef7..840b3b821 100644 --- a/src/libtomahawk/audio/audioengine.h +++ b/src/libtomahawk/audio/audioengine.h @@ -30,7 +30,7 @@ public: unsigned int volume() const { return m_audioOutput->volume() * 100.0; } // in percent bool isPlaying() const { return m_mediaObject->state() == Phonon::PlayingState; } bool isPaused() const { return m_mediaObject->state() == Phonon::PausedState; } - + /* Returns the PlaylistInterface of the currently playing track. Note: This might be different to the current playlist! */ PlaylistInterface* currentTrackPlaylist() const { return m_currentTrackPlaylist; } diff --git a/src/libtomahawk/playlist/playlistmanager.cpp b/src/libtomahawk/playlist/playlistmanager.cpp index 7eceac460..b8062fb86 100644 --- a/src/libtomahawk/playlist/playlistmanager.cpp +++ b/src/libtomahawk/playlist/playlistmanager.cpp @@ -47,7 +47,6 @@ PlaylistManager::PlaylistManager( QObject* parent ) , m_widget( new QWidget() ) , m_welcomeWidget( new WelcomeWidget() ) , m_currentMode( 0 ) - , m_superCollectionVisible( true ) { s_instance = this; @@ -151,11 +150,9 @@ PlaylistManager::show( const Tomahawk::playlist_ptr& playlist ) } setPage( view ); - m_superCollectionVisible = false; - TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist ); - emit numSourcesChanged( SourceList::instance()->count() ); + return true; } @@ -177,11 +174,9 @@ PlaylistManager::show( const Tomahawk::dynplaylist_ptr& playlist ) else m_queueView->show(); - m_superCollectionVisible = false; - TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist ); - emit numSourcesChanged( SourceList::instance()->count() ); + return true; } @@ -208,9 +203,8 @@ PlaylistManager::show( const Tomahawk::artist_ptr& artist ) } setPage( view ); - m_superCollectionVisible = false; - emit numSourcesChanged( 1 ); + return true; } @@ -236,9 +230,8 @@ PlaylistManager::show( const Tomahawk::album_ptr& album ) } setPage( view ); - m_superCollectionVisible = false; - emit numSourcesChanged( 1 ); + return true; } @@ -291,9 +284,8 @@ PlaylistManager::show( const Tomahawk::collection_ptr& collection ) setPage( aview ); } - m_superCollectionVisible = false; - emit numSourcesChanged( 1 ); + return true; } @@ -313,9 +305,8 @@ PlaylistManager::show( const Tomahawk::source_ptr& source ) } setPage( swidget ); - m_superCollectionVisible = false; - emit numSourcesChanged( 1 ); + return true; } @@ -329,7 +320,6 @@ PlaylistManager::show( ViewPage* page ) } setPage( page ); - m_superCollectionVisible = false; return true; } @@ -360,9 +350,8 @@ PlaylistManager::showSuperCollection() setPage( m_superAlbumView ); } - m_superCollectionVisible = true; - emit numSourcesChanged( m_superCollections.count() ); + return true; } @@ -381,7 +370,7 @@ PlaylistManager::setTableMode() m_currentMode = 0; - if ( m_superCollectionVisible ) + if ( isSuperCollectionVisible() ) showSuperCollection(); else show( m_currentCollection ); @@ -397,7 +386,7 @@ PlaylistManager::setTreeMode() m_currentMode = 1; - if ( m_superCollectionVisible ) + if ( isSuperCollectionVisible() ) showSuperCollection(); else show( m_currentCollection ); @@ -411,7 +400,7 @@ PlaylistManager::setAlbumMode() m_currentMode = 2; - if ( m_superCollectionVisible ) + if ( isSuperCollectionVisible() ) showSuperCollection(); else show( m_currentCollection ); @@ -531,10 +520,12 @@ PlaylistManager::setPage( ViewPage* page, bool trackHistory ) emit dynamicPlaylistActivated( dynamicPlaylistForInterface( currentPlaylistInterface() ) ); if ( collectionForInterface( currentPlaylistInterface() ) ) emit collectionActivated( collectionForInterface( currentPlaylistInterface() ) ); + if ( isSuperCollectionVisible() ) + emit superCollectionActivated(); if ( !currentPlaylistInterface() ) emit tempPageActivated(); - if ( !AudioEngine::instance()->playlist() ) + if ( !AudioEngine::instance()->isPlaying() ) AudioEngine::instance()->setPlaylist( currentPlaylistInterface() ); m_stack->setCurrentWidget( page->widget() ); @@ -781,6 +772,15 @@ PlaylistManager::collectionForInterface( PlaylistInterface* interface ) const } +bool +PlaylistManager::isSuperCollectionVisible() const +{ + return ( m_pageHistory.count() && + ( currentPage()->playlistInterface() == m_superCollectionView->playlistInterface() || + currentPage()->playlistInterface() == m_superAlbumView->playlistInterface() ) ); +} + + void PlaylistManager::showCurrentTrack() { diff --git a/src/libtomahawk/playlist/playlistmanager.h b/src/libtomahawk/playlist/playlistmanager.h index 722f7286e..4cab2f398 100644 --- a/src/libtomahawk/playlist/playlistmanager.h +++ b/src/libtomahawk/playlist/playlistmanager.h @@ -46,7 +46,7 @@ public: QWidget* widget() const { return m_widget; } PlaylistView* queue() const; - bool isSuperCollectionVisible() const { return true; } + bool isSuperCollectionVisible() const; PlaylistInterface* currentPlaylistInterface() const; Tomahawk::ViewPage* currentPage() const; @@ -103,8 +103,6 @@ public slots: void showQueue(); void hideQueue(); - void setFilter( const QString& filter ); - void setRepeatMode( PlaylistInterface::RepeatMode mode ); void setShuffled( bool enabled ); @@ -117,8 +115,8 @@ public slots: void onPauseClicked(); private slots: + void setFilter( const QString& filter ); void applyFilter(); - void onWidgetDestroyed( QWidget* widget ); private: @@ -160,9 +158,7 @@ private: int m_historyPosition; Tomahawk::collection_ptr m_currentCollection; - int m_currentMode; - bool m_superCollectionVisible; QTimer m_filterTimer; QString m_filter;