From edc60573540107e65157cc50b76f133720e324fa Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Fri, 13 Jul 2012 23:19:21 -0400 Subject: [PATCH] Also allow multiple infoplugins to return data for artist top tracks --- src/libtomahawk/ArtistPlaylistInterface.cpp | 18 ++++++++++++++++++ src/libtomahawk/ArtistPlaylistInterface.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/libtomahawk/ArtistPlaylistInterface.cpp b/src/libtomahawk/ArtistPlaylistInterface.cpp index 977edec2c..750c08c4b 100644 --- a/src/libtomahawk/ArtistPlaylistInterface.cpp +++ b/src/libtomahawk/ArtistPlaylistInterface.cpp @@ -112,6 +112,10 @@ ArtistPlaylistInterface::tracks() connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) ); + + connect( Tomahawk::InfoSystem::InfoSystem::instance(), + SIGNAL( finished( QString ) ), + SLOT( infoSystemFinished( QString ) ) ); } else if ( m_mode == DatabaseMode && !m_databaseLoaded ) { @@ -176,9 +180,23 @@ ArtistPlaylistInterface::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData r } } + if ( !m_queries.isEmpty() ) + infoSystemFinished( id() ); +} + + +void +ArtistPlaylistInterface::infoSystemFinished( const QString &infoId ) +{ + if ( infoId != id() ) + return; + m_infoSystemLoaded = true; + disconnect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), this, SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ) ); + disconnect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), + this, SLOT( infoSystemFinished( QString) ) ); if ( m_queries.isEmpty() && m_mode == Mixed ) { diff --git a/src/libtomahawk/ArtistPlaylistInterface.h b/src/libtomahawk/ArtistPlaylistInterface.h index 03b1b36bd..2e0d8c617 100644 --- a/src/libtomahawk/ArtistPlaylistInterface.h +++ b/src/libtomahawk/ArtistPlaylistInterface.h @@ -63,6 +63,7 @@ signals: private slots: void onTracksLoaded( const QList< Tomahawk::query_ptr >& tracks ); void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ); + void infoSystemFinished( const QString& infoId ); private: Q_DISABLE_COPY( ArtistPlaylistInterface )