1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 13:47:26 +02:00

* Fixed becameSolved() signal in Query class.

This commit is contained in:
Christian Muehlhaeuser
2011-03-06 17:05:49 +01:00
parent 2d7b5d3910
commit 547dc76ca8
2 changed files with 9 additions and 10 deletions

View File

@@ -44,7 +44,7 @@ Query::addResults( const QList< Tomahawk::result_ptr >& newresults )
{ {
bool becameSolved = false; bool becameSolved = false;
{ {
QMutexLocker lock( &m_mut ); // QMutexLocker lock( &m_mut );
m_results.append( newresults ); m_results.append( newresults );
qStableSort( m_results.begin(), m_results.end(), Query::resultSorter ); qStableSort( m_results.begin(), m_results.end(), Query::resultSorter );
@@ -81,7 +81,7 @@ void
Query::removeResult( const Tomahawk::result_ptr& result ) Query::removeResult( const Tomahawk::result_ptr& result )
{ {
{ {
QMutexLocker lock( &m_mut ); // QMutexLocker lock( &m_mut );
m_results.removeAll( result ); m_results.removeAll( result );
} }
@@ -101,7 +101,7 @@ Query::onResolvingFinished()
QList< result_ptr > QList< result_ptr >
Query::results() const Query::results() const
{ {
QMutexLocker lock( &m_mut ); // QMutexLocker lock( &m_mut );
return m_results; return m_results;
} }
@@ -109,7 +109,7 @@ Query::results() const
unsigned int unsigned int
Query::numResults() const Query::numResults() const
{ {
QMutexLocker lock( &m_mut ); // QMutexLocker lock( &m_mut );
return m_results.length(); return m_results.length();
} }
@@ -148,16 +148,16 @@ Query::checkResults()
{ {
bool becameSolved = false; bool becameSolved = false;
bool becameUnsolved = true; bool becameUnsolved = true;
// hook up signals, and check solved status // hook up signals, and check solved status
foreach( const result_ptr& rp, m_results ) foreach( const result_ptr& rp, m_results )
{ {
if ( !m_solved && rp->score() > 0.99 ) if ( !m_solved && rp->score() > 0.99 && rp->collection()->source()->isOnline() )
{ {
m_solved = true; m_solved = true;
becameSolved = true; becameSolved = true;
} }
if ( rp->score() > 0.99 ) if ( rp->score() > 0.99 && rp->collection()->source()->isOnline() )
{ {
becameUnsolved = false; becameUnsolved = false;
} }
@@ -166,7 +166,7 @@ Query::checkResults()
if ( m_solved && becameUnsolved ) if ( m_solved && becameUnsolved )
{ {
m_solved = false; m_solved = false;
emit solvedStateChanged( true ); emit solvedStateChanged( false );
} }
if( becameSolved ) if( becameSolved )

View File

@@ -84,8 +84,7 @@ private slots:
private: private:
void clearResults(); void clearResults();
void checkResults(); void checkResults();
mutable QMutex m_mut;
QList< Tomahawk::result_ptr > m_results; QList< Tomahawk::result_ptr > m_results;
bool m_solved; bool m_solved;
mutable QID m_qid; mutable QID m_qid;