From 759cbbb8ff7e1a684cb11da7a53cfbb9c422d14a Mon Sep 17 00:00:00 2001 From: Casper Boemann Date: Thu, 18 Oct 2007 23:56:46 +0000 Subject: [PATCH] Add dividing line below titlebar Fiddle with metrics of buttons ad text a bit We are mostly done with win dec now - Only hover on buttons missing svn path=/trunk/KDE/kdebase/workspace/; revision=726799 --- clients/oxygen/oxygenbutton.cpp | 3 +++ clients/oxygen/oxygenclient.cpp | 35 +++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/clients/oxygen/oxygenbutton.cpp b/clients/oxygen/oxygenbutton.cpp index 402acaeee4..a980cef0b6 100644 --- a/clients/oxygen/oxygenbutton.cpp +++ b/clients/oxygen/oxygenbutton.cpp @@ -169,6 +169,9 @@ void OxygenButton::paintEvent(QPaintEvent *) else pal.setCurrentColorGroup(QPalette::Inactive); + if(client_.maximizeMode() == OxygenClient::MaximizeRestore) + painter.translate(0,-2); + QColor bg = helper_.backgroundTopColor(pal.window()); painter.drawPixmap(0, 0, helper_.windecoButton(pal.button())); diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 3304bcc8b3..268e16c40a 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -314,15 +314,46 @@ void OxygenClient::paintEvent(QPaintEvent *e) // draw title text painter.setFont(options()->font(isActive(), false)); painter.setPen(titlebarTextColor(palette)); - painter.drawText(titleLeft, titleTop, titleWidth, titleHeight, + painter.drawText(titleLeft, titleTop-2, titleWidth, titleHeight, // -2 is to go into top risizearea OxygenFactory::titleAlign() | Qt::AlignVCenter, caption()); painter.setRenderHint(QPainter::Antialiasing); - // Draw shadows of the frame + // Draw dividing line frame = widget()->rect(); frame.getRect(&x, &y, &w, &h); + QColor light = helper_.calcLightColor(palette.window()); + QColor dark = helper_.calcDarkColor(palette.window()); + dark.setAlpha(120); + + if(!isActive()) { + light.setAlpha(120); + dark.setAlpha(50); + } + + QLinearGradient lg(x,0,x+w,0); + lg.setColorAt(0.5, dark); + dark.setAlpha(0); + lg.setColorAt(0.0, dark); + lg.setColorAt(1.0, dark); + painter.setPen(QPen(lg,1)); + + painter.drawLine(QPointF(x, titleTop+titleHeight-1.5), + QPointF(x+w, titleTop+titleHeight-1.5)); + + lg = QLinearGradient(x,0,x+w,0); + lg.setColorAt(0.5, light); + light.setAlpha(0); + lg.setColorAt(0.0, light); + lg.setColorAt(1.0, light); + painter.setPen(QPen(lg,1)); + + painter.drawLine(QPointF(x, titleTop+titleHeight-0.5), + QPointF(x+w, titleTop+titleHeight-0.5)); + + // Draw shadows of the frame + painter.setBrush(Qt::NoBrush); painter.setPen(QColor(255,255,255, 120)); painter.drawLine(QPointF(0, 0.5), QPointF(w, 0.5));