use ShadowConfiguration::write() to write config to file.

Do not write options which have default value.
This is consistent with what kconfigskeleton does.

svn path=/trunk/KDE/kdebase/workspace/; revision=1208709
This commit is contained in:
Hugo Pereira Da Costa 2010-12-22 22:24:09 +00:00
parent 4840b07e22
commit fd4c9ce6a7
2 changed files with 17 additions and 11 deletions

View file

@ -183,13 +183,18 @@ namespace Oxygen
assert( colorGroup == QPalette::Active || colorGroup == QPalette::Inactive );
// create shadow configuration
ShadowConfiguration configuration( colorGroup );
configuration.setShadowSize( ui.ui.shadowSize->value() );
configuration.setHorizontalOffset( 0.1*ui.ui.verticalOffset->value() );
configuration.setInnerColor( ui.ui.innerColor->color() );
configuration.setOuterColor( ui.ui.outerColor->color() );
configuration.setUseOuterColor( ui.ui.useOuterColor->isChecked() );
// save shadow configuration
KConfigGroup configurationGroup( configuration_, ( (colorGroup == QPalette::Active) ? "ActiveShadow":"InactiveShadow" ) );
configurationGroup.writeEntry( OxygenConfig::SHADOW_SIZE, ui.ui.shadowSize->value() );
configurationGroup.writeEntry( OxygenConfig::SHADOW_VOFFSET, 0.1*ui.ui.verticalOffset->value() );
configurationGroup.writeEntry( OxygenConfig::SHADOW_INNER_COLOR, ui.ui.innerColor->color() );
configurationGroup.writeEntry( OxygenConfig::SHADOW_OUTER_COLOR, ui.ui.outerColor->color() );
configurationGroup.writeEntry( OxygenConfig::SHADOW_USE_OUTER_COLOR, ui.ui.useOuterColor->isChecked() );
configurationGroup.deleteGroup();
configuration.write( configurationGroup );
}

View file

@ -92,12 +92,13 @@ namespace Oxygen
//_________________________________________________________
void ShadowConfiguration::write( KConfigGroup& group ) const
{
group.writeEntry( OxygenConfig::SHADOW_SIZE, shadowSize() );
group.writeEntry( OxygenConfig::SHADOW_HOFFSET, horizontalOffset() );
group.writeEntry( OxygenConfig::SHADOW_VOFFSET, verticalOffset() );
group.writeEntry( OxygenConfig::SHADOW_INNER_COLOR, innerColor().name() );
group.writeEntry( OxygenConfig::SHADOW_OUTER_COLOR, outerColor().name() );
group.writeEntry( OxygenConfig::SHADOW_USE_OUTER_COLOR, useOuterColor() );
ShadowConfiguration defaultConfiguration( colorGroup_ );
if( shadowSize() != defaultConfiguration.shadowSize() ) group.writeEntry( OxygenConfig::SHADOW_SIZE, shadowSize() );
if( horizontalOffset() != defaultConfiguration.horizontalOffset() ) group.writeEntry( OxygenConfig::SHADOW_HOFFSET, horizontalOffset() );
if( verticalOffset() != defaultConfiguration.verticalOffset() ) group.writeEntry( OxygenConfig::SHADOW_VOFFSET, verticalOffset() );
if( innerColor() != defaultConfiguration.innerColor() ) group.writeEntry( OxygenConfig::SHADOW_INNER_COLOR, innerColor().name() );
if( outerColor() != defaultConfiguration.outerColor() ) group.writeEntry( OxygenConfig::SHADOW_OUTER_COLOR, outerColor().name() );
if( useOuterColor() != defaultConfiguration.useOuterColor() ) group.writeEntry( OxygenConfig::SHADOW_USE_OUTER_COLOR, useOuterColor() );
}
//_________________________________________________________