1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-16 11:04:01 +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( 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() );
}

View File

@@ -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