diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index a010b16fb..444346cea 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -27,6 +27,7 @@ #include "infobar/InfoBar.h" #include "topbar/TopBar.h" +#include "FlexibleView.h" #include "TreeModel.h" #include "PlaylistModel.h" #include "PlaylistView.h" @@ -94,6 +95,7 @@ ViewManager::ViewManager( QObject* parent ) m_widget->layout()->addWidget( m_contextWidget ); m_superCollectionView = new TreeView(); + m_superCollectionView->proxyModel()->setStyle( PlayableProxyModel::Collection ); m_superCollectionModel = new TreeModel( m_superCollectionView ); m_superCollectionView->setTreeModel( m_superCollectionModel ); m_superCollectionView->setShowModes( false ); @@ -137,16 +139,20 @@ ViewManager::~ViewManager() } -PlaylistView* -ViewManager::createPageForPlaylist( const playlist_ptr& pl ) +FlexibleView* +ViewManager::createPageForPlaylist( const playlist_ptr& playlist ) { - PlaylistView* view = new PlaylistView(); + FlexibleView* view = new FlexibleView(); PlaylistModel* model = new PlaylistModel(); - view->setPlaylistModel( model ); - model->loadPlaylist( pl ); - pl->resolve(); + view->setPlayableModel( model ); + + PlaylistView* pv = new PlaylistView(); + pv->setPlaylistModel( model ); + view->setDetailedView( pv ); + + model->loadPlaylist( playlist ); + playlist->resolve(); - m_playlistViews.insert( pl, view ); return view; } @@ -170,11 +176,12 @@ ViewManager::playlistForPage( ViewPage* page ) const Tomahawk::ViewPage* ViewManager::show( const Tomahawk::playlist_ptr& playlist ) { - PlaylistView* view; + FlexibleView* view; if ( !m_playlistViews.contains( playlist ) || m_playlistViews.value( playlist ).isNull() ) { view = createPageForPlaylist( playlist ); + m_playlistViews.insert( playlist, view ); } else { @@ -182,7 +189,6 @@ ViewManager::show( const Tomahawk::playlist_ptr& playlist ) } setPage( view ); - emit numSourcesChanged( SourceList::instance()->count() ); return view; @@ -303,6 +309,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection ) if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() ) { view = new TreeView(); + view->proxyModel()->setStyle( PlayableProxyModel::Collection ); TreeModel* model = new TreeModel(); view->setTreeModel( model ); @@ -486,7 +493,7 @@ ViewManager::showRecentPlaysPage() RecentlyPlayedModel* raModel = new RecentlyPlayedModel( pv ); raModel->setTitle( tr( "Recently Played Tracks" ) ); raModel->setDescription( tr( "Recently played tracks from all your friends" ) ); - raModel->setStyle( PlayableModel::Large ); + pv->proxyModel()->setStyle( PlayableProxyModel::Large ); PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv, pv->proxyModel() ); connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv, SLOT( update( QModelIndex ) ) ); @@ -737,12 +744,16 @@ ViewManager::saveCurrentPlaylistSettings() TomahawkSettings* s = TomahawkSettings::instance(); Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() ); - if ( !pl.isNull() ) { + if ( !pl.isNull() ) + { s->setShuffleState( pl->guid(), currentPlaylistInterface()->shuffled() ); s->setRepeatMode( pl->guid(), currentPlaylistInterface()->repeatMode() ); - } else { + } + else + { Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() ); - if ( !dynPl.isNull() ) { + if ( !dynPl.isNull() ) + { s->setShuffleState( dynPl->guid(), currentPlaylistInterface()->shuffled() ); s->setRepeatMode( dynPl->guid(), currentPlaylistInterface()->repeatMode() ); } @@ -977,7 +988,7 @@ ViewManager::currentPage() const Tomahawk::playlist_ptr ViewManager::playlistForInterface( Tomahawk::playlistinterface_ptr interface ) const { - foreach ( QWeakPointer view, m_playlistViews.values() ) + foreach ( QWeakPointer view, m_playlistViews.values() ) { if ( !view.isNull() && view.data()->playlistInterface() == interface ) { diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index d4fefe1bf..1f6e7f2b4 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -40,6 +40,7 @@ class ArtistInfoWidget; class TreeView; class CollectionModel; class ContextWidget; +class FlexibleView; class PlaylistModel; class PlaylistView; class TrackProxyModel; @@ -104,7 +105,7 @@ public: // only use this is you need to create a playlist and show it directly and want it to be // linked to the sidebar. call it right after creating the playlist - PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl ); + FlexibleView* createPageForPlaylist( const Tomahawk::playlist_ptr& playlist ); bool isTomahawkLoaded() const { return m_loaded; } @@ -132,7 +133,7 @@ signals: void hideQueueRequested(); void tomahawkLoaded(); - + void historyBackAvailable( bool avail ); void historyForwardAvailable( bool avail ); @@ -156,7 +157,7 @@ public slots: void historyBack(); void historyForward(); - + QList< Tomahawk::ViewPage* > historyPages() const; void destroyPage( Tomahawk::ViewPage* page ); @@ -220,7 +221,7 @@ private: QHash< Tomahawk::artist_ptr, QWeakPointer > m_artistViews; QHash< Tomahawk::album_ptr, QWeakPointer > m_albumViews; QHash< Tomahawk::query_ptr, QWeakPointer > m_trackViews; - QHash< Tomahawk::playlist_ptr, QWeakPointer > m_playlistViews; + QHash< Tomahawk::playlist_ptr, QWeakPointer > m_playlistViews; QHash< Tomahawk::source_ptr, QWeakPointer > m_sourceViews; QList m_pageHistoryBack;