From 4abee2e112be3e5889d74d53a81b3921d20be057 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 23 Feb 2011 11:14:21 +0100 Subject: [PATCH] perform all shadow configuration in ShadowCache::readConfig. This will avoid code duplication between style and decoration. --- clients/oxygen/oxygenconfiguration.cpp | 1 + clients/oxygen/oxygenconfiguration.h | 5 --- clients/oxygen/oxygenfactory.cpp | 48 ++------------------------ 3 files changed, 3 insertions(+), 51 deletions(-) diff --git a/clients/oxygen/oxygenconfiguration.cpp b/clients/oxygen/oxygenconfiguration.cpp index 97369e3f0d..61180ee5e4 100644 --- a/clients/oxygen/oxygenconfiguration.cpp +++ b/clients/oxygen/oxygenconfiguration.cpp @@ -25,6 +25,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "oxygenconfiguration.h" +#include "oxygenshadowconfiguration.h" #include "oxygenexception.h" #include diff --git a/clients/oxygen/oxygenconfiguration.h b/clients/oxygen/oxygenconfiguration.h index 54bcb7697f..ff3baf099d 100644 --- a/clients/oxygen/oxygenconfiguration.h +++ b/clients/oxygen/oxygenconfiguration.h @@ -41,16 +41,11 @@ namespace OxygenConfig static const QString FRAME_BORDER = "FrameBorder"; static const QString BLEND_COLOR = "BlendColor"; static const QString SIZE_GRIP_MODE = "SizeGripMode"; - static const QString USE_DROP_SHADOWS = "UseDropShadows"; - static const QString USE_OXYGEN_SHADOWS = "UseOxygenShadows"; static const QString HIDE_TITLEBAR = "HideTitleBar"; static const QString USE_ANIMATIONS = "UseAnimations"; static const QString ANIMATE_TITLE_CHANGE = "AnimateTitleChange"; - static const QString ANIMATIONS_DURATION = "AnimationsDuration"; static const QString TABS_ENABLED = "TabsEnabled"; static const QString NARROW_BUTTON_SPACING = "UseNarrowButtonSpacing"; - static const QString SHADOW_MODE = "ShadowMode"; - static const QString SHADOW_CACHE_MODE = "ShadowCacheMode"; } namespace Oxygen diff --git a/clients/oxygen/oxygenfactory.cpp b/clients/oxygen/oxygenfactory.cpp index bfc9cd43ea..8c1534cbd0 100644 --- a/clients/oxygen/oxygenfactory.cpp +++ b/clients/oxygen/oxygenfactory.cpp @@ -115,33 +115,6 @@ namespace Oxygen changed = true; } - // initialize shadow cache - switch( defaultConfiguration().shadowCacheMode() ) - { - - case Configuration::CacheDisabled: - { - shadowCache_.setEnabled( false ); - break; - } - - default: - case Configuration::CacheVariable: - { - shadowCache_.setEnabled( true ); - shadowCache_.setMaxIndex( qMin( 256, int( 120*defaultConfiguration().animationsDuration()/1000 ) ) ); - break; - } - - case Configuration::CacheMaximum: - { - shadowCache_.setEnabled( true ); - shadowCache_.setMaxIndex( 256 ); - break; - } - - } - // read exceptionsreadConfig ExceptionList exceptions( config ); if( !( exceptions == exceptions_ ) ) @@ -157,25 +130,8 @@ namespace Oxygen defaultConfiguration().setUseDropShadows( false ); } - // read shadow configurations - ShadowConfiguration activeShadowConfiguration( QPalette::Active, config.group( "ActiveShadow" ) ); - activeShadowConfiguration.setEnabled( defaultConfiguration().useOxygenShadows() ); - if( shadowCache().shadowConfigurationChanged( activeShadowConfiguration ) ) - { - shadowCache().setShadowConfiguration( activeShadowConfiguration ); - shadowCache().invalidateCaches(); - changed = true; - } - - // read shadow configurations - ShadowConfiguration inactiveShadowConfiguration( QPalette::Inactive, config.group( "InactiveShadow" ) ); - inactiveShadowConfiguration.setEnabled( defaultConfiguration().useDropShadows() ); - if( shadowCache().shadowConfigurationChanged( inactiveShadowConfiguration ) ) - { - shadowCache().setShadowConfiguration( inactiveShadowConfiguration ); - shadowCache().invalidateCaches(); - changed = true; - } + // read shadowCache configuration + shadowCache().readConfig( config ); return changed;