1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

* We can't show resolver config dialogs as a sheet. So let's not try to.

This commit is contained in:
Christian Muehlhaeuser
2014-10-11 04:12:41 +02:00
parent 42cd93bd2e
commit 69c5a57f47
2 changed files with 16 additions and 27 deletions

View File

@@ -27,10 +27,6 @@ DelegateConfigWrapper::DelegateConfigWrapper( AccountConfigWidget* conf, QWidget
, m_aboutW( aboutWidget ) , m_aboutW( aboutWidget )
, m_deleted( false ) , m_deleted( false )
{ {
m_widget->setWindowFlags( Qt::Sheet );
#ifdef Q_WS_MAC
m_widget->setVisible( true );
#endif
setWindowTitle( title ); setWindowTitle( title );
QVBoxLayout* v = new QVBoxLayout( this ); QVBoxLayout* v = new QVBoxLayout( this );
v->setContentsMargins( 0, 0, 0, 0 ); v->setContentsMargins( 0, 0, 0, 0 );
@@ -57,26 +53,21 @@ DelegateConfigWrapper::DelegateConfigWrapper( AccountConfigWidget* conf, QWidget
QHBoxLayout* h = new QHBoxLayout( this ); QHBoxLayout* h = new QHBoxLayout( this );
h->addWidget( m_buttons ); h->addWidget( m_buttons );
if( m_widget && m_widget->layout() ) if ( m_widget && m_widget->layout() )
h->setContentsMargins( m_widget->layout()->contentsMargins() ); h->setContentsMargins( m_widget->layout()->contentsMargins() );
else if( m_widget ) else if ( m_widget )
h->setContentsMargins( m_widget->contentsMargins() ); h->setContentsMargins( m_widget->contentsMargins() );
v->addLayout( h ); v->addLayout( h );
setLayout( v ); 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 ); 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 void
DelegateConfigWrapper::updateSizeHint() DelegateConfigWrapper::updateSizeHint()
{ {
setSizeGripEnabled( false ); setFixedSize( sizeHint() );
setMinimumSize( sizeHint() );
setMaximumSize( sizeHint() );
} }

View File

@@ -98,7 +98,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget*
bool added = false; bool added = false;
if( account->configurationWidget() ) if( account->configurationWidget() )
{ {
#ifdef Q_WS_MAC /*#ifdef Q_WS_MAC
// on osx a sheet needs to be non-modal // 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->configurationWidget(), account->aboutWidget(), QObject::tr( "%1 Config" ).arg( account->accountFriendlyName() ), parent, Qt::Sheet );
dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) ); 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 ); QObject::connect( account->configurationWidget(), SIGNAL( dataError( bool ) ), dialog, SLOT( toggleOkButton( bool ) ), Qt::UniqueConnection );
dialog->show(); dialog->show();
#else #else*/
DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr( "%1 Config" ).arg( account->accountFriendlyName() ), parent ); DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr( "%1 Config" ).arg( account->accountFriendlyName() ), parent );
QPointer< DelegateConfigWrapper > watcher( &dialog ); QPointer< DelegateConfigWrapper > watcher( &dialog );
@@ -124,7 +124,7 @@ createAccountFromFactory( Tomahawk::Accounts::AccountFactory* factory, QWidget*
added = false; added = false;
handleAccountAdded( account, added ); handleAccountAdded( account, added );
#endif //#endif
} }
else else
{ {
@@ -139,8 +139,8 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s
{ {
if( account->configurationWidget() ) if( account->configurationWidget() )
{ {
#ifndef Q_OS_MAC //#ifndef Q_OS_MAC
DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr("%1 Configuration" ).arg( account->accountFriendlyName() ), parent ); DelegateConfigWrapper dialog( account->configurationWidget(), account->aboutWidget(), QObject::tr("%1 Config" ).arg( account->accountFriendlyName() ), parent );
dialog.setShowDelete( showDelete ); dialog.setShowDelete( showDelete );
QPointer< DelegateConfigWrapper > watcher( &dialog ); QPointer< DelegateConfigWrapper > watcher( &dialog );
int ret = dialog.exec(); int ret = dialog.exec();
@@ -153,9 +153,9 @@ openAccountConfig( Tomahawk::Accounts::Account* account, QWidget* parent, bool s
// send changed config to resolver // send changed config to resolver
account->saveConfig(); account->saveConfig();
} }
#else /*#else
// on osx a sheet needs to be non-modal // 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->setShowDelete( showDelete );
dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) ); dialog->setProperty( "accountplugin", QVariant::fromValue< QObject* >( account ) );
UtilsObject* obj = new UtilsObject( dialog ); 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() ) ); QObject::connect( dialog, SIGNAL( closedWithDelete() ), obj, SLOT( accountConfigDelete() ) );
dialog->show(); dialog->show();
#endif #endif*/
} }
} }