diff --git a/src/libtomahawk/source.cpp b/src/libtomahawk/source.cpp index 8b11b7de9..eeedee104 100644 --- a/src/libtomahawk/source.cpp +++ b/src/libtomahawk/source.cpp @@ -285,6 +285,8 @@ Source::onPlaybackStarted( const Tomahawk::query_ptr& query ) { qDebug() << Q_FUNC_INFO << query->toString(); m_currentTrack = query; + if ( m_playlistInterface.isNull() ) + getPlaylistInterface(); emit playbackStarted( query ); } diff --git a/src/libtomahawk/sourceplaylistinterface.cpp b/src/libtomahawk/sourceplaylistinterface.cpp index 72b6f0065..550222463 100644 --- a/src/libtomahawk/sourceplaylistinterface.cpp +++ b/src/libtomahawk/sourceplaylistinterface.cpp @@ -38,7 +38,6 @@ SourcePlaylistInterface::siblingItem( int itemsAway ) { Q_UNUSED( itemsAway ); qDebug() << Q_FUNC_INFO; - Pipeline::instance()->resolve( m_source->currentTrack(), true ); if ( m_source->currentTrack()->results().empty() ) { qDebug() << Q_FUNC_INFO << " Results were empty for current track"; @@ -53,7 +52,6 @@ Tomahawk::result_ptr SourcePlaylistInterface::nextItem() { qDebug() << Q_FUNC_INFO; - Pipeline::instance()->resolve( m_source->currentTrack(), true ); if ( m_source->currentTrack()->results().empty() ) { qDebug() << Q_FUNC_INFO << " Results were empty for current track"; @@ -75,5 +73,24 @@ void SourcePlaylistInterface::onSourcePlaybackStarted( const Tomahawk::query_ptr& query ) const { qDebug() << Q_FUNC_INFO; + connect( query.data(), SIGNAL( resultsAdded( const QList& ) ), SLOT( resolveResultsAdded( const QList& ) ) ); + connect( query.data(), SIGNAL( resolvingFinished( bool ) ), SLOT( resolvingFinished( bool ) ) ); Pipeline::instance()->resolve( query, true ); } + + +void +SourcePlaylistInterface::resolveResultsAdded( const QList& results ) const +{ + qDebug() << Q_FUNC_INFO; + foreach ( Tomahawk::result_ptr ptr, results ) + { + qDebug() << "Found result: " << ptr->track(); + } +} + +void +SourcePlaylistInterface::resolvingFinished( bool hasResults ) const +{ + qDebug() << Q_FUNC_INFO << " and has results? : " << (hasResults ? "true" : "false"); +} \ No newline at end of file diff --git a/src/libtomahawk/sourceplaylistinterface.h b/src/libtomahawk/sourceplaylistinterface.h index 1779a977e..56d2768d0 100644 --- a/src/libtomahawk/sourceplaylistinterface.h +++ b/src/libtomahawk/sourceplaylistinterface.h @@ -64,6 +64,8 @@ signals: private slots: void onSourcePlaybackStarted( const Tomahawk::query_ptr& query ) const; + void resolveResultsAdded( const QList& results ) const; + void resolvingFinished( bool hasResults ) const; private: Tomahawk::source_ptr m_source;