From f89f119078eb2b9c93f8b83995bc9281bed2c408 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 7 Jun 2012 10:43:26 +0200 Subject: [PATCH] * Notify results about their originating resolver. --- src/libtomahawk/database/DatabaseResolver.cpp | 5 ++++- src/libtomahawk/resolvers/QtScriptResolver.cpp | 9 +++++++-- src/libtomahawk/resolvers/ScriptResolver.cpp | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/database/DatabaseResolver.cpp b/src/libtomahawk/database/DatabaseResolver.cpp index dcdd3816a..f7791c616 100644 --- a/src/libtomahawk/database/DatabaseResolver.cpp +++ b/src/libtomahawk/database/DatabaseResolver.cpp @@ -54,7 +54,10 @@ DatabaseResolver::resolve( const Tomahawk::query_ptr& query ) void DatabaseResolver::gotResults( const Tomahawk::QID qid, QList< Tomahawk::result_ptr> results ) { - qDebug() << Q_FUNC_INFO << qid << results.length(); + tDebug( LOGVERBOSE ) << Q_FUNC_INFO << qid << results.length(); + + foreach ( const Tomahawk::result_ptr& r, results ) + r->setResolvedBy( this ); Tomahawk::Pipeline::instance()->reportResults( qid, results ); } diff --git a/src/libtomahawk/resolvers/QtScriptResolver.cpp b/src/libtomahawk/resolvers/QtScriptResolver.cpp index ca40016c0..b99a8e3cf 100644 --- a/src/libtomahawk/resolvers/QtScriptResolver.cpp +++ b/src/libtomahawk/resolvers/QtScriptResolver.cpp @@ -131,6 +131,7 @@ QtScriptResolverHelper::setResolverConfig( const QVariantMap& config ) m_resolverConfig = config; } + QString QtScriptResolverHelper::hmac( const QByteArray& key, const QByteArray &input ) { @@ -156,6 +157,7 @@ QtScriptResolverHelper::hmac( const QByteArray& key, const QByteArray &input ) #endif } + QString QtScriptResolverHelper::md5( const QByteArray& input ) { @@ -163,6 +165,7 @@ QtScriptResolverHelper::md5( const QByteArray& input ) return QString::fromLatin1( digest.toHex() ); } + void QtScriptResolverHelper::addCustomUrlHandler( const QString& protocol, const QString& callbackFuncName ) { @@ -172,6 +175,7 @@ QtScriptResolverHelper::addCustomUrlHandler( const QString& protocol, const QStr m_urlCallback = callbackFuncName; } + QSharedPointer< QIODevice > QtScriptResolverHelper::customIODeviceFactory( const Tomahawk::result_ptr& result ) { @@ -253,6 +257,7 @@ QtScriptResolver::running() const return m_ready && !m_stopped; } + void QtScriptResolver::reload() { @@ -362,8 +367,7 @@ QtScriptResolver::resolve( const Tomahawk::query_ptr& query ) } QVariantMap m = m_engine->mainFrame()->evaluateJavaScript( eval ).toMap(); - - if( m.isEmpty() ) + if ( m.isEmpty() ) { // if the resolver doesn't return anything, async api is used return; @@ -423,6 +427,7 @@ QtScriptResolver::parseResultVariantList( const QVariantList& reslist ) Q_ASSERT( !rp->mimetype().isEmpty() ); } + rp->setResolvedBy( this ); results << rp; } diff --git a/src/libtomahawk/resolvers/ScriptResolver.cpp b/src/libtomahawk/resolvers/ScriptResolver.cpp index 009dc401e..2392c5893 100644 --- a/src/libtomahawk/resolvers/ScriptResolver.cpp +++ b/src/libtomahawk/resolvers/ScriptResolver.cpp @@ -288,6 +288,7 @@ ScriptResolver::handleMsg( const QByteArray& msg ) Q_ASSERT( !rp->mimetype().isEmpty() ); } + rp->setResolvedBy( this ); results << rp; }