mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Add name() to JSPlugin.
This is more of a hack until JSResolver is ported to be a ScriptResolver
This commit is contained in:
@@ -35,7 +35,7 @@ JSInfoPlugin::JSInfoPlugin( int id, JSPlugin *resolver )
|
|||||||
m_supportedGetTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedGetTypes" ) );
|
m_supportedGetTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedGetTypes" ) );
|
||||||
m_supportedPushTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedPushTypes" ) );
|
m_supportedPushTypes = parseSupportedTypes( callMethodOnInfoPluginWithResult( "supportedPushTypes" ) );
|
||||||
|
|
||||||
setFriendlyName( QString( "JSInfoPlugin: %1" ) ); // TODO: .arg( resolver->name() )
|
setFriendlyName( QString( "JSInfoPlugin: %1" ).arg( resolver->name() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,8 +30,9 @@
|
|||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
JSPlugin::JSPlugin()
|
JSPlugin::JSPlugin( const QString& name )
|
||||||
: m_engine( new ScriptEngine( this ) )
|
: m_engine( new ScriptEngine( this ) )
|
||||||
|
, m_name( name )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,3 +124,10 @@ JSPlugin::startJob( ScriptJob* scriptJob )
|
|||||||
|
|
||||||
evaluateJavaScript( eval );
|
evaluateJavaScript( eval );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const QString
|
||||||
|
JSPlugin::name() const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
@@ -40,10 +40,13 @@ class DLLEXPORT JSPlugin : public ScriptPlugin
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
JSPlugin();
|
// HACK: needs refactoring
|
||||||
|
JSPlugin( const QString& name );
|
||||||
|
|
||||||
void startJob( ScriptJob* scriptJob ) override;
|
void startJob( ScriptJob* scriptJob ) override;
|
||||||
|
|
||||||
|
const QString name() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluate JavaScript on the WebKit thread
|
* Evaluate JavaScript on the WebKit thread
|
||||||
*/
|
*/
|
||||||
@@ -73,6 +76,7 @@ private:
|
|||||||
QVariant evaluateJavaScriptInternal( const QString& scriptSource );
|
QVariant evaluateJavaScriptInternal( const QString& scriptSource );
|
||||||
|
|
||||||
std::unique_ptr<ScriptEngine> m_engine;
|
std::unique_ptr<ScriptEngine> m_engine;
|
||||||
|
QString m_name;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -64,8 +64,8 @@ JSResolver::JSResolver( const QString& accountId, const QString& scriptPath, con
|
|||||||
Q_D( JSResolver );
|
Q_D( JSResolver );
|
||||||
tLog() << Q_FUNC_INFO << "Loading JS resolver:" << scriptPath;
|
tLog() << Q_FUNC_INFO << "Loading JS resolver:" << scriptPath;
|
||||||
|
|
||||||
d->scriptPlugin = new JSPlugin();
|
|
||||||
d->name = QFileInfo( filePath() ).baseName();
|
d->name = QFileInfo( filePath() ).baseName();
|
||||||
|
d->scriptPlugin = new JSPlugin( 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 ) );
|
||||||
|
Reference in New Issue
Block a user