diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 2f27ebb7b..d3819a607 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -84,7 +84,7 @@ set( libGuiSources resolvers/ExternalResolverGui.cpp resolvers/ScriptResolver.cpp - resolvers/JSInfoPlugin.cpp + resolvers/ScriptInfoPlugin.cpp resolvers/JSInfoSystemHelper.cpp resolvers/JSResolver.cpp resolvers/JSResolverHelper.cpp diff --git a/src/libtomahawk/resolvers/JSInfoSystemHelper.cpp b/src/libtomahawk/resolvers/JSInfoSystemHelper.cpp index 3df172243..0da167c88 100644 --- a/src/libtomahawk/resolvers/JSInfoSystemHelper.cpp +++ b/src/libtomahawk/resolvers/JSInfoSystemHelper.cpp @@ -17,7 +17,7 @@ */ #include "JSInfoSystemHelper_p.h" -#include "JSInfoPlugin.h" +#include "ScriptInfoPlugin.h" #include "JSAccount.h" #include "../utils/Logger.h" @@ -49,14 +49,14 @@ JSInfoSystemHelper::nativeAddInfoPlugin( int id ) Q_D( JSInfoSystemHelper ); // create infoplugin instance - JSInfoPlugin* jsInfoPlugin = new JSInfoPlugin( id, d->scriptAccount ); - Tomahawk::InfoSystem::InfoPluginPtr infoPlugin( jsInfoPlugin ); + ScriptInfoPlugin* scriptInfoPlugin = new ScriptInfoPlugin( id, d->scriptAccount ); + Tomahawk::InfoSystem::InfoPluginPtr infoPlugin( scriptInfoPlugin ); // move it to infosystem thread infoPlugin->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() ); // add it to local list of infoplugins - d->infoPlugins[id] = jsInfoPlugin; + d->infoPlugins[id] = scriptInfoPlugin; // add it to infosystem Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin ); diff --git a/src/libtomahawk/resolvers/JSInfoSystemHelper_p.h b/src/libtomahawk/resolvers/JSInfoSystemHelper_p.h index 2a106f356..3913adcc9 100644 --- a/src/libtomahawk/resolvers/JSInfoSystemHelper_p.h +++ b/src/libtomahawk/resolvers/JSInfoSystemHelper_p.h @@ -40,7 +40,7 @@ public: private: JSAccount* scriptAccount; - QMap infoPlugins; + QMap infoPlugins; }; diff --git a/src/libtomahawk/resolvers/JSResolver.cpp b/src/libtomahawk/resolvers/JSResolver.cpp index d5dae8970..a733cc36c 100644 --- a/src/libtomahawk/resolvers/JSResolver.cpp +++ b/src/libtomahawk/resolvers/JSResolver.cpp @@ -42,7 +42,7 @@ #include "TomahawkSettings.h" #include "TomahawkVersion.h" #include "Track.h" -#include "JSInfoPlugin.h" +#include "ScriptInfoPlugin.h" #include "JSAccount.h" #include diff --git a/src/libtomahawk/resolvers/JSResolver.h b/src/libtomahawk/resolvers/JSResolver.h index 0a3cae805..b46f438d6 100644 --- a/src/libtomahawk/resolvers/JSResolver.h +++ b/src/libtomahawk/resolvers/JSResolver.h @@ -33,7 +33,7 @@ namespace Tomahawk { -class JSInfoPlugin; +class ScriptInfoPlugin; class JSResolverHelper; class JSResolverPrivate; class ScriptEngine; diff --git a/src/libtomahawk/resolvers/JSInfoPlugin.cpp b/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp similarity index 78% rename from src/libtomahawk/resolvers/JSInfoPlugin.cpp rename to src/libtomahawk/resolvers/ScriptInfoPlugin.cpp index de4ec3144..502de09b8 100644 --- a/src/libtomahawk/resolvers/JSInfoPlugin.cpp +++ b/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp @@ -16,7 +16,7 @@ * along with Tomahawk. If not, see . */ -#include "JSInfoPlugin_p.h" +#include "ScriptInfoPlugin_p.h" #include "JSAccount.h" #include "Typedefs.h" @@ -26,8 +26,8 @@ using namespace Tomahawk; -JSInfoPlugin::JSInfoPlugin( int id, JSAccount *resolver ) - : d_ptr( new JSInfoPluginPrivate( this, id, resolver ) ) +ScriptInfoPlugin::ScriptInfoPlugin( int id, JSAccount *resolver ) + : d_ptr( new ScriptInfoPluginPrivate( this, id, resolver ) ) { Q_ASSERT( resolver ); @@ -35,25 +35,25 @@ JSInfoPlugin::JSInfoPlugin( int id, JSAccount *resolver ) m_supportedGetTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedGetTypes" ) ); m_supportedPushTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedPushTypes" ) ); - setFriendlyName( QString( "JSInfoPlugin: %1" ).arg( resolver->name() ) ); + setFriendlyName( QString( "ScriptInfoPlugin: %1" ).arg( resolver->name() ) ); } -JSInfoPlugin::~JSInfoPlugin() +ScriptInfoPlugin::~ScriptInfoPlugin() { } void -JSInfoPlugin::init() +ScriptInfoPlugin::init() { } void -JSInfoPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData ) +ScriptInfoPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData ) { - Q_D( JSInfoPlugin ); + Q_D( ScriptInfoPlugin ); d->requestDataCache[ requestData.requestId ] = requestData; @@ -68,7 +68,7 @@ JSInfoPlugin::getInfo( Tomahawk::InfoSystem::InfoRequestData requestData ) void -JSInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) +ScriptInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) { QString eval = QString( "pushInfo({ type: %1, pushFlags: %2, input: %3, additionalInput: %4})" ) .arg( pushData.type ) @@ -81,9 +81,9 @@ JSInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData ) void -JSInfoPlugin::notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData ) +ScriptInfoPlugin::notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData ) { - Q_D( JSInfoPlugin ); + Q_D( ScriptInfoPlugin ); d->requestDataCache[ requestData.requestId ] = requestData; d->criteriaCache[ requestData.requestId ] = criteria; @@ -100,7 +100,7 @@ JSInfoPlugin::notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tom void -JSInfoPlugin::addInfoRequestResult( int requestId, qint64 maxAge, const QVariantMap& returnedData ) +ScriptInfoPlugin::addInfoRequestResult( int requestId, qint64 maxAge, const QVariantMap& returnedData ) { if ( QThread::currentThread() != thread() ) { @@ -108,7 +108,7 @@ JSInfoPlugin::addInfoRequestResult( int requestId, qint64 maxAge, const QVariant return; } - Q_D( JSInfoPlugin ); + Q_D( ScriptInfoPlugin ); // retrieve requestData from cache and delete it Tomahawk::InfoSystem::InfoRequestData requestData = d->requestDataCache[ requestId ]; @@ -125,7 +125,7 @@ JSInfoPlugin::addInfoRequestResult( int requestId, qint64 maxAge, const QVariant void -JSInfoPlugin::emitGetCachedInfo( int requestId, const QVariantMap& criteria, int newMaxAge ) +ScriptInfoPlugin::emitGetCachedInfo( int requestId, const QVariantMap& criteria, int newMaxAge ) { if ( QThread::currentThread() != thread() ) { @@ -133,7 +133,7 @@ JSInfoPlugin::emitGetCachedInfo( int requestId, const QVariantMap& criteria, int return; } - Q_D( JSInfoPlugin ); + Q_D( ScriptInfoPlugin ); emit getCachedInfo( convertQVariantMapToInfoStringHash( criteria ), newMaxAge, d->requestDataCache[ requestId ]); @@ -141,7 +141,7 @@ JSInfoPlugin::emitGetCachedInfo( int requestId, const QVariantMap& criteria, int void -JSInfoPlugin::emitInfo( int requestId, const QVariantMap& output ) +ScriptInfoPlugin::emitInfo( int requestId, const QVariantMap& output ) { if ( QThread::currentThread() != thread() ) { @@ -149,25 +149,25 @@ JSInfoPlugin::emitInfo( int requestId, const QVariantMap& output ) return; } - Q_D( JSInfoPlugin ); + Q_D( ScriptInfoPlugin ); emit info( d->requestDataCache[ requestId ], output ); } QString -JSInfoPlugin::serviceGetter() const +ScriptInfoPlugin::serviceGetter() const { - Q_D( const JSInfoPlugin ); + Q_D( const ScriptInfoPlugin ); return QString( "Tomahawk.InfoSystem.getInfoPlugin(%1)" ).arg( d->id ); } // TODO: DRY, really move things into base class void -JSInfoPlugin::callMethodOnInfoPlugin( const QString& scriptSource ) +ScriptInfoPlugin::callMethodOnInfoPlugin( const QString& scriptSource ) { - Q_D( JSInfoPlugin ); + Q_D( ScriptInfoPlugin ); QString eval = QString( "%1.%2" ).arg( serviceGetter() ).arg( scriptSource ); @@ -178,9 +178,9 @@ JSInfoPlugin::callMethodOnInfoPlugin( const QString& scriptSource ) QVariant -JSInfoPlugin::callMethodOnInfoPluginWithResult(const QString& scriptSource) +ScriptInfoPlugin::callMethodOnInfoPluginWithResult(const QString& scriptSource) { - Q_D( JSInfoPlugin ); + Q_D( ScriptInfoPlugin ); QString eval = QString( "%1.%2" ).arg( serviceGetter() ).arg( scriptSource ); @@ -192,7 +192,7 @@ JSInfoPlugin::callMethodOnInfoPluginWithResult(const QString& scriptSource) QSet< Tomahawk::InfoSystem::InfoType > -JSInfoPlugin::parseSupportedTypes( const QVariant& variant ) +ScriptInfoPlugin::parseSupportedTypes( const QVariant& variant ) { QVariantList list = variant.toList(); @@ -213,7 +213,7 @@ JSInfoPlugin::parseSupportedTypes( const QVariant& variant ) QString -JSInfoPlugin::serializeQVariantMap( const QVariantMap& map ) +ScriptInfoPlugin::serializeQVariantMap( const QVariantMap& map ) { QVariantMap localMap = map; @@ -234,7 +234,7 @@ JSInfoPlugin::serializeQVariantMap( const QVariantMap& map ) QVariantMap -JSInfoPlugin::convertInfoStringHashToQVariantMap( const Tomahawk::InfoSystem::InfoStringHash& hash ) +ScriptInfoPlugin::convertInfoStringHashToQVariantMap( const Tomahawk::InfoSystem::InfoStringHash& hash ) { QVariantMap map; @@ -248,7 +248,7 @@ JSInfoPlugin::convertInfoStringHashToQVariantMap( const Tomahawk::InfoSystem::In Tomahawk::InfoSystem::InfoStringHash -JSInfoPlugin::convertQVariantMapToInfoStringHash( const QVariantMap& map ) +ScriptInfoPlugin::convertQVariantMapToInfoStringHash( const QVariantMap& map ) { Tomahawk::InfoSystem::InfoStringHash hash; diff --git a/src/libtomahawk/resolvers/JSInfoPlugin.h b/src/libtomahawk/resolvers/ScriptInfoPlugin.h similarity index 85% rename from src/libtomahawk/resolvers/JSInfoPlugin.h rename to src/libtomahawk/resolvers/ScriptInfoPlugin.h index 0aa698e86..8c8b280ae 100644 --- a/src/libtomahawk/resolvers/JSInfoPlugin.h +++ b/src/libtomahawk/resolvers/ScriptInfoPlugin.h @@ -16,8 +16,8 @@ * along with Tomahawk. If not, see . */ -#ifndef TOMAHAWK_JSINFOPLUGIN_H -#define TOMAHAWK_JSINFOPLUGIN_H +#ifndef TOMAHAWK_SCRIPTINFOPLUGIN_H +#define TOMAHAWK_SCRIPTINFOPLUGIN_H #include "../infosystem/InfoSystem.h" @@ -28,10 +28,10 @@ namespace Tomahawk { class JSAccount; -class JSInfoPluginPrivate; +class ScriptInfoPluginPrivate; -class DLLEXPORT JSInfoPlugin : public Tomahawk::InfoSystem::InfoPlugin +class DLLEXPORT ScriptInfoPlugin : public Tomahawk::InfoSystem::InfoPlugin { Q_OBJECT @@ -39,8 +39,8 @@ public: /** * @param id unique identifier to identify an infoplugin in its scope */ - JSInfoPlugin( int id, JSAccount* resolver ); - virtual ~JSInfoPlugin(); + ScriptInfoPlugin( int id, JSAccount* resolver ); + virtual ~ScriptInfoPlugin(); Q_INVOKABLE void addInfoRequestResult( int requestId, qint64 maxAge, const QVariantMap& returnedData ); @@ -66,10 +66,10 @@ private: static QVariantMap convertInfoStringHashToQVariantMap(const Tomahawk::InfoSystem::InfoStringHash& hash); static Tomahawk::InfoSystem::InfoStringHash convertQVariantMapToInfoStringHash( const QVariantMap& map ); - Q_DECLARE_PRIVATE( JSInfoPlugin ) - QScopedPointer d_ptr; + Q_DECLARE_PRIVATE( ScriptInfoPlugin ) + QScopedPointer d_ptr; }; }; // ns: Tomahawk -#endif // TOMAHAWK_JSINFOPLUGIN_H +#endif // TOMAHAWK_SCRIPTINFOPLUGIN_H diff --git a/src/libtomahawk/resolvers/JSInfoPlugin_p.h b/src/libtomahawk/resolvers/ScriptInfoPlugin_p.h similarity index 72% rename from src/libtomahawk/resolvers/JSInfoPlugin_p.h rename to src/libtomahawk/resolvers/ScriptInfoPlugin_p.h index d3724c76c..91d93a14d 100644 --- a/src/libtomahawk/resolvers/JSInfoPlugin_p.h +++ b/src/libtomahawk/resolvers/ScriptInfoPlugin_p.h @@ -16,30 +16,30 @@ * along with Tomahawk. If not, see . */ -#ifndef TOMAHAWK_JSINFOPLUGIN_P_H -#define TOMAHAWK_JSINFOPLUGIN_P_H +#ifndef TOMAHAWK_SCRIPTINFOPLUGIN_P_H +#define TOMAHAWK_SCRIPTINFOPLUGIN_P_H -#include "JSInfoPlugin.h" +#include "ScriptInfoPlugin.h" namespace Tomahawk { -class JSInfoPluginPrivate +class ScriptInfoPluginPrivate { - friend class JSInfoPlugin; + friend class ScriptInfoPlugin; public: - JSInfoPluginPrivate( JSInfoPlugin* q, int id, JSAccount* resolver ) + ScriptInfoPluginPrivate( ScriptInfoPlugin* q, int id, JSAccount* resolver ) : q_ptr ( q ) , id( id ) , resolver( resolver ) { } - JSInfoPlugin* q_ptr; - Q_DECLARE_PUBLIC ( JSInfoPlugin ) + ScriptInfoPlugin* q_ptr; + Q_DECLARE_PUBLIC ( ScriptInfoPlugin ) private: int id; - // HACK: JSInfoPlugin needs to be refactored to track a ScriptObject + // HACK: ScriptInfoPlugin needs to be refactored to track a ScriptObject JSAccount* resolver; QMap< int, Tomahawk::InfoSystem::InfoRequestData > requestDataCache; @@ -48,4 +48,4 @@ private: } // ns: Tomahawk -#endif // TOMAHAWK_JSINFOPLUGIN_P_H +#endif // TOMAHAWK_SCRIPTINFOPLUGIN_P_H