1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 03:24:15 +02:00

* GridView has child-playlistInterfaces. Store them in a MetaPlaylistInterface to fix playing state getting stuck.

This commit is contained in:
Christian Muehlhaeuser
2014-09-20 09:37:23 +02:00
parent 37b5b00506
commit d34f21301b
2 changed files with 13 additions and 4 deletions

View File

@@ -91,6 +91,10 @@ GridView::GridView( QWidget* parent )
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 ) ) );
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 ) GridView::onDelegatePlaying( const QPersistentModelIndex& index )
{ {
m_playing = index; m_playing = index;
m_mpl->addChildInterface( AudioEngine::instance()->currentTrackPlaylist() );
} }
@@ -326,6 +331,7 @@ GridView::onDelegateStopped( const QPersistentModelIndex& index )
{ {
if ( m_playing == index ) if ( m_playing == index )
m_playing = QPersistentModelIndex(); m_playing = QPersistentModelIndex();
m_mpl->removeChildInterface( AudioEngine::instance()->currentTrackPlaylist() );
} }
@@ -450,14 +456,16 @@ GridView::currentTrackRect() const
playlistinterface_ptr playlistinterface_ptr
GridView::playlistInterface() const GridView::playlistInterface() const
{ {
return proxyModel()->playlistInterface(); return m_playlistInterface;
} }
void void
GridView::setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface ) GridView::setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface )
{ {
m_mpl->removeChildInterface( proxyModel()->playlistInterface() );
proxyModel()->setPlaylistInterface( playlistInterface ); proxyModel()->setPlaylistInterface( playlistInterface );
m_mpl->addChildInterface( proxyModel()->playlistInterface() );
} }

View File

@@ -32,12 +32,12 @@
namespace Tomahawk namespace Tomahawk
{ {
class ContextMenu; class ContextMenu;
class MetaPlaylistInterface;
}; };
class AnimatedSpinner; class AnimatedSpinner;
class GridItemDelegate; class GridItemDelegate;
class PlayableModel; class PlayableModel;
class GridPlaylistInterface;
class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage
{ {
@@ -120,6 +120,9 @@ private:
AnimatedSpinner* m_loadingSpinner; AnimatedSpinner* m_loadingSpinner;
OverlayWidget* m_overlay; OverlayWidget* m_overlay;
Tomahawk::MetaPlaylistInterface* m_mpl;
Tomahawk::playlistinterface_ptr m_playlistInterface;
QModelIndex m_contextMenuIndex; QModelIndex m_contextMenuIndex;
QPersistentModelIndex m_playing; QPersistentModelIndex m_playing;
@@ -133,8 +136,6 @@ private:
QRect m_paintRect; QRect m_paintRect;
QTimer m_timer; QTimer m_timer;
friend class ::GridPlaylistInterface;
}; };
#endif // GRIDVIEW_H #endif // GRIDVIEW_H