mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 13:17:34 +02:00
* Query::numResults( onlyPlayableResults ) lets you count only online results.
This commit is contained in:
@@ -322,10 +322,23 @@ Query::results() const
|
|||||||
|
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
Query::numResults() const
|
Query::numResults( bool onlyPlayableResults ) const
|
||||||
{
|
{
|
||||||
Q_D( const Query );
|
Q_D( const Query );
|
||||||
QMutexLocker lock( &d->mutex );
|
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();
|
return d->results.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ public:
|
|||||||
QList< result_ptr > results() const;
|
QList< result_ptr > results() const;
|
||||||
|
|
||||||
/// how many results found so far?
|
/// how many results found so far?
|
||||||
unsigned int numResults() const;
|
unsigned int numResults( bool onlyPlayableResults = false ) const;
|
||||||
|
|
||||||
bool resolvingFinished() const;
|
bool resolvingFinished() const;
|
||||||
/// true when a perfect result has been found (score of 1.0)
|
/// true when a perfect result has been found (score of 1.0)
|
||||||
|
Reference in New Issue
Block a user