From e3302a1365f39fb980c94bcdd7426ff225f7bf23 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 12 Jun 2013 06:21:04 +0200 Subject: [PATCH] * Use FlexibleTreeViews for showing collections. --- src/libtomahawk/ViewManager.cpp | 25 +++++++++++++++---------- src/libtomahawk/ViewManager.h | 3 ++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index 8ec37bbb2..869adc27f 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -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; } diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index cde707f04..cc89d3e5b 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -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 > m_dynamicWidgets; - QHash< Tomahawk::collection_ptr, QPointer > m_treeWidgets; + QHash< Tomahawk::collection_ptr, QPointer > m_collectionViews; QHash< Tomahawk::artist_ptr, QPointer > m_artistViews; QHash< Tomahawk::album_ptr, QPointer > m_albumViews; QHash< Tomahawk::query_ptr, QPointer > m_trackViews;