diff --git a/src/libtomahawk/pipeline.cpp b/src/libtomahawk/pipeline.cpp index e99755887..ee6d12ff6 100644 --- a/src/libtomahawk/pipeline.cpp +++ b/src/libtomahawk/pipeline.cpp @@ -82,8 +82,9 @@ void Pipeline::removeResolver( Resolver* r ) { QMutexLocker lock( &m_mut ); - + m_resolvers.removeAll( r ); + emit resolverRemoved( r ); } @@ -100,6 +101,7 @@ Pipeline::addResolver( Resolver* r, bool sort ) Pipeline::resolverSorter ); } qDebug() << "Adding resolver" << r->name(); + emit resolverAdded( r ); /* qDebug() << "Current pipeline:"; foreach( Resolver * r, m_resolvers ) diff --git a/src/libtomahawk/pipeline.h b/src/libtomahawk/pipeline.h index 7c41e03ab..faee4a018 100644 --- a/src/libtomahawk/pipeline.h +++ b/src/libtomahawk/pipeline.h @@ -79,6 +79,9 @@ public slots: signals: void idle(); void resolving( const Tomahawk::query_ptr& query ); + + void resolverAdded( Resolver* ); + void resolverRemoved( Resolver* ); private slots: void timeoutShunt( const query_ptr& q ); diff --git a/src/libtomahawk/query.cpp b/src/libtomahawk/query.cpp index 96dad8007..471ac6fa9 100644 --- a/src/libtomahawk/query.cpp +++ b/src/libtomahawk/query.cpp @@ -67,6 +67,11 @@ Query::Query( const QString& artist, const QString& track, const QString& album, { connect( Database::instance(), SIGNAL( indexReady() ), SLOT( refreshResults() ), Qt::QueuedConnection ); } + + connect( Pipeline::instance(), SIGNAL( resolverAdded( Resolver* ) ), + SLOT( onResolverAdded() ), Qt::QueuedConnection ); + connect( Pipeline::instance(), SIGNAL( resolverRemoved( Resolver* ) ), + SLOT( onResolverRemoved() ), Qt::QueuedConnection ); } @@ -148,6 +153,26 @@ Query::onResolvingFinished() } +void +Query::onResolverAdded( ) +{ + if ( !solved() ) + { + refreshResults(); + } +} + +void +Query::onResolverRemoved( ) +{ + if ( !solved() ) + { + refreshResults(); + } + +} + + QList< result_ptr > Query::results() const { diff --git a/src/libtomahawk/query.h b/src/libtomahawk/query.h index 59a218f45..288c4ea52 100644 --- a/src/libtomahawk/query.h +++ b/src/libtomahawk/query.h @@ -105,6 +105,10 @@ public slots: void onResolvingFinished(); + // resolve if not solved() + void onResolverAdded( ); + void onResolverRemoved( ); + private slots: void onResultStatusChanged(); void refreshResults();