Moved 'expert mode' configuration widgets to default UI.

Disable (hide) 'expert mode' configuration widgets by default.
Enable them if expertMode is triggered (e.g. via oxygen-settings)

svn path=/trunk/KDE/kdebase/workspace/; revision=1121618
icc-effect-5.14.5
Hugo Pereira Da Costa 2010-05-01 22:25:45 +00:00
parent c135ebfcc5
commit e0a2585892
5 changed files with 218 additions and 51 deletions

View File

@ -50,7 +50,8 @@ namespace Oxygen
{ {
//_______________________________________________________________________ //_______________________________________________________________________
Config::Config( KConfig*, QWidget* parent ): QObject( parent ) Config::Config( KConfig*, QWidget* parent ):
QObject( parent )
{ {
KGlobal::locale()->insertCatalog("kwin_clients"); KGlobal::locale()->insertCatalog("kwin_clients");
@ -59,9 +60,9 @@ namespace Oxygen
KConfigGroup configurationGroup( configuration_, "Windeco"); KConfigGroup configurationGroup( configuration_, "Windeco");
userInterface_ = new OxygenConfigurationUI( parent ); userInterface_ = new OxygenConfigurationUI( parent );
connect( userInterface_, SIGNAL(changed()), SIGNAL( changed() ) );
load( configurationGroup ); load( configurationGroup );
connect( userInterface_, SIGNAL(changed()), SLOT( updateChanged() ) );
userInterface_->show(); userInterface_->show();
} }
@ -74,6 +75,9 @@ namespace Oxygen
delete configuration_; delete configuration_;
} }
//_______________________________________________________________________
void Config::toggleExpertMode( bool value )
{ userInterface_->toggleExpertMode( value ); }
//_______________________________________________________________________ //_______________________________________________________________________
void Config::load( const KConfigGroup& ) void Config::load( const KConfigGroup& )
@ -92,10 +96,46 @@ namespace Oxygen
// install in ui // install in ui
userInterface_->ui.exceptions->setExceptions( exceptions ); userInterface_->ui.exceptions->setExceptions( exceptions );
updateChanged();
} }
//_______________________________________________________________________
void Config::updateChanged( void )
{
OxygenConfiguration configuration( KConfigGroup( configuration_, "Windeco") );
bool modified( false );
if( userInterface_->ui.titleAlignment->currentIndex() != userInterface_->ui.titleAlignment->findText( configuration.titleAlignmentName( true ) ) ) modified = true;
else if( userInterface_->ui.buttonSize->currentIndex() != userInterface_->ui.buttonSize->findText( configuration.buttonSizeName( true ) ) ) modified = true;
else if( userInterface_->ui.blendColor->currentIndex() != userInterface_->ui.blendColor->findText( configuration.blendColorName( true ) ) ) modified = true;
else if( userInterface_->ui.frameBorder->currentIndex() != userInterface_->ui.frameBorder->findText( configuration.frameBorderName( true ) ) ) modified = true;
else if( userInterface_->ui.sizeGripMode->currentIndex() != userInterface_->ui.sizeGripMode->findText( configuration.sizeGripModeName( true ) ) ) modified = true;
else if( userInterface_->ui.shadowMode->currentIndex() != userInterface_->ui.shadowMode->findText( configuration.shadowModeName( true ) ) ) modified = true;
else if( userInterface_->ui.shadowCacheMode->currentIndex() != userInterface_->ui.shadowCacheMode->findText( configuration.shadowCacheModeName( true ) ) ) modified = true;
else if( userInterface_->ui.drawSeparator->isChecked() != configuration.drawSeparator() ) modified = true;
else if( userInterface_->ui.titleOutline->isChecked() != configuration.drawTitleOutline() ) modified = true;
else if( userInterface_->shadowConfigurations[0]->isChecked() != configuration.useOxygenShadows() ) modified = true;
else if( userInterface_->shadowConfigurations[1]->isChecked() != configuration.useDropShadows() ) modified = true;
else if( userInterface_->ui.tabsEnabled->isChecked() != configuration.tabsEnabled() ) modified = true;
else if( userInterface_->ui.useAnimations->isChecked() != configuration.useAnimations() ) modified = true;
else if( userInterface_->ui.animateTitleChange->isChecked() != configuration.animateTitleChange() ) modified = true;
else if( userInterface_->ui.narrowButtonSpacing->isChecked() != configuration.useNarrowButtonSpacing() ) modified = true;
// shadow configurations
else if( shadowConfigurationChanged( OxygenShadowConfiguration( QPalette::Active ), *userInterface_->shadowConfigurations[0] ) ) modified = true;
else if( shadowConfigurationChanged( OxygenShadowConfiguration( QPalette::Inactive ), *userInterface_->shadowConfigurations[1] ) ) modified = true;
// exceptions
else if( exceptionListChanged() ) modified = true;
// emit relevant signals
if( modified ) emit changed();
emit changed( modified );
}
//_______________________________________________________________________ //_______________________________________________________________________
void Config::save( KConfigGroup& ) void Config::save( KConfigGroup& )
@ -126,12 +166,18 @@ namespace Oxygen
OxygenConfig::SIZE_GRIP_MODE, OxygenConfig::SIZE_GRIP_MODE,
OxygenConfiguration::sizeGripModeName( OxygenConfiguration::sizeGripMode( userInterface_->ui.sizeGripMode->currentText(), true ), false ) ); OxygenConfiguration::sizeGripModeName( OxygenConfiguration::sizeGripMode( userInterface_->ui.sizeGripMode->currentText(), true ), false ) );
configurationGroup.writeEntry(
OxygenConfig::SHADOW_CACHE_MODE,
OxygenConfiguration::shadowCacheModeName( OxygenConfiguration::shadowCacheMode( userInterface_->ui.shadowCacheMode->currentText(), true ), false ) );
configurationGroup.writeEntry( OxygenConfig::DRAW_SEPARATOR, userInterface_->ui.drawSeparator->isChecked() ); configurationGroup.writeEntry( OxygenConfig::DRAW_SEPARATOR, userInterface_->ui.drawSeparator->isChecked() );
configurationGroup.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, userInterface_->ui.titleOutline->isChecked() ); configurationGroup.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, userInterface_->ui.titleOutline->isChecked() );
configurationGroup.writeEntry( OxygenConfig::USE_DROP_SHADOWS, userInterface_->shadowConfigurations[1]->isChecked() ); configurationGroup.writeEntry( OxygenConfig::USE_DROP_SHADOWS, userInterface_->shadowConfigurations[1]->isChecked() );
configurationGroup.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, userInterface_->shadowConfigurations[0]->isChecked() ); configurationGroup.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, userInterface_->shadowConfigurations[0]->isChecked() );
configurationGroup.writeEntry( OxygenConfig::TABS_ENABLED, userInterface_->ui.tabsEnabled->isChecked() ); configurationGroup.writeEntry( OxygenConfig::TABS_ENABLED, userInterface_->ui.tabsEnabled->isChecked() );
configurationGroup.writeEntry( OxygenConfig::USE_ANIMATIONS, userInterface_->ui.useAnimations->isChecked() ); configurationGroup.writeEntry( OxygenConfig::USE_ANIMATIONS, userInterface_->ui.useAnimations->isChecked() );
configurationGroup.writeEntry( OxygenConfig::ANIMATE_TITLE_CHANGE, userInterface_->ui.animateTitleChange->isChecked() );
configurationGroup.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, userInterface_->ui.narrowButtonSpacing->isChecked() );
// write exceptions // write exceptions
userInterface_->ui.exceptions->exceptions().write( *configuration_ ); userInterface_->ui.exceptions->exceptions().write( *configuration_ );
@ -178,8 +224,7 @@ namespace Oxygen
// install default exceptions // install default exceptions
userInterface_->ui.exceptions->setExceptions( OxygenExceptionList::defaultList() ); userInterface_->ui.exceptions->setExceptions( OxygenExceptionList::defaultList() );
// emit changed signal updateChanged();
emit changed();
} }
@ -199,10 +244,12 @@ namespace Oxygen
userInterface_->shadowConfigurations[1]->setChecked( configuration.useDropShadows() ); userInterface_->shadowConfigurations[1]->setChecked( configuration.useDropShadows() );
userInterface_->ui.tabsEnabled->setChecked( configuration.tabsEnabled() ); userInterface_->ui.tabsEnabled->setChecked( configuration.tabsEnabled() );
userInterface_->ui.useAnimations->setChecked( configuration.useAnimations() ); userInterface_->ui.useAnimations->setChecked( configuration.useAnimations() );
userInterface_->ui.animateTitleChange->setChecked( configuration.animateTitleChange() );
userInterface_->ui.narrowButtonSpacing->setChecked( configuration.useNarrowButtonSpacing() );
userInterface_->ui.shadowMode->setCurrentIndex( userInterface_->ui.shadowMode->findText( configuration.shadowModeName( true ) ) ); userInterface_->ui.shadowMode->setCurrentIndex( userInterface_->ui.shadowMode->findText( configuration.shadowModeName( true ) ) );
userInterface_->ui.shadowCacheMode->setCurrentIndex( userInterface_->ui.shadowCacheMode->findText( configuration.shadowCacheModeName( true ) ) );
} }
//_______________________________________________________________________ //_______________________________________________________________________
void Config::loadShadowConfiguration( QPalette::ColorGroup colorGroup, const OxygenShadowConfiguration& configuration ) void Config::loadShadowConfiguration( QPalette::ColorGroup colorGroup, const OxygenShadowConfiguration& configuration )
{ {
@ -216,7 +263,31 @@ namespace Oxygen
} }
//_______________________________________________________________________ //_______________________________________________________________________
void Config::aboutOxygen( void ) bool Config::shadowConfigurationChanged( const OxygenShadowConfiguration& configuration, const OxygenShadowConfigurationUI& ui ) const
{} {
bool modified( false );
if( ui.ui.shadowSize->value() != configuration.shadowSize() ) modified = true;
else if( 0.1*ui.ui.verticalOffset->value() != configuration.verticalOffset() ) modified = true;
else if( ui.ui.innerColor->color() != configuration.innerColor() ) modified = true;
else if( ui.ui.useOuterColor->isChecked() != configuration.useOuterColor() ) modified = true;
else if( ui.ui.useOuterColor->isChecked() && ui.ui.outerColor->color() != configuration.outerColor() ) modified = true;
return modified;
}
//_______________________________________________________________________
bool Config::exceptionListChanged( void ) const
{
// get saved list
OxygenExceptionList exceptions;
exceptions.read( *configuration_ );
if( exceptions.empty() )
{ exceptions = OxygenExceptionList::defaultList(); }
// compare to current
return exceptions != userInterface_->ui.exceptions->exceptions();
}
} }

