1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00

* Fixed selecting Super Collection when it becomes active.

This commit is contained in:
Christian Muehlhaeuser
2011-02-27 05:03:18 +01:00
parent 5ac6a0309c
commit 8945577fcd
2 changed files with 22 additions and 25 deletions

View File

@@ -47,7 +47,6 @@ PlaylistManager::PlaylistManager( QObject* parent )
, m_widget( new QWidget() ) , m_widget( new QWidget() )
, m_welcomeWidget( new WelcomeWidget() ) , m_welcomeWidget( new WelcomeWidget() )
, m_currentMode( 0 ) , m_currentMode( 0 )
, m_superCollectionVisible( true )
{ {
s_instance = this; s_instance = this;
@@ -151,11 +150,9 @@ PlaylistManager::show( const Tomahawk::playlist_ptr& playlist )
} }
setPage( view ); setPage( view );
m_superCollectionVisible = false;
TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist ); TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist );
emit numSourcesChanged( SourceList::instance()->count() ); emit numSourcesChanged( SourceList::instance()->count() );
return true; return true;
} }
@@ -177,11 +174,9 @@ PlaylistManager::show( const Tomahawk::dynplaylist_ptr& playlist )
else else
m_queueView->show(); m_queueView->show();
m_superCollectionVisible = false;
TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist ); TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist );
emit numSourcesChanged( SourceList::instance()->count() ); emit numSourcesChanged( SourceList::instance()->count() );
return true; return true;
} }
@@ -208,9 +203,8 @@ PlaylistManager::show( const Tomahawk::artist_ptr& artist )
} }
setPage( view ); setPage( view );
m_superCollectionVisible = false;
emit numSourcesChanged( 1 ); emit numSourcesChanged( 1 );
return true; return true;
} }
@@ -236,9 +230,8 @@ PlaylistManager::show( const Tomahawk::album_ptr& album )
} }
setPage( view ); setPage( view );
m_superCollectionVisible = false;
emit numSourcesChanged( 1 ); emit numSourcesChanged( 1 );
return true; return true;
} }
@@ -291,9 +284,8 @@ PlaylistManager::show( const Tomahawk::collection_ptr& collection )
setPage( aview ); setPage( aview );
} }
m_superCollectionVisible = false;
emit numSourcesChanged( 1 ); emit numSourcesChanged( 1 );
return true; return true;
} }
@@ -313,9 +305,8 @@ PlaylistManager::show( const Tomahawk::source_ptr& source )
} }
setPage( swidget ); setPage( swidget );
m_superCollectionVisible = false;
emit numSourcesChanged( 1 ); emit numSourcesChanged( 1 );
return true; return true;
} }
@@ -329,7 +320,6 @@ PlaylistManager::show( ViewPage* page )
} }
setPage( page ); setPage( page );
m_superCollectionVisible = false;
return true; return true;
} }
@@ -360,9 +350,8 @@ PlaylistManager::showSuperCollection()
setPage( m_superAlbumView ); setPage( m_superAlbumView );
} }
m_superCollectionVisible = true;
emit numSourcesChanged( m_superCollections.count() ); emit numSourcesChanged( m_superCollections.count() );
return true; return true;
} }
@@ -381,7 +370,7 @@ PlaylistManager::setTableMode()
m_currentMode = 0; m_currentMode = 0;
if ( m_superCollectionVisible ) if ( isSuperCollectionVisible() )
showSuperCollection(); showSuperCollection();
else else
show( m_currentCollection ); show( m_currentCollection );
@@ -397,7 +386,7 @@ PlaylistManager::setTreeMode()
m_currentMode = 1; m_currentMode = 1;
if ( m_superCollectionVisible ) if ( isSuperCollectionVisible() )
showSuperCollection(); showSuperCollection();
else else
show( m_currentCollection ); show( m_currentCollection );
@@ -411,7 +400,7 @@ PlaylistManager::setAlbumMode()
m_currentMode = 2; m_currentMode = 2;
if ( m_superCollectionVisible ) if ( isSuperCollectionVisible() )
showSuperCollection(); showSuperCollection();
else else
show( m_currentCollection ); show( m_currentCollection );
@@ -531,6 +520,8 @@ PlaylistManager::setPage( ViewPage* page, bool trackHistory )
emit dynamicPlaylistActivated( dynamicPlaylistForInterface( currentPlaylistInterface() ) ); emit dynamicPlaylistActivated( dynamicPlaylistForInterface( currentPlaylistInterface() ) );
if ( collectionForInterface( currentPlaylistInterface() ) ) if ( collectionForInterface( currentPlaylistInterface() ) )
emit collectionActivated( collectionForInterface( currentPlaylistInterface() ) ); emit collectionActivated( collectionForInterface( currentPlaylistInterface() ) );
if ( isSuperCollectionVisible() )
emit superCollectionActivated();
if ( !currentPlaylistInterface() ) if ( !currentPlaylistInterface() )
emit tempPageActivated(); emit tempPageActivated();
@@ -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 void
PlaylistManager::showCurrentTrack() PlaylistManager::showCurrentTrack()
{ {

View File

@@ -46,7 +46,7 @@ public:
QWidget* widget() const { return m_widget; } QWidget* widget() const { return m_widget; }
PlaylistView* queue() const; PlaylistView* queue() const;
bool isSuperCollectionVisible() const { return true; } bool isSuperCollectionVisible() const;
PlaylistInterface* currentPlaylistInterface() const; PlaylistInterface* currentPlaylistInterface() const;
Tomahawk::ViewPage* currentPage() const; Tomahawk::ViewPage* currentPage() const;
@@ -118,7 +118,6 @@ public slots:
private slots: private slots:
void applyFilter(); void applyFilter();
void onWidgetDestroyed( QWidget* widget ); void onWidgetDestroyed( QWidget* widget );
private: private:
@@ -160,9 +159,7 @@ private:
int m_historyPosition; int m_historyPosition;
Tomahawk::collection_ptr m_currentCollection; Tomahawk::collection_ptr m_currentCollection;
int m_currentMode; int m_currentMode;
bool m_superCollectionVisible;
QTimer m_filterTimer; QTimer m_filterTimer;
QString m_filter; QString m_filter;