From e43eff979256769d301d12ca2ed8d27bdcb14acd Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 22 Dec 2010 19:23:46 +0000 Subject: [PATCH] Added "Follow Style Hint" setting to the "fine tuning->background style" option When selected, the decoration looks for a WM Hint set by the style, to decide whether or not it should draw a gradient in the background. svn path=/trunk/KDE/kdebase/workspace/; revision=1208665 --- clients/oxygen/config/oxygenconfigurationui.cpp | 1 + clients/oxygen/config/oxygenexceptiondialog.cpp | 4 +++- clients/oxygen/oxygenclient.cpp | 6 +++++- clients/oxygen/oxygenconfiguration.cpp | 4 +++- clients/oxygen/oxygenconfiguration.h | 3 ++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/clients/oxygen/config/oxygenconfigurationui.cpp b/clients/oxygen/config/oxygenconfigurationui.cpp index 09e2c4f5e3..1b30fb0180 100644 --- a/clients/oxygen/config/oxygenconfigurationui.cpp +++ b/clients/oxygen/config/oxygenconfigurationui.cpp @@ -76,6 +76,7 @@ namespace Oxygen ui.blendColor->insertItems(0, QStringList() << Configuration::blendColorName( Configuration::NoBlending, true ) << Configuration::blendColorName( Configuration::RadialBlending, true ) + << Configuration::blendColorName( Configuration::BlendFromStyle, true ) ); // draw size grip diff --git a/clients/oxygen/config/oxygenexceptiondialog.cpp b/clients/oxygen/config/oxygenexceptiondialog.cpp index 28c6f4c2b2..2a2cae41e1 100644 --- a/clients/oxygen/config/oxygenexceptiondialog.cpp +++ b/clients/oxygen/config/oxygenexceptiondialog.cpp @@ -72,7 +72,9 @@ namespace Oxygen // blend color ui.blendColorComboBox->insertItems(0, QStringList() << Exception::blendColorName( Exception::NoBlending, true ) - << Exception::blendColorName( Exception::RadialBlending, true ) ); + << Exception::blendColorName( Exception::RadialBlending, true ) + << Exception::blendColorName( Exception::BlendFromStyle, true ) + ); ui.blendColorComboBox->setEnabled( false ); checkboxes_.insert( std::make_pair( Exception::BlendColor, ui.blendColorCheckBox ) ); connect( ui.blendColorCheckBox, SIGNAL( toggled( bool ) ), ui.blendColorComboBox, SLOT( setEnabled( bool ) ) ); diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 33682c2b49..4fee1b7c8e 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -522,7 +522,11 @@ namespace Oxygen void Client::renderWindowBackground( QPainter* painter, const QRect& rect, const QWidget* widget, const QPalette& palette ) const { - if( configuration().blendColor() == Configuration::NoBlending ) + if( + configuration().blendColor() == Configuration::NoBlending || + ( configuration().blendColor() == Configuration::BlendFromStyle && + !helper().hasBackgroundGradient( windowId() ) + ) ) { painter->fillRect( rect, palette.color( QPalette::Window ) ); diff --git a/clients/oxygen/oxygenconfiguration.cpp b/clients/oxygen/oxygenconfiguration.cpp index aa9abc3c9d..33759e61b7 100644 --- a/clients/oxygen/oxygenconfiguration.cpp +++ b/clients/oxygen/oxygenconfiguration.cpp @@ -37,7 +37,7 @@ namespace Oxygen titleAlignment_( Qt::AlignHCenter ), buttonSize_( ButtonDefault ), frameBorder_( BorderTiny ), - blendColor_( RadialBlending ), + blendColor_( BlendFromStyle ), sizeGripMode_( SizeGripWhenNeeded ), separatorMode_( SeparatorNever ), drawTitleOutline_( false ), @@ -306,6 +306,7 @@ namespace Oxygen { case NoBlending: out = translated ? i18n( "Solid Color" ):"Solid Color"; break; case RadialBlending: out = translated ? i18n( "Radial Gradient" ):"Radial Gradient"; break; + case BlendFromStyle: out = translated ? i18n( "Follow Style Hint" ):"Follow Style Hint"; break; default: return Configuration().blendColorName( translated ); } @@ -318,6 +319,7 @@ namespace Oxygen { if( value == blendColorName( NoBlending, translated ) ) return NoBlending; else if( value == blendColorName( RadialBlending, translated ) ) return RadialBlending; + else if( value == blendColorName( BlendFromStyle, translated ) ) return BlendFromStyle; else return Configuration().blendColor(); } diff --git a/clients/oxygen/oxygenconfiguration.h b/clients/oxygen/oxygenconfiguration.h index 76a45b14ba..6db18fb1cc 100644 --- a/clients/oxygen/oxygenconfiguration.h +++ b/clients/oxygen/oxygenconfiguration.h @@ -89,7 +89,8 @@ namespace Oxygen //! blend color enumeration enum BlendColorType { NoBlending, - RadialBlending + RadialBlending, + BlendFromStyle }; //! size grip mode