mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
Unlatch whenever a user stops listening along
This commit is contained in:
@@ -100,6 +100,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
|||||||
showOfflineSources( TomahawkSettings::instance()->showOfflineSources() );
|
showOfflineSources( TomahawkSettings::instance()->showOfflineSources() );
|
||||||
|
|
||||||
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) );
|
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
|
// Light-blue sourcetree on osx
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
@@ -365,7 +366,7 @@ SourceTreeView::latchOn()
|
|||||||
cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() );
|
cmd->setTimestamp( QDateTime::currentDateTime().toTime_t() );
|
||||||
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
Database::instance()->enqueue( QSharedPointer< DatabaseCommand >( cmd ) );
|
||||||
|
|
||||||
m_latch = source->getPlaylistInterface();
|
m_waitingToPlayLatch = source;
|
||||||
AudioEngine::instance()->playItem( source->getPlaylistInterface().data(), source->getPlaylistInterface()->nextItem() );
|
AudioEngine::instance()->playItem( source->getPlaylistInterface().data(), source->getPlaylistInterface()->nextItem() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,8 +375,16 @@ SourceTreeView::playlistChanged( PlaylistInterface* newInterface )
|
|||||||
{
|
{
|
||||||
// If we were latched on and changed, send the listening along stop
|
// If we were latched on and changed, send the listening along stop
|
||||||
if ( m_latch.isNull() )
|
if ( m_latch.isNull() )
|
||||||
|
{
|
||||||
|
if ( m_waitingToPlayLatch.isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_latch = m_waitingToPlayLatch->getPlaylistInterface();
|
||||||
|
m_waitingToPlayLatch.clear();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const PlaylistInterface* pi = AudioEngine::instance()->playlist();
|
const PlaylistInterface* pi = AudioEngine::instance()->playlist();
|
||||||
bool listeningAlong = false;
|
bool listeningAlong = false;
|
||||||
source_ptr newSource;
|
source_ptr newSource;
|
||||||
|
@@ -62,7 +62,7 @@ private slots:
|
|||||||
|
|
||||||
void latchOn();
|
void latchOn();
|
||||||
void latchOff();
|
void latchOff();
|
||||||
void playlistChanged( Tomahawk::PlaylistInterface* );
|
void playlistChanged( Tomahawk::PlaylistInterface* = 0 );
|
||||||
|
|
||||||
void onCustomContextMenu( const QPoint& pos );
|
void onCustomContextMenu( const QPoint& pos );
|
||||||
|
|
||||||
@@ -98,6 +98,8 @@ private:
|
|||||||
QAction* m_addToLocalAction;
|
QAction* m_addToLocalAction;
|
||||||
QAction* m_latchOnAction;
|
QAction* m_latchOnAction;
|
||||||
QAction* m_latchOffAction;
|
QAction* m_latchOffAction;
|
||||||
|
|
||||||
|
Tomahawk::source_ptr m_waitingToPlayLatch;
|
||||||
Tomahawk::playlistinterface_ptr m_latch;
|
Tomahawk::playlistinterface_ptr m_latch;
|
||||||
|
|
||||||
bool m_dragging;
|
bool m_dragging;
|
||||||
|
Reference in New Issue
Block a user