This commit is contained in:
Hugo Pereira Da Costa 2011-09-19 15:31:18 +02:00
parent b8a767e3cf
commit e22573e586
2 changed files with 23 additions and 17 deletions

View file

@ -238,25 +238,30 @@ namespace Oxygen
buttonDetailColor( _client.backgroundPalette( this, palette ) ): buttonDetailColor( _client.backgroundPalette( this, palette ) ):
buttonDetailColor( palette ); buttonDetailColor( palette );
// glow color // decide decoration color
QColor glow = isCloseButton() ? QColor glow;
if( isAnimated() || _status == Oxygen::Hovered )
{
glow = isCloseButton() ?
_helper.viewNegativeTextBrush().brush(palette).color(): _helper.viewNegativeTextBrush().brush(palette).color():
_helper.viewHoverBrush().brush(palette).color(); _helper.viewHoverBrush().brush(palette).color();
// decide decoration color if( isAnimated() )
if( isAnimated() ) color = KColorUtils::mix( color, glow, glowIntensity() ); {
else if( _status == Oxygen::Hovered ) color = glow;
color = KColorUtils::mix( color, glow, glowIntensity() );
glow = _helper.alphaColor( glow, glowIntensity() );
} else if( _status == Oxygen::Hovered ) color = glow;
}
if( hasDecoration() ) if( hasDecoration() )
{ {
// scale
// shadow color
if( isAnimated() ) shadow = _helper.alphaColor( glow, glowIntensity() );
else if( _status == Oxygen::Hovered ) shadow = glow;
qreal scale( (21.0*_client.configuration().buttonSize())/22.0 ); qreal scale( (21.0*_client.configuration().buttonSize())/22.0 );
// decide on pressed state // pressed state
const bool pressed( const bool pressed(
(_status == Oxygen::Pressed) || (_status == Oxygen::Pressed) ||
( _type == ButtonSticky && _client.isOnAllDesktops() ) || ( _type == ButtonSticky && _client.isOnAllDesktops() ) ||
@ -264,7 +269,7 @@ namespace Oxygen
( _type == ButtonBelow && _client.keepBelow() ) ); ( _type == ButtonBelow && _client.keepBelow() ) );
// draw button shape // draw button shape
painter.drawPixmap(0, 0, _helper.windecoButton( base, shadow, pressed, scale ) ); painter.drawPixmap(0, 0, _helper.windecoButton( base, glow, pressed, scale ) );
} }

View file

@ -66,14 +66,14 @@ namespace Oxygen
QPainter p( pixmap ); QPainter p( pixmap );
p.setRenderHints(QPainter::Antialiasing); p.setRenderHints(QPainter::Antialiasing);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setWindow( 0, 0, 18, 18 ); p.setWindow( 0, 0, 21, 21 );
// button shadow // button shadow
if( color.isValid() ) if( color.isValid() )
{ {
p.save(); p.save();
p.translate( 0, -1.2 ); p.translate( 0, -1.2 );
drawShadow( p, calcShadowColor( color ), 18 ); drawShadow( p, calcShadowColor( color ), 21 );
p.restore(); p.restore();
} }
@ -82,11 +82,12 @@ namespace Oxygen
{ {
p.save(); p.save();
p.translate( 0, -1.2 ); p.translate( 0, -1.2 );
drawOuterGlow( p, glow, 18 ); drawOuterGlow( p, glow, 21 );
p.restore(); p.restore();
} }
// button slab // button slab
p.setWindow( 0, 0, 18, 18 );
if( color.isValid() ) if( color.isValid() )
{ {
p.translate( 0, (0.5-0.668) ); p.translate( 0, (0.5-0.668) );