1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

End listen along status job if the listener quits tomahawk

This commit is contained in:
Leo Franchi 2011-09-20 13:01:43 -04:00
parent bc33bd8420
commit 92fb2dbb0d
2 changed files with 18 additions and 0 deletions

View File

@ -80,9 +80,26 @@ LatchedStatusManager::latchedOn( const Tomahawk::source_ptr& from, const Tomahaw
LatchedStatusItem* item = new LatchedStatusItem( from, to, this );
m_jobs[ from->userName() ] = item;
JobStatusView::instance()->model()->addJob( item );
connect( from.data(), SIGNAL( offline() ), this, SLOT( sourceOffline() ), Qt::UniqueConnection );
}
}
void
LatchedStatusManager::sourceOffline()
{
Tomahawk::Source* s = qobject_cast< Tomahawk::Source* >( sender() );
Q_ASSERT( s );
if ( m_jobs.contains( s->userName() ) )
{
QWeakPointer< LatchedStatusItem> job = m_jobs.take( s->userName() ).data();
if ( !job.isNull() )
job.data()->stop();
}
}
void
LatchedStatusManager::latchedOff( const Tomahawk::source_ptr& from, const Tomahawk::source_ptr& to )
{

View File

@ -56,6 +56,7 @@ public:
private slots:
void latchedOn( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
void latchedOff( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
void sourceOffline();
private:
QPixmap m_pixmap;