restored original drawFloatFrame method from oxygen windeco

svn path=/trunk/KDE/kdebase/workspace/; revision=1015647
remotes/origin/Plasma/5.0
Hugo Pereira Da Costa 17 years ago
parent 43df0f4fca
commit cf5b3972a5
  1. 109
      clients/nitrogen/lib/helper.cpp
  2. 10
      clients/nitrogen/lib/helper.h

@ -497,16 +497,9 @@ QPixmap NitrogenHelper::glow(const QColor &color, int size, int rsize)
} }
//_______________________________________________________________________________________________________________ //_______________________________________________________________________________________________________________
void NitrogenHelper::drawFloatFrame( void NitrogenHelper::drawFloatFrame(QPainter *p, const QRect r, const QColor &color, bool drawUglyShadow, bool isActive, const QColor &frameColor) const
QPainter *p,
const QRect r,
const QColor &color,
bool drawUglyShadow,
bool isActive,
const QColor &frameColor,
int frameBorder ) const
{ {
p->save();
p->setRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing);
QRect frame = r; QRect frame = r;
frame.adjust(1,1,-1,-1); frame.adjust(1,1,-1,-1);
@ -519,90 +512,48 @@ void NitrogenHelper::drawFloatFrame(
p->setBrush(Qt::NoBrush); p->setBrush(Qt::NoBrush);
if (drawUglyShadow && frameBorder >= 1 ) if (drawUglyShadow) {
{ if(isActive) { //window active - it's a glow - not a shadow
if(isActive)
{
//window active - it's a glow - not a shadow
p->setPen(glow); p->setPen(glow);
// top
p->drawLine(QPointF(x+4, y-0.5), QPointF(x+w-4, y-0.5)); 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-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); p->drawArc(QRectF(x+w-11+0.5, y-0.5, 11, 11), 0, 90*16);
p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-4));
if( frameBorder >= 3 ) 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->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-4)); p->drawArc(QRectF(x+w-11+0.5, y+h-11+0.5, 11, 11),270*16, 90*16);
p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h-4)); p->drawLine(QPointF(x+4, y+h+0.5), QPointF(x+w-4, y+h+0.5));
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));
}
light = KColorUtils::mix(light, frameColor); light = KColorUtils::mix(light, frameColor);
dark = KColorUtils::mix(dark, frameColor); dark = KColorUtils::mix(dark, frameColor);
}
} else { else { //window inactive - draw something resembling shadow
//window inactive - draw something resembling shadow
QColor shadow = KColorUtils::darken(color, 0.0, 0.0); // fully desaturate QColor shadow = KColorUtils::darken(color, 0.0, 0.0); // fully desaturate
p->setPen(KColorUtils::darken(shadow, 0.2)); p->setPen(KColorUtils::darken(shadow, 0.2));
p->drawLine(QPointF(x+4, y-0.5), QPointF(x+w-4, y-0.5)); 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-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); p->drawArc(QRectF(x+w-11+0.5, y-0.5, 11, 11), 0, 90*16);
p->setPen(KColorUtils::darken(shadow, 0.35));
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->setPen(KColorUtils::darken(shadow, 0.45));
p->setPen(KColorUtils::darken(shadow, 0.35)); p->drawArc(QRectF(x-0.5, y+h-11+0.5, 11, 11),180*16, 90*16);
p->drawLine(QPointF(x-0.5, y+4), QPointF(x-0.5, y+h-4)); p->drawArc(QRectF(x+w-11+0.5, y+h-11+0.5, 11, 11),270*16, 90*16);
p->drawLine(QPointF(x+w+0.5, y+4), QPointF(x+w+0.5, y+h-4)); p->setPen(KColorUtils::darken(shadow, 0.6));
p->setPen(KColorUtils::darken(shadow, 0.45)); p->drawLine(QPointF(x+4, y+h+0.5), QPointF(x+w-4, y+h+0.5));
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));
}
} }
} }
if( frameBorder >= 5 ) p->setPen(QPen(light, 0.8));
{ p->drawLine(QPointF(x+4, y+0.6), QPointF(x+w-4, y+0.6));
p->setPen(QPen(light, 0.8)); QLinearGradient lg = QLinearGradient(0.0, 1.5, 0.0, 4.5);
p->drawLine(QPointF(x+4, y+0.6), QPointF(x+w-4, y+0.6)); lg.setColorAt(0, light);
QLinearGradient lg = QLinearGradient(0.0, 1.5, 0.0, 4.5); lg.setColorAt(1, dark);
lg.setColorAt(0, light); p->setPen(QPen(lg, 0.8));
lg.setColorAt(1, dark); p->drawArc(QRectF(x+0.6, y+0.6, 9, 9),90*16, 90*16);
p->setPen(QPen(lg, 0.8)); p->drawArc(QRectF(x+w-9-0.6, y+0.6, 9, 9), 0, 90*16);
p->drawArc(QRectF(x+0.6, y+0.6, 9, 9),90*16, 90*16); p->drawLine(QPointF(x+0.6, y+4), QPointF(x+0.6, y+h-4));
p->drawArc(QRectF(x+w-9-0.6, y+0.6, 9, 9), 0, 90*16); p->drawLine(QPointF(x+w-0.6, y+4), QPointF(x+w-0.6, y+h-4));
p->drawLine(QPointF(x+0.6, y+4), QPointF(x+0.6, y+h-4)); p->restore();
p->drawLine(QPointF(x+w-0.6, y+4), QPointF(x+w-0.6, y+h-4));
}
return;
} }
//_______________________________________________________________________________________________________________ //_______________________________________________________________________________________________________________

@ -91,15 +91,7 @@ class NitrogenHelper
QPixmap windecoButtonGlow(const QColor &color, int size = 21); QPixmap windecoButtonGlow(const QColor &color, int size = 21);
//! frame //! frame
void drawFloatFrame( void drawFloatFrame(QPainter *p, const QRect r, const QColor &color, bool drawUglyShadow=true, bool isActive=false, const QColor &frameColor=QColor()) const;
QPainter *p,
const QRect r,
const QColor &color,
bool drawUglyShadow=true,
bool isActive=false,
const QColor &frameColor=QColor(),
int frameBorder = 5
) const;
//! separator //! separator
void drawSeparator(QPainter *p, const QRect &r, const QColor &color, Qt::Orientation orientation) const; void drawSeparator(QPainter *p, const QRect &r, const QColor &color, Qt::Orientation orientation) const;

Loading…
Cancel
Save