From cf5b3972a576f4e2bcc5a11dfc2d4b0f4f9cfd02 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 26 Aug 2009 04:30:37 +0000 Subject: [PATCH] restored original drawFloatFrame method from oxygen windeco svn path=/trunk/KDE/kdebase/workspace/; revision=1015647 --- clients/nitrogen/lib/helper.cpp | 109 +++++++++----------------------- clients/nitrogen/lib/helper.h | 10 +-- 2 files changed, 31 insertions(+), 88 deletions(-) diff --git a/clients/nitrogen/lib/helper.cpp b/clients/nitrogen/lib/helper.cpp index 8efed5602e..52013011ec 100644 --- a/clients/nitrogen/lib/helper.cpp +++ b/clients/nitrogen/lib/helper.cpp @@ -497,16 +497,9 @@ QPixmap NitrogenHelper::glow(const QColor &color, int size, int rsize) } //_______________________________________________________________________________________________________________ -void NitrogenHelper::drawFloatFrame( - QPainter *p, - const QRect r, - const QColor &color, - bool drawUglyShadow, - bool isActive, - const QColor &frameColor, - int frameBorder ) const +void NitrogenHelper::drawFloatFrame(QPainter *p, const QRect r, const QColor &color, bool drawUglyShadow, bool isActive, const QColor &frameColor) const { - + p->save(); p->setRenderHint(QPainter::Antialiasing); QRect frame = r; frame.adjust(1,1,-1,-1); @@ -519,90 +512,48 @@ void NitrogenHelper::drawFloatFrame( p->setBrush(Qt::NoBrush); - if (drawUglyShadow && frameBorder >= 1 ) - { - - if(isActive) - { - - //window active - it's a glow - not a shadow + if (drawUglyShadow) { + if(isActive) { //window active - it's a glow - not a shadow p->setPen(glow); - - // top p->drawLine(QPointF(x+4, y-0.5), QPointF(x+w-4, y-0.5)); p->drawArc(QRectF(x-0.5, y-0.5, 11, 11),90*16, 90*16); p->drawArc(QRectF(x+w-11+0.5, y-0.5, 11, 11), 0, 90*16); - - if( frameBorder >= 3 ) - { - p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-4)); - p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h-4)); - p->drawArc(QRectF(0.5, y+h-11+0.5, 11, 11),180*16, 90*16); - p->drawArc(QRectF(x+w-11+0.5, y+h-11+0.5, 11, 11),270*16, 90*16); - - // bottom - p->drawLine(QPointF(x+4, y+h+0.5), QPointF(x+w-4, y+h+0.5)); - - } else { - - p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h+0.5)); - p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h+0.5)); - p->drawLine(QPointF(x-0.5, y+h+0.5), QPointF(x+w+0.5, y+h+0.5)); - - } - + p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-4)); + p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h-4)); + p->drawArc(QRectF(x-0.5, y+h-11+0.5, 11, 11),180*16, 90*16); + p->drawArc(QRectF(x+w-11+0.5, y+h-11+0.5, 11, 11),270*16, 90*16); + p->drawLine(QPointF(x+4, y+h+0.5), QPointF(x+w-4, y+h+0.5)); light = KColorUtils::mix(light, frameColor); dark = KColorUtils::mix(dark, frameColor); - - } else { - - //window inactive - draw something resembling shadow + } + else { //window inactive - draw something resembling shadow QColor shadow = KColorUtils::darken(color, 0.0, 0.0); // fully desaturate p->setPen(KColorUtils::darken(shadow, 0.2)); - p->drawLine(QPointF(x+4, y-0.5), QPointF(x+w-4, y-0.5)); p->drawArc(QRectF(x-0.5, y-0.5, 11, 11),90*16, 90*16); p->drawArc(QRectF(x+w-11+0.5, y-0.5, 11, 11), 0, 90*16); - - if( frameBorder >= 3 ) - { - - p->setPen(KColorUtils::darken(shadow, 0.35)); - p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-4)); - p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h-4)); - p->setPen(KColorUtils::darken(shadow, 0.45)); - p->drawArc(QRectF(0.5, y+h-11+0.5, 11, 11),180*16, 90*16); - p->drawArc(QRectF(x+w-11+0.5, y+h-11+0.5, 11, 11),270*16, 90*16); - p->setPen(KColorUtils::darken(shadow, 0.6)); - p->drawLine(QPointF(x+4, y+h+0.5), QPointF(x+w-4, y+h+0.5)); - - } else { - - p->setPen(KColorUtils::darken(shadow, 0.35)); - p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-0.5)); - p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h-0.5)); - p->setPen(KColorUtils::darken(shadow, 0.6)); - p->drawLine(QPointF(x+0.5, y+h+0.5), QPointF(x+w-0.5, y+h+0.5)); - - } + p->setPen(KColorUtils::darken(shadow, 0.35)); + p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-4)); + p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h-4)); + p->setPen(KColorUtils::darken(shadow, 0.45)); + p->drawArc(QRectF(x-0.5, y+h-11+0.5, 11, 11),180*16, 90*16); + p->drawArc(QRectF(x+w-11+0.5, y+h-11+0.5, 11, 11),270*16, 90*16); + p->setPen(KColorUtils::darken(shadow, 0.6)); + p->drawLine(QPointF(x+4, y+h+0.5), QPointF(x+w-4, y+h+0.5)); } } - if( frameBorder >= 5 ) - { - p->setPen(QPen(light, 0.8)); - p->drawLine(QPointF(x+4, y+0.6), QPointF(x+w-4, y+0.6)); - QLinearGradient lg = QLinearGradient(0.0, 1.5, 0.0, 4.5); - lg.setColorAt(0, light); - lg.setColorAt(1, dark); - p->setPen(QPen(lg, 0.8)); - p->drawArc(QRectF(x+0.6, y+0.6, 9, 9),90*16, 90*16); - p->drawArc(QRectF(x+w-9-0.6, y+0.6, 9, 9), 0, 90*16); - p->drawLine(QPointF(x+0.6, y+4), QPointF(x+0.6, y+h-4)); - p->drawLine(QPointF(x+w-0.6, y+4), QPointF(x+w-0.6, y+h-4)); - } - - return; + p->setPen(QPen(light, 0.8)); + p->drawLine(QPointF(x+4, y+0.6), QPointF(x+w-4, y+0.6)); + QLinearGradient lg = QLinearGradient(0.0, 1.5, 0.0, 4.5); + lg.setColorAt(0, light); + lg.setColorAt(1, dark); + p->setPen(QPen(lg, 0.8)); + p->drawArc(QRectF(x+0.6, y+0.6, 9, 9),90*16, 90*16); + p->drawArc(QRectF(x+w-9-0.6, y+0.6, 9, 9), 0, 90*16); + p->drawLine(QPointF(x+0.6, y+4), QPointF(x+0.6, y+h-4)); + p->drawLine(QPointF(x+w-0.6, y+4), QPointF(x+w-0.6, y+h-4)); + p->restore(); } //_______________________________________________________________________________________________________________ diff --git a/clients/nitrogen/lib/helper.h b/clients/nitrogen/lib/helper.h index a88e145862..bd9bd4d6e3 100644 --- a/clients/nitrogen/lib/helper.h +++ b/clients/nitrogen/lib/helper.h @@ -91,15 +91,7 @@ class NitrogenHelper QPixmap windecoButtonGlow(const QColor &color, int size = 21); //! frame - void drawFloatFrame( - QPainter *p, - const QRect r, - const QColor &color, - bool drawUglyShadow=true, - bool isActive=false, - const QColor &frameColor=QColor(), - int frameBorder = 5 - ) const; + void drawFloatFrame(QPainter *p, const QRect r, const QColor &color, bool drawUglyShadow=true, bool isActive=false, const QColor &frameColor=QColor()) const; //! separator void drawSeparator(QPainter *p, const QRect &r, const QColor &color, Qt::Orientation orientation) const;