mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 23:39:42 +01:00
* Use FlexibleTreeViews for showing collections.
This commit is contained in:
parent
5e3bdd51c2
commit
e3302a1365
@ -26,11 +26,13 @@
|
||||
#include "infobar/InfoBar.h"
|
||||
|
||||
#include "playlist/FlexibleView.h"
|
||||
#include "playlist/FlexibleTreeView.h"
|
||||
#include "playlist/TreeModel.h"
|
||||
#include "playlist/PlaylistModel.h"
|
||||
#include "playlist/PlaylistView.h"
|
||||
#include "playlist/PlayableProxyModel.h"
|
||||
#include "playlist/PlayableModel.h"
|
||||
#include "playlist/ColumnView.h"
|
||||
#include "playlist/TreeView.h"
|
||||
#include "playlist/TreeWidget.h"
|
||||
#include "playlist/GridView.h"
|
||||
@ -309,28 +311,31 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
|
||||
{
|
||||
m_currentCollection = collection;
|
||||
|
||||
TreeWidget* widget;
|
||||
if ( !m_treeWidgets.contains( collection ) || m_treeWidgets.value( collection ).isNull() )
|
||||
FlexibleTreeView* view;
|
||||
if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() )
|
||||
{
|
||||
widget = new TreeWidget();
|
||||
widget->view()->proxyModel()->setStyle( PlayableProxyModel::Collection );
|
||||
view = new FlexibleTreeView();
|
||||
|
||||
view->columnView()->proxyModel()->setStyle( PlayableProxyModel::Collection );
|
||||
TreeModel* model = new TreeModel();
|
||||
widget->view()->setTreeModel( model );
|
||||
|
||||
view->setTreeModel( model );
|
||||
|
||||
if ( !collection.isNull() )
|
||||
widget->view()->setEmptyTip( collection->emptyText() );
|
||||
view->setEmptyTip( collection->emptyText() );
|
||||
|
||||
model->addCollection( collection );
|
||||
setPage( view );
|
||||
|
||||
m_treeWidgets.insert( collection, widget );
|
||||
m_collectionViews.insert( collection, view );
|
||||
}
|
||||
else
|
||||
{
|
||||
widget = m_treeWidgets.value( collection ).data();
|
||||
view = m_collectionViews.value( collection ).data();
|
||||
}
|
||||
|
||||
setPage( widget );
|
||||
return widget;
|
||||
setPage( view );
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,6 +41,7 @@ class TreeWidget;
|
||||
class CollectionModel;
|
||||
class ContextWidget;
|
||||
class FlexibleView;
|
||||
class FlexibleTreeView;
|
||||
class PlaylistModel;
|
||||
class PlaylistView;
|
||||
class TrackProxyModel;
|
||||
@ -200,7 +201,7 @@ private:
|
||||
QList< Tomahawk::collection_ptr > m_superCollections;
|
||||
|
||||
QHash< Tomahawk::dynplaylist_ptr, QPointer<Tomahawk::DynamicWidget> > m_dynamicWidgets;
|
||||
QHash< Tomahawk::collection_ptr, QPointer<TreeWidget> > m_treeWidgets;
|
||||
QHash< Tomahawk::collection_ptr, QPointer<FlexibleTreeView> > m_collectionViews;
|
||||
QHash< Tomahawk::artist_ptr, QPointer<ArtistInfoWidget> > m_artistViews;
|
||||
QHash< Tomahawk::album_ptr, QPointer<AlbumInfoWidget> > m_albumViews;
|
||||
QHash< Tomahawk::query_ptr, QPointer<TrackInfoWidget> > m_trackViews;
|
||||
|
Loading…
x
Reference in New Issue
Block a user