1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 16:42:26 +02:00

TWK-471: Show config UI for resolvers that have one as soon as you add the resolver

This commit is contained in:
Leo Franchi 2011-10-02 17:38:23 -04:00
parent 5594e25dcf
commit 2de19a1c94
3 changed files with 18 additions and 2 deletions

View File

@ -28,7 +28,6 @@
#include "utils/logger.h"
ResolversModel::ResolversModel( QObject* parent )
: QAbstractListModel( parent )
{
@ -135,6 +134,11 @@ ResolversModel::addResolver( const QString& resolver, bool enable )
Tomahawk::ExternalResolver* res = Tomahawk::Pipeline::instance()->addScriptResolver( resolver, enable );
connect( res, SIGNAL( changed() ), this, SLOT( resolverChanged() ) );
endInsertRows();
if ( res->configUI() )
emit openConfig( res->filePath() );
else
m_waitingForLoad << resolver;
}
void
@ -177,6 +181,12 @@ ResolversModel::resolverChanged()
qDebug() << "Got resolverChanged signal, does it have a config UI yet?" << res->configUI();
const QModelIndex idx = index( Tomahawk::Pipeline::instance()->scriptResolvers().indexOf( res ), 0, QModelIndex() );
emit dataChanged( idx, idx );
if ( m_waitingForLoad.contains( res->filePath() ) )
{
m_waitingForLoad.remove( res->filePath() );
emit openConfig( res->filePath() );
}
}
}

View File

@ -22,7 +22,7 @@
#include <QModelIndex>
#include <QStringList>
#include <QSet>
class ResolversModel : public QAbstractListModel
{
@ -49,11 +49,16 @@ public:
void removeResolver( const QString& resolver );
void saveScriptResolvers();
signals:
void openConfig( const QString& filePath );
private slots:
void resolverChanged();
private:
void addInstalledResolvers();
QSet<QString> m_waitingForLoad;
};
#endif // RESOLVERSMODEL_H

View File

@ -200,6 +200,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
m_resolversModel = new ResolversModel( this );
ui->scriptList->setModel( m_resolversModel );
ui->scriptList->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
connect( m_resolversModel, SIGNAL( openConfig( QString ) ), SLOT( openResolverConfig( QString ) ) );
#ifdef LIBATTICA_FOUND
connect( ui->getMoreResolvers, SIGNAL( clicked() ), this, SLOT( getMoreResolvers() ) );