From a05eecf4f04722317558db7b20467f365fac53f5 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Fri, 16 Sep 2011 17:49:45 +0200 Subject: [PATCH] improved and simplified window decoration buttons. --- clients/oxygen/oxygendecohelper.cpp | 43 +++++------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/clients/oxygen/oxygendecohelper.cpp b/clients/oxygen/oxygendecohelper.cpp index 3e37aa1c17..732425ca92 100644 --- a/clients/oxygen/oxygendecohelper.cpp +++ b/clients/oxygen/oxygendecohelper.cpp @@ -67,49 +67,20 @@ namespace Oxygen p.setRenderHints(QPainter::Antialiasing); p.setPen(Qt::NoPen); p.setWindow( 0, 0, 18, 18 ); - p.translate( 0.5, (0.5-0.668) ); // button glow if( glow.isValid() ) { - - { - // outer shadow - QRadialGradient rg( 8.5, 8.5, 8.5 ); - - static const int nPoints(5); - const qreal x[5] = { 0.61, 0.72, 0.81, 0.9, 1}; - const qreal values[5] = { 255-172, 255-178, 255-210, 255-250, 0 }; - QColor c = glow; - for( int i = 0; irect() ); - p.setBrush( rg ); - p.drawRect( r ); - } - - { - // inner shadow - QRadialGradient rg( 8.5, 8.5, 8.5 ); - - static const int nPoints(6); - const qreal x[6] = { 0.61, 0.67, 0.7, 0.74, 0.78, 1 }; - const qreal values[6] = { 255-92, 255-100, 255-135, 255-205, 255-250, 0 }; - QColor c = glow; - for( int i = 0; irect() ); - p.setBrush( rg ); - p.drawRect( r ); - } - + p.save(); + p.translate( 0, -1.2 ); + drawShadow( p, glow, 18 ); + p.restore(); } // button slab if( color.isValid() ) { + p.translate( 0, (0.5-0.668) ); const QColor light( calcLightColor(color) ); const QColor dark( calcDarkColor(color) ); @@ -126,7 +97,7 @@ namespace Oxygen lg.setColorAt( 1, dark ); } - const QRectF r( 0.5*(17-12.33), 1.665, 12.33, 12.33 ); + const QRectF r( 0.5*(18-12.33), 1.665, 12.33, 12.33 ); p.setBrush( lg ); p.drawEllipse( r ); } @@ -137,7 +108,7 @@ namespace Oxygen QLinearGradient lg( 0, 1.665, 0, (2.0*12.33+1.665) ); lg.setColorAt( 0, light ); lg.setColorAt( 1, dark ); - const QRectF r( 0.5*(17-12.33+penWidth), (1.665+penWidth), (12.33-penWidth), (12.33-penWidth) ); + const QRectF r( 0.5*(18-12.33+penWidth), (1.665+penWidth), (12.33-penWidth), (12.33-penWidth) ); p.setPen( QPen( lg, penWidth ) ); p.setBrush( Qt::NoBrush ); p.drawEllipse( r );