From e22573e5865034a2467438f342862230350c8ce7 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 19 Sep 2011 15:31:18 +0200 Subject: [PATCH] buttons --- clients/oxygen/oxygenbutton.cpp | 33 +++++++++++++++++------------ clients/oxygen/oxygendecohelper.cpp | 7 +++--- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/clients/oxygen/oxygenbutton.cpp b/clients/oxygen/oxygenbutton.cpp index 5b4d53b81c..19819395bc 100644 --- a/clients/oxygen/oxygenbutton.cpp +++ b/clients/oxygen/oxygenbutton.cpp @@ -238,25 +238,30 @@ namespace Oxygen buttonDetailColor( _client.backgroundPalette( this, palette ) ): buttonDetailColor( palette ); - // glow color - QColor glow = isCloseButton() ? - _helper.viewNegativeTextBrush().brush(palette).color(): - _helper.viewHoverBrush().brush(palette).color(); - // decide decoration color - if( isAnimated() ) color = KColorUtils::mix( color, glow, glowIntensity() ); - else if( _status == Oxygen::Hovered ) color = glow; + QColor glow; + if( isAnimated() || _status == Oxygen::Hovered ) + { + glow = isCloseButton() ? + _helper.viewNegativeTextBrush().brush(palette).color(): + _helper.viewHoverBrush().brush(palette).color(); + + if( isAnimated() ) + { + + color = KColorUtils::mix( color, glow, glowIntensity() ); + glow = _helper.alphaColor( glow, glowIntensity() ); + + } else if( _status == Oxygen::Hovered ) color = glow; + + } if( hasDecoration() ) { - - // shadow color - if( isAnimated() ) shadow = _helper.alphaColor( glow, glowIntensity() ); - else if( _status == Oxygen::Hovered ) shadow = glow; - + // scale qreal scale( (21.0*_client.configuration().buttonSize())/22.0 ); - // decide on pressed state + // pressed state const bool pressed( (_status == Oxygen::Pressed) || ( _type == ButtonSticky && _client.isOnAllDesktops() ) || @@ -264,7 +269,7 @@ namespace Oxygen ( _type == ButtonBelow && _client.keepBelow() ) ); // draw button shape - painter.drawPixmap(0, 0, _helper.windecoButton( base, shadow, pressed, scale ) ); + painter.drawPixmap(0, 0, _helper.windecoButton( base, glow, pressed, scale ) ); } diff --git a/clients/oxygen/oxygendecohelper.cpp b/clients/oxygen/oxygendecohelper.cpp index 39f95728d8..eb2afa1bc3 100644 --- a/clients/oxygen/oxygendecohelper.cpp +++ b/clients/oxygen/oxygendecohelper.cpp @@ -66,14 +66,14 @@ namespace Oxygen QPainter p( pixmap ); p.setRenderHints(QPainter::Antialiasing); p.setPen(Qt::NoPen); - p.setWindow( 0, 0, 18, 18 ); + p.setWindow( 0, 0, 21, 21 ); // button shadow if( color.isValid() ) { p.save(); p.translate( 0, -1.2 ); - drawShadow( p, calcShadowColor( color ), 18 ); + drawShadow( p, calcShadowColor( color ), 21 ); p.restore(); } @@ -82,11 +82,12 @@ namespace Oxygen { p.save(); p.translate( 0, -1.2 ); - drawOuterGlow( p, glow, 18 ); + drawOuterGlow( p, glow, 21 ); p.restore(); } // button slab + p.setWindow( 0, 0, 18, 18 ); if( color.isValid() ) { p.translate( 0, (0.5-0.668) );