From 90f10f219ad42eba9e8c2156282fe29f507a8ab7 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 8 Oct 2009 23:01:35 +0000 Subject: [PATCH] implemented new buttons (from nuno) svn path=/trunk/KDE/kdebase/workspace/; revision=1032950 --- clients/oxygen/oxygenbutton.cpp | 38 +++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/clients/oxygen/oxygenbutton.cpp b/clients/oxygen/oxygenbutton.cpp index 85f135ccb2..5c1a2f3b65 100644 --- a/clients/oxygen/oxygenbutton.cpp +++ b/clients/oxygen/oxygenbutton.cpp @@ -208,35 +208,51 @@ namespace Oxygen KColorScheme(palette.currentColorGroup()).foreground(KColorScheme::NegativeText).color(): KColorScheme(palette.currentColorGroup()).decoration(KColorScheme::HoverColor).color(); + // make glow darker + glow = helper_.calcDarkColor( glow ); + if( timeLineIsRunning() ) color = KColorUtils::mix( color, glow, opacity() ); else if( status_ == Oxygen::Hovered ) color = glow; // button shape color QColor bt = palette.window().color(); - // draw button shape - painter.drawPixmap(0, 0, helper_.windecoButton(bt, status_ == Oxygen::Pressed, (21.0*client_.configuration().buttonSize())/22 ) ); - // draw glow on hover if( timeLineIsRunning() ) { - painter.drawPixmap(0, 0, helper_.windecoButtonGlow( helper_.alphaColor( glow, opacity() ), (21.0*client_.configuration().buttonSize())/22)); + // mixed shadow and glow for smooth transition + painter.drawPixmap(0, 0, helper_.windecoButtonGlow( KColorUtils::mix( Qt::black, glow, opacity() ), (21.0*client_.configuration().buttonSize())/22)); } else if( status_ == Oxygen::Hovered ) { + // glow only painter.drawPixmap(0, 0, helper_.windecoButtonGlow(glow, (21.0*client_.configuration().buttonSize())/22)); + } else { + + // shadow only + painter.drawPixmap(0, 0, helper_.windecoButtonGlow(Qt::black, (21.0*client_.configuration().buttonSize())/22)); + } - // draw button icon - QLinearGradient lg = helper_.decoGradient( QRect( 4, 4, 13, 13 ), color); - painter.setRenderHints(QPainter::Antialiasing); - qreal width( 1.4 ); + // draw button shape + painter.drawPixmap(0, 0, helper_.windecoButton(bt, status_ == Oxygen::Pressed, (21.0*client_.configuration().buttonSize())/22.0 ) ); - painter.setBrush(Qt::NoBrush); - painter.setPen(QPen(color, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - drawIcon(&painter, palette, type_); + // draw button icon + painter.setRenderHints(QPainter::Antialiasing); + qreal width( 1.2 ); + + { + painter.setBrush(Qt::NoBrush); + painter.setPen(QPen( helper_.calcLightColor( bt ), width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + drawIcon(&painter, palette, type_); + + painter.translate(0,-1.5); + painter.setBrush(Qt::NoBrush); + painter.setPen(QPen(color, width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + drawIcon(&painter, palette, type_); + } }