mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-30 19:00:12 +02:00
Pass account to DelegateConfigWrapper
This commit is contained in:
@@ -16,18 +16,24 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "DelegateConfigWrapper.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountConfigWidget.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
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() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -18,6 +18,8 @@
|
||||
#ifndef RESOLVER_CONFIG_WRAPPER
|
||||
#define RESOLVER_CONFIG_WRAPPER
|
||||
|
||||
#include "Account.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
@@ -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;
|
||||
};
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user