perform all shadow configuration in ShadowCache::readConfig.
This will avoid code duplication between style and decoration.
This commit is contained in:
parent
2099e9dab0
commit
4abee2e112
3 changed files with 3 additions and 51 deletions
|
@ -25,6 +25,7 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "oxygenconfiguration.h"
|
||||
#include "oxygenshadowconfiguration.h"
|
||||
#include "oxygenexception.h"
|
||||
|
||||
#include <QTextStream>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue