1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

* Renamed ArtistView to TreeView.

This commit is contained in:
Christian Muehlhaeuser
2012-06-01 05:58:42 +02:00
parent d97b83557b
commit 0abc1a4be9
14 changed files with 53 additions and 60 deletions

View File

@@ -61,7 +61,7 @@ set( libGuiSources
playlist/AlbumModel.cpp playlist/AlbumModel.cpp
playlist/GridItemDelegate.cpp playlist/GridItemDelegate.cpp
playlist/GridView.cpp playlist/GridView.cpp
playlist/ArtistView.cpp playlist/TreeView.cpp
playlist/CustomPlaylistView.cpp playlist/CustomPlaylistView.cpp
playlist/ViewHeader.cpp playlist/ViewHeader.cpp
playlist/RecentlyAddedModel.cpp playlist/RecentlyAddedModel.cpp

View File

@@ -32,7 +32,7 @@
#include "PlaylistView.h" #include "PlaylistView.h"
#include "PlayableProxyModel.h" #include "PlayableProxyModel.h"
#include "PlayableModel.h" #include "PlayableModel.h"
#include "ArtistView.h" #include "TreeView.h"
#include "GridView.h" #include "GridView.h"
#include "AlbumModel.h" #include "AlbumModel.h"
#include "SourceList.h" #include "SourceList.h"
@@ -93,7 +93,7 @@ ViewManager::ViewManager( QObject* parent )
m_widget->layout()->addWidget( m_stack ); m_widget->layout()->addWidget( m_stack );
m_widget->layout()->addWidget( m_contextWidget ); m_widget->layout()->addWidget( m_contextWidget );
m_superCollectionView = new ArtistView(); m_superCollectionView = new TreeView();
m_superCollectionModel = new TreeModel( m_superCollectionView ); m_superCollectionModel = new TreeModel( m_superCollectionView );
m_superCollectionView->setTreeModel( m_superCollectionModel ); m_superCollectionView->setTreeModel( m_superCollectionModel );
m_superCollectionView->setShowModes( false ); m_superCollectionView->setShowModes( false );
@@ -299,10 +299,10 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
if ( m_currentMode == PlaylistModes::Tree ) if ( m_currentMode == PlaylistModes::Tree )
{ {
ArtistView* view; TreeView* view;
if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() ) if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() )
{ {
view = new ArtistView(); view = new TreeView();
TreeModel* model = new TreeModel(); TreeModel* model = new TreeModel();
view->setTreeModel( model ); view->setTreeModel( model );
@@ -1030,7 +1030,7 @@ ViewManager::showCurrentTrack()
m_currentMode = PlaylistModes::Flat; m_currentMode = PlaylistModes::Flat;
else if ( dynamic_cast< GridView* >( page ) ) else if ( dynamic_cast< GridView* >( page ) )
m_currentMode = PlaylistModes::Album; m_currentMode = PlaylistModes::Album;
else if ( dynamic_cast< ArtistView* >( page ) ) else if ( dynamic_cast< TreeView* >( page ) )
m_currentMode = PlaylistModes::Tree; m_currentMode = PlaylistModes::Tree;
else else
return; return;
@@ -1075,7 +1075,7 @@ ViewManager::recentPlaysWidget() const
} }
ArtistView* TreeView*
ViewManager::superCollectionView() const ViewManager::superCollectionView() const
{ {
return m_superCollectionView; return m_superCollectionView;

View File

@@ -37,7 +37,7 @@ class AlbumModel;
class GridView; class GridView;
class AlbumInfoWidget; class AlbumInfoWidget;
class ArtistInfoWidget; class ArtistInfoWidget;
class ArtistView; class TreeView;
class CollectionModel; class CollectionModel;
class ContextWidget; class ContextWidget;
class PlaylistModel; class PlaylistModel;
@@ -92,7 +92,7 @@ public:
Tomahawk::ViewPage* newReleasesWidget() const; Tomahawk::ViewPage* newReleasesWidget() const;
Tomahawk::ViewPage* topLovedWidget() const; Tomahawk::ViewPage* topLovedWidget() const;
Tomahawk::ViewPage* recentPlaysWidget() const; Tomahawk::ViewPage* recentPlaysWidget() const;
ArtistView* superCollectionView() const; TreeView* superCollectionView() const;
/// Get the view page for the given item. Not pretty... /// Get the view page for the given item. Not pretty...
Tomahawk::ViewPage* pageForPlaylist( const Tomahawk::playlist_ptr& pl ) const; Tomahawk::ViewPage* pageForPlaylist( const Tomahawk::playlist_ptr& pl ) const;
@@ -204,7 +204,7 @@ private:
AlbumModel* m_superAlbumModel; AlbumModel* m_superAlbumModel;
GridView* m_superGridView; GridView* m_superGridView;
TreeModel* m_superCollectionModel; TreeModel* m_superCollectionModel;
ArtistView* m_superCollectionView; TreeView* m_superCollectionView;
QueueView* m_queue; QueueView* m_queue;
WelcomeWidget* m_welcomeWidget; WelcomeWidget* m_welcomeWidget;
WhatsHotWidget* m_whatsHotWidget; WhatsHotWidget* m_whatsHotWidget;
@@ -215,7 +215,7 @@ private:
QList< Tomahawk::collection_ptr > m_superCollections; QList< Tomahawk::collection_ptr > m_superCollections;
QHash< Tomahawk::dynplaylist_ptr, QWeakPointer<Tomahawk::DynamicWidget> > m_dynamicWidgets; QHash< Tomahawk::dynplaylist_ptr, QWeakPointer<Tomahawk::DynamicWidget> > m_dynamicWidgets;
QHash< Tomahawk::collection_ptr, QWeakPointer<ArtistView> > m_treeViews; QHash< Tomahawk::collection_ptr, QWeakPointer<TreeView> > m_treeViews;
QHash< Tomahawk::collection_ptr, QWeakPointer<GridView> > m_collectionGridViews; QHash< Tomahawk::collection_ptr, QWeakPointer<GridView> > m_collectionGridViews;
QHash< Tomahawk::artist_ptr, QWeakPointer<ArtistInfoWidget> > m_artistViews; QHash< Tomahawk::artist_ptr, QWeakPointer<ArtistInfoWidget> > m_artistViews;
QHash< Tomahawk::album_ptr, QWeakPointer<AlbumInfoWidget> > m_albumViews; QHash< Tomahawk::album_ptr, QWeakPointer<AlbumInfoWidget> > m_albumViews;

View File

@@ -29,8 +29,6 @@
#include "context/pages/TopTracksContext.h" #include "context/pages/TopTracksContext.h"
#include "context/pages/WikipediaContext.h" #include "context/pages/WikipediaContext.h"
#include "playlist/ArtistView.h"
#include "playlist/TreeModel.h"
#include "Source.h" #include "Source.h"
#include "utils/StyleHelper.h" #include "utils/StyleHelper.h"

View File

@@ -21,7 +21,7 @@
#include <QHeaderView> #include <QHeaderView>
#include "playlist/ArtistView.h" #include "playlist/TreeView.h"
#include "playlist/TreeModel.h" #include "playlist/TreeModel.h"
#include "Source.h" #include "Source.h"
@@ -31,7 +31,7 @@ using namespace Tomahawk;
RelatedArtistsContext::RelatedArtistsContext() RelatedArtistsContext::RelatedArtistsContext()
: ContextPage() : ContextPage()
{ {
m_relatedView = new ArtistView(); m_relatedView = new TreeView();
m_relatedView->setGuid( "RelatedArtistsContext" ); m_relatedView->setGuid( "RelatedArtistsContext" );
m_relatedView->setUpdatesContextView( false ); m_relatedView->setUpdatesContextView( false );
m_relatedModel = new TreeModel( m_relatedView ); m_relatedModel = new TreeModel( m_relatedView );

View File

@@ -30,7 +30,7 @@
#include "context/ContextPage.h" #include "context/ContextPage.h"
class TreeModel; class TreeModel;
class ArtistView; class TreeView;
class DLLEXPORT RelatedArtistsContext : public Tomahawk::ContextPage class DLLEXPORT RelatedArtistsContext : public Tomahawk::ContextPage
{ {
@@ -58,7 +58,7 @@ private slots:
void onSimilarArtistsLoaded(); void onSimilarArtistsLoaded();
private: private:
ArtistView* m_relatedView; TreeView* m_relatedView;
TreeModel* m_relatedModel; TreeModel* m_relatedModel;
QGraphicsProxyWidget* m_proxy; QGraphicsProxyWidget* m_proxy;

View File

@@ -35,10 +35,10 @@
#include "PlayableItem.h" #include "PlayableItem.h"
#include "TreeProxyModel.h" #include "TreeProxyModel.h"
#include "Source.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 ) : QStyledItemDelegate( (QObject*)parent )
, m_view( parent ) , m_view( parent )
, m_model( proxy ) , m_model( proxy )

View File

@@ -28,7 +28,7 @@ namespace Tomahawk {
class PixmapDelegateFader; class PixmapDelegateFader;
} }
class ArtistView; class TreeView;
class TreeProxyModel; class TreeProxyModel;
class DLLEXPORT TreeItemDelegate : public QStyledItemDelegate class DLLEXPORT TreeItemDelegate : public QStyledItemDelegate
@@ -36,7 +36,7 @@ class DLLEXPORT TreeItemDelegate : public QStyledItemDelegate
Q_OBJECT Q_OBJECT
public: public:
TreeItemDelegate( ArtistView* parent = 0, TreeProxyModel* proxy = 0 ); TreeItemDelegate( TreeView* parent = 0, TreeProxyModel* proxy = 0 );
protected: protected:
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
@@ -51,7 +51,7 @@ private slots:
void doUpdateIndex( const QPersistentModelIndex& index ); void doUpdateIndex( const QPersistentModelIndex& index );
private: private:
ArtistView* m_view; TreeView* m_view;
TreeProxyModel* m_model; TreeProxyModel* m_model;
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps; mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps;

View File

@@ -17,7 +17,7 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ArtistView.h" #include "TreeView.h"
#include <QHeaderView> #include <QHeaderView>
#include <QKeyEvent> #include <QKeyEvent>
@@ -45,7 +45,7 @@
using namespace Tomahawk; using namespace Tomahawk;
ArtistView::ArtistView( QWidget* parent ) TreeView::TreeView( QWidget* parent )
: QTreeView( parent ) : QTreeView( parent )
, m_header( new ViewHeader( this ) ) , m_header( new ViewHeader( this ) )
, m_overlay( new OverlayWidget( this ) ) , m_overlay( new OverlayWidget( this ) )
@@ -98,14 +98,14 @@ ArtistView::ArtistView( QWidget* parent )
} }
ArtistView::~ArtistView() TreeView::~TreeView()
{ {
tDebug() << Q_FUNC_INFO; tDebug() << Q_FUNC_INFO;
} }
void void
ArtistView::setProxyModel( TreeProxyModel* model ) TreeView::setProxyModel( TreeProxyModel* model )
{ {
m_proxyModel = model; m_proxyModel = model;
TreeItemDelegate* del = new TreeItemDelegate( this, m_proxyModel ); TreeItemDelegate* del = new TreeItemDelegate( this, m_proxyModel );
@@ -117,7 +117,7 @@ ArtistView::setProxyModel( TreeProxyModel* model )
void void
ArtistView::setModel( QAbstractItemModel* model ) TreeView::setModel( QAbstractItemModel* model )
{ {
Q_UNUSED( model ); Q_UNUSED( model );
qDebug() << "Explicitly use setPlaylistModel instead"; qDebug() << "Explicitly use setPlaylistModel instead";
@@ -126,7 +126,7 @@ ArtistView::setModel( QAbstractItemModel* model )
void void
ArtistView::setTreeModel( TreeModel* model ) TreeView::setTreeModel( TreeModel* model )
{ {
m_model = model; m_model = model;
@@ -169,7 +169,7 @@ ArtistView::setTreeModel( TreeModel* model )
void void
ArtistView::onViewChanged() TreeView::onViewChanged()
{ {
if ( m_timer.isActive() ) if ( m_timer.isActive() )
m_timer.stop(); m_timer.stop();
@@ -179,7 +179,7 @@ ArtistView::onViewChanged()
void void
ArtistView::onScrollTimeout() TreeView::onScrollTimeout()
{ {
if ( m_timer.isActive() ) if ( m_timer.isActive() )
m_timer.stop(); m_timer.stop();
@@ -207,7 +207,7 @@ ArtistView::onScrollTimeout()
void void
ArtistView::currentChanged( const QModelIndex& current, const QModelIndex& previous ) TreeView::currentChanged( const QModelIndex& current, const QModelIndex& previous )
{ {
QTreeView::currentChanged( current, previous ); QTreeView::currentChanged( current, previous );
@@ -230,7 +230,7 @@ ArtistView::currentChanged( const QModelIndex& current, const QModelIndex& previ
void void
ArtistView::onItemActivated( const QModelIndex& index ) TreeView::onItemActivated( const QModelIndex& index )
{ {
PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) ); PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) );
if ( item ) if ( item )
@@ -249,7 +249,7 @@ ArtistView::onItemActivated( const QModelIndex& index )
void void
ArtistView::keyPressEvent( QKeyEvent* event ) TreeView::keyPressEvent( QKeyEvent* event )
{ {
QTreeView::keyPressEvent( event ); QTreeView::keyPressEvent( event );
@@ -264,7 +264,7 @@ ArtistView::keyPressEvent( QKeyEvent* event )
void void
ArtistView::resizeEvent( QResizeEvent* event ) TreeView::resizeEvent( QResizeEvent* event )
{ {
QTreeView::resizeEvent( event ); QTreeView::resizeEvent( event );
m_header->checkState(); m_header->checkState();
@@ -280,7 +280,7 @@ ArtistView::resizeEvent( QResizeEvent* event )
void void
ArtistView::onItemCountChanged( unsigned int items ) TreeView::onItemCountChanged( unsigned int items )
{ {
if ( items == 0 ) if ( items == 0 )
{ {
@@ -297,7 +297,7 @@ ArtistView::onItemCountChanged( unsigned int items )
void void
ArtistView::onFilterChangeFinished() TreeView::onFilterChangeFinished()
{ {
if ( selectedIndexes().count() ) if ( selectedIndexes().count() )
scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter ); scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter );
@@ -314,7 +314,7 @@ ArtistView::onFilterChangeFinished()
void void
ArtistView::onFilteringStarted() TreeView::onFilteringStarted()
{ {
m_overlay->hide(); m_overlay->hide();
m_loadingSpinner->fadeIn(); m_loadingSpinner->fadeIn();
@@ -322,7 +322,7 @@ ArtistView::onFilteringStarted()
void void
ArtistView::startDrag( Qt::DropActions supportedActions ) TreeView::startDrag( Qt::DropActions supportedActions )
{ {
QList<QPersistentModelIndex> pindexes; QList<QPersistentModelIndex> pindexes;
QModelIndexList indexes; QModelIndexList indexes;
@@ -362,7 +362,7 @@ ArtistView::startDrag( Qt::DropActions supportedActions )
void void
ArtistView::onCustomContextMenu( const QPoint& pos ) TreeView::onCustomContextMenu( const QPoint& pos )
{ {
m_contextMenu->clear(); m_contextMenu->clear();
@@ -403,7 +403,7 @@ ArtistView::onCustomContextMenu( const QPoint& pos )
void void
ArtistView::onMenuTriggered( int action ) TreeView::onMenuTriggered( int action )
{ {
switch ( action ) switch ( action )
{ {
@@ -418,7 +418,7 @@ ArtistView::onMenuTriggered( int action )
bool bool
ArtistView::jumpToCurrentTrack() TreeView::jumpToCurrentTrack()
{ {
if ( !m_proxyModel ) if ( !m_proxyModel )
return false; return false;
@@ -429,7 +429,7 @@ ArtistView::jumpToCurrentTrack()
QString QString
ArtistView::guid() const TreeView::guid() const
{ {
if ( m_guid.isEmpty() ) if ( m_guid.isEmpty() )
{ {

View File

@@ -17,8 +17,8 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef ARTISTVIEW_H #ifndef TREEVIEW_H
#define ARTISTVIEW_H #define TREEVIEW_H
#include <QtGui/QSortFilterProxyModel> #include <QtGui/QSortFilterProxyModel>
#include <QtGui/QTreeView> #include <QtGui/QTreeView>
@@ -41,13 +41,13 @@ class AnimatedSpinner;
class OverlayWidget; class OverlayWidget;
class TreeModel; class TreeModel;
class DLLEXPORT ArtistView : public QTreeView, public Tomahawk::ViewPage class DLLEXPORT TreeView : public QTreeView, public Tomahawk::ViewPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ArtistView( QWidget* parent = 0 ); explicit TreeView( QWidget* parent = 0 );
~ArtistView(); ~TreeView();
virtual QString guid() const; virtual QString guid() const;
virtual void setGuid( const QString& guid ) { m_guid = guid; } virtual void setGuid( const QString& guid ) { m_guid = guid; }
@@ -122,4 +122,4 @@ private:
mutable QString m_guid; mutable QString m_guid;
}; };
#endif // ARTISTVIEW_H #endif // TREEVIEW_H

View File

@@ -33,7 +33,7 @@
<widget class="QWidget" name="page1"> <widget class="QWidget" name="page1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="ArtistView" name="artistsViewLeft"> <widget class="TreeView" name="artistsViewLeft">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>320</width> <width>320</width>
@@ -69,9 +69,9 @@
<header location="global">playlist/GridView.h</header> <header location="global">playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>ArtistView</class> <class>TreeView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>ArtistView.h</header> <header>TreeView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>PlaylistView</class> <class>PlaylistView</class>

View File

@@ -22,7 +22,7 @@
<property name="handleWidth"> <property name="handleWidth">
<number>1</number> <number>1</number>
</property> </property>
<widget class="ArtistView" name="tracksView"/> <widget class="TreeView" name="tracksView"/>
<widget class="QWidget" name=""> <widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@@ -48,9 +48,9 @@
<header location="global">widgets/HeaderLabel.h</header> <header location="global">widgets/HeaderLabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>ArtistView</class> <class>TreeView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header location="global">ArtistView.h</header> <header location="global">TreeView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>GridView</class> <class>GridView</class>

View File

@@ -108,11 +108,6 @@
<extends>QPushButton</extends> <extends>QPushButton</extends>
<header location="global">widgets/ToggleButton.h</header> <header location="global">widgets/ToggleButton.h</header>
</customwidget> </customwidget>
<customwidget>
<class>ArtistView</class>
<extends>QTreeView</extends>
<header location="global">ArtistView.h</header>
</customwidget>
<customwidget> <customwidget>
<class>GridView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>

View File

@@ -40,7 +40,7 @@
#include "GlobalActionManager.h" #include "GlobalActionManager.h"
#include "DropJob.h" #include "DropJob.h"
#include "items/PlaylistItems.h" #include "items/PlaylistItems.h"
#include "playlist/ArtistView.h" #include "playlist/TreeView.h"
#include "playlist/PlaylistView.h" #include "playlist/PlaylistView.h"
#include "playlist/dynamic/widgets/DynamicWidget.h" #include "playlist/dynamic/widgets/DynamicWidget.h"