bool PlaylistManager::show( const Tomahawk::collection_ptr& collection ) { m_currentCollection = collection; if ( m_currentMode == 0 ) { CollectionView* view; if ( !m_collectionViews.contains( collection ) ) { view = new CollectionView(); CollectionFlatModel* model = new CollectionFlatModel(); view->setModel( model ); view->setFrameShape( QFrame::NoFrame ); view->setAttribute( Qt::WA_MacShowFocusRect, 0 ); model->addCollection( collection ); m_collectionViews.insert( collection, view ); } else { view = m_collectionViews.value( collection ); } setPage( view ); } if ( m_currentMode == 2 ) { AlbumView* aview; if ( !m_collectionAlbumViews.contains( collection ) ) { aview = new AlbumView(); AlbumModel* amodel = new AlbumModel( aview ); aview->setModel( amodel ); aview->setFrameShape( QFrame::NoFrame ); aview->setAttribute( Qt::WA_MacShowFocusRect, 0 ); amodel->addCollection( collection ); m_collectionAlbumViews.insert( collection, aview ); } else { aview = m_collectionAlbumViews.value( collection ); } setPage( aview ); } emit numSourcesChanged( 1 ); return true; }
Tomahawk::ViewPage* ViewManager::show( const Tomahawk::collection_ptr& collection ) { qDebug() << Q_FUNC_INFO << m_currentMode; m_currentCollection = collection; ViewPage* shown = 0; if ( m_currentMode == PlaylistInterface::Flat ) { CollectionView* view; if ( !m_collectionViews.contains( collection ) ) { view = new CollectionView(); CollectionFlatModel* model = new CollectionFlatModel(); view->setTrackModel( model ); view->setFrameShape( QFrame::NoFrame ); view->setAttribute( Qt::WA_MacShowFocusRect, 0 ); model->addCollection( collection ); m_collectionViews.insert( collection, view ); } else { view = m_collectionViews.value( collection ); } shown = view; setPage( view ); } if ( m_currentMode == PlaylistInterface::Tree ) { ArtistView* view; if ( !m_treeViews.contains( collection ) ) { view = new ArtistView(); TreeModel* model = new TreeModel(); view->setTreeModel( model ); view->setFrameShape( QFrame::NoFrame ); view->setAttribute( Qt::WA_MacShowFocusRect, 0 ); model->addCollection( collection ); m_treeViews.insert( collection, view ); } else { view = m_treeViews.value( collection ); } shown = view; setPage( view ); } if ( m_currentMode == PlaylistInterface::Album ) { AlbumView* aview; if ( !m_collectionAlbumViews.contains( collection ) ) { aview = new AlbumView(); AlbumModel* amodel = new AlbumModel( aview ); aview->setAlbumModel( amodel ); aview->setFrameShape( QFrame::NoFrame ); aview->setAttribute( Qt::WA_MacShowFocusRect, 0 ); amodel->addCollection( collection ); m_collectionAlbumViews.insert( collection, aview ); } else { aview = m_collectionAlbumViews.value( collection ); } shown = aview; setPage( aview ); } emit numSourcesChanged( 1 ); return shown; }