1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

* Query::numResults( onlyPlayableResults ) lets you count only online results.

This commit is contained in:
Christian Muehlhaeuser 2014-10-05 08:06:37 +02:00
parent d36935a28e
commit ae16fcda43
2 changed files with 15 additions and 2 deletions

View File

@ -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();
}

View File

@ -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)