mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
Remove script objects automatically from ScriptAccount when they are deleted
This commit is contained in:
@@ -92,6 +92,7 @@ ScriptAccount::registerScriptPlugin( const QString& type, const QString& objectI
|
|||||||
if( !object )
|
if( !object )
|
||||||
{
|
{
|
||||||
object = new ScriptObject( objectId, this );
|
object = new ScriptObject( objectId, this );
|
||||||
|
connect( object, SIGNAL( destroyed( QObject* ) ), SLOT( onScriptObjectDeleted( QObject* ) ) );
|
||||||
m_objects.insert( objectId, object );
|
m_objects.insert( objectId, object );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +100,13 @@ ScriptAccount::registerScriptPlugin( const QString& type, const QString& objectI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ScriptAccount::onScriptObjectDeleted( QObject* scriptObject )
|
||||||
|
{
|
||||||
|
m_objects.remove( m_objects.key( static_cast< ScriptObject* >( scriptObject ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScriptAccount::scriptPluginFactory( const QString& type, ScriptObject* object )
|
ScriptAccount::scriptPluginFactory( const QString& type, ScriptObject* object )
|
||||||
{
|
{
|
||||||
|
@@ -55,6 +55,8 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void onJobDeleted( const QString& jobId );
|
void onJobDeleted( const QString& jobId );
|
||||||
|
|
||||||
|
void onScriptObjectDeleted( QObject* scriptObject );
|
||||||
|
|
||||||
private: // TODO: pimple, might be renamed before tho
|
private: // TODO: pimple, might be renamed before tho
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QHash< QString, ScriptJob* > m_jobs;
|
QHash< QString, ScriptJob* > m_jobs;
|
||||||
|
Reference in New Issue
Block a user