mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Split ExternalResolver
This commit is contained in:
@@ -88,6 +88,7 @@ set( libGuiSources
|
|||||||
playlist/topbar/lineedit.cpp
|
playlist/topbar/lineedit.cpp
|
||||||
playlist/topbar/searchbutton.cpp
|
playlist/topbar/searchbutton.cpp
|
||||||
|
|
||||||
|
ExternalResolverGui.cpp
|
||||||
resolvers/scriptresolver.cpp
|
resolvers/scriptresolver.cpp
|
||||||
resolvers/qtscriptresolver.cpp
|
resolvers/qtscriptresolver.cpp
|
||||||
|
|
||||||
@@ -204,6 +205,7 @@ set( libGuiHeaders
|
|||||||
playlist/dynamic/widgets/DynamicSetupWidget.h
|
playlist/dynamic/widgets/DynamicSetupWidget.h
|
||||||
playlist/dynamic/widgets/LoadingSpinner.h
|
playlist/dynamic/widgets/LoadingSpinner.h
|
||||||
|
|
||||||
|
ExternalResolverGui.h
|
||||||
resolvers/scriptresolver.h
|
resolvers/scriptresolver.h
|
||||||
resolvers/qtscriptresolver.h
|
resolvers/qtscriptresolver.h
|
||||||
|
|
||||||
|
@@ -18,111 +18,10 @@
|
|||||||
|
|
||||||
#include "ExternalResolver.h"
|
#include "ExternalResolver.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QMetaProperty>
|
|
||||||
#include <QBuffer>
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
|
||||||
#include <QIcon>
|
|
||||||
#include <QWidget>
|
|
||||||
#endif
|
|
||||||
#include <QUiLoader>
|
|
||||||
|
|
||||||
Tomahawk::ExternalResolver::ErrorState
|
Tomahawk::ExternalResolver::ErrorState
|
||||||
Tomahawk::ExternalResolver::error() const
|
Tomahawk::ExternalResolver::error() const
|
||||||
{
|
{
|
||||||
return NoError;
|
return NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
|
||||||
QVariant
|
|
||||||
Tomahawk::ExternalResolver::configMsgFromWidget( QWidget* w )
|
|
||||||
{
|
|
||||||
if( !w )
|
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
// generate a qvariantmap of all the widgets in the hierarchy, and for each one include the list of properties and values
|
|
||||||
QVariantMap widgetMap;
|
|
||||||
addChildProperties( w, widgetMap );
|
|
||||||
// qDebug() << "Generated widget variant:" << widgetMap;
|
|
||||||
return widgetMap;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
Tomahawk::ExternalResolver::addChildProperties( QObject* widget, QVariantMap& m )
|
|
||||||
{
|
|
||||||
// recursively add all properties of this widget to the map, then repeat on all children.
|
|
||||||
// bare QWidgets are boring---so skip them! They have no input that the user can set.
|
|
||||||
if( !widget || !widget->isWidgetType() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( qstrcmp( widget->metaObject()->className(), "QWidget" ) != 0 )
|
|
||||||
{
|
|
||||||
// qDebug() << "Adding properties for this:" << widget->metaObject()->className();
|
|
||||||
// add this widget's properties
|
|
||||||
QVariantMap props;
|
|
||||||
for( int i = 0; i < widget->metaObject()->propertyCount(); i++ )
|
|
||||||
{
|
|
||||||
QString prop = widget->metaObject()->property( i ).name();
|
|
||||||
QVariant val = widget->property( prop.toLatin1() );
|
|
||||||
// clean up for QJson....
|
|
||||||
if( val.canConvert< QPixmap >() || val.canConvert< QImage >() || val.canConvert< QIcon >() )
|
|
||||||
continue;
|
|
||||||
props[ prop ] = val.toString();
|
|
||||||
// qDebug() << QString( "%1: %2" ).arg( prop ).arg( props[ prop ].toString() );
|
|
||||||
}
|
|
||||||
m[ widget->objectName() ] = props;
|
|
||||||
}
|
|
||||||
// and recurse
|
|
||||||
foreach( QObject* child, widget->children() )
|
|
||||||
addChildProperties( child, m );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QWidget*
|
|
||||||
Tomahawk::ExternalResolver::widgetFromData( QByteArray& data, QWidget* parent )
|
|
||||||
{
|
|
||||||
if( data.isEmpty() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
QUiLoader l;
|
|
||||||
QBuffer b( &data );
|
|
||||||
QWidget* w = l.load( &b, parent );
|
|
||||||
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray
|
|
||||||
Tomahawk::ExternalResolver::fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images )
|
|
||||||
{
|
|
||||||
// with a list of images and image data, write each to a temp file, replace the path in the .ui file with the temp file path
|
|
||||||
QString uiFile = QString::fromUtf8( data );
|
|
||||||
foreach( const QString& filename, images.keys() )
|
|
||||||
{
|
|
||||||
if( !uiFile.contains( filename ) ) // make sure the image is used
|
|
||||||
continue;
|
|
||||||
|
|
||||||
QString fullPath = QDir::tempPath() + "/" + filename;
|
|
||||||
QFile imgF( fullPath );
|
|
||||||
if( !imgF.open( QIODevice::WriteOnly ) )
|
|
||||||
{
|
|
||||||
qWarning() << "Failed to write to temporary image in UI file:" << filename << fullPath;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QByteArray data = images[ filename ].toByteArray();
|
|
||||||
|
|
||||||
// qDebug() << "expanding data:" << data << compressed;
|
|
||||||
data = compressed ? qUncompress( QByteArray::fromBase64( data ) ) : QByteArray::fromBase64( data );
|
|
||||||
imgF.write( data );
|
|
||||||
imgF.close();
|
|
||||||
|
|
||||||
// replace the path to the image with the real path
|
|
||||||
uiFile.replace( filename, fullPath );
|
|
||||||
}
|
|
||||||
return uiFile.toUtf8();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -53,7 +53,6 @@ public:
|
|||||||
|
|
||||||
virtual QString filePath() const { return m_filePath; }
|
virtual QString filePath() const { return m_filePath; }
|
||||||
|
|
||||||
virtual QWidget* configUI() const = 0;
|
|
||||||
virtual void saveConfig() = 0;
|
virtual void saveConfig() = 0;
|
||||||
|
|
||||||
virtual void reload() {} // Reloads from file (especially useful to check if file now exists)
|
virtual void reload() {} // Reloads from file (especially useful to check if file now exists)
|
||||||
@@ -68,18 +67,12 @@ signals:
|
|||||||
void changed(); // if config widget was added/removed
|
void changed(); // if config widget was added/removed
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QWidget* widgetFromData( QByteArray& data, QWidget* parent = 0 );
|
|
||||||
QVariant configMsgFromWidget( QWidget* w );
|
|
||||||
QByteArray fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images );
|
|
||||||
|
|
||||||
void setFilePath( const QString& path ) { m_filePath = path; }
|
void setFilePath( const QString& path ) { m_filePath = path; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addChildProperties( QObject* parent, QVariantMap& m );
|
|
||||||
|
|
||||||
QString m_filePath;
|
QString m_filePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; //ns
|
}; //ns
|
||||||
|
|
||||||
#endif // EXTERNALRESOLVER_H
|
#endif // EXTERNALESOLVER_H
|
||||||
|
124
src/libtomahawk/ExternalResolverGui.cpp
Normal file
124
src/libtomahawk/ExternalResolverGui.cpp
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ExternalResolverGui.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QMetaProperty>
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QUiLoader>
|
||||||
|
#include "utils/logger.h"
|
||||||
|
|
||||||
|
Tomahawk::ExternalResolverGui::ExternalResolverGui(const QString& filePath)
|
||||||
|
: Tomahawk::ExternalResolver(filePath)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariant
|
||||||
|
Tomahawk::ExternalResolverGui::configMsgFromWidget( QWidget* w )
|
||||||
|
{
|
||||||
|
if( !w )
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
// generate a qvariantmap of all the widgets in the hierarchy, and for each one include the list of properties and values
|
||||||
|
QVariantMap widgetMap;
|
||||||
|
addChildProperties( w, widgetMap );
|
||||||
|
// qDebug() << "Generated widget variant:" << widgetMap;
|
||||||
|
return widgetMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Tomahawk::ExternalResolverGui::addChildProperties( QObject* widget, QVariantMap& m )
|
||||||
|
{
|
||||||
|
// recursively add all properties of this widget to the map, then repeat on all children.
|
||||||
|
// bare QWidgets are boring---so skip them! They have no input that the user can set.
|
||||||
|
if( !widget || !widget->isWidgetType() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( qstrcmp( widget->metaObject()->className(), "QWidget" ) != 0 )
|
||||||
|
{
|
||||||
|
// qDebug() << "Adding properties for this:" << widget->metaObject()->className();
|
||||||
|
// add this widget's properties
|
||||||
|
QVariantMap props;
|
||||||
|
for( int i = 0; i < widget->metaObject()->propertyCount(); i++ )
|
||||||
|
{
|
||||||
|
QString prop = widget->metaObject()->property( i ).name();
|
||||||
|
QVariant val = widget->property( prop.toLatin1() );
|
||||||
|
// clean up for QJson....
|
||||||
|
if( val.canConvert< QPixmap >() || val.canConvert< QImage >() || val.canConvert< QIcon >() )
|
||||||
|
continue;
|
||||||
|
props[ prop ] = val.toString();
|
||||||
|
// qDebug() << QString( "%1: %2" ).arg( prop ).arg( props[ prop ].toString() );
|
||||||
|
}
|
||||||
|
m[ widget->objectName() ] = props;
|
||||||
|
}
|
||||||
|
// and recurse
|
||||||
|
foreach( QObject* child, widget->children() )
|
||||||
|
addChildProperties( child, m );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QWidget*
|
||||||
|
Tomahawk::ExternalResolverGui::widgetFromData( QByteArray& data, QWidget* parent )
|
||||||
|
{
|
||||||
|
if( data.isEmpty() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
QUiLoader l;
|
||||||
|
QBuffer b( &data );
|
||||||
|
QWidget* w = l.load( &b, parent );
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QByteArray
|
||||||
|
Tomahawk::ExternalResolverGui::fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images )
|
||||||
|
{
|
||||||
|
// with a list of images and image data, write each to a temp file, replace the path in the .ui file with the temp file path
|
||||||
|
QString uiFile = QString::fromUtf8( data );
|
||||||
|
foreach( const QString& filename, images.keys() )
|
||||||
|
{
|
||||||
|
if( !uiFile.contains( filename ) ) // make sure the image is used
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QString fullPath = QDir::tempPath() + "/" + filename;
|
||||||
|
QFile imgF( fullPath );
|
||||||
|
if( !imgF.open( QIODevice::WriteOnly ) )
|
||||||
|
{
|
||||||
|
qWarning() << "Failed to write to temporary image in UI file:" << filename << fullPath;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QByteArray data = images[ filename ].toByteArray();
|
||||||
|
|
||||||
|
// qDebug() << "expanding data:" << data << compressed;
|
||||||
|
data = compressed ? qUncompress( QByteArray::fromBase64( data ) ) : QByteArray::fromBase64( data );
|
||||||
|
imgF.write( data );
|
||||||
|
imgF.close();
|
||||||
|
|
||||||
|
// replace the path to the image with the real path
|
||||||
|
uiFile.replace( filename, fullPath );
|
||||||
|
}
|
||||||
|
return uiFile.toUtf8();
|
||||||
|
}
|
55
src/libtomahawk/ExternalResolverGui.h
Normal file
55
src/libtomahawk/ExternalResolverGui.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EXTERNALRESOLVERGUI_H
|
||||||
|
#define EXTERNALRESOLVERGUI_H
|
||||||
|
|
||||||
|
#include "ExternalResolver.h"
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
class QWidget;
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic resolver object, used to manage a resolver that Tomahawk knows about
|
||||||
|
*
|
||||||
|
* You *must* start() a resolver after creating an ExternalResolver in order to use it,
|
||||||
|
* otherwise it will not do anything.
|
||||||
|
*/
|
||||||
|
class DLLEXPORT ExternalResolverGui : public ExternalResolver
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ExternalResolverGui( const QString& filePath );
|
||||||
|
virtual QWidget* configUI() const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QWidget* widgetFromData( QByteArray& data, QWidget* parent = 0 );
|
||||||
|
QVariant configMsgFromWidget( QWidget* w );
|
||||||
|
QByteArray fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void addChildProperties( QObject* parent, QVariantMap& m );
|
||||||
|
};
|
||||||
|
|
||||||
|
}; //ns
|
||||||
|
|
||||||
|
#endif // RESOLVER_H
|
@@ -201,7 +201,7 @@ ScriptEngine::javaScriptConsoleMessage( const QString& message, int lineNumber,
|
|||||||
|
|
||||||
|
|
||||||
QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
QtScriptResolver::QtScriptResolver( const QString& scriptPath )
|
||||||
: Tomahawk::ExternalResolver( scriptPath )
|
: Tomahawk::ExternalResolverGui( scriptPath )
|
||||||
, m_ready( false )
|
, m_ready( false )
|
||||||
, m_stopped( true )
|
, m_stopped( true )
|
||||||
, m_error( Tomahawk::ExternalResolver::NoError )
|
, m_error( Tomahawk::ExternalResolver::NoError )
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#ifndef QTSCRIPTRESOLVER_H
|
#ifndef QTSCRIPTRESOLVER_H
|
||||||
#define QTSCRIPTRESOLVER_H
|
#define QTSCRIPTRESOLVER_H
|
||||||
|
|
||||||
#include "resolver.h"
|
#include "ExternalResolverGui.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -114,7 +114,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class DLLEXPORT QtScriptResolver : public Tomahawk::ExternalResolver
|
class DLLEXPORT QtScriptResolver : public Tomahawk::ExternalResolverGui
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
|
|
||||||
ScriptResolver::ScriptResolver( const QString& exe )
|
ScriptResolver::ScriptResolver( const QString& exe )
|
||||||
: Tomahawk::ExternalResolver( exe )
|
: Tomahawk::ExternalResolverGui( exe )
|
||||||
, m_num_restarts( 0 )
|
, m_num_restarts( 0 )
|
||||||
, m_msgsize( 0 )
|
, m_msgsize( 0 )
|
||||||
, m_ready( false )
|
, m_ready( false )
|
||||||
|
@@ -26,13 +26,13 @@
|
|||||||
#include <qjson/qobjecthelper.h>
|
#include <qjson/qobjecthelper.h>
|
||||||
|
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "resolver.h"
|
#include "ExternalResolverGui.h"
|
||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
class DLLEXPORT ScriptResolver : public Tomahawk::ExternalResolver
|
class DLLEXPORT ScriptResolver : public Tomahawk::ExternalResolverGui
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
#include "resolverconfigdelegate.h"
|
#include "resolverconfigdelegate.h"
|
||||||
|
|
||||||
#include "resolversmodel.h"
|
#include "resolversmodel.h"
|
||||||
#include "resolver.h"
|
#include "ExternalResolverGui.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "tomahawksettings.h"
|
#include "tomahawksettings.h"
|
||||||
#include "tomahawkapp.h"
|
#include "tomahawkapp.h"
|
||||||
#include "resolver.h"
|
#include "ExternalResolverGui.h"
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "AtticaManager.h"
|
#include "AtticaManager.h"
|
||||||
@@ -47,7 +47,9 @@ ResolversModel::data( const QModelIndex& index, int role ) const
|
|||||||
if( !index.isValid() || !hasIndex( index.row(), index.column(), QModelIndex() ) )
|
if( !index.isValid() || !hasIndex( index.row(), index.column(), QModelIndex() ) )
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
Tomahawk::ExternalResolver* res = Tomahawk::Pipeline::instance()->scriptResolvers().at( index.row() );
|
Tomahawk::ExternalResolver* r = Tomahawk::Pipeline::instance()->scriptResolvers().at( index.row() );
|
||||||
|
Tomahawk::ExternalResolverGui* res = qobject_cast< Tomahawk::ExternalResolverGui* >( r );
|
||||||
|
Q_ASSERT(res); // this is part of the gui, so there should be no non-gui resolvers
|
||||||
switch( role )
|
switch( role )
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
@@ -135,7 +137,9 @@ ResolversModel::addResolver( const QString& resolver, bool enable )
|
|||||||
{
|
{
|
||||||
const int count = rowCount( QModelIndex() );
|
const int count = rowCount( QModelIndex() );
|
||||||
beginInsertRows( QModelIndex(), count, count );
|
beginInsertRows( QModelIndex(), count, count );
|
||||||
Tomahawk::ExternalResolver* res = Tomahawk::Pipeline::instance()->addScriptResolver( resolver, enable );
|
Tomahawk::ExternalResolver* r = Tomahawk::Pipeline::instance()->addScriptResolver( resolver, enable );
|
||||||
|
Tomahawk::ExternalResolverGui* res = qobject_cast< Tomahawk::ExternalResolverGui* >( r );
|
||||||
|
Q_ASSERT(res); // this is part of the gui, so there should be no non-gui resolvers
|
||||||
connect( res, SIGNAL( changed() ), this, SLOT( resolverChanged() ) );
|
connect( res, SIGNAL( changed() ), this, SLOT( resolverChanged() ) );
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
@@ -184,7 +188,7 @@ ResolversModel::resolverChanged()
|
|||||||
|
|
||||||
if ( Tomahawk::Pipeline::instance()->scriptResolvers().contains( res ) )
|
if ( Tomahawk::Pipeline::instance()->scriptResolvers().contains( res ) )
|
||||||
{
|
{
|
||||||
qDebug() << "Got resolverChanged signal, does it have a config UI yet?" << res->configUI();
|
qDebug() << "Got resolverChanged signal, does it have a config UI yet?" << qobject_cast< Tomahawk::ExternalResolverGui* >(res)->configUI();
|
||||||
const QModelIndex idx = index( Tomahawk::Pipeline::instance()->scriptResolvers().indexOf( res ), 0, QModelIndex() );
|
const QModelIndex idx = index( Tomahawk::Pipeline::instance()->scriptResolvers().indexOf( res ), 0, QModelIndex() );
|
||||||
emit dataChanged( idx, idx );
|
emit dataChanged( idx, idx );
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#include "musicscanner.h"
|
#include "musicscanner.h"
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
#include "resolver.h"
|
#include "resolver.h"
|
||||||
|
#include "ExternalResolverGui.h"
|
||||||
#include "resolverconfigdelegate.h"
|
#include "resolverconfigdelegate.h"
|
||||||
#include "resolversmodel.h"
|
#include "resolversmodel.h"
|
||||||
#include "scanmanager.h"
|
#include "scanmanager.h"
|
||||||
@@ -563,10 +564,11 @@ void
|
|||||||
SettingsDialog::openResolverConfig( const QString& resolver )
|
SettingsDialog::openResolverConfig( const QString& resolver )
|
||||||
{
|
{
|
||||||
Tomahawk::ExternalResolver* r = Tomahawk::Pipeline::instance()->resolverForPath( resolver );
|
Tomahawk::ExternalResolver* r = Tomahawk::Pipeline::instance()->resolverForPath( resolver );
|
||||||
if( r && r->configUI() )
|
Tomahawk::ExternalResolverGui* res = qobject_cast< Tomahawk::ExternalResolverGui* >( r );
|
||||||
|
if( res && res->configUI() )
|
||||||
{
|
{
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_WS_MAC
|
||||||
DelegateConfigWrapper dialog( r->configUI(), "Resolver Configuration", this );
|
DelegateConfigWrapper dialog( res->configUI(), "Resolver Configuration", this );
|
||||||
QWeakPointer< DelegateConfigWrapper > watcher( &dialog );
|
QWeakPointer< DelegateConfigWrapper > watcher( &dialog );
|
||||||
int ret = dialog.exec();
|
int ret = dialog.exec();
|
||||||
if( !watcher.isNull() && ret == QDialog::Accepted )
|
if( !watcher.isNull() && ret == QDialog::Accepted )
|
||||||
|
Reference in New Issue
Block a user