From 0abc1a4be9a4dc75dc013c6481d7e0da75e545b0 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 1 Jun 2012 05:58:42 +0200 Subject: [PATCH] * Renamed ArtistView to TreeView. --- src/libtomahawk/CMakeLists.txt | 2 +- src/libtomahawk/ViewManager.cpp | 12 +++--- src/libtomahawk/ViewManager.h | 8 ++-- src/libtomahawk/context/ContextWidget.cpp | 2 - .../context/pages/RelatedArtistsContext.cpp | 4 +- .../context/pages/RelatedArtistsContext.h | 4 +- src/libtomahawk/playlist/TreeItemDelegate.cpp | 4 +- src/libtomahawk/playlist/TreeItemDelegate.h | 6 +-- .../playlist/{ArtistView.cpp => TreeView.cpp} | 40 +++++++++---------- .../playlist/{ArtistView.h => TreeView.h} | 12 +++--- src/libtomahawk/widgets/WhatsHotWidget.ui | 6 +-- .../widgets/infowidgets/AlbumInfoWidget.ui | 6 +-- .../widgets/infowidgets/ArtistInfoWidget.ui | 5 --- src/sourcetree/SourcesModel.cpp | 2 +- 14 files changed, 53 insertions(+), 60 deletions(-) rename src/libtomahawk/playlist/{ArtistView.cpp => TreeView.cpp} (93%) rename src/libtomahawk/playlist/{ArtistView.h => TreeView.h} (94%) diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 5b53750f9..501d84cc6 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -61,7 +61,7 @@ set( libGuiSources playlist/AlbumModel.cpp playlist/GridItemDelegate.cpp playlist/GridView.cpp - playlist/ArtistView.cpp + playlist/TreeView.cpp playlist/CustomPlaylistView.cpp playlist/ViewHeader.cpp playlist/RecentlyAddedModel.cpp diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index d2543b6ac..35c5970d5 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -32,7 +32,7 @@ #include "PlaylistView.h" #include "PlayableProxyModel.h" #include "PlayableModel.h" -#include "ArtistView.h" +#include "TreeView.h" #include "GridView.h" #include "AlbumModel.h" #include "SourceList.h" @@ -93,7 +93,7 @@ ViewManager::ViewManager( QObject* parent ) m_widget->layout()->addWidget( m_stack ); m_widget->layout()->addWidget( m_contextWidget ); - m_superCollectionView = new ArtistView(); + m_superCollectionView = new TreeView(); m_superCollectionModel = new TreeModel( m_superCollectionView ); m_superCollectionView->setTreeModel( m_superCollectionModel ); m_superCollectionView->setShowModes( false ); @@ -299,10 +299,10 @@ ViewManager::show( const Tomahawk::collection_ptr& collection ) if ( m_currentMode == PlaylistModes::Tree ) { - ArtistView* view; + TreeView* view; if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() ) { - view = new ArtistView(); + view = new TreeView(); TreeModel* model = new TreeModel(); view->setTreeModel( model ); @@ -1030,7 +1030,7 @@ ViewManager::showCurrentTrack() m_currentMode = PlaylistModes::Flat; else if ( dynamic_cast< GridView* >( page ) ) m_currentMode = PlaylistModes::Album; - else if ( dynamic_cast< ArtistView* >( page ) ) + else if ( dynamic_cast< TreeView* >( page ) ) m_currentMode = PlaylistModes::Tree; else return; @@ -1075,7 +1075,7 @@ ViewManager::recentPlaysWidget() const } -ArtistView* +TreeView* ViewManager::superCollectionView() const { return m_superCollectionView; diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index 50ab8ae85..d4fefe1bf 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -37,7 +37,7 @@ class AlbumModel; class GridView; class AlbumInfoWidget; class ArtistInfoWidget; -class ArtistView; +class TreeView; class CollectionModel; class ContextWidget; class PlaylistModel; @@ -92,7 +92,7 @@ public: Tomahawk::ViewPage* newReleasesWidget() const; Tomahawk::ViewPage* topLovedWidget() const; Tomahawk::ViewPage* recentPlaysWidget() const; - ArtistView* superCollectionView() const; + TreeView* superCollectionView() const; /// Get the view page for the given item. Not pretty... Tomahawk::ViewPage* pageForPlaylist( const Tomahawk::playlist_ptr& pl ) const; @@ -204,7 +204,7 @@ private: AlbumModel* m_superAlbumModel; GridView* m_superGridView; TreeModel* m_superCollectionModel; - ArtistView* m_superCollectionView; + TreeView* m_superCollectionView; QueueView* m_queue; WelcomeWidget* m_welcomeWidget; WhatsHotWidget* m_whatsHotWidget; @@ -215,7 +215,7 @@ private: QList< Tomahawk::collection_ptr > m_superCollections; QHash< Tomahawk::dynplaylist_ptr, QWeakPointer > m_dynamicWidgets; - QHash< Tomahawk::collection_ptr, QWeakPointer > m_treeViews; + QHash< Tomahawk::collection_ptr, QWeakPointer > m_treeViews; QHash< Tomahawk::collection_ptr, QWeakPointer > m_collectionGridViews; QHash< Tomahawk::artist_ptr, QWeakPointer > m_artistViews; QHash< Tomahawk::album_ptr, QWeakPointer > m_albumViews; diff --git a/src/libtomahawk/context/ContextWidget.cpp b/src/libtomahawk/context/ContextWidget.cpp index ce6b69a05..bbf0e8334 100644 --- a/src/libtomahawk/context/ContextWidget.cpp +++ b/src/libtomahawk/context/ContextWidget.cpp @@ -29,8 +29,6 @@ #include "context/pages/TopTracksContext.h" #include "context/pages/WikipediaContext.h" -#include "playlist/ArtistView.h" -#include "playlist/TreeModel.h" #include "Source.h" #include "utils/StyleHelper.h" diff --git a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp index eab2c7d2a..f3a7edd4a 100644 --- a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp +++ b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp @@ -21,7 +21,7 @@ #include -#include "playlist/ArtistView.h" +#include "playlist/TreeView.h" #include "playlist/TreeModel.h" #include "Source.h" @@ -31,7 +31,7 @@ using namespace Tomahawk; RelatedArtistsContext::RelatedArtistsContext() : ContextPage() { - m_relatedView = new ArtistView(); + m_relatedView = new TreeView(); m_relatedView->setGuid( "RelatedArtistsContext" ); m_relatedView->setUpdatesContextView( false ); m_relatedModel = new TreeModel( m_relatedView ); diff --git a/src/libtomahawk/context/pages/RelatedArtistsContext.h b/src/libtomahawk/context/pages/RelatedArtistsContext.h index c87b25630..3e45cebce 100644 --- a/src/libtomahawk/context/pages/RelatedArtistsContext.h +++ b/src/libtomahawk/context/pages/RelatedArtistsContext.h @@ -30,7 +30,7 @@ #include "context/ContextPage.h" class TreeModel; -class ArtistView; +class TreeView; class DLLEXPORT RelatedArtistsContext : public Tomahawk::ContextPage { @@ -58,7 +58,7 @@ private slots: void onSimilarArtistsLoaded(); private: - ArtistView* m_relatedView; + TreeView* m_relatedView; TreeModel* m_relatedModel; QGraphicsProxyWidget* m_proxy; diff --git a/src/libtomahawk/playlist/TreeItemDelegate.cpp b/src/libtomahawk/playlist/TreeItemDelegate.cpp index da0b367db..c22847709 100644 --- a/src/libtomahawk/playlist/TreeItemDelegate.cpp +++ b/src/libtomahawk/playlist/TreeItemDelegate.cpp @@ -35,10 +35,10 @@ #include "PlayableItem.h" #include "TreeProxyModel.h" #include "Source.h" -#include "ArtistView.h" +#include "TreeView.h" -TreeItemDelegate::TreeItemDelegate( ArtistView* parent, TreeProxyModel* proxy ) +TreeItemDelegate::TreeItemDelegate( TreeView* parent, TreeProxyModel* proxy ) : QStyledItemDelegate( (QObject*)parent ) , m_view( parent ) , m_model( proxy ) diff --git a/src/libtomahawk/playlist/TreeItemDelegate.h b/src/libtomahawk/playlist/TreeItemDelegate.h index 419bc6790..2c4e90f12 100644 --- a/src/libtomahawk/playlist/TreeItemDelegate.h +++ b/src/libtomahawk/playlist/TreeItemDelegate.h @@ -28,7 +28,7 @@ namespace Tomahawk { class PixmapDelegateFader; } -class ArtistView; +class TreeView; class TreeProxyModel; class DLLEXPORT TreeItemDelegate : public QStyledItemDelegate @@ -36,7 +36,7 @@ class DLLEXPORT TreeItemDelegate : public QStyledItemDelegate Q_OBJECT public: - TreeItemDelegate( ArtistView* parent = 0, TreeProxyModel* proxy = 0 ); + TreeItemDelegate( TreeView* parent = 0, TreeProxyModel* proxy = 0 ); protected: void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; @@ -51,7 +51,7 @@ private slots: void doUpdateIndex( const QPersistentModelIndex& index ); private: - ArtistView* m_view; + TreeView* m_view; TreeProxyModel* m_model; mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps; diff --git a/src/libtomahawk/playlist/ArtistView.cpp b/src/libtomahawk/playlist/TreeView.cpp similarity index 93% rename from src/libtomahawk/playlist/ArtistView.cpp rename to src/libtomahawk/playlist/TreeView.cpp index b62a9f16b..16820325e 100644 --- a/src/libtomahawk/playlist/ArtistView.cpp +++ b/src/libtomahawk/playlist/TreeView.cpp @@ -17,7 +17,7 @@ * along with Tomahawk. If not, see . */ -#include "ArtistView.h" +#include "TreeView.h" #include #include @@ -45,7 +45,7 @@ using namespace Tomahawk; -ArtistView::ArtistView( QWidget* parent ) +TreeView::TreeView( QWidget* parent ) : QTreeView( parent ) , m_header( new ViewHeader( this ) ) , m_overlay( new OverlayWidget( this ) ) @@ -98,14 +98,14 @@ ArtistView::ArtistView( QWidget* parent ) } -ArtistView::~ArtistView() +TreeView::~TreeView() { tDebug() << Q_FUNC_INFO; } void -ArtistView::setProxyModel( TreeProxyModel* model ) +TreeView::setProxyModel( TreeProxyModel* model ) { m_proxyModel = model; TreeItemDelegate* del = new TreeItemDelegate( this, m_proxyModel ); @@ -117,7 +117,7 @@ ArtistView::setProxyModel( TreeProxyModel* model ) void -ArtistView::setModel( QAbstractItemModel* model ) +TreeView::setModel( QAbstractItemModel* model ) { Q_UNUSED( model ); qDebug() << "Explicitly use setPlaylistModel instead"; @@ -126,7 +126,7 @@ ArtistView::setModel( QAbstractItemModel* model ) void -ArtistView::setTreeModel( TreeModel* model ) +TreeView::setTreeModel( TreeModel* model ) { m_model = model; @@ -169,7 +169,7 @@ ArtistView::setTreeModel( TreeModel* model ) void -ArtistView::onViewChanged() +TreeView::onViewChanged() { if ( m_timer.isActive() ) m_timer.stop(); @@ -179,7 +179,7 @@ ArtistView::onViewChanged() void -ArtistView::onScrollTimeout() +TreeView::onScrollTimeout() { if ( m_timer.isActive() ) m_timer.stop(); @@ -207,7 +207,7 @@ ArtistView::onScrollTimeout() void -ArtistView::currentChanged( const QModelIndex& current, const QModelIndex& previous ) +TreeView::currentChanged( const QModelIndex& current, const QModelIndex& previous ) { QTreeView::currentChanged( current, previous ); @@ -230,7 +230,7 @@ ArtistView::currentChanged( const QModelIndex& current, const QModelIndex& previ void -ArtistView::onItemActivated( const QModelIndex& index ) +TreeView::onItemActivated( const QModelIndex& index ) { PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) ); if ( item ) @@ -249,7 +249,7 @@ ArtistView::onItemActivated( const QModelIndex& index ) void -ArtistView::keyPressEvent( QKeyEvent* event ) +TreeView::keyPressEvent( QKeyEvent* event ) { QTreeView::keyPressEvent( event ); @@ -264,7 +264,7 @@ ArtistView::keyPressEvent( QKeyEvent* event ) void -ArtistView::resizeEvent( QResizeEvent* event ) +TreeView::resizeEvent( QResizeEvent* event ) { QTreeView::resizeEvent( event ); m_header->checkState(); @@ -280,7 +280,7 @@ ArtistView::resizeEvent( QResizeEvent* event ) void -ArtistView::onItemCountChanged( unsigned int items ) +TreeView::onItemCountChanged( unsigned int items ) { if ( items == 0 ) { @@ -297,7 +297,7 @@ ArtistView::onItemCountChanged( unsigned int items ) void -ArtistView::onFilterChangeFinished() +TreeView::onFilterChangeFinished() { if ( selectedIndexes().count() ) scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter ); @@ -314,7 +314,7 @@ ArtistView::onFilterChangeFinished() void -ArtistView::onFilteringStarted() +TreeView::onFilteringStarted() { m_overlay->hide(); m_loadingSpinner->fadeIn(); @@ -322,7 +322,7 @@ ArtistView::onFilteringStarted() void -ArtistView::startDrag( Qt::DropActions supportedActions ) +TreeView::startDrag( Qt::DropActions supportedActions ) { QList pindexes; QModelIndexList indexes; @@ -362,7 +362,7 @@ ArtistView::startDrag( Qt::DropActions supportedActions ) void -ArtistView::onCustomContextMenu( const QPoint& pos ) +TreeView::onCustomContextMenu( const QPoint& pos ) { m_contextMenu->clear(); @@ -403,7 +403,7 @@ ArtistView::onCustomContextMenu( const QPoint& pos ) void -ArtistView::onMenuTriggered( int action ) +TreeView::onMenuTriggered( int action ) { switch ( action ) { @@ -418,7 +418,7 @@ ArtistView::onMenuTriggered( int action ) bool -ArtistView::jumpToCurrentTrack() +TreeView::jumpToCurrentTrack() { if ( !m_proxyModel ) return false; @@ -429,7 +429,7 @@ ArtistView::jumpToCurrentTrack() QString -ArtistView::guid() const +TreeView::guid() const { if ( m_guid.isEmpty() ) { diff --git a/src/libtomahawk/playlist/ArtistView.h b/src/libtomahawk/playlist/TreeView.h similarity index 94% rename from src/libtomahawk/playlist/ArtistView.h rename to src/libtomahawk/playlist/TreeView.h index 47b01dc36..cee339518 100644 --- a/src/libtomahawk/playlist/ArtistView.h +++ b/src/libtomahawk/playlist/TreeView.h @@ -17,8 +17,8 @@ * along with Tomahawk. If not, see . */ -#ifndef ARTISTVIEW_H -#define ARTISTVIEW_H +#ifndef TREEVIEW_H +#define TREEVIEW_H #include #include @@ -41,13 +41,13 @@ class AnimatedSpinner; class OverlayWidget; class TreeModel; -class DLLEXPORT ArtistView : public QTreeView, public Tomahawk::ViewPage +class DLLEXPORT TreeView : public QTreeView, public Tomahawk::ViewPage { Q_OBJECT public: - explicit ArtistView( QWidget* parent = 0 ); - ~ArtistView(); + explicit TreeView( QWidget* parent = 0 ); + ~TreeView(); virtual QString guid() const; virtual void setGuid( const QString& guid ) { m_guid = guid; } @@ -122,4 +122,4 @@ private: mutable QString m_guid; }; -#endif // ARTISTVIEW_H +#endif // TREEVIEW_H diff --git a/src/libtomahawk/widgets/WhatsHotWidget.ui b/src/libtomahawk/widgets/WhatsHotWidget.ui index b684f1566..88eb41339 100644 --- a/src/libtomahawk/widgets/WhatsHotWidget.ui +++ b/src/libtomahawk/widgets/WhatsHotWidget.ui @@ -33,7 +33,7 @@ - + 320 @@ -69,9 +69,9 @@
playlist/GridView.h
- ArtistView + TreeView QTreeView -
ArtistView.h
+
TreeView.h
PlaylistView diff --git a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.ui b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.ui index 61107dc20..ec146f484 100644 --- a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.ui +++ b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.ui @@ -22,7 +22,7 @@ 1 - + @@ -48,9 +48,9 @@
widgets/HeaderLabel.h
- ArtistView + TreeView QTreeView -
ArtistView.h
+
TreeView.h
GridView diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui index e882b823b..246a3e593 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.ui @@ -108,11 +108,6 @@ QPushButton
widgets/ToggleButton.h
- - ArtistView - QTreeView -
ArtistView.h
-
GridView QListView diff --git a/src/sourcetree/SourcesModel.cpp b/src/sourcetree/SourcesModel.cpp index 3a56eded8..2c383ef40 100644 --- a/src/sourcetree/SourcesModel.cpp +++ b/src/sourcetree/SourcesModel.cpp @@ -40,7 +40,7 @@ #include "GlobalActionManager.h" #include "DropJob.h" #include "items/PlaylistItems.h" -#include "playlist/ArtistView.h" +#include "playlist/TreeView.h" #include "playlist/PlaylistView.h" #include "playlist/dynamic/widgets/DynamicWidget.h"