mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* GridView now allows (like Track- & TreeView) to have its PlaylistInterface overwritten.
This commit is contained in:
@@ -110,8 +110,6 @@ GridView::GridView( QWidget* parent )
|
|||||||
setAutoResize( false );
|
setAutoResize( false );
|
||||||
setProxyModel( new PlayableProxyModel( this ) );
|
setProxyModel( new PlayableProxyModel( this ) );
|
||||||
|
|
||||||
m_playlistInterface = playlistinterface_ptr( new GridPlaylistInterface( m_proxyModel, this ) );
|
|
||||||
|
|
||||||
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
||||||
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
|
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
|
||||||
|
|
||||||
@@ -136,6 +134,9 @@ GridView::setProxyModel( PlayableProxyModel* model )
|
|||||||
m_proxyModel = model;
|
m_proxyModel = model;
|
||||||
connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) );
|
connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) );
|
||||||
|
|
||||||
|
if ( m_delegate )
|
||||||
|
delete m_delegate;
|
||||||
|
|
||||||
m_delegate = new GridItemDelegate( this, m_proxyModel );
|
m_delegate = new GridItemDelegate( this, m_proxyModel );
|
||||||
connect( m_delegate, SIGNAL( updateIndex( QModelIndex ) ), this, SLOT( update( QModelIndex ) ) );
|
connect( m_delegate, SIGNAL( updateIndex( QModelIndex ) ), this, SLOT( update( QModelIndex ) ) );
|
||||||
connect( m_delegate, SIGNAL( startedPlaying( QPersistentModelIndex ) ), this, SLOT( onDelegatePlaying( QPersistentModelIndex ) ) );
|
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"
|
#include "GridView.moc"
|
||||||
|
@@ -65,7 +65,8 @@ public:
|
|||||||
void setEmptyTip( const QString& tip );
|
void setEmptyTip( const QString& tip );
|
||||||
|
|
||||||
virtual QWidget* widget() { return this; }
|
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 title() const { return m_model->title(); }
|
||||||
virtual QString description() const { return m_model->description(); }
|
virtual QString description() const { return m_model->description(); }
|
||||||
@@ -110,7 +111,6 @@ private:
|
|||||||
GridItemDelegate* m_delegate;
|
GridItemDelegate* m_delegate;
|
||||||
AnimatedSpinner* m_loadingSpinner;
|
AnimatedSpinner* m_loadingSpinner;
|
||||||
OverlayWidget* m_overlay;
|
OverlayWidget* m_overlay;
|
||||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
|
||||||
|
|
||||||
QModelIndex m_contextMenuIndex;
|
QModelIndex m_contextMenuIndex;
|
||||||
QPersistentModelIndex m_playing;
|
QPersistentModelIndex m_playing;
|
||||||
|
Reference in New Issue
Block a user