1
0
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:
Dominik Schmidt
2014-12-01 23:54:50 +01:00
parent 42343c81c4
commit cefa97af18
4 changed files with 16 additions and 4 deletions

View File

@@ -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() ) );
} }

View File

@@ -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;
}

View File

@@ -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;
}; };

View File

@@ -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 ) );