diff --git a/src/libtomahawk/database/fuzzyindex.cpp b/src/libtomahawk/database/fuzzyindex.cpp index 4ffdd7b9a..97463d45c 100644 --- a/src/libtomahawk/database/fuzzyindex.cpp +++ b/src/libtomahawk/database/fuzzyindex.cpp @@ -19,7 +19,7 @@ FuzzyIndex::FuzzyIndex( DatabaseImpl& db ) bool create = !lucene::index::IndexReader::indexExists( lucenePath.toStdString().c_str() ); m_luceneDir = lucene::store::FSDirectory::getDirectory( lucenePath.toStdString().c_str(), create ); - m_analyzer = new lucene::analysis::SimpleAnalyzer(); + m_analyzer = _CLNEW lucene::analysis::SimpleAnalyzer(); } @@ -68,13 +68,13 @@ FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QStrin QString name = it.value(); { - lucene::document::Field* field = new lucene::document::Field( table.toStdWString().c_str(), name.toStdWString().c_str(), + lucene::document::Field* field = _CLNEW lucene::document::Field( table.toStdWString().c_str(), name.toStdWString().c_str(), lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_UNTOKENIZED ); doc.add( *field ); } { - lucene::document::Field* field = new lucene::document::Field( _T( "id" ), QString::number( id ).toStdWString().c_str(), + lucene::document::Field* field = _CLNEW lucene::document::Field( _T( "id" ), QString::number( id ).toStdWString().c_str(), lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO ); doc.add( *field ); } @@ -109,7 +109,7 @@ FuzzyIndex::search( const QString& table, const QString& name ) } m_luceneReader = lucene::index::IndexReader::open( m_luceneDir ); - m_luceneSearcher = new lucene::search::IndexSearcher( m_luceneReader ); + m_luceneSearcher = _CLNEW lucene::search::IndexSearcher( m_luceneReader ); } if ( name.isEmpty() ) @@ -119,8 +119,7 @@ FuzzyIndex::search( const QString& table, const QString& name ) lucene::queryParser::QueryParser parser( table.toStdWString().c_str(), m_analyzer ); lucene::search::Hits* hits = 0; - lucene::search::FuzzyQuery* qry = new lucene::search::FuzzyQuery( new lucene::index::Term( table.toStdWString().c_str(), - name.toStdWString().c_str() ) ); + lucene::search::FuzzyQuery* qry = _CLNEW lucene::search::FuzzyQuery( _CLNEW lucene::index::Term( table.toStdWString().c_str(), name.toStdWString().c_str() ) ); hits = m_luceneSearcher->search( qry ); for ( unsigned int i = 0; i < hits->length(); i++ ) diff --git a/src/libtomahawk/pipeline.cpp b/src/libtomahawk/pipeline.cpp index 548294790..6a754a8a2 100644 --- a/src/libtomahawk/pipeline.cpp +++ b/src/libtomahawk/pipeline.cpp @@ -85,16 +85,16 @@ Pipeline::resolve( const QList<query_ptr>& qlist, bool prioritized ) m_qids.insert( q->id(), q ); } } - } - if ( prioritized ) - { - for( int i = qlist.count() - 1; i >= 0; i-- ) - m_queries_pending.insert( 0, qlist.at( i ) ); - } - else - { - m_queries_pending.append( qlist ); + if ( prioritized ) + { + for( int i = qlist.count() - 1; i >= 0; i-- ) + m_queries_pending.insert( 0, qlist.at( i ) ); + } + else + { + m_queries_pending.append( qlist ); + } } if ( m_index_ready && m_queries_pending.count() ) @@ -162,19 +162,25 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results ) void Pipeline::shuntNext() { - if ( m_queries_pending.isEmpty() ) + query_ptr q; + { - emit idle(); - return; + QMutexLocker lock( &m_mut ); + + if ( m_queries_pending.isEmpty() ) + { + emit idle(); + return; + } + + /* + Since resolvers are async, we now dispatch to the highest weighted ones + and after timeout, dispatch to next highest etc, aborting when solved + */ + q = m_queries_pending.takeFirst(); + q->setLastPipelineWeight( 101 ); } - - /* - Since resolvers are async, we now dispatch to the highest weighted ones - and after timeout, dispatch to next highest etc, aborting when solved - */ - - query_ptr q = m_queries_pending.takeFirst(); - q->setLastPipelineWeight( 101 ); + shunt( q ); // bump into next stage of pipeline (highest weights are 100) } diff --git a/src/libtomahawk/result.cpp b/src/libtomahawk/result.cpp index fa129215d..65adb656f 100644 --- a/src/libtomahawk/result.cpp +++ b/src/libtomahawk/result.cpp @@ -8,7 +8,8 @@ using namespace Tomahawk; Result::Result() {} Result::Result( const QVariant& v, const collection_ptr& collection ) - : m_v( v ) + : QObject() + , m_v( v ) , m_collection( collection ) { QVariantMap m = m_v.toMap(); diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp index feb2d988a..db9102fde 100644 --- a/src/libtomahawk/widgets/welcomewidget.cpp +++ b/src/libtomahawk/widgets/welcomewidget.cpp @@ -27,7 +27,7 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) m_tracksModel = new PlaylistModel( ui->tracksView ); ui->tracksView->setModel( m_tracksModel ); - m_tracksModel->loadHistory( Tomahawk::source_ptr() ); + m_tracksModel->loadHistory( Tomahawk::source_ptr(), 50 ); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );