From 724f92e776b16d4de18aaf1e351cf89b67ef2ff6 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Wed, 23 Jan 2013 19:29:30 +0100 Subject: [PATCH] Introduce AccountConfigWidget type for handling errors later on --- src/accounts/xmpp/XmppAccount.cpp | 3 +- src/accounts/xmpp/XmppAccount.h | 4 +-- src/accounts/xmpp/XmppConfigWidget.cpp | 2 +- src/accounts/xmpp/XmppConfigWidget.h | 4 +-- src/accounts/zeroconf/ZeroconfAccount.h | 2 +- src/libtomahawk/CMakeLists.txt | 1 + src/libtomahawk/ExternalResolverGui.cpp | 15 +++++++-- src/libtomahawk/ExternalResolverGui.h | 5 +-- src/libtomahawk/accounts/Account.cpp | 2 +- src/libtomahawk/accounts/Account.h | 3 +- .../accounts/AccountConfigWidget.cpp | 24 ++++++++++++++ .../accounts/AccountConfigWidget.h | 33 +++++++++++++++++++ .../accounts/DelegateConfigWrapper.cpp | 4 ++- .../accounts/DelegateConfigWrapper.h | 7 ++-- src/libtomahawk/accounts/ResolverAccount.cpp | 2 +- src/libtomahawk/accounts/ResolverAccount.h | 2 +- .../accounts/lastfm/LastFmAccount.cpp | 2 +- .../accounts/lastfm/LastFmAccount.h | 2 +- .../accounts/lastfm/LastFmConfig.cpp | 2 +- .../accounts/lastfm/LastFmConfig.h | 3 +- .../accounts/spotify/SpotifyAccount.cpp | 4 +-- .../accounts/spotify/SpotifyAccount.h | 2 +- .../accounts/spotify/SpotifyAccountConfig.cpp | 2 +- .../accounts/spotify/SpotifyAccountConfig.h | 4 ++- .../resolvers/QtScriptResolver.cpp | 6 ++-- src/libtomahawk/resolvers/QtScriptResolver.h | 4 +-- src/libtomahawk/resolvers/ScriptResolver.cpp | 5 +-- src/libtomahawk/resolvers/ScriptResolver.h | 4 +-- src/libtomahawk/utils/GuiHelpers.cpp | 1 + 29 files changed, 118 insertions(+), 36 deletions(-) create mode 100644 src/libtomahawk/accounts/AccountConfigWidget.cpp create mode 100644 src/libtomahawk/accounts/AccountConfigWidget.h diff --git a/src/accounts/xmpp/XmppAccount.cpp b/src/accounts/xmpp/XmppAccount.cpp index b1ae9f278..88107557c 100644 --- a/src/accounts/xmpp/XmppAccount.cpp +++ b/src/accounts/xmpp/XmppAccount.cpp @@ -22,6 +22,7 @@ #include "XmppConfigWidget.h" #include "sip/SipPlugin.h" #include "XmppInfoPlugin.h" +#include "accounts/AccountConfigWidget.h" #include @@ -44,7 +45,7 @@ XmppAccount::XmppAccount( const QString &accountId ) setAccountServiceName( "Jabber (XMPP)" ); setTypes( SipType ); - m_configWidget = QPointer< QWidget >( new XmppConfigWidget( this, 0 ) ); + m_configWidget = QPointer< AccountConfigWidget >( new XmppConfigWidget( this, 0 ) ); m_onlinePixmap = QPixmap( ":/xmpp-icon.png" ); m_offlinePixmap = QPixmap( ":/xmpp-offline-icon.png" ); diff --git a/src/accounts/xmpp/XmppAccount.h b/src/accounts/xmpp/XmppAccount.h index 999a77f6f..d32b69dc5 100644 --- a/src/accounts/xmpp/XmppAccount.h +++ b/src/accounts/xmpp/XmppAccount.h @@ -73,14 +73,14 @@ public: SipPlugin* sipPlugin(); - QWidget* configurationWidget() { return m_configWidget.data(); } + AccountConfigWidget* configurationWidget() { return m_configWidget.data(); } QWidget* aclWidget() { return 0; } void saveConfig(); virtual Tomahawk::Accounts::Account::ConnectionState connectionState() const; protected: - QPointer< QWidget > m_configWidget; // so the google wrapper can change the config dialog a bit + QPointer< AccountConfigWidget > m_configWidget; // so the google wrapper can change the config dialog a bit QPointer< XmppSipPlugin > m_xmppSipPlugin; QPointer< Tomahawk::InfoSystem::XmppInfoPlugin > m_xmppInfoPlugin; diff --git a/src/accounts/xmpp/XmppConfigWidget.cpp b/src/accounts/xmpp/XmppConfigWidget.cpp index 80640543b..4796b061f 100644 --- a/src/accounts/xmpp/XmppConfigWidget.cpp +++ b/src/accounts/xmpp/XmppConfigWidget.cpp @@ -34,7 +34,7 @@ namespace Accounts { XmppConfigWidget::XmppConfigWidget( XmppAccount* account, QWidget *parent ) : - QWidget( parent ), + AccountConfigWidget( parent ), m_ui( new Ui::XmppConfigWidget ), m_account( account ) { diff --git a/src/accounts/xmpp/XmppConfigWidget.h b/src/accounts/xmpp/XmppConfigWidget.h index c16e3f6fa..bb08f871f 100644 --- a/src/accounts/xmpp/XmppConfigWidget.h +++ b/src/accounts/xmpp/XmppConfigWidget.h @@ -21,7 +21,7 @@ #define JABBERACCOUNTCONFIGWIDGET_H #include "accounts/AccountDllMacro.h" - +#include "accounts/AccountConfigWidget.h" #include namespace Ui @@ -39,7 +39,7 @@ class XmppAccount; class GoogleWrapper; -class ACCOUNTDLLEXPORT XmppConfigWidget : public QWidget +class ACCOUNTDLLEXPORT XmppConfigWidget : public AccountConfigWidget { Q_OBJECT diff --git a/src/accounts/zeroconf/ZeroconfAccount.h b/src/accounts/zeroconf/ZeroconfAccount.h index a223ce275..2c9ff05ed 100644 --- a/src/accounts/zeroconf/ZeroconfAccount.h +++ b/src/accounts/zeroconf/ZeroconfAccount.h @@ -68,7 +68,7 @@ public: virtual Tomahawk::InfoSystem::InfoPluginPtr infoPlugin() { return Tomahawk::InfoSystem::InfoPluginPtr(); } SipPlugin* sipPlugin(); - QWidget* configurationWidget() { return 0; } + AccountConfigWidget* configurationWidget() { return 0; } QWidget* aclWidget() { return 0; } private: diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 086c820cf..cc8d666ee 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -201,6 +201,7 @@ list(APPEND libSources accounts/DelegateConfigWrapper.cpp accounts/AccountFactoryWrapper.cpp accounts/AccountFactoryWrapperDelegate.cpp + accounts/AccountConfigWidget.cpp accounts/spotify/SpotifyAccount.cpp accounts/spotify/SpotifyAccountConfig.cpp diff --git a/src/libtomahawk/ExternalResolverGui.cpp b/src/libtomahawk/ExternalResolverGui.cpp index 4b986e413..b5014fb2c 100644 --- a/src/libtomahawk/ExternalResolverGui.cpp +++ b/src/libtomahawk/ExternalResolverGui.cpp @@ -21,6 +21,7 @@ #include "Source.h" #include "utils/Logger.h" +#include "accounts/AccountConfigWidget.h" #include #include @@ -28,6 +29,7 @@ #include #include #include +#include Tomahawk::ExternalResolverGui::ExternalResolverGui(const QString& filePath) : Tomahawk::ExternalResolver(filePath) @@ -80,22 +82,29 @@ Tomahawk::ExternalResolverGui::addChildProperties( QObject* widget, QVariantMap& } -QWidget* +AccountConfigWidget* Tomahawk::ExternalResolverGui::widgetFromData( QByteArray& data, QWidget* parent ) { if( data.isEmpty() ) return 0; + AccountConfigWidget* configWidget = new AccountConfigWidget( parent ); + QUiLoader l; QBuffer b( &data ); - QWidget* w = l.load( &b, parent ); + QWidget* w = l.load( &b, configWidget ); + + // HACK: proper way would be to create a designer plugin for this widget type + configWidget->setLayout( new QBoxLayout( QBoxLayout::TopToBottom ) ); + configWidget->layout()->addWidget( w ); + #ifdef Q_OS_MAC w->setContentsMargins( 12, 12, 12, 12 ); #else w->setContentsMargins( 6, 6, 6, 6 ); #endif - return w; + return configWidget; } diff --git a/src/libtomahawk/ExternalResolverGui.h b/src/libtomahawk/ExternalResolverGui.h index 68832fb06..72f7164ae 100644 --- a/src/libtomahawk/ExternalResolverGui.h +++ b/src/libtomahawk/ExternalResolverGui.h @@ -25,6 +25,7 @@ #include class QWidget; +class AccountConfigWidget; namespace Tomahawk { @@ -41,13 +42,13 @@ Q_OBJECT public: ExternalResolverGui( const QString& filePath ); - virtual QWidget* configUI() const = 0; + virtual AccountConfigWidget* configUI() const = 0; virtual QPixmap icon() const { return QPixmap(); } virtual void setIcon( const QPixmap& ) {} protected: - QWidget* widgetFromData( QByteArray& data, QWidget* parent = 0 ); + AccountConfigWidget* widgetFromData( QByteArray& data, QWidget* parent = 0 ); QVariant configMsgFromWidget( QWidget* w ); QByteArray fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images ); diff --git a/src/libtomahawk/accounts/Account.cpp b/src/libtomahawk/accounts/Account.cpp index e182889eb..9cbd30870 100644 --- a/src/libtomahawk/accounts/Account.cpp +++ b/src/libtomahawk/accounts/Account.cpp @@ -66,7 +66,7 @@ Account::~Account() #ifndef ENABLE_HEADLESS -QWidget* +AccountConfigWidget* Account::configurationWidget() { return 0; diff --git a/src/libtomahawk/accounts/Account.h b/src/libtomahawk/accounts/Account.h index e7ddec24a..324a76779 100644 --- a/src/libtomahawk/accounts/Account.h +++ b/src/libtomahawk/accounts/Account.h @@ -33,6 +33,7 @@ class SipPlugin; +class AccountConfigWidget; namespace Tomahawk { @@ -82,7 +83,7 @@ public: * Configuration widgets can have a "dataError( bool )" signal to enable/disable the OK button in their wrapper dialogs. */ #ifndef ENABLE_HEADLESS - virtual QWidget* configurationWidget() = 0; + virtual AccountConfigWidget* configurationWidget() = 0; virtual QWidget* aboutWidget() { return 0; } virtual QWidget* aclWidget() = 0; virtual QPixmap icon() const = 0; diff --git a/src/libtomahawk/accounts/AccountConfigWidget.cpp b/src/libtomahawk/accounts/AccountConfigWidget.cpp new file mode 100644 index 000000000..44794089c --- /dev/null +++ b/src/libtomahawk/accounts/AccountConfigWidget.cpp @@ -0,0 +1,24 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2013, Dominik Schmidt + * + * 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 . + */ + +#include "AccountConfigWidget.h" + +AccountConfigWidget::AccountConfigWidget(QWidget *parent) : + QWidget(parent) +{ +} diff --git a/src/libtomahawk/accounts/AccountConfigWidget.h b/src/libtomahawk/accounts/AccountConfigWidget.h new file mode 100644 index 000000000..b809c5761 --- /dev/null +++ b/src/libtomahawk/accounts/AccountConfigWidget.h @@ -0,0 +1,33 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2013, Dominik Schmidt + * + * 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 . + */ + +#ifndef ACCOUNTCONFIGWIDGET_H +#define ACCOUNTCONFIGWIDGET_H + +#include "DllMacro.h" + +#include + +class DLLEXPORT AccountConfigWidget : public QWidget +{ + Q_OBJECT +public: + explicit AccountConfigWidget(QWidget *parent = 0); +}; + +#endif // ACCOUNTCONFIGWIDGET_H diff --git a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp index 96850610d..a16116914 100644 --- a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp +++ b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp @@ -16,10 +16,12 @@ * along with Tomahawk. If not, see . */ #include "DelegateConfigWrapper.h" +#include "AccountConfigWidget.h" + #include -DelegateConfigWrapper::DelegateConfigWrapper( QWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags ) +DelegateConfigWrapper::DelegateConfigWrapper( AccountConfigWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags ) : QDialog( parent, flags ) , m_widget( conf ) , m_aboutW( aboutWidget ) diff --git a/src/libtomahawk/accounts/DelegateConfigWrapper.h b/src/libtomahawk/accounts/DelegateConfigWrapper.h index 612fefd58..be0c32f30 100644 --- a/src/libtomahawk/accounts/DelegateConfigWrapper.h +++ b/src/libtomahawk/accounts/DelegateConfigWrapper.h @@ -24,11 +24,13 @@ #include #include +class AccountConfigWidget; + class DelegateConfigWrapper : public QDialog { Q_OBJECT public: - DelegateConfigWrapper( QWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags = 0 ); + DelegateConfigWrapper( AccountConfigWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags = 0 ); ~DelegateConfigWrapper() {} @@ -53,7 +55,8 @@ private slots: private: QDialogButtonBox* m_buttons; - QWidget* m_widget, *m_aboutW; + AccountConfigWidget* m_widget; + QWidget* m_aboutW; QPushButton *m_okButton, *m_deleteButton; bool m_deleted; }; diff --git a/src/libtomahawk/accounts/ResolverAccount.cpp b/src/libtomahawk/accounts/ResolverAccount.cpp index a4fdca543..184790505 100644 --- a/src/libtomahawk/accounts/ResolverAccount.cpp +++ b/src/libtomahawk/accounts/ResolverAccount.cpp @@ -181,7 +181,7 @@ ResolverAccount::connectionState() const } -QWidget* +AccountConfigWidget* ResolverAccount::configurationWidget() { if ( m_resolver.isNull() ) diff --git a/src/libtomahawk/accounts/ResolverAccount.h b/src/libtomahawk/accounts/ResolverAccount.h index 83b005c76..830f3c0ba 100644 --- a/src/libtomahawk/accounts/ResolverAccount.h +++ b/src/libtomahawk/accounts/ResolverAccount.h @@ -71,7 +71,7 @@ public: virtual bool isAuthenticated() const; virtual Tomahawk::Accounts::Account::ConnectionState connectionState() const; - virtual QWidget* configurationWidget(); + virtual AccountConfigWidget* configurationWidget(); virtual QString errorMessage() const; virtual void saveConfig(); diff --git a/src/libtomahawk/accounts/lastfm/LastFmAccount.cpp b/src/libtomahawk/accounts/lastfm/LastFmAccount.cpp index 11e62ff5d..e7094d55a 100644 --- a/src/libtomahawk/accounts/lastfm/LastFmAccount.cpp +++ b/src/libtomahawk/accounts/lastfm/LastFmAccount.cpp @@ -137,7 +137,7 @@ LastFmAccount::deauthenticate() } -QWidget* +AccountConfigWidget* LastFmAccount::configurationWidget() { if ( m_configWidget.isNull() ) diff --git a/src/libtomahawk/accounts/lastfm/LastFmAccount.h b/src/libtomahawk/accounts/lastfm/LastFmAccount.h index 50d9fe8f0..b2fce44d4 100644 --- a/src/libtomahawk/accounts/lastfm/LastFmAccount.h +++ b/src/libtomahawk/accounts/lastfm/LastFmAccount.h @@ -81,7 +81,7 @@ public: virtual ConnectionState connectionState() const; virtual QPixmap icon() const; virtual QWidget* aclWidget() { return 0; } - virtual QWidget* configurationWidget(); + virtual AccountConfigWidget* configurationWidget(); virtual void saveConfig(); QString username() const; diff --git a/src/libtomahawk/accounts/lastfm/LastFmConfig.cpp b/src/libtomahawk/accounts/lastfm/LastFmConfig.cpp index 1f3c00887..ecda751b0 100644 --- a/src/libtomahawk/accounts/lastfm/LastFmConfig.cpp +++ b/src/libtomahawk/accounts/lastfm/LastFmConfig.cpp @@ -39,7 +39,7 @@ using namespace Tomahawk::Accounts; LastFmConfig::LastFmConfig( LastFmAccount* account ) - : QWidget( 0 ) + : AccountConfigWidget( 0 ) , m_account( account ) , m_page( 1 ) , m_lastTimeStamp( 0 ) diff --git a/src/libtomahawk/accounts/lastfm/LastFmConfig.h b/src/libtomahawk/accounts/lastfm/LastFmConfig.h index b443b85a5..83964b460 100644 --- a/src/libtomahawk/accounts/lastfm/LastFmConfig.h +++ b/src/libtomahawk/accounts/lastfm/LastFmConfig.h @@ -20,6 +20,7 @@ #define LASTFMCONFIG_H #include "Query.h" +#include "accounts/AccountConfigWidget.h" #include "database/DatabaseCommand_LoadSocialActions.h" #include @@ -34,7 +35,7 @@ namespace Accounts { class LastFmAccount; -class LastFmConfig : public QWidget +class LastFmConfig : public AccountConfigWidget { Q_OBJECT public: diff --git a/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp b/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp index 7c8290e22..37fb15804 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp +++ b/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp @@ -1110,7 +1110,7 @@ SpotifyAccount::icon() const } -QWidget* +AccountConfigWidget* SpotifyAccount::configurationWidget() { if ( m_configWidget.isNull() ) @@ -1124,7 +1124,7 @@ SpotifyAccount::configurationWidget() if ( m_spotifyResolver.isNull() || !m_spotifyResolver.data()->running() ) return 0; - return static_cast< QWidget* >( m_configWidget.data() ); + return static_cast< AccountConfigWidget* >( m_configWidget.data() ); } diff --git a/src/libtomahawk/accounts/spotify/SpotifyAccount.h b/src/libtomahawk/accounts/spotify/SpotifyAccount.h index bb29d3b5a..a096dda2d 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyAccount.h +++ b/src/libtomahawk/accounts/spotify/SpotifyAccount.h @@ -89,7 +89,7 @@ public: virtual ~SpotifyAccount(); static SpotifyAccount* instance(); virtual QPixmap icon() const; - virtual QWidget* configurationWidget(); + virtual AccountConfigWidget* configurationWidget(); virtual QWidget* aboutWidget(); virtual void saveConfig(); virtual Attica::Content atticaContent() const; diff --git a/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.cpp b/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.cpp index c7622b3e8..e834de8d0 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.cpp +++ b/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.cpp @@ -36,7 +36,7 @@ bool InfoSorter( const SpotifyPlaylistInfo* left, const SpotifyPlaylistInfo* rig } SpotifyAccountConfig::SpotifyAccountConfig( SpotifyAccount *account ) - : QWidget( 0 ) + : AccountConfigWidget( 0 ) , m_ui( new Ui::SpotifyConfig ) , m_loggedInUser( 0 ) , m_account( account ) diff --git a/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.h b/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.h index 8afedd69f..6224108bb 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.h +++ b/src/libtomahawk/accounts/spotify/SpotifyAccountConfig.h @@ -19,6 +19,8 @@ #ifndef SPOTIFYACCOUNTCONFIG_H #define SPOTIFYACCOUNTCONFIG_H +#include "accounts/AccountConfigWidget.h" + #include #include #include @@ -40,7 +42,7 @@ namespace Accounts class SpotifyAccount; struct SpotifyPlaylistInfo; -class SpotifyAccountConfig : public QWidget +class SpotifyAccountConfig : public AccountConfigWidget { Q_OBJECT public: diff --git a/src/libtomahawk/resolvers/QtScriptResolver.cpp b/src/libtomahawk/resolvers/QtScriptResolver.cpp index 03b734803..23d8ed9cf 100644 --- a/src/libtomahawk/resolvers/QtScriptResolver.cpp +++ b/src/libtomahawk/resolvers/QtScriptResolver.cpp @@ -25,6 +25,8 @@ #include "Pipeline.h" #include "SourceList.h" +#include "accounts/AccountConfigWidget.h" + #include "network/Servent.h" #include "jobview/JobStatusView.h" @@ -527,13 +529,13 @@ QtScriptResolver::loadUi() if( m.contains( "images" ) ) uiData = fixDataImagePaths( uiData, compressed, images ); - m_configWidget = QPointer< QWidget >( widgetFromData( uiData, 0 ) ); + m_configWidget = QPointer< AccountConfigWidget >( widgetFromData( uiData, 0 ) ); emit changed(); } -QWidget* +AccountConfigWidget* QtScriptResolver::configUI() const { if( m_configWidget.isNull() ) diff --git a/src/libtomahawk/resolvers/QtScriptResolver.h b/src/libtomahawk/resolvers/QtScriptResolver.h index 29d85bf11..69e5e947d 100644 --- a/src/libtomahawk/resolvers/QtScriptResolver.h +++ b/src/libtomahawk/resolvers/QtScriptResolver.h @@ -134,7 +134,7 @@ public: virtual unsigned int weight() const { return m_weight; } virtual unsigned int timeout() const { return m_timeout; } - virtual QWidget* configUI() const; + virtual AccountConfigWidget* configUI() const; virtual void saveConfig(); virtual ExternalResolver::ErrorState error() const; @@ -176,7 +176,7 @@ private: ExternalResolver::ErrorState m_error; QtScriptResolverHelper* m_resolverHelper; - QPointer< QWidget > m_configWidget; + QPointer< AccountConfigWidget > m_configWidget; QList< QVariant > m_dataWidgets; }; diff --git a/src/libtomahawk/resolvers/ScriptResolver.cpp b/src/libtomahawk/resolvers/ScriptResolver.cpp index 8a4046470..1ac8ab6cb 100644 --- a/src/libtomahawk/resolvers/ScriptResolver.cpp +++ b/src/libtomahawk/resolvers/ScriptResolver.cpp @@ -28,6 +28,7 @@ #include "Pipeline.h" #include "SourceList.h" +#include "accounts/AccountConfigWidget.h" #include "utils/TomahawkUtilsGui.h" #include "utils/Logger.h" @@ -427,7 +428,7 @@ ScriptResolver::setupConfWidget( const QVariantMap& m ) if ( m.contains( "images" ) ) uiData = fixDataImagePaths( uiData, compressed, m[ "images" ].toMap() ); - m_configWidget = QPointer< QWidget >( widgetFromData( uiData, 0 ) ); + m_configWidget = QPointer< AccountConfigWidget >( widgetFromData( uiData, 0 ) ); emit changed(); } @@ -514,7 +515,7 @@ ScriptResolver::setIcon( const QPixmap& icon ) } -QWidget* +AccountConfigWidget* ScriptResolver::configUI() const { if ( m_configWidget.isNull() ) diff --git a/src/libtomahawk/resolvers/ScriptResolver.h b/src/libtomahawk/resolvers/ScriptResolver.h index 8663dcef4..a7594561f 100644 --- a/src/libtomahawk/resolvers/ScriptResolver.h +++ b/src/libtomahawk/resolvers/ScriptResolver.h @@ -49,7 +49,7 @@ public: virtual void setIcon( const QPixmap& icon ); - virtual QWidget* configUI() const; + virtual AccountConfigWidget* configUI() const; virtual void saveConfig(); virtual ExternalResolver::ErrorState error() const; @@ -87,7 +87,7 @@ private: QString m_name; QPixmap m_icon; unsigned int m_weight, m_preference, m_timeout, m_num_restarts; - QPointer< QWidget > m_configWidget; + QPointer< AccountConfigWidget > m_configWidget; quint32 m_msgsize; QByteArray m_msg; diff --git a/src/libtomahawk/utils/GuiHelpers.cpp b/src/libtomahawk/utils/GuiHelpers.cpp index 645271beb..b62af8d54 100644 --- a/src/libtomahawk/utils/GuiHelpers.cpp +++ b/src/libtomahawk/utils/GuiHelpers.cpp @@ -23,6 +23,7 @@ #include "accounts/Account.h" #include "accounts/AccountManager.h" #include "accounts/DelegateConfigWrapper.h" +#include "accounts/AccountConfigWidget.h" #include "TomahawkSettings.h" namespace TomahawkUtils