From 69c5a57f4747e218095d13899363bd146c4a66a0 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 11 Oct 2014 04:12:41 +0200 Subject: [PATCH] * We can't show resolver config dialogs as a sheet. So let's not try to. --- .../accounts/DelegateConfigWrapper.cpp | 27 ++++++------------- src/libtomahawk/utils/GuiHelpers.cpp | 16 +++++------ 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp index e0c34937a..c7f61c359 100644 --- a/src/libtomahawk/accounts/DelegateConfigWrapper.cpp +++ b/src/libtomahawk/accounts/DelegateConfigWrapper.cpp @@ -27,10 +27,6 @@ DelegateConfigWrapper::DelegateConfigWrapper( AccountConfigWidget* conf, QWidget , m_aboutW( aboutWidget ) , m_deleted( false ) { - m_widget->setWindowFlags( Qt::Sheet ); -#ifdef Q_WS_MAC - m_widget->setVisible( true ); -#endif setWindowTitle( title ); QVBoxLayout* v = new QVBoxLayout( this ); v->setContentsMargins( 0, 0, 0, 0 ); @@ -57,26 +53,21 @@ DelegateConfigWrapper::DelegateConfigWrapper( AccountConfigWidget* conf, QWidget QHBoxLayout* h = new QHBoxLayout( this ); h->addWidget( m_buttons ); - if( m_widget && m_widget->layout() ) + if ( m_widget && m_widget->layout() ) h->setContentsMargins( m_widget->layout()->contentsMargins() ); - else if( m_widget ) + else if ( m_widget ) h->setContentsMargins( m_widget->contentsMargins() ); v->addLayout( h ); - setLayout( v ); -#ifdef Q_WS_MAC - setSizeGripEnabled( false ); - setMinimumSize( sizeHint() ); - setMaximumSize( sizeHint() ); // to remove the resize grip on osx this is the only way - - if( conf->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 ) - connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) ); -#else m_widget->setVisible( true ); -#endif + setSizeGripEnabled( false ); + updateSizeHint(); + + if ( conf->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 ) + connect( conf, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) ); } @@ -155,9 +146,7 @@ DelegateConfigWrapper::rejected() void DelegateConfigWrapper::updateSizeHint() { - setSizeGripEnabled( false ); - setMinimumSize( sizeHint() ); - setMaximumSize( sizeHint() ); + setFixedSize( sizeHint() ); } diff --git a/src/libtomahawk/utils/GuiHelpers.cpp b/src/libtomahawk/utils/GuiHelpers.cpp index b62af8d54..4058b3caf 100644 --- a/src/libtomahawk/utils/GuiHelpers.cpp +++ b/src/libtomahawk/utils/GuiHelpers.cpp @@ -98,7 +98,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget* bool added = false; if( account->configurationWidget() ) { -#ifdef Q_WS_MAC +/*#ifdef Q_WS_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 ); dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) ); @@ -110,7 +110,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget* QObject::connect( account->configurationWidget(), SIGNAL( dataError( bool ) ), dialog, SLOT( toggleOkButton( bool ) ), Qt::UniqueConnection ); dialog->show(); -#else +#else*/ DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr( "%1 Config" ).arg( account->accountFriendlyName() ), parent ); QPointer< DelegateConfigWrapper > watcher( &dialog ); @@ -124,7 +124,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget* added = false; handleAccountAdded( account, added ); -#endif +//#endif } else { @@ -139,8 +139,8 @@ 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 Configuration" ).arg( account->accountFriendlyName() ), parent ); +//#ifndef Q_OS_MAC + DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr("%1 Config" ).arg( account->accountFriendlyName() ), parent ); dialog.setShowDelete( showDelete ); QPointer< DelegateConfigWrapper > watcher( &dialog ); int ret = dialog.exec(); @@ -153,9 +153,9 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s // send changed config to resolver account->saveConfig(); } -#else +/*#else // on osx a sheet needs to be non-modal - DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account->configurationWidget(), account->aboutWidget(), QObject::tr("%1 Configuration" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet ); + DelegateConfigWrapper* dialog = new DelegateConfigWrapper( account->configurationWidget(), account->aboutWidget(), QObject::tr("%1 Config" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet ); dialog->setShowDelete( showDelete ); dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) ); UtilsObject* obj = new UtilsObject( dialog ); @@ -164,7 +164,7 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s QObject::connect( dialog, SIGNAL( closedWithDelete() ), obj, SLOT( accountConfigDelete() ) ); dialog->show(); -#endif +#endif*/ } }