From 49411bcda521eaf99b1e30f7b5cedc9fc25ea60d Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 25 Mar 2010 00:51:27 +0000 Subject: [PATCH] Added checkbox to disable shadow drawing (as a replacement to setting shadow size to zero), consistently with the checkbox used to disable the active window glow. svn path=/trunk/KDE/kdebase/workspace/; revision=1107183 --- clients/oxygen/config/config.cpp | 2 ++ clients/oxygen/config/oxygenconfigurationui.cpp | 3 +++ clients/oxygen/config/oxygenconfigurationui.ui | 3 +++ clients/oxygen/oxygen.cpp | 1 + clients/oxygen/oxygenconfiguration.cpp | 8 ++++++++ clients/oxygen/oxygenconfiguration.h | 12 ++++++++++++ clients/oxygen/oxygenshadowcache.cpp | 2 +- clients/oxygen/oxygenshadowcache.h | 4 +++- clients/oxygen/oxygenshadowconfiguration.cpp | 6 ++++-- clients/oxygen/oxygenshadowconfiguration.h | 12 ++++++++++++ 10 files changed, 49 insertions(+), 4 deletions(-) diff --git a/clients/oxygen/config/config.cpp b/clients/oxygen/config/config.cpp index 628a8f956a..a77d646457 100644 --- a/clients/oxygen/config/config.cpp +++ b/clients/oxygen/config/config.cpp @@ -128,6 +128,7 @@ namespace Oxygen 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() ); @@ -193,6 +194,7 @@ namespace Oxygen userInterface_->ui.drawSeparator->setChecked( configuration.drawSeparator() ); userInterface_->ui.titleOutline->setChecked( configuration.drawTitleOutline() ); userInterface_->shadowConfigurations[0]->setChecked( configuration.useOxygenShadows() ); + userInterface_->shadowConfigurations[1]->setChecked( configuration.useDropShadows() ); userInterface_->ui.tabsEnabled->setChecked( configuration.tabsEnabled() ); userInterface_->ui.useAnimations->setChecked( configuration.useAnimations() ); } diff --git a/clients/oxygen/config/oxygenconfigurationui.cpp b/clients/oxygen/config/oxygenconfigurationui.cpp index 6dc54d1356..a65f738ba6 100644 --- a/clients/oxygen/config/oxygenconfigurationui.cpp +++ b/clients/oxygen/config/oxygenconfigurationui.cpp @@ -101,7 +101,10 @@ namespace Oxygen connect( shadowConfigurations[0], SIGNAL( changed() ), SIGNAL( changed() ) ); connect( shadowConfigurations[0], SIGNAL( toggled( bool ) ), SIGNAL( changed() ) ); + connect( shadowConfigurations[1], SIGNAL( changed() ), SIGNAL( changed() ) ); + connect( shadowConfigurations[1], SIGNAL( toggled( bool ) ), SIGNAL( changed() ) ); + connect( ui.titleAlignment, SIGNAL(currentIndexChanged(int)), SIGNAL( changed() ) ); connect( ui.buttonSize, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) ); connect( ui.frameBorder, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) ); diff --git a/clients/oxygen/config/oxygenconfigurationui.ui b/clients/oxygen/config/oxygenconfigurationui.ui index 097ff61467..3120d739fb 100644 --- a/clients/oxygen/config/oxygenconfigurationui.ui +++ b/clients/oxygen/config/oxygenconfigurationui.ui @@ -191,6 +191,9 @@ Window Drop-Down Shadow + + true + diff --git a/clients/oxygen/oxygen.cpp b/clients/oxygen/oxygen.cpp index 4233991be8..b6d3dba63b 100644 --- a/clients/oxygen/oxygen.cpp +++ b/clients/oxygen/oxygen.cpp @@ -127,6 +127,7 @@ namespace Oxygen // read shadow configurations OxygenShadowConfiguration inactiveShadowConfiguration( QPalette::Inactive, config.group( "InactiveShadow" ) ); + inactiveShadowConfiguration.setEnabled( configuration.useDropShadows() ); if( shadowCache().shadowConfigurationChanged( inactiveShadowConfiguration ) ) { shadowCache().setShadowConfiguration( inactiveShadowConfiguration ); diff --git a/clients/oxygen/oxygenconfiguration.cpp b/clients/oxygen/oxygenconfiguration.cpp index 2ca6a87bf2..573a1a17c9 100644 --- a/clients/oxygen/oxygenconfiguration.cpp +++ b/clients/oxygen/oxygenconfiguration.cpp @@ -40,6 +40,7 @@ namespace Oxygen drawSeparator_( false ), drawTitleOutline_( false ), hideTitleBar_( false ), + useDropShadows_( true ), useOxygenShadows_( true ), useAnimations_( true ), animateTitleChange_( true ), @@ -95,6 +96,11 @@ namespace Oxygen OxygenConfig::HIDE_TITLEBAR, defaultConfiguration.hideTitleBar() ) ); + // drop shadows + setUseDropShadows( group.readEntry( + OxygenConfig::USE_DROP_SHADOWS, + defaultConfiguration.useDropShadows() ) ); + // oxygen shadows setUseOxygenShadows( group.readEntry( OxygenConfig::USE_OXYGEN_SHADOWS, @@ -140,6 +146,7 @@ namespace Oxygen group.writeEntry( OxygenConfig::DRAW_SEPARATOR, drawSeparator() ); 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() ); @@ -311,6 +318,7 @@ namespace Oxygen drawSeparator() == other.drawSeparator() && drawTitleOutline() == other.drawTitleOutline() && hideTitleBar() == other.hideTitleBar() && + useDropShadows() == other.useDropShadows() && useOxygenShadows() == other.useOxygenShadows() && useAnimations() == other.useAnimations() && animateTitleChange() == other.animateTitleChange() && diff --git a/clients/oxygen/oxygenconfiguration.h b/clients/oxygen/oxygenconfiguration.h index bebbc4b8c7..46ed4e5a2d 100644 --- a/clients/oxygen/oxygenconfiguration.h +++ b/clients/oxygen/oxygenconfiguration.h @@ -38,6 +38,7 @@ 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"; @@ -243,6 +244,14 @@ namespace Oxygen virtual void setHideTitleBar( bool value ) { hideTitleBar_ = value; } + //! drop shadows + virtual bool useDropShadows( void ) const + { return useDropShadows_; } + + //! drop shadows + virtual void setUseDropShadows( bool value ) + { useDropShadows_ = value; } + //! oxygen shadows virtual bool useOxygenShadows( void ) const { return useOxygenShadows_; } @@ -309,6 +318,9 @@ namespace Oxygen //! hide titlebar completely (but not window border) bool hideTitleBar_; + //! drop shadows + bool useDropShadows_; + //! oxygen shadows bool useOxygenShadows_; diff --git a/clients/oxygen/oxygenshadowcache.cpp b/clients/oxygen/oxygenshadowcache.cpp index 3486c050be..0be8368703 100644 --- a/clients/oxygen/oxygenshadowcache.cpp +++ b/clients/oxygen/oxygenshadowcache.cpp @@ -152,7 +152,7 @@ namespace Oxygen static const qreal fixedSize = 25.5; qreal size( shadowSize() ); - qreal shadowSize( shadowConfiguration.shadowSize() ); + qreal shadowSize( shadowConfiguration.isEnabled() ? shadowConfiguration.shadowSize():0 ); QPixmap shadow = QPixmap( size*2, size*2 ); shadow.fill( Qt::transparent ); diff --git a/clients/oxygen/oxygenshadowcache.h b/clients/oxygen/oxygenshadowcache.h index ac3c798b97..09a4d2b641 100644 --- a/clients/oxygen/oxygenshadowcache.h +++ b/clients/oxygen/oxygenshadowcache.h @@ -74,7 +74,9 @@ namespace Oxygen //! shadow size qreal shadowSize( void ) const { - qreal size( qMax( activeShadowConfiguration_.shadowSize(), inactiveShadowConfiguration_.shadowSize() ) ); + qreal activeSize( activeShadowConfiguration_.isEnabled() ? activeShadowConfiguration_.shadowSize():0 ); + qreal inactiveSize( inactiveShadowConfiguration_.isEnabled() ? inactiveShadowConfiguration_.shadowSize():0 ); + qreal size( qMax( activeSize, inactiveSize ) ); // even if shadows are disabled, // you need a minimum size to allow corner rendering diff --git a/clients/oxygen/oxygenshadowconfiguration.cpp b/clients/oxygen/oxygenshadowconfiguration.cpp index 95142d1e53..5fdb2253b8 100644 --- a/clients/oxygen/oxygenshadowconfiguration.cpp +++ b/clients/oxygen/oxygenshadowconfiguration.cpp @@ -33,7 +33,8 @@ namespace Oxygen //_________________________________________________________ OxygenShadowConfiguration::OxygenShadowConfiguration( QPalette::ColorGroup colorGroup ): - colorGroup_( colorGroup ) + colorGroup_( colorGroup ), + enabled_( true ) { // check colorgroup @@ -69,7 +70,8 @@ namespace Oxygen //_________________________________________________________ OxygenShadowConfiguration::OxygenShadowConfiguration( QPalette::ColorGroup colorGroup, KConfigGroup group ): - colorGroup_( colorGroup ) + colorGroup_( colorGroup ), + enabled_( true ) { // get default configuration diff --git a/clients/oxygen/oxygenshadowconfiguration.h b/clients/oxygen/oxygenshadowconfiguration.h index d8198f3c7a..dfc1ef2d8e 100644 --- a/clients/oxygen/oxygenshadowconfiguration.h +++ b/clients/oxygen/oxygenshadowconfiguration.h @@ -66,6 +66,14 @@ namespace Oxygen QPalette::ColorGroup colorGroup( void ) const { return colorGroup_; } + //! enability + void setEnabled( bool value ) + { enabled_ = value; } + + //! enability + bool isEnabled( void ) const + { return enabled_; } + //! shadow size qreal shadowSize( void ) const { return shadowSize_; } @@ -121,6 +129,7 @@ namespace Oxygen { return colorGroup_ == other.colorGroup_ && + enabled_ == other.enabled_ && shadowSize_ == other.shadowSize_ && horizontalOffset_ == other.horizontalOffset_ && verticalOffset_ == other.verticalOffset_ && @@ -152,6 +161,9 @@ namespace Oxygen //! color group QPalette::ColorGroup colorGroup_; + //! enability + bool enabled_; + //! shadow size qreal shadowSize_;