write only configuration options that differ from default

svn path=/trunk/KDE/kdebase/workspace/; revision=1208701
This commit is contained in:
Hugo Pereira Da Costa 2010-12-22 22:08:41 +00:00
parent 8f1c262c40
commit 4840b07e22

View file

@ -27,6 +27,7 @@
#include "oxygenconfiguration.h"
#include "oxygenexception.h"
#include <QTextStream>
#include <KLocale>
namespace Oxygen
@ -162,33 +163,38 @@ namespace Oxygen
if( exception.mask() & Exception::TitleOutline ) setDrawTitleOutline( exception.drawTitleOutline() );
if( exception.mask() & Exception::SizeGripMode ) setSizeGripMode( exception.sizeGripMode() );
setHideTitleBar( exception.hideTitleBar() );
}
//__________________________________________________
void Configuration::write( KConfigGroup& group ) const
{
group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) );
group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) );
group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) );
group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) );
group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) );
Configuration defaultConfiguration;
group.writeEntry( OxygenConfig::DRAW_SEPARATOR, separatorMode() != SeparatorNever );
group.writeEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, separatorMode() == SeparatorActive );
if( titleAlignment() != defaultConfiguration.titleAlignment() ) group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) );
if( buttonSize() != defaultConfiguration.buttonSize() ) group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) );
group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() );
group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() );
group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() );
group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() );
group.writeEntry( OxygenConfig::USE_ANIMATIONS, useAnimations() );
group.writeEntry( OxygenConfig::ANIMATE_TITLE_CHANGE, animateTitleChange() );
group.writeEntry( OxygenConfig::ANIMATIONS_DURATION, animationsDuration() );
group.writeEntry( OxygenConfig::TABS_ENABLED, tabsEnabled() );
group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() );
group.writeEntry( OxygenConfig::SHADOW_MODE, shadowModeName( false ) );
group.writeEntry( OxygenConfig::SHADOW_CACHE_MODE, shadowCacheModeName( false ) );
if( blendColor() != defaultConfiguration.blendColor() ) group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) );
if( frameBorder() != defaultConfiguration.frameBorder() ) group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) );
if( sizeGripMode() != defaultConfiguration.sizeGripMode() ) group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) );
if( separatorMode() != defaultConfiguration.separatorMode() )
{
group.writeEntry( OxygenConfig::DRAW_SEPARATOR, separatorMode() != SeparatorNever );
group.writeEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, separatorMode() == SeparatorActive );
}
if( drawTitleOutline() != defaultConfiguration.drawTitleOutline() ) group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() );
if( hideTitleBar() != defaultConfiguration.hideTitleBar() ) group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() );
if( useDropShadows() != defaultConfiguration.useDropShadows() ) group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() );
if( useOxygenShadows() != defaultConfiguration.useOxygenShadows() ) group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() );
if( useAnimations() != defaultConfiguration.useAnimations() ) group.writeEntry( OxygenConfig::USE_ANIMATIONS, useAnimations() );
if( animateTitleChange() != defaultConfiguration.animateTitleChange() ) group.writeEntry( OxygenConfig::ANIMATE_TITLE_CHANGE, animateTitleChange() );
if( animationsDuration() != defaultConfiguration.animationsDuration() ) group.writeEntry( OxygenConfig::ANIMATIONS_DURATION, animationsDuration() );
if( tabsEnabled() != defaultConfiguration.tabsEnabled() ) group.writeEntry( OxygenConfig::TABS_ENABLED, tabsEnabled() );
if( useNarrowButtonSpacing() != defaultConfiguration.useNarrowButtonSpacing() ) group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() );
if( shadowMode() != defaultConfiguration.shadowMode() ) group.writeEntry( OxygenConfig::SHADOW_MODE, shadowModeName( false ) );
if( shadowCacheMode() != defaultConfiguration.shadowCacheMode() ) group.writeEntry( OxygenConfig::SHADOW_CACHE_MODE, shadowCacheModeName( false ) );
}