mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 13:17:34 +02:00
* Prevent stuck now playing indicator.
This commit is contained in:
@@ -39,13 +39,13 @@ TrackModel::TrackModel( QObject* parent )
|
|||||||
, m_readOnly( true )
|
, m_readOnly( true )
|
||||||
, m_style( Detailed )
|
, m_style( Detailed )
|
||||||
{
|
{
|
||||||
|
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
||||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TrackModel::~TrackModel()
|
TrackModel::~TrackModel()
|
||||||
{
|
{
|
||||||
delete m_rootItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -475,6 +475,17 @@ TrackModel::itemFromIndex( const QModelIndex& index ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||||
|
{
|
||||||
|
TrackModelItem* oldEntry = itemFromIndex( m_currentIndex );
|
||||||
|
if ( oldEntry && ( oldEntry->query().isNull() || !oldEntry->query()->numResults() || oldEntry->query()->results().first().data() != result.data() ) )
|
||||||
|
{
|
||||||
|
oldEntry->setIsPlaying( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackModel::onPlaybackStopped()
|
TrackModel::onPlaybackStopped()
|
||||||
{
|
{
|
||||||
|
@@ -126,6 +126,7 @@ public slots:
|
|||||||
virtual void setShuffled( bool /*shuffled*/ ) {}
|
virtual void setShuffled( bool /*shuffled*/ ) {}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
||||||
void onPlaybackStopped();
|
void onPlaybackStopped();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -43,7 +43,7 @@ TreeModel::TreeModel( QObject* parent )
|
|||||||
{
|
{
|
||||||
setIcon( QPixmap( RESPATH "images/music-icon.png" ) );
|
setIcon( QPixmap( RESPATH "images/music-icon.png" ) );
|
||||||
|
|
||||||
connect( AudioEngine::instance(), SIGNAL( finished( Tomahawk::result_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
||||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
||||||
|
|
||||||
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
|
||||||
@@ -948,11 +948,10 @@ TreeModel::infoSystemFinished( QString target )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TreeModel::onPlaybackFinished( const Tomahawk::result_ptr& result )
|
TreeModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||||
{
|
{
|
||||||
TreeModelItem* oldEntry = itemFromIndex( m_currentIndex );
|
TreeModelItem* oldEntry = itemFromIndex( m_currentIndex );
|
||||||
qDebug() << oldEntry->result().data() << result.data();
|
if ( oldEntry && ( oldEntry->result().isNull() || oldEntry->result().data() != result.data() ) )
|
||||||
if ( oldEntry && !oldEntry->result().isNull() && oldEntry->result().data() == result.data() )
|
|
||||||
{
|
{
|
||||||
oldEntry->setIsPlaying( false );
|
oldEntry->setIsPlaying( false );
|
||||||
}
|
}
|
||||||
|
@@ -149,7 +149,7 @@ private slots:
|
|||||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||||
void infoSystemFinished( QString target );
|
void infoSystemFinished( QString target );
|
||||||
|
|
||||||
void onPlaybackFinished( const Tomahawk::result_ptr& result );
|
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
||||||
void onPlaybackStopped();
|
void onPlaybackStopped();
|
||||||
|
|
||||||
void onDataChanged();
|
void onDataChanged();
|
||||||
|
Reference in New Issue
Block a user