1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 09:19:41 +01:00

Unlatch whenever a user stops listening along

This commit is contained in:
Leo Franchi 2011-09-20 12:43:24 -04:00
parent 27c2bc1b2d
commit bc33bd8420
2 changed files with 13 additions and 2 deletions

View File

@ -100,6 +100,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
showOfflineSources( TomahawkSettings::instance()->showOfflineSources() );
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) );
connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( playlistChanged() ) );
// Light-blue sourcetree on osx
#ifdef Q_WS_MAC
@ -365,7 +366,7 @@ SourceTreeView::latchOn()
cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() );
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
m_latch = source->getPlaylistInterface();
m_waitingToPlayLatch = source;
AudioEngine::instance()->playItem( source->getPlaylistInterface().data(), source->getPlaylistInterface()->nextItem() );
}
@ -374,7 +375,15 @@ SourceTreeView::playlistChanged( PlaylistInterface* newInterface )
{
// If we were latched on and changed, send the listening along stop
if ( m_latch.isNull() )
{
if ( m_waitingToPlayLatch.isNull() )
return;
m_latch = m_waitingToPlayLatch->getPlaylistInterface();
m_waitingToPlayLatch.clear();
return;
}
const PlaylistInterface* pi = AudioEngine::instance()->playlist();
bool listeningAlong = false;

View File

@ -62,7 +62,7 @@ private slots:
void latchOn();
void latchOff();
void playlistChanged( Tomahawk::PlaylistInterface* );
void playlistChanged( Tomahawk::PlaylistInterface* = 0 );
void onCustomContextMenu( const QPoint& pos );
@ -98,6 +98,8 @@ private:
QAction* m_addToLocalAction;
QAction* m_latchOnAction;
QAction* m_latchOffAction;
Tomahawk::source_ptr m_waitingToPlayLatch;
Tomahawk::playlistinterface_ptr m_latch;
bool m_dragging;