View File

@ -60,21 +60,27 @@ namespace Oxygen {
//! emmited whenever configuration is changed //! emmited whenever configuration is changed
void changed(); void changed();
//! emmited whenever configuration is changed
void changed( bool );
public slots: public slots:
//! load configuration //! load configuration
void load( const KConfigGroup& conf ); void load( const KConfigGroup& );
//! save configuration //! save configuration
void save( KConfigGroup& conf ); void save( KConfigGroup& );
//! restore defaults //! restore defaults
void defaults(); void defaults( void );
//! toggle expert mode
void toggleExpertMode( bool );
private slots: private slots:
//! about oxygen //! update change state
void aboutOxygen( void ); void updateChanged( void );
private: private:
@ -87,6 +93,15 @@ namespace Oxygen {
//! load configuration //! load configuration
void saveShadowConfiguration( QPalette::ColorGroup, const OxygenShadowConfigurationUI& ) const; void saveShadowConfiguration( QPalette::ColorGroup, const OxygenShadowConfigurationUI& ) const;
//! returns true if shadow configuration changed
bool shadowConfigurationChanged( const OxygenShadowConfiguration&, const OxygenShadowConfigurationUI& ) const;
//! returns true if exception list is changed
bool exceptionListChanged( void ) const;
//! expert mode
bool expertMode_;
//! user interface //! user interface
OxygenConfigurationUI *userInterface_; OxygenConfigurationUI *userInterface_;

View File

@ -39,7 +39,8 @@ namespace Oxygen
//_________________________________________________________ //_________________________________________________________
OxygenConfigurationUI::OxygenConfigurationUI( QWidget* parent ): OxygenConfigurationUI::OxygenConfigurationUI( QWidget* parent ):
QWidget( parent ) QWidget( parent ),
expertMode_( false )
{ {
ui.setupUi( this ); ui.setupUi( this );
@ -98,6 +99,11 @@ namespace Oxygen
<< OxygenConfiguration::shadowModeName( OxygenConfiguration::KWinShadows, true ) << OxygenConfiguration::shadowModeName( OxygenConfiguration::KWinShadows, true )
<< OxygenConfiguration::shadowModeName( OxygenConfiguration::NoShadows, true ) ); << OxygenConfiguration::shadowModeName( OxygenConfiguration::NoShadows, true ) );
ui.shadowCacheMode->insertItems(0, QStringList()
<< OxygenConfiguration::shadowCacheModeName( OxygenConfiguration::CacheDisabled, true )
<< OxygenConfiguration::shadowCacheModeName( OxygenConfiguration::CacheVariable, true )
<< OxygenConfiguration::shadowCacheModeName( OxygenConfiguration::CacheMaximum, true ) );
shadowConfigurations.push_back( ui.activeShadowConfiguration ); shadowConfigurations.push_back( ui.activeShadowConfiguration );
shadowConfigurations.push_back( ui.inactiveShadowConfiguration ); shadowConfigurations.push_back( ui.inactiveShadowConfiguration );
connect( ui.shadowMode, SIGNAL( currentIndexChanged(int)), SLOT(shadowModeChanged(int)) ); connect( ui.shadowMode, SIGNAL( currentIndexChanged(int)), SLOT(shadowModeChanged(int)) );
@ -120,10 +126,31 @@ namespace Oxygen
connect( ui.tabsEnabled, SIGNAL(clicked()), SIGNAL(changed()) ); connect( ui.tabsEnabled, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.useAnimations, SIGNAL(clicked()), SIGNAL(changed()) ); connect( ui.useAnimations, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.animateTitleChange, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.narrowButtonSpacing, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.drawSeparator, SIGNAL(clicked()), SIGNAL(changed()) ); connect( ui.drawSeparator, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.titleOutline, SIGNAL(clicked()), SIGNAL(changed()) ); connect( ui.titleOutline, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui.exceptions, SIGNAL(changed()), SIGNAL(changed()) ); connect( ui.exceptions, SIGNAL(changed()), SIGNAL(changed()) );
connect( ui.useAnimations, SIGNAL( toggled( bool ) ), ui.animateTitleChange, SLOT( setEnabled( bool ) ) );
toggleExpertMode( false );
}
//_________________________________________________________
void OxygenConfigurationUI::toggleExpertMode( bool value )
{
expertMode_ = value;
ui.animateTitleChange->setVisible( expertMode_ );
ui.narrowButtonSpacing->setVisible( expertMode_ );
ui.shadowCacheModeLabel->setVisible( expertMode_ );
ui.shadowCacheMode->setVisible( expertMode_ );
if( expertMode_ ) ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
else ui.shadowSpacer->changeSize(0,0, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
} }
//_________________________________________________________ //_________________________________________________________

View File

@ -55,7 +55,11 @@ namespace Oxygen
//! shadow configuration //! shadow configuration
QVector<OxygenShadowConfigurationUI*> shadowConfigurations; QVector<OxygenShadowConfigurationUI*> shadowConfigurations;
//! toggle expert mode
void toggleExpertMode( bool );
protected slots: protected slots:
//! shadow mode changed //! shadow mode changed
void shadowModeChanged( int ); void shadowModeChanged( int );
@ -64,6 +68,11 @@ namespace Oxygen
//! emmited when changed //! emmited when changed
bool changed( void ); bool changed( void );
private:
//! expert mode
bool expertMode_;
}; };
} }

