diff --git a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp index c7f61c359..18be51ad6 100644 --- a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp +++ b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp @@ -16,18 +16,24 @@ * along with Tomahawk. If not, see . */ #include "DelegateConfigWrapper.h" + +#include "Account.h" #include "AccountConfigWidget.h" #include -DelegateConfigWrapper::DelegateConfigWrapper( AccountConfigWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags ) +DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* account, QWidget* parent, Qt::WindowFlags flags ) : QDialog( parent, flags ) - , m_widget( conf ) - , m_aboutW( aboutWidget ) + , m_account( account ) + , m_widget( account->configurationWidget() ) + , m_aboutW( account->aboutWidget() ) + , m_buttons( nullptr ) + , m_okButton( nullptr ) + , m_deleteButton( nullptr ) , m_deleted( false ) { - setWindowTitle( title ); + setWindowTitle( tr("%1 Config" ).arg( account->accountFriendlyName() ) ); QVBoxLayout* v = new QVBoxLayout( this ); v->setContentsMargins( 0, 0, 0, 0 ); v->addWidget( m_widget ); @@ -66,8 +72,8 @@ DelegateConfigWrapper::DelegateConfigWrapper( AccountConfigWidget* conf, QWidget setSizeGripEnabled( false ); updateSizeHint(); - if ( conf->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 ) - connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) ); + if ( m_widget->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 ) + connect( m_widget, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) ); } diff --git a/src/libtomahawk/accounts/DelegateConfigWrapper.h b/src/libtomahawk/accounts/DelegateConfigWrapper.h index be0c32f30..7dae3a274 100644 --- a/src/libtomahawk/accounts/DelegateConfigWrapper.h +++ b/src/libtomahawk/accounts/DelegateConfigWrapper.h @@ -18,6 +18,8 @@ #ifndef RESOLVER_CONFIG_WRAPPER #define RESOLVER_CONFIG_WRAPPER +#include "Account.h" + #include #include #include @@ -30,7 +32,7 @@ class DelegateConfigWrapper : public QDialog { Q_OBJECT public: - DelegateConfigWrapper( AccountConfigWidget* conf, QWidget* aboutWidget, const QString& title, QWidget* parent, Qt::WindowFlags flags = 0 ); + DelegateConfigWrapper( Tomahawk::Accounts::Account* account, QWidget* parent, Qt::WindowFlags flags = 0 ); ~DelegateConfigWrapper() {} @@ -54,9 +56,10 @@ private slots: void aboutClicked( bool ); private: - QDialogButtonBox* m_buttons; + Tomahawk::Accounts::Account* m_account; AccountConfigWidget* m_widget; QWidget* m_aboutW; + QDialogButtonBox* m_buttons; QPushButton *m_okButton, *m_deleteButton; bool m_deleted; }; diff --git a/src/libtomahawk/utils/GuiHelpers.cpp b/src/libtomahawk/utils/GuiHelpers.cpp index 4f2519f98..6c72bd8d6 100644 --- a/src/libtomahawk/utils/GuiHelpers.cpp +++ b/src/libtomahawk/utils/GuiHelpers.cpp @@ -100,7 +100,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget* { /*#ifdef Q_OS_MAC // on osx a sheet needs to be non-modal - DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account->configurationWidget(), account->aboutWidget(), QObject::tr( "%1 Config" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet ); + DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account, parent, Qt::Sheet ); dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) ); UtilsObject* obj = new UtilsObject( dialog ); @@ -111,7 +111,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget* dialog->show(); #else*/ - DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr( "%1 Config" ).arg( account->accountFriendlyName() ), parent ); + DelegateConfigWrapper dialog( account, parent ); QPointer< DelegateConfigWrapper > watcher( &dialog ); if( account->configurationWidget()->metaObject()->indexOfSignal( "dataError(bool)" ) > -1 ) @@ -140,7 +140,7 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s if( account->configurationWidget() ) { //#ifndef Q_OS_MAC - DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr("%1 Config" ).arg( account->accountFriendlyName() ), parent ); + DelegateConfigWrapper dialog( account, parent ); dialog.setShowDelete( showDelete ); QPointer< DelegateConfigWrapper > watcher( &dialog ); int ret = dialog.exec();