mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-24 06:33:04 +02:00
Allow deleting of script resolvers and removal from pipeline
This commit is contained in:
@@ -67,6 +67,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void addScriptResolver( const QString& scriptPath );
|
void addScriptResolver( const QString& scriptPath );
|
||||||
|
void removeScriptResolver( const QString& scriptPath );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
@@ -21,6 +21,11 @@ ScriptResolver::ScriptResolver(const QString& exe) :
|
|||||||
m_proc.start( m_cmd );
|
m_proc.start( m_cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScriptResolver::~ScriptResolver()
|
||||||
|
{
|
||||||
|
Tomahawk::Pipeline::instance()->removeResolver( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScriptResolver::readStderr()
|
void ScriptResolver::readStderr()
|
||||||
{
|
{
|
||||||
|
@@ -15,6 +15,7 @@ class ScriptResolver : public Tomahawk::Resolver
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ScriptResolver(const QString& exe);
|
explicit ScriptResolver(const QString& exe);
|
||||||
|
virtual ~ScriptResolver();
|
||||||
|
|
||||||
virtual QString name() const { return m_name; }
|
virtual QString name() const { return m_name; }
|
||||||
virtual unsigned int weight() const { return m_weight; }
|
virtual unsigned int weight() const { return m_weight; }
|
||||||
@@ -23,6 +24,7 @@ public:
|
|||||||
|
|
||||||
virtual void resolve( const QVariant& v );
|
virtual void resolve( const QVariant& v );
|
||||||
|
|
||||||
|
QString exe() const { return m_cmd; }
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@@ -348,7 +348,10 @@ SettingsDialog::removeScriptResolver()
|
|||||||
{
|
{
|
||||||
// only one selection
|
// only one selection
|
||||||
if( !ui->scriptList->selectedItems().isEmpty() ) {
|
if( !ui->scriptList->selectedItems().isEmpty() ) {
|
||||||
|
QString resolver = ui->scriptList->selectedItems().first()->data( 1, Qt::DisplayRole ).toString();
|
||||||
delete ui->scriptList->takeTopLevelItem( ui->scriptList->indexOfTopLevelItem( ui->scriptList->selectedItems().first() ) );
|
delete ui->scriptList->takeTopLevelItem( ui->scriptList->indexOfTopLevelItem( ui->scriptList->selectedItems().first() ) );
|
||||||
|
|
||||||
|
TomahawkApp::instance()->removeScriptResolver( resolver );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -333,6 +333,19 @@ TomahawkApp::addScriptResolver( const QString& path )
|
|||||||
m_scriptResolvers << new ScriptResolver( path );
|
m_scriptResolvers << new ScriptResolver( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkApp::removeScriptResolver( const QString& path )
|
||||||
|
{
|
||||||
|
foreach( ScriptResolver* r, m_scriptResolvers ) {
|
||||||
|
if( r->exe() == path ) {
|
||||||
|
m_scriptResolvers.removeAll( r );
|
||||||
|
|
||||||
|
delete r;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkApp::initLocalCollection()
|
TomahawkApp::initLocalCollection()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user