[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/artwork/Oxygen/style/code
From: Riccardo Iaconelli <ruphy () fsfe ! org>
Date: 2007-06-03 18:52:05
Message-ID: 1180896725.673280.31169.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 671084 by ruphy:
hover effect of pushbutton
the backligt animation still doesn't work though
Casper
M +4 -4 animation.cpp
M +28 -31 drawprimitive.cpp
M +12 -6 genpixmaps.cpp
M +2 -2 inlinehelp.cpp
M +1 -1 oxygen.h
--- trunk/playground/artwork/Oxygen/style/code/animation.cpp #671083:671084
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006-2007 by Thomas Lübking *
+ * Copyright (C) 2006-2007 by Thomas L�bking *
* thomas.luebking@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -447,15 +447,15 @@
HoverFades::iterator it = hoverWidgets.begin();
while (it != hoverWidgets.end()) {
if (it.value().fadeIn) {
- it.value().step += 2;
+ it.value().step += 1;
it.key()->update();
- if (it.value().step > 4)
+ if (it.value().step > 8)
it = hoverWidgets.erase(it);
else
++it;
}
else { // fade out
- --it.value().step;
+ it.value().step-=2;
it.key()->update();
if (it.value().step < 1)
it = hoverWidgets.erase(it);
--- trunk/playground/artwork/Oxygen/style/code/drawprimitive.cpp #671083:671084
@@ -75,17 +75,25 @@
int step = hoverStep(widget);
- QColor c = btnBgColor(PAL, isEnabled, 0, step);
+ QColor c = btnBgColor(PAL, isEnabled, 0, 0);
QRect r = RECT;
// shadow
- //shadows.button[sunken][hover||hasFocus].render(r, painter);
- shadows.button[sunken][0].render(r, painter);
+ shadows.button[sunken][hover?7:step].render(r, painter);
+/*
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(Qt::red);
+ painter->setRenderHint(QPainter::Antialiasing);
+ painter->drawRoundRect(r, ceil(9*90.0/r.width()), ceil(9*90.0/r.height()));
+*/
+ r.adjust(dpi.$4,dpi.$4,-dpi.$4,-dpi.$4);
- r.adjust(dpi.$4,dpi.$4,-dpi.$5,-dpi.$5);
-
+ // background
+ painter->setRenderHint(QPainter::Antialiasing,false);
fillWithMask(painter, r, c, &masks.button);
+ // edge and a nice light gradient
+ painter->setRenderHint(QPainter::Antialiasing);
QLinearGradient lg(0, r.x(), 0, r.bottom());
QGradientStops stops;
stops << QGradientStop( 0, QColor(255,255,255, (isEnabled&&!sunken ? 220 : \
160)) ) @@ -99,33 +107,22 @@
lg2.setStops(stops);
painter->setPen(QPen(QBrush(lg),1));
painter->setBrush(lg2);
- painter->drawRoundRect(r, ceil(9*90.0/r.width()), ceil(9*90.0/r.height()));
+ QRectF rf = r;
+ rf.adjust(0.5, 0.5,-0.5,-0.5);
+ painter->drawRoundRect(rf, ceil(9*90.0/r.width()), ceil(9*90.0/r.height()));
-
- painter->setRenderHint(QPainter::Antialiasing);
-
- if (hover) {
- QRadialGradient rg = QRadialGradient(r.width()/2.0, 0.35*r.height(), \
qMax(r.width(),r.height())/2.0 - 5, r.width()/2.0, 0.35*r.height());
- stops << QGradientStop( 0, QColor(255, 255, 255, 190) )
- << QGradientStop( 1, QColor(255, 255, 255, 60) );
- rg.setStops(stops);
- painter->setPen(Qt::NoPen);
- painter->setBrush(rg);
- painter->drawRoundRect(r, ceil(9*90.0/r.width()), ceil(9*90.0/r.height()));
- }
-
-/* // glass
- if (sunken) r.adjust($1,0,-$1,-$1);
- else r.adjust($3,$1,-$3,-$3);
- if (isEnabled) {
- GradientType gt = isOn ? GradSunken : ( isDefault ? config.gradientStrong : \
config.gradBtn);
- fillWithMask(painter, r, gradient(c, r.height(), Qt::Vertical, gt), \
&masks.button);
- // border - glass has over or underlightened borders,
- // we assume 360� overlight - looks nicer with the shadows ;)
- masks.button.outline(r, painter, Qt::white, true);
- }
- else
-*/ break;
+ // hover effect
+ QRadialGradient rg = QRadialGradient(r.width()/2.0, 0.35*r.height(), \
qMax(r.width(),r.height())/2.0 - 5, r.width()/2.0, 0.35*r.height()); + c = \
btnBgColor(PAL, isEnabled, hover, step); + c.setAlpha(190);
+ QColor c2= c;
+ c2.setAlpha(60);
+ stops << QGradientStop( 0, c ) << QGradientStop( 1, c2 );
+ rg.setStops(stops);
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(rg);
+ painter->drawRoundRect(r, ceil(9*90.0/r.width()), ceil(9*90.0/r.height()));
+ break;
}
case PE_PanelButtonTool: { // Panel for a Tool button, used with QToolButton.
if (sunken || (option->state & State_On)) {
--- trunk/playground/artwork/Oxygen/style/code/genpixmaps.cpp #671083:671084
@@ -14,7 +14,7 @@
int $7 = dpi.$7, $8 = dpi.$8;
int $13 = dpi.$13, $15 = $7+$8, $6 = dpi.$6;
tmp = QPixmap($15,$15);
- for (int i = 0; i < 2; ++i) { // opaque?
+ for (int i = 0; i < 8; ++i) { // opaque?
for (int j = 0; j < 2; ++j) { // sunken?
tmp.fill(Qt::transparent);
p.begin(&tmp);
@@ -23,6 +23,7 @@
QRadialGradient rg;
if (j) {
rg = QRadialGradient($15/2.0, $15/2.0, $5, $15/2.0, $15/2.0+$3);
+ stops.clear();
stops << QGradientStop( 0, QColor(0,0,0, 150) )
<< QGradientStop( 0.59, QColor(0,0,0, 70) )
<< QGradientStop( 1, QColor(0,0,0, 0) );
@@ -30,21 +31,25 @@
}
else {
rg = QRadialGradient($15/2.0, $15/2.0, $15/2.0, $15/2.0, $15/2.0+$2);
+ stops.clear();
stops << QGradientStop( 0, QColor(0,0,0, 160) )
<< QGradientStop( 0.4, QColor(0,0,0, 60) )
<< QGradientStop( 0.85, QColor(0,0,0, 0) )
<< QGradientStop( 1, QColor(0,0,0, 0) );
rg.setStops(stops);
+
+ if (i) {
+ rg = QRadialGradient($15/2.0, $15/2.0, $15/2.0, $15/2.0, $15/2.0);
+ stops.clear();
+ stops << QGradientStop( 0, QColor(222,193,0, 180*i/7) )
+ << QGradientStop( 1, QColor(222,193,0,0) );
+ rg.setStops(stops);
+ }
}
p.setBrush(rg);
p.drawRoundRect(0,0,$15,$15,90,90);
- // erase inner part where button is
- p.setCompositionMode( QPainter::CompositionMode_Clear );
-//p.setBrush(Qt::red);
- p.drawRoundRect($5,$5,$5,$6,99,99);
-
p.end();
shadows.button[j][i] = Tile::Set(tmp,$7,$7,$15-2*$7,$15-2*$7);
}
@@ -72,6 +77,7 @@
p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::Antialiasing);
rg = QRadialGradient($9/2.0,$9/2.0, dpi.$5, $9/2.0,$9/2.0+1.5*$1);
+ stops.clear();
stops << QGradientStop( 0, QColor(0,0,0, 0) )
<< QGradientStop( 0.4, QColor(0,0,0, 0) )
<< QGradientStop( 0.58, QColor(0,0,0, 40/2) )
--- trunk/playground/artwork/Oxygen/style/code/inlinehelp.cpp #671083:671084
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006-2007 by Thomas Lübking *
+ * Copyright (C) 2006-2007 by Thomas L�bking *
* thomas.luebking@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -94,7 +94,7 @@
if (step)
return midColor(TMP_CONF_COLOR(role_btn[0]),
TMP_CONF_COLOR(role_btnHover[0]),
- 6-step, step);
+ 8-step, step);
if (hover)
return TMP_CONF_COLOR(role_btnHover[0]);
return TMP_CONF_COLOR(role_btn[0]).dark(103);
--- trunk/playground/artwork/Oxygen/style/code/oxygen.h #671083:671084
@@ -318,7 +318,7 @@
QRegion popupCorner[4];
} masks;
struct {
- Tile::Set button[2][2], tab, sunken, group, lineEdit[2], raised, relief;
+ Tile::Set button[2][8], tab, sunken, group, lineEdit[2], raised, relief;
QPixmap radio[2][2];
QPixmap winClose[2], winMin[2], winMax[2];
Tile::Line line[2][3];
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic