1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

* GridView now allows (like Track- & TreeView) to have its PlaylistInterface overwritten.

This commit is contained in:
Christian Muehlhaeuser 2012-12-09 09:09:42 +01:00
parent 5376435094
commit 9e31e03498
2 changed files with 19 additions and 4 deletions

View File

@ -110,8 +110,6 @@ GridView::GridView( QWidget* parent )
setAutoResize( false );
setProxyModel( new PlayableProxyModel( this ) );
m_playlistInterface = playlistinterface_ptr( new GridPlaylistInterface( m_proxyModel, this ) );
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
@ -136,6 +134,9 @@ GridView::setProxyModel( PlayableProxyModel* model )
m_proxyModel = model;
connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) );
if ( m_delegate )
delete m_delegate;
m_delegate = new GridItemDelegate( this, m_proxyModel );
connect( m_delegate, SIGNAL( updateIndex( QModelIndex ) ), this, SLOT( update( QModelIndex ) ) );
connect( m_delegate, SIGNAL( startedPlaying( QPersistentModelIndex ) ), this, SLOT( onDelegatePlaying( QPersistentModelIndex ) ) );
@ -432,4 +433,18 @@ GridView::currentTrackRect() const
}
playlistinterface_ptr
GridView::playlistInterface() const
{
return proxyModel()->playlistInterface();
}
void
GridView::setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface )
{
proxyModel()->setPlaylistInterface( playlistInterface );
}
#include "GridView.moc"

View File

@ -65,7 +65,8 @@ public:
void setEmptyTip( const QString& tip );
virtual QWidget* widget() { return this; }
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return m_playlistInterface; }
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
void setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface );
virtual QString title() const { return m_model->title(); }
virtual QString description() const { return m_model->description(); }
@ -110,7 +111,6 @@ private:
GridItemDelegate* m_delegate;
AnimatedSpinner* m_loadingSpinner;
OverlayWidget* m_overlay;
Tomahawk::playlistinterface_ptr m_playlistInterface;
QModelIndex m_contextMenuIndex;
QPersistentModelIndex m_playing;