1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01: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_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() );
}

View File

@ -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*/
}
}