diff --git a/src/libtomahawk/Query.cpp b/src/libtomahawk/Query.cpp index 645af6ef0..1c4702376 100644 --- a/src/libtomahawk/Query.cpp +++ b/src/libtomahawk/Query.cpp @@ -322,10 +322,23 @@ Query::results() const unsigned int -Query::numResults() const +Query::numResults( bool onlyPlayableResults ) const { Q_D( const Query ); QMutexLocker lock( &d->mutex ); + + if ( onlyPlayableResults ) + { + unsigned int c = 0; + foreach ( const result_ptr& result, d->results ) + { + if ( result->isOnline() ) + c++; + } + + return c; + } + return d->results.length(); } diff --git a/src/libtomahawk/Query.h b/src/libtomahawk/Query.h index c3b8f0832..1b9bb9342 100644 --- a/src/libtomahawk/Query.h +++ b/src/libtomahawk/Query.h @@ -71,7 +71,7 @@ public: QList< result_ptr > results() const; /// how many results found so far? - unsigned int numResults() const; + unsigned int numResults( bool onlyPlayableResults = false ) const; bool resolvingFinished() const; /// true when a perfect result has been found (score of 1.0)