mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Rename ScriptPlugin to ScriptAccount and JSPlugin to JSAccount
This commit is contained in:
@@ -89,12 +89,12 @@ set( libGuiSources
|
|||||||
resolvers/JSResolver.cpp
|
resolvers/JSResolver.cpp
|
||||||
resolvers/JSResolverHelper.cpp
|
resolvers/JSResolverHelper.cpp
|
||||||
resolvers/ScriptEngine.cpp
|
resolvers/ScriptEngine.cpp
|
||||||
resolvers/JSPlugin.cpp
|
resolvers/JSAccount.cpp
|
||||||
resolvers/ScriptJob.cpp
|
resolvers/ScriptJob.cpp
|
||||||
resolvers/SyncScriptJob.cpp
|
resolvers/SyncScriptJob.cpp
|
||||||
resolvers/ScriptObject.cpp
|
resolvers/ScriptObject.cpp
|
||||||
resolvers/ScriptLinkGeneratorPlugin.cpp
|
resolvers/ScriptLinkGeneratorPlugin.cpp
|
||||||
resolvers/ScriptPlugin.cpp
|
resolvers/ScriptAccount.cpp
|
||||||
|
|
||||||
utils/DpiScaler.cpp
|
utils/DpiScaler.cpp
|
||||||
utils/ImageRegistry.cpp
|
utils/ImageRegistry.cpp
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "JSPlugin.h"
|
#include "JSAccount.h"
|
||||||
|
|
||||||
#include "../utils/Json.h"
|
#include "../utils/Json.h"
|
||||||
#include "../utils/Logger.h"
|
#include "../utils/Logger.h"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
JSPlugin::JSPlugin( const QString& name )
|
JSAccount::JSAccount( const QString& name )
|
||||||
: m_engine( new ScriptEngine( this ) )
|
: m_engine( new ScriptEngine( this ) )
|
||||||
, m_name( name )
|
, m_name( name )
|
||||||
{
|
{
|
||||||
@@ -38,14 +38,14 @@ JSPlugin::JSPlugin( const QString& name )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JSPlugin::addToJavaScriptWindowObject( const QString& name, QObject* object )
|
JSAccount::addToJavaScriptWindowObject( const QString& name, QObject* object )
|
||||||
{
|
{
|
||||||
m_engine->mainFrame()->addToJavaScriptWindowObject( name, object );
|
m_engine->mainFrame()->addToJavaScriptWindowObject( name, object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
JSPlugin::serializeQVariantMap( const QVariantMap& map )
|
JSAccount::serializeQVariantMap( const QVariantMap& map )
|
||||||
{
|
{
|
||||||
QVariantMap localMap = map;
|
QVariantMap localMap = map;
|
||||||
|
|
||||||
@@ -62,12 +62,12 @@ JSPlugin::serializeQVariantMap( const QVariantMap& map )
|
|||||||
|
|
||||||
QByteArray serialized = TomahawkUtils::toJson( localMap );
|
QByteArray serialized = TomahawkUtils::toJson( localMap );
|
||||||
|
|
||||||
return QString( "JSON.parse('%1')" ).arg( JSPlugin::escape( QString::fromUtf8( serialized ) ) );
|
return QString( "JSON.parse('%1')" ).arg( JSAccount::escape( QString::fromUtf8( serialized ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
JSPlugin::JSPlugin::escape( const QString& source )
|
JSAccount::JSAccount::escape( const QString& source )
|
||||||
{
|
{
|
||||||
QString copy = source;
|
QString copy = source;
|
||||||
return copy.replace( "\\", "\\\\" ).replace( "'", "\\'" );
|
return copy.replace( "\\", "\\\\" ).replace( "'", "\\'" );
|
||||||
@@ -75,7 +75,7 @@ JSPlugin::JSPlugin::escape( const QString& source )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JSPlugin::loadScript( const QString& path )
|
JSAccount::loadScript( const QString& path )
|
||||||
{
|
{
|
||||||
QFile file( path );
|
QFile file( path );
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ JSPlugin::loadScript( const QString& path )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JSPlugin::loadScripts( const QStringList& paths )
|
JSAccount::loadScripts( const QStringList& paths )
|
||||||
{
|
{
|
||||||
foreach ( const QString& path, paths )
|
foreach ( const QString& path, paths )
|
||||||
{
|
{
|
||||||
@@ -106,7 +106,7 @@ JSPlugin::loadScripts( const QStringList& paths )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JSPlugin::startJob( ScriptJob* scriptJob )
|
JSAccount::startJob( ScriptJob* scriptJob )
|
||||||
{
|
{
|
||||||
QString eval = QString(
|
QString eval = QString(
|
||||||
"Tomahawk.PluginManager.invoke("
|
"Tomahawk.PluginManager.invoke("
|
||||||
@@ -128,21 +128,21 @@ JSPlugin::startJob( ScriptJob* scriptJob )
|
|||||||
|
|
||||||
|
|
||||||
const QString
|
const QString
|
||||||
JSPlugin::name() const
|
JSAccount::name() const
|
||||||
{
|
{
|
||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
JSPlugin::evaluateJavaScriptInternal( const QString& scriptSource )
|
JSAccount::evaluateJavaScriptInternal( const QString& scriptSource )
|
||||||
{
|
{
|
||||||
return m_engine->mainFrame()->evaluateJavaScript( scriptSource );
|
return m_engine->mainFrame()->evaluateJavaScript( scriptSource );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JSPlugin::evaluateJavaScript( const QString& scriptSource )
|
JSAccount::evaluateJavaScript( const QString& scriptSource )
|
||||||
{
|
{
|
||||||
if ( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
@@ -155,7 +155,7 @@ JSPlugin::evaluateJavaScript( const QString& scriptSource )
|
|||||||
|
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
JSPlugin::evaluateJavaScriptWithResult( const QString& scriptSource )
|
JSAccount::evaluateJavaScriptWithResult( const QString& scriptSource )
|
||||||
{
|
{
|
||||||
Q_ASSERT( QThread::currentThread() == thread() );
|
Q_ASSERT( QThread::currentThread() == thread() );
|
||||||
|
|
@@ -16,11 +16,11 @@
|
|||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TOMAHAWK_JSPLUGIN_H
|
#ifndef TOMAHAWK_JSACCOUNT_H
|
||||||
#define TOMAHAWK_JSPLUGIN_H
|
#define TOMAHAWK_JSACCOUNT_H
|
||||||
|
|
||||||
|
|
||||||
#include "ScriptPlugin.h"
|
#include "ScriptAccount.h"
|
||||||
|
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -35,13 +35,13 @@ namespace Tomahawk
|
|||||||
//TODO: pimple
|
//TODO: pimple
|
||||||
class ScriptEngine;
|
class ScriptEngine;
|
||||||
|
|
||||||
class DLLEXPORT JSPlugin : public ScriptPlugin
|
class DLLEXPORT JSAccount : public ScriptAccount
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// HACK: needs refactoring
|
// HACK: needs refactoring
|
||||||
JSPlugin( const QString& name );
|
JSAccount( const QString& name );
|
||||||
|
|
||||||
void startJob( ScriptJob* scriptJob ) override;
|
void startJob( ScriptJob* scriptJob ) override;
|
||||||
|
|
||||||
@@ -82,5 +82,5 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TOMAHAWK_SCRIPTJOB_H
|
#endif // TOMAHAWK_JSACCOUNT_H
|
||||||
|
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "JSInfoPlugin_p.h"
|
#include "JSInfoPlugin_p.h"
|
||||||
|
|
||||||
#include "JSPlugin.h"
|
#include "JSAccount.h"
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
|
|
||||||
#include "../utils/Logger.h"
|
#include "../utils/Logger.h"
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
JSInfoPlugin::JSInfoPlugin( int id, JSPlugin *resolver )
|
JSInfoPlugin::JSInfoPlugin( int id, JSAccount *resolver )
|
||||||
: d_ptr( new JSInfoPluginPrivate( this, id, resolver ) )
|
: d_ptr( new JSInfoPluginPrivate( this, id, resolver ) )
|
||||||
{
|
{
|
||||||
Q_ASSERT( resolver );
|
Q_ASSERT( resolver );
|
||||||
@@ -229,7 +229,7 @@ JSInfoPlugin::serializeQVariantMap( const QVariantMap& map )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return JSPlugin::serializeQVariantMap( localMap );
|
return JSAccount::serializeQVariantMap( localMap );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
class JSPlugin;
|
class JSAccount;
|
||||||
class JSInfoPluginPrivate;
|
class JSInfoPluginPrivate;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @param id unique identifier to identify an infoplugin in its scope
|
* @param id unique identifier to identify an infoplugin in its scope
|
||||||
*/
|
*/
|
||||||
JSInfoPlugin( int id, JSPlugin* resolver );
|
JSInfoPlugin( int id, JSAccount* resolver );
|
||||||
virtual ~JSInfoPlugin();
|
virtual ~JSInfoPlugin();
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ protected slots:
|
|||||||
void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData ) override;
|
void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// TODO: create JSPlugin base class and move these methods there
|
// TODO: create JSAccount base class and move these methods there
|
||||||
QString serviceGetter() const; // = 0
|
QString serviceGetter() const; // = 0
|
||||||
void callMethodOnInfoPlugin( const QString& scriptSource );
|
void callMethodOnInfoPlugin( const QString& scriptSource );
|
||||||
QVariant callMethodOnInfoPluginWithResult( const QString& scriptSource );
|
QVariant callMethodOnInfoPluginWithResult( const QString& scriptSource );
|
||||||
|
@@ -28,7 +28,7 @@ class JSInfoPluginPrivate
|
|||||||
{
|
{
|
||||||
friend class JSInfoPlugin;
|
friend class JSInfoPlugin;
|
||||||
public:
|
public:
|
||||||
JSInfoPluginPrivate( JSInfoPlugin* q, int id, JSPlugin* resolver )
|
JSInfoPluginPrivate( JSInfoPlugin* q, int id, JSAccount* resolver )
|
||||||
: q_ptr ( q )
|
: q_ptr ( q )
|
||||||
, id( id )
|
, id( id )
|
||||||
, resolver( resolver )
|
, resolver( resolver )
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
int id;
|
int id;
|
||||||
// HACK: JSInfoPlugin needs to be refactored to track a ScriptObject
|
// HACK: JSInfoPlugin needs to be refactored to track a ScriptObject
|
||||||
JSPlugin* resolver;
|
JSAccount* resolver;
|
||||||
|
|
||||||
QMap< int, Tomahawk::InfoSystem::InfoRequestData > requestDataCache;
|
QMap< int, Tomahawk::InfoSystem::InfoRequestData > requestDataCache;
|
||||||
QMap< int, Tomahawk::InfoSystem::InfoStringHash > criteriaCache;
|
QMap< int, Tomahawk::InfoSystem::InfoStringHash > criteriaCache;
|
||||||
|
@@ -19,12 +19,12 @@
|
|||||||
#include "JSInfoSystemHelper_p.h"
|
#include "JSInfoSystemHelper_p.h"
|
||||||
#include "JSInfoPlugin.h"
|
#include "JSInfoPlugin.h"
|
||||||
|
|
||||||
#include "JSPlugin.h"
|
#include "JSAccount.h"
|
||||||
#include "../utils/Logger.h"
|
#include "../utils/Logger.h"
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
JSInfoSystemHelper::JSInfoSystemHelper( JSPlugin* parent )
|
JSInfoSystemHelper::JSInfoSystemHelper( JSAccount* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, d_ptr( new JSInfoSystemHelperPrivate( this, parent ) )
|
, d_ptr( new JSInfoSystemHelperPrivate( this, parent ) )
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ JSInfoSystemHelper::nativeAddInfoPlugin( int id )
|
|||||||
Q_D( JSInfoSystemHelper );
|
Q_D( JSInfoSystemHelper );
|
||||||
|
|
||||||
// create infoplugin instance
|
// create infoplugin instance
|
||||||
JSInfoPlugin* jsInfoPlugin = new JSInfoPlugin( id, d->scriptPlugin );
|
JSInfoPlugin* jsInfoPlugin = new JSInfoPlugin( id, d->scriptAccount );
|
||||||
Tomahawk::InfoSystem::InfoPluginPtr infoPlugin( jsInfoPlugin );
|
Tomahawk::InfoSystem::InfoPluginPtr infoPlugin( jsInfoPlugin );
|
||||||
|
|
||||||
// move it to infosystem thread
|
// move it to infosystem thread
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
class JSPlugin;
|
class JSAccount;
|
||||||
class JSInfoSystemHelperPrivate;
|
class JSInfoSystemHelperPrivate;
|
||||||
|
|
||||||
class JSInfoSystemHelper : public QObject
|
class JSInfoSystemHelper : public QObject
|
||||||
@@ -32,7 +32,7 @@ class JSInfoSystemHelper : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
JSInfoSystemHelper( JSPlugin* parent );
|
JSInfoSystemHelper( JSAccount* parent );
|
||||||
~JSInfoSystemHelper();
|
~JSInfoSystemHelper();
|
||||||
|
|
||||||
QStringList requiredScriptPaths() const;
|
QStringList requiredScriptPaths() const;
|
||||||
|
@@ -29,9 +29,9 @@ class JSInfoSystemHelperPrivate
|
|||||||
{
|
{
|
||||||
friend class JSInfoSystemHelper;
|
friend class JSInfoSystemHelper;
|
||||||
public:
|
public:
|
||||||
JSInfoSystemHelperPrivate( JSInfoSystemHelper* q, JSPlugin* scriptPlugin )
|
JSInfoSystemHelperPrivate( JSInfoSystemHelper* q, JSAccount* scriptAccount )
|
||||||
: q_ptr ( q )
|
: q_ptr ( q )
|
||||||
, scriptPlugin ( scriptPlugin )
|
, scriptAccount ( scriptAccount )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
Q_DECLARE_PUBLIC ( JSInfoSystemHelper )
|
Q_DECLARE_PUBLIC ( JSInfoSystemHelper )
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JSPlugin* scriptPlugin;
|
JSAccount* scriptAccount;
|
||||||
QMap<int,JSInfoPlugin*> infoPlugins;
|
QMap<int,JSInfoPlugin*> infoPlugins;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
#include "TomahawkVersion.h"
|
#include "TomahawkVersion.h"
|
||||||
#include "Track.h"
|
#include "Track.h"
|
||||||
#include "JSInfoPlugin.h"
|
#include "JSInfoPlugin.h"
|
||||||
#include "JSPlugin.h"
|
#include "JSAccount.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@@ -65,7 +65,7 @@ JSResolver::JSResolver( const QString& accountId, const QString& scriptPath, con
|
|||||||
tLog() << Q_FUNC_INFO << "Loading JS resolver:" << scriptPath;
|
tLog() << Q_FUNC_INFO << "Loading JS resolver:" << scriptPath;
|
||||||
|
|
||||||
d->name = QFileInfo( filePath() ).baseName();
|
d->name = QFileInfo( filePath() ).baseName();
|
||||||
d->scriptPlugin.reset( new JSPlugin( d->name ) );
|
d->scriptAccount.reset( new JSAccount( d->name ) );
|
||||||
|
|
||||||
// set the icon, if we launch properly we'll get the icon the resolver reports
|
// set the icon, if we launch properly we'll get the icon the resolver reports
|
||||||
d->icon = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultResolver, TomahawkUtils::Original, QSize( 128, 128 ) );
|
d->icon = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultResolver, TomahawkUtils::Original, QSize( 128, 128 ) );
|
||||||
@@ -207,14 +207,14 @@ JSResolver::init()
|
|||||||
// tomahawk.js
|
// tomahawk.js
|
||||||
{
|
{
|
||||||
// add c++ part of tomahawk javascript library
|
// add c++ part of tomahawk javascript library
|
||||||
d->scriptPlugin->addToJavaScriptWindowObject( "Tomahawk", d->resolverHelper );
|
d->scriptAccount->addToJavaScriptWindowObject( "Tomahawk", d->resolverHelper );
|
||||||
|
|
||||||
// load es6-promises shim
|
// load es6-promises shim
|
||||||
d->scriptPlugin->loadScript( RESPATH "js/es6-promise-2.0.0.min.js" );
|
d->scriptAccount->loadScript( RESPATH "js/es6-promise-2.0.0.min.js" );
|
||||||
|
|
||||||
|
|
||||||
// Load CrytoJS core
|
// Load CrytoJS core
|
||||||
d->scriptPlugin->loadScript( RESPATH "js/cryptojs-core.js" );
|
d->scriptAccount->loadScript( RESPATH "js/cryptojs-core.js" );
|
||||||
|
|
||||||
// Load CryptoJS modules
|
// Load CryptoJS modules
|
||||||
QStringList jsfiles;
|
QStringList jsfiles;
|
||||||
@@ -222,11 +222,11 @@ JSResolver::init()
|
|||||||
QDir cryptojs( RESPATH "js/cryptojs" );
|
QDir cryptojs( RESPATH "js/cryptojs" );
|
||||||
foreach ( QString jsfile, cryptojs.entryList( jsfiles ) )
|
foreach ( QString jsfile, cryptojs.entryList( jsfiles ) )
|
||||||
{
|
{
|
||||||
d->scriptPlugin->loadScript( RESPATH "js/cryptojs/" + jsfile );
|
d->scriptAccount->loadScript( RESPATH "js/cryptojs/" + jsfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load tomahawk.js
|
// Load tomahawk.js
|
||||||
d->scriptPlugin->loadScript( RESPATH "js/tomahawk.js" );
|
d->scriptAccount->loadScript( RESPATH "js/tomahawk.js" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// tomahawk-infosystem.js
|
// tomahawk-infosystem.js
|
||||||
@@ -234,21 +234,24 @@ JSResolver::init()
|
|||||||
// TODO: be smarter about this, only instantiate this if the resolver supports infoplugins
|
// TODO: be smarter about this, only instantiate this if the resolver supports infoplugins
|
||||||
|
|
||||||
// add c++ part of tomahawk infosystem bindings as Tomahawk.InfoSystem
|
// add c++ part of tomahawk infosystem bindings as Tomahawk.InfoSystem
|
||||||
d->infoSystemHelper = new JSInfoSystemHelper( d->scriptPlugin.get() );
|
d->infoSystemHelper = new JSInfoSystemHelper( d->scriptAccount.get() );
|
||||||
d->scriptPlugin->addToJavaScriptWindowObject( "_TomahawkInfoSystem", d->infoSystemHelper );
|
d->scriptAccount->addToJavaScriptWindowObject( "_TomahawkInfoSystem", d->infoSystemHelper );
|
||||||
d->scriptPlugin->evaluateJavaScript( "Tomahawk.InfoSystem = _TomahawkInfoSystem;" );
|
d->scriptAccount->evaluateJavaScript( "Tomahawk.InfoSystem = _TomahawkInfoSystem;" );
|
||||||
|
|
||||||
// add deps
|
// add deps
|
||||||
d->scriptPlugin->loadScripts( d->infoSystemHelper->requiredScriptPaths() );
|
d->scriptAccount->loadScripts( d->infoSystemHelper->requiredScriptPaths() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// add resolver dependencies, if any
|
// add resolver dependencies, if any
|
||||||
d->scriptPlugin->loadScripts( d->requiredScriptPaths );
|
d->scriptAccount->loadScripts( d->requiredScriptPaths );
|
||||||
|
|
||||||
|
|
||||||
// add resolver
|
// add resolver
|
||||||
d->scriptPlugin->loadScript( filePath() );
|
d->scriptAccount->loadScript( filePath() );
|
||||||
|
|
||||||
|
// HACK: register resolver object
|
||||||
|
d->scriptAccount->evaluateJavaScript( "Tomahawk.PluginManager.registerPlugin('resolver', Tomahawk.resolver.instance);" )
|
||||||
|
;
|
||||||
// init resolver
|
// init resolver
|
||||||
resolverInit();
|
resolverInit();
|
||||||
|
|
||||||
@@ -326,7 +329,7 @@ JSResolver::artists( const Tomahawk::collection_ptr& collection )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString eval = QString( "artists( '%1' )" )
|
QString eval = QString( "artists( '%1' )" )
|
||||||
.arg( JSPlugin::escape( collection->name() ) );
|
.arg( JSAccount::escape( collection->name() ) );
|
||||||
|
|
||||||
QVariantMap m = callOnResolver( eval ).toMap();
|
QVariantMap m = callOnResolver( eval ).toMap();
|
||||||
if ( m.isEmpty() )
|
if ( m.isEmpty() )
|
||||||
@@ -362,8 +365,8 @@ JSResolver::albums( const Tomahawk::collection_ptr& collection, const Tomahawk::
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString eval = QString( "albums( '%1', '%2' )" )
|
QString eval = QString( "albums( '%1', '%2' )" )
|
||||||
.arg( JSPlugin::escape( collection->name() ) )
|
.arg( JSAccount::escape( collection->name() ) )
|
||||||
.arg( JSPlugin::escape( artist->name() ) );
|
.arg( JSAccount::escape( artist->name() ) );
|
||||||
|
|
||||||
QVariantMap m = callOnResolver( eval ).toMap();
|
QVariantMap m = callOnResolver( eval ).toMap();
|
||||||
if ( m.isEmpty() )
|
if ( m.isEmpty() )
|
||||||
@@ -399,9 +402,9 @@ JSResolver::tracks( const Tomahawk::collection_ptr& collection, const Tomahawk::
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString eval = QString( "tracks( '%1', '%2', '%3' )" )
|
QString eval = QString( "tracks( '%1', '%2', '%3' )" )
|
||||||
.arg( JSPlugin::escape( collection->name() ) )
|
.arg( JSAccount::escape( collection->name() ) )
|
||||||
.arg( JSPlugin::escape( album->artist()->name() ) )
|
.arg( JSAccount::escape( album->artist()->name() ) )
|
||||||
.arg( JSPlugin::escape( album->name() ) );
|
.arg( JSAccount::escape( album->name() ) );
|
||||||
|
|
||||||
QVariantMap m = callOnResolver( eval ).toMap();
|
QVariantMap m = callOnResolver( eval ).toMap();
|
||||||
if ( m.isEmpty() )
|
if ( m.isEmpty() )
|
||||||
@@ -432,7 +435,7 @@ JSResolver::canParseUrl( const QString& url, UrlType type )
|
|||||||
if ( d->capabilities.testFlag( UrlLookup ) )
|
if ( d->capabilities.testFlag( UrlLookup ) )
|
||||||
{
|
{
|
||||||
QString eval = QString( "canParseUrl( '%1', %2 )" )
|
QString eval = QString( "canParseUrl( '%1', %2 )" )
|
||||||
.arg( JSPlugin::escape( QString( url ) ) )
|
.arg( JSAccount::escape( QString( url ) ) )
|
||||||
.arg( (int) type );
|
.arg( (int) type );
|
||||||
return callOnResolver( eval ).toBool();
|
return callOnResolver( eval ).toBool();
|
||||||
}
|
}
|
||||||
@@ -463,7 +466,7 @@ JSResolver::lookupUrl( const QString& url )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString eval = QString( "lookupUrl( '%1' )" )
|
QString eval = QString( "lookupUrl( '%1' )" )
|
||||||
.arg( JSPlugin::escape( QString( url ) ) );
|
.arg( JSAccount::escape( QString( url ) ) );
|
||||||
|
|
||||||
QVariantMap m = callOnResolver( eval ).toMap();
|
QVariantMap m = callOnResolver( eval ).toMap();
|
||||||
if ( m.isEmpty() )
|
if ( m.isEmpty() )
|
||||||
@@ -500,16 +503,16 @@ JSResolver::resolve( const Tomahawk::query_ptr& query )
|
|||||||
if ( !query->isFullTextQuery() )
|
if ( !query->isFullTextQuery() )
|
||||||
{
|
{
|
||||||
eval = QString( "resolve( '%1', '%2', '%3', '%4' )" )
|
eval = QString( "resolve( '%1', '%2', '%3', '%4' )" )
|
||||||
.arg( JSPlugin::escape( query->id() ) )
|
.arg( JSAccount::escape( query->id() ) )
|
||||||
.arg( JSPlugin::escape( query->queryTrack()->artist() ) )
|
.arg( JSAccount::escape( query->queryTrack()->artist() ) )
|
||||||
.arg( JSPlugin::escape( query->queryTrack()->album() ) )
|
.arg( JSAccount::escape( query->queryTrack()->album() ) )
|
||||||
.arg( JSPlugin::escape( query->queryTrack()->track() ) );
|
.arg( JSAccount::escape( query->queryTrack()->track() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eval = QString( "search( '%1', '%2' )" )
|
eval = QString( "search( '%1', '%2' )" )
|
||||||
.arg( JSPlugin::escape( query->id() ) )
|
.arg( JSAccount::escape( query->id() ) )
|
||||||
.arg( JSPlugin::escape( query->fullTextQuery() ) );
|
.arg( JSAccount::escape( query->fullTextQuery() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap m = callOnResolver( eval ).toMap();
|
QVariantMap m = callOnResolver( eval ).toMap();
|
||||||
@@ -960,7 +963,7 @@ JSResolver::callOnResolver( const QString& scriptSource )
|
|||||||
|
|
||||||
QString propertyName = scriptSource.split('(').first();
|
QString propertyName = scriptSource.split('(').first();
|
||||||
|
|
||||||
return d->scriptPlugin->evaluateJavaScriptWithResult( QString(
|
return d->scriptAccount->evaluateJavaScriptWithResult( QString(
|
||||||
"if(Tomahawk.resolver.instance['_adapter_%1']) {"
|
"if(Tomahawk.resolver.instance['_adapter_%1']) {"
|
||||||
" Tomahawk.resolver.instance._adapter_%2;"
|
" Tomahawk.resolver.instance._adapter_%2;"
|
||||||
"} else {"
|
"} else {"
|
||||||
|
@@ -38,7 +38,7 @@ class JSResolverPrivate;
|
|||||||
class ScriptEngine;
|
class ScriptEngine;
|
||||||
class ScriptJob;
|
class ScriptJob;
|
||||||
class ScriptObject;
|
class ScriptObject;
|
||||||
class ScriptPlugin;
|
class ScriptAccount;
|
||||||
|
|
||||||
class DLLEXPORT JSResolver : public Tomahawk::ExternalResolverGui
|
class DLLEXPORT JSResolver : public Tomahawk::ExternalResolverGui
|
||||||
{
|
{
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
#include "Result.h"
|
#include "Result.h"
|
||||||
#include "SourceList.h"
|
#include "SourceList.h"
|
||||||
#include "UrlHandler.h"
|
#include "UrlHandler.h"
|
||||||
#include "JSPlugin.h"
|
#include "JSAccount.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -412,14 +412,14 @@ JSResolverHelper::reportCapabilities( const QVariant& v )
|
|||||||
void
|
void
|
||||||
JSResolverHelper::reportScriptJobResults( const QVariantMap& result )
|
JSResolverHelper::reportScriptJobResults( const QVariantMap& result )
|
||||||
{
|
{
|
||||||
m_resolver->d_func()->scriptPlugin->reportScriptJobResult( result );
|
m_resolver->d_func()->scriptAccount->reportScriptJobResult( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JSResolverHelper::registerScriptPlugin(const QString& type, const QString& objectId)
|
JSResolverHelper::registerScriptPlugin(const QString& type, const QString& objectId)
|
||||||
{
|
{
|
||||||
m_resolver->d_func()->scriptPlugin->registerScriptPlugin( type, objectId );
|
m_resolver->d_func()->scriptAccount->registerScriptPlugin( type, objectId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -507,14 +507,14 @@ JSResolverHelper::customIODeviceFactory( const Tomahawk::result_ptr&, const QStr
|
|||||||
.arg( url );
|
.arg( url );
|
||||||
|
|
||||||
m_streamCallbacks.insert( qid, callback );
|
m_streamCallbacks.insert( qid, callback );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( getUrl );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( getUrl );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString getUrl = QString( "Tomahawk.resolver.instance.%1( '%2' );" ).arg( m_urlCallback )
|
QString getUrl = QString( "Tomahawk.resolver.instance.%1( '%2' );" ).arg( m_urlCallback )
|
||||||
.arg( url );
|
.arg( url );
|
||||||
|
|
||||||
QString urlStr = m_resolver->d_func()->scriptPlugin->evaluateJavaScriptWithResult( getUrl ).toString();
|
QString urlStr = m_resolver->d_func()->scriptAccount->evaluateJavaScriptWithResult( getUrl ).toString();
|
||||||
|
|
||||||
returnStreamUrl( urlStr, QMap<QString, QString>(), callback );
|
returnStreamUrl( urlStr, QMap<QString, QString>(), callback );
|
||||||
}
|
}
|
||||||
@@ -551,7 +551,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
|
|||||||
{
|
{
|
||||||
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Supplied size is not (yet) supported');" )
|
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Supplied size is not (yet) supported');" )
|
||||||
.arg( metadataId );
|
.arg( metadataId );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +618,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
|
|||||||
{
|
{
|
||||||
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Unknown mime type for tagging: %2');" )
|
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Unknown mime type for tagging: %2');" )
|
||||||
.arg( metadataId ).arg( mime_type );
|
.arg( metadataId ).arg( mime_type );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,7 +633,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
|
|||||||
{
|
{
|
||||||
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Could not read tag information.');" )
|
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Could not read tag information.');" )
|
||||||
.arg( metadataId );
|
.arg( metadataId );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +647,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
|
|||||||
{
|
{
|
||||||
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Empty track returnd');" )
|
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Empty track returnd');" )
|
||||||
.arg( metadataId );
|
.arg( metadataId );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,7 +655,7 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
|
|||||||
{
|
{
|
||||||
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Empty artist returnd');" )
|
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Empty artist returnd');" )
|
||||||
.arg( metadataId );
|
.arg( metadataId );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,13 +670,13 @@ JSResolverHelper::nativeRetrieveMetadata( int metadataId, const QString& url,
|
|||||||
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, %2 );" )
|
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, %2 );" )
|
||||||
.arg( metadataId )
|
.arg( metadataId )
|
||||||
.arg( QString::fromLatin1( TomahawkUtils::toJson( m ) ) );
|
.arg( QString::fromLatin1( TomahawkUtils::toJson( m ) ) );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Protocol not supported');" )
|
QString javascript = QString( "Tomahawk.retrievedMetadata( %1, null, 'Protocol not supported');" )
|
||||||
.arg( metadataId );
|
.arg( metadataId );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,7 +740,7 @@ JSResolverHelper::nativeAsyncRequestDone( int requestId, NetworkReply* reply )
|
|||||||
QString javascript = QString( "Tomahawk.nativeAsyncRequestDone( %1, %2 );" )
|
QString javascript = QString( "Tomahawk.nativeAsyncRequestDone( %1, %2 );" )
|
||||||
.arg( QString::number( requestId ) )
|
.arg( QString::number( requestId ) )
|
||||||
.arg( json );
|
.arg( json );
|
||||||
m_resolver->d_func()->scriptPlugin->evaluateJavaScript( javascript );
|
m_resolver->d_func()->scriptAccount->evaluateJavaScript( javascript );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ private:
|
|||||||
QList< QVariant > dataWidgets;
|
QList< QVariant > dataWidgets;
|
||||||
QStringList requiredScriptPaths;
|
QStringList requiredScriptPaths;
|
||||||
|
|
||||||
std::unique_ptr<JSPlugin> scriptPlugin;
|
std::unique_ptr<JSAccount> scriptAccount;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ns: Tomahawk
|
} // ns: Tomahawk
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "ScriptPlugin.h"
|
#include "ScriptAccount.h"
|
||||||
|
|
||||||
#include "ScriptObject.h"
|
#include "ScriptObject.h"
|
||||||
#include "../utils/Logger.h"
|
#include "../utils/Logger.h"
|
||||||
@@ -38,7 +38,7 @@ requestIdGenerator()
|
|||||||
|
|
||||||
|
|
||||||
ScriptJob*
|
ScriptJob*
|
||||||
ScriptPlugin::invoke( ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments )
|
ScriptAccount::invoke( ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments )
|
||||||
{
|
{
|
||||||
QString requestId = requestIdGenerator();
|
QString requestId = requestIdGenerator();
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ ScriptPlugin::invoke( ScriptObject* scriptObject, const QString& methodName, con
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScriptPlugin::reportScriptJobResult( const QVariantMap& result )
|
ScriptAccount::reportScriptJobResult( const QVariantMap& result )
|
||||||
{
|
{
|
||||||
tLog() << Q_FUNC_INFO << result;
|
tLog() << Q_FUNC_INFO << result;
|
||||||
const QString requestId = result[ "requestId" ].toString();
|
const QString requestId = result[ "requestId" ].toString();
|
||||||
@@ -75,7 +75,7 @@ ScriptPlugin::reportScriptJobResult( const QVariantMap& result )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScriptPlugin::registerScriptPlugin( const QString& type, const QString& objectId )
|
ScriptAccount::registerScriptPlugin( const QString& type, const QString& objectId )
|
||||||
{
|
{
|
||||||
ScriptObject* object = m_objects.value( objectId );
|
ScriptObject* object = m_objects.value( objectId );
|
||||||
if( !object )
|
if( !object )
|
||||||
@@ -99,7 +99,7 @@ ScriptPlugin::registerScriptPlugin( const QString& type, const QString& objectId
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScriptPlugin::onJobDeleted( const QString& jobId )
|
ScriptAccount::onJobDeleted( const QString& jobId )
|
||||||
{
|
{
|
||||||
m_jobs.remove( jobId );
|
m_jobs.remove( jobId );
|
||||||
}
|
}
|
@@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifndef TOMAHAWK_SCRIPTPLUGIN_H
|
#ifndef TOMAHAWK_SCRIPTACCOUNT_H
|
||||||
#define TOMAHAWK_SCRIPTPLUGIN_H
|
#define TOMAHAWK_SCRIPTACCOUNT_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
@@ -34,12 +34,12 @@ namespace Tomahawk {
|
|||||||
class ScriptObject;
|
class ScriptObject;
|
||||||
class ScriptJob;
|
class ScriptJob;
|
||||||
|
|
||||||
class DLLEXPORT ScriptPlugin : public QObject
|
class DLLEXPORT ScriptAccount : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ScriptPlugin() {}
|
virtual ~ScriptAccount() {}
|
||||||
|
|
||||||
ScriptJob* invoke( ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments );
|
ScriptJob* invoke( ScriptObject* scriptObject, const QString& methodName, const QVariantMap& arguments );
|
||||||
virtual void startJob( ScriptJob* scriptJob ) = 0;
|
virtual void startJob( ScriptJob* scriptJob ) = 0;
|
||||||
@@ -57,4 +57,4 @@ private: // TODO: pimple, might be renamed before tho
|
|||||||
|
|
||||||
} // ns: Tomahawk
|
} // ns: Tomahawk
|
||||||
|
|
||||||
#endif // TOMAHAWK_SCRIPTPLUGIN_H
|
#endif // TOMAHAWK_SCRIPTACCOUNT_H
|
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
ScriptEngine::ScriptEngine( JSPlugin* parent )
|
ScriptEngine::ScriptEngine( JSAccount* parent )
|
||||||
: QWebPage( (QObject*) parent )
|
: QWebPage( (QObject*) parent )
|
||||||
, m_parent( parent )
|
, m_parent( parent )
|
||||||
{
|
{
|
||||||
|
@@ -32,14 +32,14 @@ class QNetworkReply;
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
class JSPlugin;
|
class JSAccount;
|
||||||
|
|
||||||
class DLLEXPORT ScriptEngine : public QWebPage
|
class DLLEXPORT ScriptEngine : public QWebPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ScriptEngine( JSPlugin* parent );
|
explicit ScriptEngine( JSAccount* parent );
|
||||||
|
|
||||||
QString userAgentForUrl( const QUrl& url ) const;
|
QString userAgentForUrl( const QUrl& url ) const;
|
||||||
void setScriptPath( const QString& scriptPath );
|
void setScriptPath( const QString& scriptPath );
|
||||||
@@ -54,7 +54,7 @@ private slots:
|
|||||||
void sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errlist );
|
void sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errlist );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JSPlugin* m_parent;
|
JSAccount* m_parent;
|
||||||
QString m_scriptPath;
|
QString m_scriptPath;
|
||||||
QString m_header;
|
QString m_header;
|
||||||
};
|
};
|
||||||
|
@@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
#include "ScriptObject_p.h"
|
#include "ScriptObject_p.h"
|
||||||
|
|
||||||
#include "ScriptPlugin.h"
|
#include "ScriptAccount.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
ScriptObject::ScriptObject( const QString& id, ScriptPlugin* parent )
|
ScriptObject::ScriptObject( const QString& id, ScriptAccount* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, d_ptr( new ScriptObjectPrivate( this, id, parent ))
|
, d_ptr( new ScriptObjectPrivate( this, id, parent ))
|
||||||
{
|
{
|
||||||
@@ -39,7 +39,7 @@ ScriptObject::invoke( const QString& methodName, const QVariantMap& arguments )
|
|||||||
{
|
{
|
||||||
Q_D( ScriptObject );
|
Q_D( ScriptObject );
|
||||||
|
|
||||||
return d->scriptPlugin->invoke( this, methodName, arguments );
|
return d->scriptAccount->invoke( this, methodName, arguments );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,5 +57,5 @@ ScriptObject::startJob( ScriptJob* scriptJob )
|
|||||||
{
|
{
|
||||||
Q_D( const ScriptObject );
|
Q_D( const ScriptObject );
|
||||||
|
|
||||||
d->scriptPlugin->startJob( scriptJob );
|
d->scriptAccount->startJob( scriptJob );
|
||||||
}
|
}
|
||||||
|
@@ -27,17 +27,17 @@
|
|||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
class ScriptPlugin;
|
class ScriptAccount;
|
||||||
class ScriptObjectPrivate;
|
class ScriptObjectPrivate;
|
||||||
class ScriptJob;
|
class ScriptJob;
|
||||||
|
|
||||||
class DLLEXPORT ScriptObject : public QObject
|
class DLLEXPORT ScriptObject : public QObject
|
||||||
{
|
{
|
||||||
friend class JSPlugin;
|
friend class JSAccount;
|
||||||
friend class ScriptJob;
|
friend class ScriptJob;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScriptObject( const QString& id, ScriptPlugin* parent );
|
ScriptObject( const QString& id, ScriptAccount* parent );
|
||||||
virtual ~ScriptObject();
|
virtual ~ScriptObject();
|
||||||
|
|
||||||
ScriptJob* invoke( const QString& methodName, const QVariantMap& arguments );
|
ScriptJob* invoke( const QString& methodName, const QVariantMap& arguments );
|
||||||
|
@@ -28,10 +28,10 @@ class ScriptObjectPrivate
|
|||||||
{
|
{
|
||||||
friend class ScriptObject;
|
friend class ScriptObject;
|
||||||
public:
|
public:
|
||||||
ScriptObjectPrivate( ScriptObject* q, const QString& id, ScriptPlugin* scriptPlugin )
|
ScriptObjectPrivate( ScriptObject* q, const QString& id, ScriptAccount* scriptAccount )
|
||||||
: q_ptr ( q )
|
: q_ptr ( q )
|
||||||
, id( id )
|
, id( id )
|
||||||
, scriptPlugin( scriptPlugin )
|
, scriptAccount( scriptAccount )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ScriptObject* q_ptr;
|
ScriptObject* q_ptr;
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString id;
|
QString id;
|
||||||
ScriptPlugin* scriptPlugin;
|
ScriptAccount* scriptAccount;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ns: Tomahawk
|
} // ns: Tomahawk
|
||||||
|
Reference in New Issue
Block a user