diff --git a/src/libtomahawk/playlist/GridView.cpp b/src/libtomahawk/playlist/GridView.cpp index fefefe5d1..b97d8a8ed 100644 --- a/src/libtomahawk/playlist/GridView.cpp +++ b/src/libtomahawk/playlist/GridView.cpp @@ -91,6 +91,10 @@ GridView::GridView( QWidget* parent ) connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) ); connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) ); + + m_mpl = new Tomahawk::MetaPlaylistInterface(); + m_mpl->addChildInterface( proxyModel()->playlistInterface() ); + m_playlistInterface = playlistinterface_ptr( m_mpl ); } @@ -318,6 +322,7 @@ void GridView::onDelegatePlaying( const QPersistentModelIndex& index ) { m_playing = index; + m_mpl->addChildInterface( AudioEngine::instance()->currentTrackPlaylist() ); } @@ -326,6 +331,7 @@ GridView::onDelegateStopped( const QPersistentModelIndex& index ) { if ( m_playing == index ) m_playing = QPersistentModelIndex(); + m_mpl->removeChildInterface( AudioEngine::instance()->currentTrackPlaylist() ); } @@ -450,14 +456,16 @@ GridView::currentTrackRect() const playlistinterface_ptr GridView::playlistInterface() const { - return proxyModel()->playlistInterface(); + return m_playlistInterface; } void GridView::setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface ) { + m_mpl->removeChildInterface( proxyModel()->playlistInterface() ); proxyModel()->setPlaylistInterface( playlistInterface ); + m_mpl->addChildInterface( proxyModel()->playlistInterface() ); } diff --git a/src/libtomahawk/playlist/GridView.h b/src/libtomahawk/playlist/GridView.h index cd63cbcdc..94ae1b71b 100644 --- a/src/libtomahawk/playlist/GridView.h +++ b/src/libtomahawk/playlist/GridView.h @@ -32,12 +32,12 @@ namespace Tomahawk { class ContextMenu; + class MetaPlaylistInterface; }; class AnimatedSpinner; class GridItemDelegate; class PlayableModel; -class GridPlaylistInterface; class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage { @@ -120,6 +120,9 @@ private: AnimatedSpinner* m_loadingSpinner; OverlayWidget* m_overlay; + Tomahawk::MetaPlaylistInterface* m_mpl; + Tomahawk::playlistinterface_ptr m_playlistInterface; + QModelIndex m_contextMenuIndex; QPersistentModelIndex m_playing; @@ -133,8 +136,6 @@ private: QRect m_paintRect; QTimer m_timer; - - friend class ::GridPlaylistInterface; }; #endif // GRIDVIEW_H