mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-20 07:52:30 +02:00
Implement request / script uuids
This commit is contained in:
parent
ec3f40718e
commit
a59cdbe19f
@ -595,8 +595,7 @@ Tomahawk.PluginManager = {
|
||||
objects: {},
|
||||
identifyObject: function (object) {
|
||||
if( object.id === undefined ) {
|
||||
// FIXME: get a proper unique id
|
||||
object.id = "foobar";
|
||||
object.id = Tomahawk.uuid();
|
||||
}
|
||||
|
||||
return object.id;
|
||||
|
@ -272,6 +272,13 @@ JSResolverHelper::instanceUUID()
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
JSResolverHelper::uuid() const
|
||||
{
|
||||
return ::uuid();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JSResolverHelper::addUrlResult( const QString& url, const QVariantMap& result )
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ public slots:
|
||||
QString readBase64( const QString& fileName );
|
||||
QString readCompressed( const QString& fileName );
|
||||
QString instanceUUID();
|
||||
|
||||
QString uuid() const;
|
||||
QString compress( const QString& data );
|
||||
QVariantMap resolverData();
|
||||
|
||||
|
@ -22,14 +22,10 @@
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
ScriptObject::ScriptObject( ScriptPlugin* parent )
|
||||
ScriptObject::ScriptObject( const QString& id, ScriptPlugin* parent )
|
||||
: QObject( parent )
|
||||
, d_ptr( new ScriptObjectPrivate( this, parent ))
|
||||
, d_ptr( new ScriptObjectPrivate( this, id, parent ))
|
||||
{
|
||||
Q_D( ScriptObject );
|
||||
|
||||
// TODO:retrieve id from ScriptPlugin
|
||||
d->id = "foobar";
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ friend class JSPlugin;
|
||||
friend class ScriptJob;
|
||||
|
||||
public:
|
||||
ScriptObject( ScriptPlugin* parent );
|
||||
ScriptObject( const QString& id, ScriptPlugin* parent );
|
||||
virtual ~ScriptObject();
|
||||
|
||||
ScriptJob* invoke( const QString& methodName, const QVariantMap& arguments );
|
||||
|
@ -28,8 +28,9 @@ class ScriptObjectPrivate
|
||||
{
|
||||
friend class ScriptObject;
|
||||
public:
|
||||
ScriptObjectPrivate( ScriptObject* q, ScriptPlugin* scriptPlugin )
|
||||
ScriptObjectPrivate( ScriptObject* q, const QString& id, ScriptPlugin* scriptPlugin )
|
||||
: q_ptr ( q )
|
||||
, id( id )
|
||||
, scriptPlugin( scriptPlugin )
|
||||
{
|
||||
}
|
||||
|
@ -31,8 +31,7 @@ using namespace Tomahawk;
|
||||
static QString
|
||||
requestIdGenerator()
|
||||
{
|
||||
//FIXME: create a proper requestId
|
||||
return "somerequestId";
|
||||
return uuid();
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +84,7 @@ ScriptPlugin::registerScriptPlugin( const QString& type, const QString& objectId
|
||||
ScriptObject* object = m_objects.value( objectId );
|
||||
if( !object )
|
||||
{
|
||||
object = new ScriptObject( this );
|
||||
object = new ScriptObject( objectId, this );
|
||||
m_objects.insert( objectId, object );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user