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");
@ -59,9 +60,9 @@ namespace Oxygen
KConfigGroup configurationGroup( configuration_, "Windeco");
userInterface_ = new OxygenConfigurationUI( parent );
connect( userInterface_, SIGNAL(changed()), SIGNAL( changed() ) );
load( configurationGroup );
connect( userInterface_, SIGNAL(changed()), SLOT( updateChanged() ) );
userInterface_->show();
}
@ -74,6 +75,9 @@ namespace Oxygen
delete configuration_;
}
//_______________________________________________________________________
void Config::toggleExpertMode( bool value )
{ userInterface_->toggleExpertMode( value ); }
//_______________________________________________________________________
void Config::load( const KConfigGroup& )
@ -92,10 +96,46 @@ namespace Oxygen
// install in ui
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& )
@ -126,12 +166,18 @@ namespace Oxygen
OxygenConfig::SIZE_GRIP_MODE,
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_TITLE_OUTLINE, userInterface_->ui.titleOutline->isChecked() );
configurationGroup.writeEntry( OxygenConfig::USE_DROP_SHADOWS, userInterface_->shadowConfigurations[1]->isChecked() );
configurationGroup.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, userInterface_->shadowConfigurations[0]->isChecked() );
configurationGroup.writeEntry( OxygenConfig::TABS_ENABLED, userInterface_->ui.tabsEnabled->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
userInterface_->ui.exceptions->exceptions().write( *configuration_ );
@ -178,8 +224,7 @@ namespace Oxygen
// install default exceptions
userInterface_->ui.exceptions->setExceptions( OxygenExceptionList::defaultList() );
// emit changed signal
emit changed();
updateChanged();
}
@ -199,10 +244,12 @@ namespace Oxygen
userInterface_->shadowConfigurations[1]->setChecked( configuration.useDropShadows() );
userInterface_->ui.tabsEnabled->setChecked( configuration.tabsEnabled() );
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.shadowCacheMode->setCurrentIndex( userInterface_->ui.shadowCacheMode->findText( configuration.shadowCacheModeName( true ) ) );
}
//_______________________________________________________________________
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
void changed();
//! emmited whenever configuration is changed
void changed( bool );
public slots:
//! load configuration
void load( const KConfigGroup& conf );
void load( const KConfigGroup& );
//! save configuration
void save( KConfigGroup& conf );
void save( KConfigGroup& );
//! restore defaults
void defaults();
void defaults( void );
//! toggle expert mode
void toggleExpertMode( bool );
private slots:
//! about oxygen
void aboutOxygen( void );
//! update change state
void updateChanged( void );
private:
@ -87,6 +93,15 @@ namespace Oxygen {
//! load configuration
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
OxygenConfigurationUI *userInterface_;

View File

@ -39,7 +39,8 @@ namespace Oxygen
//_________________________________________________________
OxygenConfigurationUI::OxygenConfigurationUI( QWidget* parent ):
QWidget( parent )
QWidget( parent ),
expertMode_( false )
{
ui.setupUi( this );
@ -98,6 +99,11 @@ namespace Oxygen
<< OxygenConfiguration::shadowModeName( OxygenConfiguration::KWinShadows, 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.inactiveShadowConfiguration );
connect( ui.shadowMode, SIGNAL( currentIndexChanged(int)), SLOT(shadowModeChanged(int)) );
@ -120,10 +126,31 @@ namespace Oxygen
connect( ui.tabsEnabled, 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.titleOutline, SIGNAL(clicked()), 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
QVector<OxygenShadowConfigurationUI*> shadowConfigurations;
//! toggle expert mode
void toggleExpertMode( bool );
protected slots:
//! shadow mode changed
void shadowModeChanged( int );
@ -64,6 +68,11 @@ namespace Oxygen
//! emmited when changed
bool changed( void );
private:
//! expert mode
bool expertMode_;
};
}

View File

@ -85,14 +85,14 @@
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="tabsEnabled">
<property name="text">
<string>Enable window grouping</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -105,13 +105,23 @@
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="useAnimations">
<property name="text">
<string>Enable animations</string>
</property>
</widget>
</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>
</widget>
<widget class="QWidget" name="tab_2">
@ -127,6 +137,9 @@
<property name="text">
<string>Background style: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
@ -137,6 +150,9 @@
<property name="text">
<string>Extra size grip display: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
@ -155,21 +171,21 @@
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="titleOutline">
<property name="text">
<string>Outline active window title</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="drawSeparator">
<property name="text">
<string>Draw Separator between title bar and active window contents </string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -182,44 +198,60 @@
</property>
</spacer>
</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>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Shadows</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Shadow style:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</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>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Shadow style:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</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">
<item>
<widget class="Oxygen::OxygenShadowConfigurationUI" name="inactiveShadowConfiguration">
@ -243,6 +275,19 @@
</item>
</layout>
</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>
</widget>
<widget class="QWidget" name="tab_4">