View File

@ -85,14 +85,14 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="tabsEnabled"> <widget class="QCheckBox" name="tabsEnabled">
<property name="text"> <property name="text">
<string>Enable window grouping</string> <string>Enable window grouping</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -105,13 +105,23 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="useAnimations"> <widget class="QCheckBox" name="useAnimations">
<property name="text"> <property name="text">
<string>Enable animations</string> <string>Enable animations</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="animateTitleChange">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Enable title transition animations</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
@ -127,6 +137,9 @@
<property name="text"> <property name="text">
<string>Background style: </string> <string>Background style: </string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
@ -137,6 +150,9 @@
<property name="text"> <property name="text">
<string>Extra size grip display: </string> <string>Extra size grip display: </string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
@ -155,21 +171,21 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="titleOutline"> <widget class="QCheckBox" name="titleOutline">
<property name="text"> <property name="text">
<string>Outline active window title</string> <string>Outline active window title</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="drawSeparator"> <widget class="QCheckBox" name="drawSeparator">
<property name="text"> <property name="text">
<string>Draw Separator between title bar and active window contents </string> <string>Draw Separator between title bar and active window contents </string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="7" column="0">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -182,44 +198,60 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="narrowButtonSpacing">
<property name="text">
<string>Use narrow space between decoration buttons</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
<string>Shadows</string> <string>Shadows</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QGridLayout" name="gridLayout_3">
<item> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_8"> <widget class="QLabel" name="label_6">
<item> <property name="text">
<widget class="QLabel" name="label_6"> <string>Shadow style:</string>
<property name="text"> </property>
<string>Shadow style:</string> <property name="alignment">
</property> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="alignment"> </property>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </widget>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="shadowMode"/>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item row="0" column="1">
<widget class="KComboBox" name="shadowMode"/>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>308</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="shadowCacheModeLabel">
<property name="text">
<string>Shadow caching:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="shadowCacheMode"/>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<item> <item>
<widget class="Oxygen::OxygenShadowConfigurationUI" name="inactiveShadowConfiguration"> <widget class="Oxygen::OxygenShadowConfigurationUI" name="inactiveShadowConfiguration">
@ -243,6 +275,19 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0">
<spacer name="shadowSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_4"> <widget class="QWidget" name="tab_4">