diff --git a/data/js/tomahawk.js b/data/js/tomahawk.js index 9190a0add..49deeaf03 100644 --- a/data/js/tomahawk.js +++ b/data/js/tomahawk.js @@ -590,3 +590,31 @@ Tomahawk.setTimeout = Tomahawk.setTimeout || window.setTimeout; Tomahawk.setInterval = Tomahawk.setInterval || window.setInterval; Tomahawk.base64Decode = function(a) { return window.atob(a); }; Tomahawk.base64Encode = function(b) { return window.btoa(b); }; + +Tomahawk.PluginManager = { + objects: {}, + identifyObject: function (object) { + if( object.id === undefined ) { + // FIXME: get a proper unique id + object.id = "foobar"; + } + + return object.id; + }, + registerPlugin: function (type, object) { + this.objects[this.identifyObject(object)] = object; + + Tomahawk.registerScriptPlugin(type, object.id); + }, + + invoke: function (requestId, objectId, methodName, params ) { + this.objects[objectId][methodName](params).then(function (result) { + Tomahawk.reportScriptJobResults({ + requestId: requestId, + data: result + }); + },function (error) { + Tomahawk.reportScriptJobResults({error: error}); + }); + } +}; diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index bc659cda4..2e0e7f98c 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -92,6 +92,9 @@ set( libGuiSources resolvers/JSPlugin.cpp resolvers/ScriptJob.cpp resolvers/SyncScriptJob.cpp + resolvers/ScriptObject.cpp + resolvers/ScriptLinkGeneratorPlugin.cpp + resolvers/ScriptPlugin.cpp utils/DpiScaler.cpp utils/ImageRegistry.cpp diff --git a/src/libtomahawk/resolvers/JSPlugin.cpp b/src/libtomahawk/resolvers/JSPlugin.cpp index e13d94369..eadd9e199 100644 --- a/src/libtomahawk/resolvers/JSPlugin.cpp +++ b/src/libtomahawk/resolvers/JSPlugin.cpp @@ -21,6 +21,8 @@ #include "../utils/Json.h" #include "../utils/Logger.h" #include "ScriptEngine.h" +#include "ScriptJob.h" +#include "ScriptObject.h" #include #include @@ -100,3 +102,24 @@ JSPlugin::loadScripts( const QStringList& paths ) loadScript( path ); } } + + +void +JSPlugin::startJob( ScriptJob* scriptJob ) +{ + QString eval = QString( + "Tomahawk.PluginManager.invoke(" + "'%1'," // requestId + "'%2'," // objectId + "'%3'," // methodName + "%4" // arguments + ");" + ).arg( scriptJob->id() ) + .arg( scriptJob->scriptObject()->id() ) + .arg( scriptJob->methodName() ) + .arg( serializeQVariantMap( scriptJob->arguments() ) ); + + tLog() << Q_FUNC_INFO << eval; + + evaluateJavaScript( eval ); +} diff --git a/src/libtomahawk/resolvers/JSPlugin.h b/src/libtomahawk/resolvers/JSPlugin.h index 75d6acb52..98fc05e4f 100644 --- a/src/libtomahawk/resolvers/JSPlugin.h +++ b/src/libtomahawk/resolvers/JSPlugin.h @@ -35,13 +35,15 @@ namespace Tomahawk //TODO: pimple class ScriptEngine; -class DLLEXPORT JSPlugin : public QObject, public ScriptPlugin +class DLLEXPORT JSPlugin : public ScriptPlugin { Q_OBJECT public: JSPlugin(); + void startJob( ScriptJob* scriptJob ) override; + /** * Evaluate JavaScript on the WebKit thread */ diff --git a/src/libtomahawk/resolvers/JSResolverHelper.cpp b/src/libtomahawk/resolvers/JSResolverHelper.cpp index def34c60b..47bbae6e0 100644 --- a/src/libtomahawk/resolvers/JSResolverHelper.cpp +++ b/src/libtomahawk/resolvers/JSResolverHelper.cpp @@ -401,6 +401,20 @@ JSResolverHelper::reportCapabilities( const QVariant& v ) } +void +JSResolverHelper::reportScriptJobResults( const QVariantMap& result ) +{ + m_resolver->d_func()->scriptPlugin->reportScriptJobResult( result ); +} + + +void +JSResolverHelper::registerScriptPlugin(const QString& type, const QString& objectId) +{ + m_resolver->d_func()->scriptPlugin->registerScriptPlugin( type, objectId ); +} + + void JSResolverHelper::tracksAdded( const QList&, const ModelMode, const collection_ptr&) { diff --git a/src/libtomahawk/resolvers/JSResolverHelper.h b/src/libtomahawk/resolvers/JSResolverHelper.h index d1439f423..c6cad662e 100644 --- a/src/libtomahawk/resolvers/JSResolverHelper.h +++ b/src/libtomahawk/resolvers/JSResolverHelper.h @@ -143,6 +143,10 @@ public slots: void reportCapabilities( const QVariant& capabilities ); + void reportScriptJobResults( const QVariantMap& result ); + + void registerScriptPlugin( const QString& type, const QString& objectId ); + private slots: void gotStreamUrl( IODeviceCallback callback, NetworkReply* reply ); void tracksAdded( const QList& tracks, const Tomahawk::ModelMode, const Tomahawk::collection_ptr& collection ); diff --git a/src/libtomahawk/resolvers/ScriptJob.cpp b/src/libtomahawk/resolvers/ScriptJob.cpp index a41edc06a..4a1ff4828 100644 --- a/src/libtomahawk/resolvers/ScriptJob.cpp +++ b/src/libtomahawk/resolvers/ScriptJob.cpp @@ -17,25 +17,63 @@ */ #include "ScriptJob.h" +#include "ScriptObject.h" #include using namespace Tomahawk; -ScriptJob::ScriptJob( ScriptObject* scriptObject, const QString& method, const QVariantMap& parameters ) - : QObject() +ScriptJob::ScriptJob( const QString& id, ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments ) + : QObject( scriptObject ) + , m_id( id ) + , m_scriptObject( scriptObject ) + , m_methodName( methodName ) + , m_arguments( arguments ) { } ScriptJob::~ScriptJob() { + //FIXME: probably not necessary if we change the inheritance order + if ( !m_id.isEmpty() ) + { + Q_ASSERT( m_scriptObject ); + m_scriptObject->removeJob( this ); + } } - void ScriptJob::start() { + m_scriptObject->startJob( this ); +} + +ScriptObject* +ScriptJob::scriptObject() const +{ + return m_scriptObject; +} + + +const QString +ScriptJob::id() const +{ + return m_id; +} + + +const QString +ScriptJob::methodName() const +{ + return m_methodName; +} + + +const QVariantMap +ScriptJob::arguments() const +{ + return m_arguments; } diff --git a/src/libtomahawk/resolvers/ScriptJob.h b/src/libtomahawk/resolvers/ScriptJob.h index a4c76599b..de6ec827a 100644 --- a/src/libtomahawk/resolvers/ScriptJob.h +++ b/src/libtomahawk/resolvers/ScriptJob.h @@ -31,17 +31,20 @@ class ScriptObject; class DLLEXPORT ScriptJob : public QObject { -friend class ScriptObject; - Q_OBJECT public: - ScriptJob( ScriptObject* scriptObject, const QString& method, const QVariantMap& parameters = QVariantMap() ); + ScriptJob( const QString& id, ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments = QVariantMap() ); virtual ~ScriptJob(); virtual void start(); -protected slots: + const QString id() const; + ScriptObject* scriptObject() const; + const QString methodName() const; + const QVariantMap arguments() const; + +public slots: void reportResults( const QVariantMap& data ); void reportFailure(); @@ -51,7 +54,11 @@ signals: protected: // TODO: pimple + QString m_id; + ScriptObject* m_scriptObject; QVariantMap m_data; + QString m_methodName; + QVariantMap m_arguments; }; } diff --git a/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin.cpp b/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin.cpp new file mode 100644 index 000000000..caa1089ea --- /dev/null +++ b/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin.cpp @@ -0,0 +1,83 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2014, Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ +#include "ScriptLinkGeneratorPlugin_p.h" + +#include "ScriptObject.h" + +#include "../Artist.h" +#include "../Album.h" + +using namespace Tomahawk; + +ScriptLinkGeneratorPlugin::ScriptLinkGeneratorPlugin( ScriptObject* scriptObject ) + : Utils::LinkGeneratorPlugin() + , d_ptr( new ScriptLinkGeneratorPluginPrivate( this, scriptObject ) ) +{ +} + + +ScriptLinkGeneratorPlugin::~ScriptLinkGeneratorPlugin() +{ +} + + +ScriptJob* +ScriptLinkGeneratorPlugin::openLink( const QString& title, const QString& artist, const QString& album ) const +{ + Q_D( const ScriptLinkGeneratorPlugin ); + + QVariantMap arguments; + arguments[ "title" ] = QVariant( title ); + arguments[ "artist" ] = QVariant( artist ); + arguments[ "album" ] = QVariant( album ); + + return d->scriptObject->invoke( "generateQueryLink", arguments ); +} + + +ScriptJob* +ScriptLinkGeneratorPlugin::openLink( const artist_ptr& artist ) const +{ + Q_D( const ScriptLinkGeneratorPlugin ); + + // TODO: create proper serializer for QObjects + QVariantMap arguments; + arguments[ "name" ] = QVariant( artist->name() ); + + return d->scriptObject->invoke( "generateArtistLink", arguments ); +} + + +ScriptJob* +ScriptLinkGeneratorPlugin::openLink( const album_ptr& album ) const +{ + Q_D( const ScriptLinkGeneratorPlugin ); + + // TODO: create proper serializer for QObjects + QVariantMap arguments; + arguments[ "name" ] = QVariant( album->name() ); + + return d->scriptObject->invoke( "generateAlbumLink", arguments ); +} + + +ScriptJob* +ScriptLinkGeneratorPlugin::openLink( const dynplaylist_ptr& playlist ) const +{ + return nullptr; +} diff --git a/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin.h b/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin.h new file mode 100644 index 000000000..076c4550e --- /dev/null +++ b/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin.h @@ -0,0 +1,53 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2014, Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef TOMAHAWK_SCRIPTLINKGENERATORPLUGIN_H +#define TOMAHAWK_SCRIPTLINKGENERATORPLUGIN_H + +#include "../utils/LinkGeneratorPlugin.h" + +#include "DllMacro.h" + + +namespace Tomahawk +{ + +class ScriptObject; +class ScriptLinkGeneratorPluginPrivate; + +class DLLEXPORT ScriptLinkGeneratorPlugin : QObject, public Utils::LinkGeneratorPlugin +{ +Q_OBJECT + +public: + ScriptLinkGeneratorPlugin( ScriptObject* scriptObject ); + virtual ~ScriptLinkGeneratorPlugin(); + + ScriptJob* openLink( const QString& title, const QString& artist, const QString& album ) const override; + ScriptJob* openLink( const artist_ptr& artist ) const override; + ScriptJob* openLink( const album_ptr& album ) const override; + ScriptJob* openLink( const dynplaylist_ptr& playlist ) const override; + +private: + Q_DECLARE_PRIVATE( ScriptLinkGeneratorPlugin ) + QScopedPointer d_ptr; +}; + +}; // ns: Tomahawk + +#endif // TOMAHAWK_SCRIPTLINKGENERATORPLUGIN_H diff --git a/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin_p.h b/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin_p.h new file mode 100644 index 000000000..fc0840a46 --- /dev/null +++ b/src/libtomahawk/resolvers/ScriptLinkGeneratorPlugin_p.h @@ -0,0 +1,45 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2014, Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef TOMAHAWK_SCRIPTLINKGENERATORPLUGIN_P_H +#define TOMAHAWK_SCRIPTLINKGENERATORPLUGIN_P_H + +#include "ScriptLinkGeneratorPlugin.h" + +namespace Tomahawk +{ + +class ScriptLinkGeneratorPluginPrivate +{ + friend class ScriptLinkGeneratorPlugin; +public: + ScriptLinkGeneratorPluginPrivate( ScriptLinkGeneratorPlugin* q, ScriptObject* scriptObject ) + : q_ptr ( q ) + , scriptObject( scriptObject ) + { + } + ScriptLinkGeneratorPlugin* q_ptr; + Q_DECLARE_PUBLIC ( ScriptLinkGeneratorPlugin ) + +private: + ScriptObject* scriptObject; +}; + +} // ns: Tomahawk + +#endif // TOMAHAWK_SCRIPTLINKGENERATORPLUGIN_P_H diff --git a/src/libtomahawk/resolvers/ScriptObject.cpp b/src/libtomahawk/resolvers/ScriptObject.cpp new file mode 100644 index 000000000..48c24e950 --- /dev/null +++ b/src/libtomahawk/resolvers/ScriptObject.cpp @@ -0,0 +1,76 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2014, Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ +#include "ScriptObject_p.h" + +#include "ScriptPlugin.h" + + +using namespace Tomahawk; + +ScriptObject::ScriptObject( ScriptPlugin* parent ) + : QObject( parent ) + , d_ptr( new ScriptObjectPrivate( this, parent )) +{ + Q_D( ScriptObject ); + + // TODO:retrieve id from ScriptPlugin + d->id = "foobar"; +} + + +ScriptObject::~ScriptObject() +{ +} + + +ScriptJob* +ScriptObject::invoke( const QString& methodName, const QVariantMap& arguments ) +{ + Q_D( ScriptObject ); + + return d->scriptPlugin->invoke( this, methodName, arguments ); +} + + +QString +ScriptObject::id() const +{ + Q_D( const ScriptObject ); + + return d->id; +} + + +void +ScriptObject::startJob( ScriptJob* scriptJob ) +{ + Q_D( const ScriptObject ); + + d->scriptPlugin->startJob( scriptJob ); +} + + +void +ScriptObject::removeJob( ScriptJob* scriptJob ) +{ + Q_D( const ScriptObject ); + + Q_ASSERT( d->scriptPlugin ); + d->scriptPlugin->removeJob( scriptJob ); +} + diff --git a/src/libtomahawk/resolvers/ScriptObject.h b/src/libtomahawk/resolvers/ScriptObject.h new file mode 100644 index 000000000..144b82c9b --- /dev/null +++ b/src/libtomahawk/resolvers/ScriptObject.h @@ -0,0 +1,57 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2014, Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef TOMAHAWK_SCRIPTOBJECT_H +#define TOMAHAWK_SCRIPTOBJECT_H + +#include +#include + +#include "DllMacro.h" + +namespace Tomahawk +{ + +class ScriptPlugin; +class ScriptObjectPrivate; +class ScriptJob; + +class DLLEXPORT ScriptObject : public QObject +{ +friend class JSPlugin; +friend class ScriptJob; + +public: + ScriptObject( ScriptPlugin* parent ); + virtual ~ScriptObject(); + + ScriptJob* invoke( const QString& methodName, const QVariantMap& arguments ); + +protected: + QString id() const; + + void startJob( ScriptJob* scriptJob ); + void removeJob( ScriptJob* scriptJob ); +private: + Q_DECLARE_PRIVATE( ScriptObject ) + QScopedPointer d_ptr; +}; + +}; // ns: Tomahawk + +#endif // TOMAHAWK_SCRIPTOBJECT_H diff --git a/src/libtomahawk/resolvers/ScriptObject_p.h b/src/libtomahawk/resolvers/ScriptObject_p.h new file mode 100644 index 000000000..1392992bb --- /dev/null +++ b/src/libtomahawk/resolvers/ScriptObject_p.h @@ -0,0 +1,46 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2014, Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef TOMAHAWK_SCRIPTOBJECT_P_H +#define TOMAHAWK_SCRIPTOBJECT_P_H + +#include "ScriptObject.h" + +namespace Tomahawk +{ + +class ScriptObjectPrivate +{ + friend class ScriptObject; +public: + ScriptObjectPrivate( ScriptObject* q, ScriptPlugin* scriptPlugin ) + : q_ptr ( q ) + , scriptPlugin( scriptPlugin ) + { + } + ScriptObject* q_ptr; + Q_DECLARE_PUBLIC ( ScriptObject ) + +private: + QString id; + ScriptPlugin* scriptPlugin; +}; + +} // ns: Tomahawk + +#endif // TOMAHAWK_SCRIPTOBJECT_P_H diff --git a/src/libtomahawk/resolvers/ScriptPlugin.cpp b/src/libtomahawk/resolvers/ScriptPlugin.cpp new file mode 100644 index 000000000..a4aab7cb5 --- /dev/null +++ b/src/libtomahawk/resolvers/ScriptPlugin.cpp @@ -0,0 +1,103 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright (C) 2011 Leo Franchi + * Copyright (C) 2014 Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ +#include "ScriptPlugin.h" + +#include "ScriptObject.h" +#include "../utils/Logger.h" + + +// TODO: register factory methods instead of hardcoding all plugin types in here +#include "../utils/LinkGenerator.h" +#include "ScriptLinkGeneratorPlugin.h" + +using namespace Tomahawk; + +static QString +requestIdGenerator() +{ + //FIXME: create a proper requestId + return "somerequestId"; +} + + +ScriptJob* +ScriptPlugin::invoke( ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments ) +{ + QString requestId = requestIdGenerator(); + + ScriptJob* job = new ScriptJob( requestId, scriptObject, methodName, arguments ); + m_jobs.insert( requestId, job ); + + return job; +} + + +void +ScriptPlugin::removeJob( ScriptJob* job ) +{ + m_jobs.remove( job->id() ); +} + + +void +ScriptPlugin::reportScriptJobResult( const QVariantMap& result ) +{ + tLog() << Q_FUNC_INFO << result; + const QString requestId = result[ "requestId" ].toString(); + Q_ASSERT( !requestId.isEmpty() ); + + ScriptJob* job = m_jobs.value( requestId ); + Q_ASSERT( job ); + + // got a successful job result + if ( result[ "error"].isNull() ) + { + const QVariantMap data = result[ "data" ].toMap(); + + job->reportResults( data ); + } + else + { + job->reportFailure(); + } +} + + +void +ScriptPlugin::registerScriptPlugin( const QString& type, const QString& objectId ) +{ + ScriptObject* object = m_objects.value( objectId ); + if( !object ) + { + object = new ScriptObject( this ); + m_objects.insert( objectId, object ); + } + + if ( type == "linkGenerator" ) + { + tLog() << "Got link generator plugin"; + ScriptLinkGeneratorPlugin* lgp = new ScriptLinkGeneratorPlugin( object ); + Utils::LinkGenerator::instance()->addPlugin( lgp ); + } + else + { + tLog() << "This plugin type is not handled by Tomahawk"; + Q_ASSERT( false ); + } +} diff --git a/src/libtomahawk/resolvers/ScriptPlugin.h b/src/libtomahawk/resolvers/ScriptPlugin.h index ed0a89f15..add808f2c 100644 --- a/src/libtomahawk/resolvers/ScriptPlugin.h +++ b/src/libtomahawk/resolvers/ScriptPlugin.h @@ -22,15 +22,36 @@ #define TOMAHAWK_SCRIPTPLUGIN_H #include +#include + +//TODO: pimple +#include #include "../DllMacro.h" namespace Tomahawk { -class DLLEXPORT ScriptPlugin +class ScriptObject; +class ScriptJob; + +class DLLEXPORT ScriptPlugin : public QObject { + Q_OBJECT + public: virtual ~ScriptPlugin() {} + + ScriptJob* invoke( ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments ); + virtual void startJob( ScriptJob* scriptJob ) = 0; + void removeJob( ScriptJob* ); + + void reportScriptJobResult( const QVariantMap& result ); + void registerScriptPlugin( const QString& type, const QString& objectId ); + + +private: // TODO: pimple, might be renamed before tho + QHash< QString, ScriptJob* > m_jobs; + QHash< QString, ScriptObject* > m_objects; }; } // ns: Tomahawk diff --git a/src/libtomahawk/resolvers/SyncScriptJob.cpp b/src/libtomahawk/resolvers/SyncScriptJob.cpp index 9b2150dbf..82a72dc1b 100644 --- a/src/libtomahawk/resolvers/SyncScriptJob.cpp +++ b/src/libtomahawk/resolvers/SyncScriptJob.cpp @@ -19,7 +19,7 @@ Tomahawk::SyncScriptJob::SyncScriptJob( const QVariantMap& resultData ) - : ScriptJob( nullptr, "nomethod") + : ScriptJob( QString(), nullptr, QString() ) { m_data = resultData; }