-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 14 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.cpp | 2 |
2 files changed, 3 insertions, 13 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 4653639..2b6eaa4 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -1,1319 +1,1309 @@ | |||
1 | /*- | 1 | /*- |
2 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. | 2 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
7 | #ifndef INCLUDE_MENUITEM_DEF | 7 | #ifndef INCLUDE_MENUITEM_DEF |
8 | #define INCLUDE_MENUITEM_DEF | 8 | #define INCLUDE_MENUITEM_DEF |
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | #include <qmenudata.h> | 11 | #include <qmenudata.h> |
12 | #include "liquid.h" | 12 | #include "liquid.h" |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | #include <qpe/config.h> | 14 | #include <qpe/config.h> |
15 | #include "effects.h" | 15 | #include "effects.h" |
16 | #include <qpalette.h> | 16 | #include <qpalette.h> |
17 | #include <qbitmap.h> | 17 | #include <qbitmap.h> |
18 | #include <qtabbar.h> | 18 | #include <qtabbar.h> |
19 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
20 | #include <qobjectlist.h> | 20 | #include <qobjectlist.h> |
21 | #include <qimage.h> | 21 | #include <qimage.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qpixmapcache.h> | 23 | #include <qpixmapcache.h> |
24 | #include <qradiobutton.h> | 24 | #include <qradiobutton.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qdrawutil.h> | 26 | #include <qdrawutil.h> |
27 | #include <qwidgetlist.h> | 27 | #include <qwidgetlist.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qheader.h> | 29 | #include <qheader.h> |
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | #include <qmenubar.h> | 31 | #include <qmenubar.h> |
32 | 32 | ||
33 | 33 | ||
34 | #include <stdio.h> | 34 | #include <stdio.h> |
35 | 35 | ||
36 | #include "htmlmasks.h" | 36 | #include "htmlmasks.h" |
37 | #include "embeddata.h" | 37 | #include "embeddata.h" |
38 | 38 | ||
39 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, | 39 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, |
40 | QColorGroup &, bool, bool); | 40 | QColorGroup &, bool, bool); |
41 | 41 | ||
42 | QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); | 42 | QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); |
43 | 43 | ||
44 | void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) | 44 | void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) |
45 | { | 45 | { |
46 | QImage img(pix.convertToImage()); | 46 | QImage img(pix.convertToImage()); |
47 | QImageEffect::fade(img, 0.9, color); | 47 | QImageEffect::fade(img, 0.9, color); |
48 | int x, y; | 48 | int x, y; |
49 | int r, g, b; | 49 | int r, g, b; |
50 | for(y=0; y < img.height(); y+=3){ | 50 | for(y=0; y < img.height(); y+=3){ |
51 | unsigned int *data = (unsigned int *) img.scanLine(y); | 51 | unsigned int *data = (unsigned int *) img.scanLine(y); |
52 | for(x=0; x < img.width(); ++x){ | 52 | for(x=0; x < img.width(); ++x){ |
53 | r = qRed(data[x]); | 53 | r = qRed(data[x]); |
54 | g = qGreen(data[x]); | 54 | g = qGreen(data[x]); |
55 | b = qBlue(data[x]); | 55 | b = qBlue(data[x]); |
56 | if(r-10) | 56 | if(r-10) |
57 | r-=10; | 57 | r-=10; |
58 | if(g-10) | 58 | if(g-10) |
59 | g-=10; | 59 | g-=10; |
60 | if(b-10) | 60 | if(b-10) |
61 | b-=10; | 61 | b-=10; |
62 | data[x] = qRgb(r, g, b); | 62 | data[x] = qRgb(r, g, b); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | pix.convertFromImage(img); | 65 | pix.convertFromImage(img); |
66 | } | 66 | } |
67 | 67 | ||
68 | TransMenuHandler::TransMenuHandler(QObject *parent) | 68 | TransMenuHandler::TransMenuHandler(QObject *parent) |
69 | : QObject(parent) | 69 | : QObject(parent) |
70 | { | 70 | { |
71 | pixDict.setAutoDelete(true); | 71 | pixDict.setAutoDelete(true); |
72 | reloadSettings(); | 72 | reloadSettings(); |
73 | } | 73 | } |
74 | 74 | ||
75 | void TransMenuHandler::reloadSettings() | 75 | void TransMenuHandler::reloadSettings() |
76 | { | 76 | { |
77 | pixDict.clear(); | 77 | pixDict.clear(); |
78 | 78 | ||
79 | Config config ( "qpe" ); | 79 | Config config ( "qpe" ); |
80 | config. setGroup ( "MosfetMenus" ); | 80 | config. setGroup ( "MosfetMenus" ); |
81 | 81 | ||
82 | type = config. readNumEntry("Type", TransStippleBg); | 82 | type = config. readNumEntry("Type", TransStippleBg); |
83 | color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); | 83 | color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); |
84 | fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); | 84 | fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); |
85 | opacity = config. readNumEntry("Opacity", 10); | 85 | opacity = config. readNumEntry("Opacity", 10); |
86 | if ( opacity < -20 ) | 86 | if ( opacity < -20 ) |
87 | opacity = 20; | 87 | opacity = 20; |
88 | else if ( opacity > 20 ) | 88 | else if ( opacity > 20 ) |
89 | opacity = 20; | 89 | opacity = 20; |
90 | 90 | ||
91 | shadowText = config. readBoolEntry("ShadowText", true); | 91 | shadowText = config. readBoolEntry("ShadowText", true); |
92 | } | 92 | } |
93 | 93 | ||
94 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | 94 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) |
95 | { | 95 | { |
96 | QWidget *p = (QWidget *)obj; | 96 | QWidget *p = (QWidget *)obj; |
97 | 97 | ||
98 | if(ev->type() == QEvent::Show){ | 98 | if(ev->type() == QEvent::Show){ |
99 | if(type == TransStippleBg || type == TransStippleBtn || | 99 | if(type == TransStippleBg || type == TransStippleBtn || |
100 | type == Custom){ | 100 | type == Custom){ |
101 | QApplication::syncX(); | 101 | QApplication::syncX(); |
102 | QPixmap *pix = new QPixmap; | 102 | QPixmap *pix = new QPixmap; |
103 | if(p->testWFlags(Qt::WType_Popup)){ | 103 | if(p->testWFlags(Qt::WType_Popup)){ |
104 | QRect r(p->x(), p->y(), p->width(), p->height()); | 104 | QRect r(p->x(), p->y(), p->width(), p->height()); |
105 | QRect deskR = QApplication::desktop()->rect(); | 105 | QRect deskR = QApplication::desktop()->rect(); |
106 | if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ | 106 | if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ |
107 | r.setBottom(deskR.bottom()); | 107 | r.setBottom(deskR.bottom()); |
108 | r.setRight(deskR.right()); | 108 | r.setRight(deskR.right()); |
109 | } | 109 | } |
110 | *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), | 110 | *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), |
111 | r.width(), r.height()); | 111 | r.width(), r.height()); |
112 | } | 112 | } |
113 | else{ // tear off menu | 113 | else{ // tear off menu |
114 | pix->resize(p->width(), p->height()); | 114 | pix->resize(p->width(), p->height()); |
115 | pix->fill(Qt::black.rgb()); | 115 | pix->fill(Qt::black.rgb()); |
116 | } | 116 | } |
117 | if(type == TransStippleBg){ | 117 | if(type == TransStippleBg){ |
118 | stripePixmap(*pix, p->colorGroup().background()); | 118 | stripePixmap(*pix, p->colorGroup().background()); |
119 | } | 119 | } |
120 | else if(type == TransStippleBtn){ | 120 | else if(type == TransStippleBtn){ |
121 | stripePixmap(*pix, p->colorGroup().button()); | 121 | stripePixmap(*pix, p->colorGroup().button()); |
122 | } | 122 | } |
123 | else{ | 123 | else{ |
124 | QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 124 | QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
125 | } | 125 | } |
126 | 126 | ||
127 | if (p->inherits("QPopupMenu")) | 127 | if (p->inherits("QPopupMenu")) |
128 | pixDict.insert(p->winId(), pix); | 128 | pixDict.insert(p->winId(), pix); |
129 | else { | 129 | else { |
130 | p->setBackgroundPixmap(*pix); | 130 | p->setBackgroundPixmap(*pix); |
131 | 131 | ||
132 | QObjectList *ol = p-> queryList("QWidget"); | 132 | QObjectList *ol = p-> queryList("QWidget"); |
133 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 133 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
134 | QWidget *wid = (QWidget *) it.current ( ); | 134 | QWidget *wid = (QWidget *) it.current ( ); |
135 | 135 | ||
136 | wid-> setBackgroundPixmap(*pix); | 136 | wid-> setBackgroundPixmap(*pix); |
137 | wid-> setBackgroundOrigin(QWidget::ParentOrigin); | 137 | wid-> setBackgroundOrigin(QWidget::ParentOrigin); |
138 | } | 138 | } |
139 | delete ol; | 139 | delete ol; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } | 142 | } |
143 | else if(ev->type() == QEvent::Hide){ | 143 | else if(ev->type() == QEvent::Hide){ |
144 | if(type == TransStippleBg || type == TransStippleBtn || | 144 | if(type == TransStippleBg || type == TransStippleBtn || |
145 | type == Custom){ | 145 | type == Custom){ |
146 | // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 146 | // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
147 | 147 | ||
148 | if (p->inherits("QPopupMenu")) | 148 | if (p->inherits("QPopupMenu")) |
149 | pixDict.remove(p->winId()); | 149 | pixDict.remove(p->winId()); |
150 | else { | 150 | else { |
151 | p->setBackgroundMode(QWidget::PaletteBackground); | 151 | p->setBackgroundMode(QWidget::PaletteBackground); |
152 | 152 | ||
153 | QObjectList *ol = p-> queryList("QWidget"); | 153 | QObjectList *ol = p-> queryList("QWidget"); |
154 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 154 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
155 | QWidget *wid = (QWidget *) it.current ( ); | 155 | QWidget *wid = (QWidget *) it.current ( ); |
156 | 156 | ||
157 | wid-> setBackgroundMode( QWidget::PaletteBackground ); | 157 | wid-> setBackgroundMode( QWidget::PaletteBackground ); |
158 | } | 158 | } |
159 | delete ol; | 159 | delete ol; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
163 | else if(ev->type() == QEvent::Paint){ | ||
164 | if(type == TransStippleBg || type == TransStippleBtn || | ||
165 | type == Custom){ | ||
166 | // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | ||
167 | |||
168 | if (!p->inherits("QPopupMenu")) | ||
169 | p->erase(); | ||
170 | } | ||
171 | } | ||
172 | return(false); | 163 | return(false); |
173 | } | 164 | } |
174 | 165 | ||
175 | 166 | ||
176 | LiquidStyle::LiquidStyle() | 167 | LiquidStyle::LiquidStyle() |
177 | :QWindowsStyle() | 168 | :QWindowsStyle() |
178 | { | 169 | { |
179 | setName ( "LiquidStyle" ); | 170 | setName ( "LiquidStyle" ); |
180 | 171 | ||
181 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 172 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
182 | btnMaskBmp.setMask(btnMaskBmp); | 173 | btnMaskBmp.setMask(btnMaskBmp); |
183 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 174 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
184 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); | 175 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); |
185 | headerHoverID = -1; | 176 | headerHoverID = -1; |
186 | highlightWidget = NULL; | 177 | highlightWidget = NULL; |
187 | setButtonDefaultIndicatorWidth(0); | 178 | setButtonDefaultIndicatorWidth(0); |
188 | btnDict.setAutoDelete(true); | 179 | btnDict.setAutoDelete(true); |
189 | bevelFillDict.setAutoDelete(true); | 180 | bevelFillDict.setAutoDelete(true); |
190 | smallBevelFillDict.setAutoDelete(true); | 181 | smallBevelFillDict.setAutoDelete(true); |
191 | customBtnColorList.setAutoDelete(true); | 182 | customBtnColorList.setAutoDelete(true); |
192 | customBtnIconList.setAutoDelete(true); | 183 | customBtnIconList.setAutoDelete(true); |
193 | customBtnLabelList.setAutoDelete(true); | 184 | customBtnLabelList.setAutoDelete(true); |
194 | 185 | ||
195 | rMatrix.rotate(270.0); | 186 | rMatrix.rotate(270.0); |
196 | highcolor = QPixmap::defaultDepth() > 8; | 187 | highcolor = QPixmap::defaultDepth() > 8; |
197 | btnBorderPix = new QPixmap; | 188 | btnBorderPix = new QPixmap; |
198 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); | 189 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); |
199 | btnBlendPix = new QPixmap; | 190 | btnBlendPix = new QPixmap; |
200 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); | 191 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); |
201 | bevelFillPix = new QPixmap; | 192 | bevelFillPix = new QPixmap; |
202 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); | 193 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); |
203 | smallBevelFillPix = new QPixmap; | 194 | smallBevelFillPix = new QPixmap; |
204 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); | 195 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); |
205 | // new stuff | 196 | // new stuff |
206 | vsbSliderFillPix = menuPix = NULL; | 197 | vsbSliderFillPix = menuPix = NULL; |
207 | menuHandler = new TransMenuHandler(this); | 198 | menuHandler = new TransMenuHandler(this); |
208 | setScrollBarExtent(15, 15); | 199 | setScrollBarExtent(15, 15); |
209 | int i; | 200 | int i; |
210 | for(i=0; i < BITMAP_ITEMS; ++i){ | 201 | for(i=0; i < BITMAP_ITEMS; ++i){ |
211 | pixmaps[i] = NULL; | 202 | pixmaps[i] = NULL; |
212 | } | 203 | } |
213 | oldSliderThickness = sliderThickness(); | 204 | oldSliderThickness = sliderThickness(); |
214 | setSliderThickness(11); | 205 | setSliderThickness(11); |
215 | } | 206 | } |
216 | 207 | ||
217 | LiquidStyle::~LiquidStyle() | 208 | LiquidStyle::~LiquidStyle() |
218 | { | 209 | { |
219 | if(btnBorderPix) | 210 | if(btnBorderPix) |
220 | delete btnBorderPix; | 211 | delete btnBorderPix; |
221 | if(btnBlendPix) | 212 | if(btnBlendPix) |
222 | delete btnBlendPix; | 213 | delete btnBlendPix; |
223 | if(bevelFillPix) | 214 | if(bevelFillPix) |
224 | delete bevelFillPix; | 215 | delete bevelFillPix; |
225 | if(smallBevelFillPix) | 216 | if(smallBevelFillPix) |
226 | delete smallBevelFillPix; | 217 | delete smallBevelFillPix; |
227 | if(vsbSliderFillPix) | 218 | if(vsbSliderFillPix) |
228 | delete vsbSliderFillPix; | 219 | delete vsbSliderFillPix; |
229 | if(menuPix) | 220 | if(menuPix) |
230 | delete menuPix; | 221 | delete menuPix; |
231 | 222 | ||
232 | setScrollBarExtent(16, 16); | 223 | setScrollBarExtent(16, 16); |
233 | setSliderThickness(oldSliderThickness); | 224 | setSliderThickness(oldSliderThickness); |
234 | int i; | 225 | int i; |
235 | for(i=0; i < BITMAP_ITEMS; ++i){ | 226 | for(i=0; i < BITMAP_ITEMS; ++i){ |
236 | if(pixmaps[i]) | 227 | if(pixmaps[i]) |
237 | delete pixmaps[i]; | 228 | delete pixmaps[i]; |
238 | } | 229 | } |
239 | } | 230 | } |
240 | 231 | ||
241 | void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, | 232 | void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, |
242 | const QColor &c, const QColor &bg) | 233 | const QColor &c, const QColor &bg) |
243 | { | 234 | { |
244 | 235 | ||
245 | QPen oldPen = p->pen(); // headers need this | 236 | QPen oldPen = p->pen(); // headers need this |
246 | int x2 = x+w-1; | 237 | int x2 = x+w-1; |
247 | int y2 = y+h-1; | 238 | int y2 = y+h-1; |
248 | // outer dark rect | 239 | // outer dark rect |
249 | p->setPen(c.dark(130)); | 240 | p->setPen(c.dark(130)); |
250 | p->drawLine(x, y+2, x, y2-2); // l | 241 | p->drawLine(x, y+2, x, y2-2); // l |
251 | p->drawLine(x2, y+2, x2, y2-2); // r | 242 | p->drawLine(x2, y+2, x2, y2-2); // r |
252 | p->drawLine(x+2, y, x2-2, y); // t | 243 | p->drawLine(x+2, y, x2-2, y); // t |
253 | p->drawLine(x+2, y2, x2-2, y2); // b | 244 | p->drawLine(x+2, y2, x2-2, y2); // b |
254 | p->drawPoint(x+1, y+1); // tl | 245 | p->drawPoint(x+1, y+1); // tl |
255 | p->drawPoint(x2-1, y+1); // tr | 246 | p->drawPoint(x2-1, y+1); // tr |
256 | p->drawPoint(x+1, y2-1); // bl | 247 | p->drawPoint(x+1, y2-1); // bl |
257 | p->drawPoint(x2-1, y2-1); // br | 248 | p->drawPoint(x2-1, y2-1); // br |
258 | 249 | ||
259 | // inner top light lines | 250 | // inner top light lines |
260 | p->setPen(c.light(105)); | 251 | p->setPen(c.light(105)); |
261 | p->drawLine(x+2, y+1, x2-2, y+1); | 252 | p->drawLine(x+2, y+1, x2-2, y+1); |
262 | p->drawLine(x+1, y+2, x2-1, y+2); | 253 | p->drawLine(x+1, y+2, x2-1, y+2); |
263 | p->drawLine(x+1, y+3, x+2, y+3); | 254 | p->drawLine(x+1, y+3, x+2, y+3); |
264 | p->drawLine(x2-2, y+3, x2-1, y+3); | 255 | p->drawLine(x2-2, y+3, x2-1, y+3); |
265 | p->drawPoint(x+1, y+4); | 256 | p->drawPoint(x+1, y+4); |
266 | p->drawPoint(x2-1, y+4); | 257 | p->drawPoint(x2-1, y+4); |
267 | 258 | ||
268 | // inner bottom light lines | 259 | // inner bottom light lines |
269 | p->setPen(c.light(110)); | 260 | p->setPen(c.light(110)); |
270 | p->drawLine(x+2, y2-1, x2-2, y2-1); | 261 | p->drawLine(x+2, y2-1, x2-2, y2-1); |
271 | p->drawLine(x+1, y2-2, x2-1, y2-2); | 262 | p->drawLine(x+1, y2-2, x2-1, y2-2); |
272 | p->drawLine(x+1, y2-3, x+2, y2-3); | 263 | p->drawLine(x+1, y2-3, x+2, y2-3); |
273 | p->drawLine(x2-2, y2-3, x2-1, y2-3); | 264 | p->drawLine(x2-2, y2-3, x2-1, y2-3); |
274 | p->drawPoint(x+1, y2-4); | 265 | p->drawPoint(x+1, y2-4); |
275 | p->drawPoint(x2-1, y2-4); | 266 | p->drawPoint(x2-1, y2-4); |
276 | 267 | ||
277 | // inner left mid lines | 268 | // inner left mid lines |
278 | //p->setPen(c.light(105)); | 269 | //p->setPen(c.light(105)); |
279 | p->setPen(c); | 270 | p->setPen(c); |
280 | p->drawLine(x+1, y+5, x+1, y2-5); | 271 | p->drawLine(x+1, y+5, x+1, y2-5); |
281 | p->drawLine(x+2, y+4, x+2, y2-4); | 272 | p->drawLine(x+2, y+4, x+2, y2-4); |
282 | 273 | ||
283 | // inner right mid lines | 274 | // inner right mid lines |
284 | p->drawLine(x2-1, y+5, x2-1, y2-5); | 275 | p->drawLine(x2-1, y+5, x2-1, y2-5); |
285 | p->drawLine(x2-2, y+4, x2-2, y2-4); | 276 | p->drawLine(x2-2, y+4, x2-2, y2-4); |
286 | 277 | ||
287 | // fill | 278 | // fill |
288 | QPixmap *pix; | 279 | QPixmap *pix; |
289 | if(h >= 32){ | 280 | if(h >= 32){ |
290 | pix = bevelFillDict.find(c.rgb()); | 281 | pix = bevelFillDict.find(c.rgb()); |
291 | if(!pix){ | 282 | if(!pix){ |
292 | int h, s, v; | 283 | int h, s, v; |
293 | c.hsv(&h, &s, &v); | 284 | c.hsv(&h, &s, &v); |
294 | pix = new QPixmap(*bevelFillPix); | 285 | pix = new QPixmap(*bevelFillPix); |
295 | adjustHSV(*pix, h, s, v); | 286 | adjustHSV(*pix, h, s, v); |
296 | bevelFillDict.insert(c.rgb(), pix); | 287 | bevelFillDict.insert(c.rgb(), pix); |
297 | } | 288 | } |
298 | } | 289 | } |
299 | else{ | 290 | else{ |
300 | pix = smallBevelFillDict.find(c.rgb()); | 291 | pix = smallBevelFillDict.find(c.rgb()); |
301 | if(!pix){ | 292 | if(!pix){ |
302 | int h, s, v; | 293 | int h, s, v; |
303 | c.hsv(&h, &s, &v); | 294 | c.hsv(&h, &s, &v); |
304 | pix = new QPixmap(*smallBevelFillPix); | 295 | pix = new QPixmap(*smallBevelFillPix); |
305 | adjustHSV(*pix, h, s, v); | 296 | adjustHSV(*pix, h, s, v); |
306 | smallBevelFillDict.insert(c.rgb(), pix); | 297 | smallBevelFillDict.insert(c.rgb(), pix); |
307 | } | 298 | } |
308 | } | 299 | } |
309 | p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); | 300 | p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); |
310 | // blend | 301 | // blend |
311 | int red, green, blue; | 302 | int red, green, blue; |
312 | QColor btnColor(c.dark(130)); | 303 | QColor btnColor(c.dark(130)); |
313 | red = (btnColor.red() >> 1) + (bg.red() >> 1); | 304 | red = (btnColor.red() >> 1) + (bg.red() >> 1); |
314 | green = (btnColor.green() >> 1) + (bg.green() >> 1); | 305 | green = (btnColor.green() >> 1) + (bg.green() >> 1); |
315 | blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); | 306 | blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); |
316 | btnColor.setRgb(red, green, blue); | 307 | btnColor.setRgb(red, green, blue); |
317 | 308 | ||
318 | p->setPen(btnColor); | 309 | p->setPen(btnColor); |
319 | p->drawPoint(x+1, y); | 310 | p->drawPoint(x+1, y); |
320 | p->drawPoint(x, y+1); | 311 | p->drawPoint(x, y+1); |
321 | p->drawPoint(x+1, y2); | 312 | p->drawPoint(x+1, y2); |
322 | p->drawPoint(x, y2-1); | 313 | p->drawPoint(x, y2-1); |
323 | 314 | ||
324 | p->drawPoint(x2-1, y); | 315 | p->drawPoint(x2-1, y); |
325 | p->drawPoint(x2, y+1); | 316 | p->drawPoint(x2, y+1); |
326 | p->drawPoint(x2-1, y2); | 317 | p->drawPoint(x2-1, y2); |
327 | p->drawPoint(x2, y2-1); | 318 | p->drawPoint(x2, y2-1); |
328 | 319 | ||
329 | p->setPen(oldPen); | 320 | p->setPen(oldPen); |
330 | 321 | ||
331 | } | 322 | } |
332 | 323 | ||
333 | void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, | 324 | void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, |
334 | const QColor &back, int x, int y, int w, int h, | 325 | const QColor &back, int x, int y, int w, int h, |
335 | bool supportPushDown, bool pushedDown, | 326 | bool supportPushDown, bool pushedDown, |
336 | bool autoDefault, bool isMasked) | 327 | bool autoDefault, bool isMasked) |
337 | { | 328 | { |
338 | if(w < 21 || h < 21){ | 329 | if(w < 21 || h < 21){ |
339 | drawClearBevel(painter, x, y, w, h, c, back); | 330 | drawClearBevel(painter, x, y, w, h, c, back); |
340 | return; | 331 | return; |
341 | } | 332 | } |
342 | if(supportPushDown){ | 333 | if(supportPushDown){ |
343 | --w, --h; | 334 | --w, --h; |
344 | } | 335 | } |
345 | /* We don't make the round buttons smaller, since they don't look as good | 336 | /* We don't make the round buttons smaller, since they don't look as good |
346 | if(autoDefault){ | 337 | if(autoDefault){ |
347 | w = w-buttonDefaultIndicatorWidth()*2; | 338 | w = w-buttonDefaultIndicatorWidth()*2; |
348 | h = h-buttonDefaultIndicatorWidth()*2; | 339 | h = h-buttonDefaultIndicatorWidth()*2; |
349 | }*/ | 340 | }*/ |
350 | 341 | ||
351 | 342 | ||
352 | QPixmap *pix = btnDict.find(c.rgb()); | 343 | QPixmap *pix = btnDict.find(c.rgb()); |
353 | if(!pix){ | 344 | if(!pix){ |
354 | int h, s, v; | 345 | int h, s, v; |
355 | c.hsv(&h, &s, &v); | 346 | c.hsv(&h, &s, &v); |
356 | pix = new QPixmap(*btnBorderPix); | 347 | pix = new QPixmap(*btnBorderPix); |
357 | adjustHSV(*pix, h, s, v); | 348 | adjustHSV(*pix, h, s, v); |
358 | btnDict.insert(c.rgb(), pix); | 349 | btnDict.insert(c.rgb(), pix); |
359 | } | 350 | } |
360 | int x2 = x+w-1; | 351 | int x2 = x+w-1; |
361 | int y2 = y+h-1; | 352 | int y2 = y+h-1; |
362 | int bx2 = pix->width()-1; | 353 | int bx2 = pix->width()-1; |
363 | int by2 = pix->height()-1; | 354 | int by2 = pix->height()-1; |
364 | 355 | ||
365 | QPixmap tmpPix(w, h); | 356 | QPixmap tmpPix(w, h); |
366 | QPixmap tilePix; | 357 | QPixmap tilePix; |
367 | QPainter p; | 358 | QPainter p; |
368 | p.begin(&tmpPix); | 359 | p.begin(&tmpPix); |
369 | 360 | ||
370 | // do the fill | 361 | // do the fill |
371 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl | 362 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl |
372 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr | 363 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr |
373 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl | 364 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl |
374 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br | 365 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br |
375 | 366 | ||
376 | // edges | 367 | // edges |
377 | tilePix.resize(pix->width()-20, 10); | 368 | tilePix.resize(pix->width()-20, 10); |
378 | // top | 369 | // top |
379 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); | 370 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); |
380 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); | 371 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); |
381 | // bottom | 372 | // bottom |
382 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); | 373 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); |
383 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); | 374 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); |
384 | // left | 375 | // left |
385 | tilePix.resize(10, pix->height()-20); | 376 | tilePix.resize(10, pix->height()-20); |
386 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); | 377 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); |
387 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); | 378 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); |
388 | // right | 379 | // right |
389 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); | 380 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); |
390 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); | 381 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); |
391 | 382 | ||
392 | // middle | 383 | // middle |
393 | tilePix.resize(pix->width()-20, pix->height()-20); | 384 | tilePix.resize(pix->width()-20, pix->height()-20); |
394 | bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); | 385 | bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); |
395 | p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); | 386 | p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); |
396 | 387 | ||
397 | 388 | ||
398 | // do the blend | 389 | // do the blend |
399 | QBitmap blendMask; | 390 | QBitmap blendMask; |
400 | if(!isMasked){ | 391 | if(!isMasked){ |
401 | //QRgb bgRgb = back.rgb(); | 392 | //QRgb bgRgb = back.rgb(); |
402 | //QRgb fgRgb = c.rgb(); | 393 | //QRgb fgRgb = c.rgb(); |
403 | //int r, g, b; | 394 | //int r, g, b; |
404 | 395 | ||
405 | //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); | 396 | //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); |
406 | //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); | 397 | //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); |
407 | //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); | 398 | //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); |
408 | //QColor blendColor(r, g, b); | 399 | //QColor blendColor(r, g, b); |
409 | int hue, sat, v1, v2; | 400 | int hue, sat, v1, v2; |
410 | QColor blendColor(autoDefault ? c : back); | 401 | QColor blendColor(autoDefault ? c : back); |
411 | back.hsv(&hue, &sat, &v1); | 402 | back.hsv(&hue, &sat, &v1); |
412 | blendColor.hsv(&hue, &sat, &v2); | 403 | blendColor.hsv(&hue, &sat, &v2); |
413 | if(v2 > v1) | 404 | if(v2 > v1) |
414 | blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); | 405 | blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); |
415 | 406 | ||
416 | pix = btnBorderDict.find(blendColor.rgb()); | 407 | pix = btnBorderDict.find(blendColor.rgb()); |
417 | if(!pix){ | 408 | if(!pix){ |
418 | int h, s, v; | 409 | int h, s, v; |
419 | blendColor.hsv(&h, &s, &v); | 410 | blendColor.hsv(&h, &s, &v); |
420 | pix = new QPixmap(*btnBlendPix); | 411 | pix = new QPixmap(*btnBlendPix); |
421 | adjustHSV(*pix, h, s, v); | 412 | adjustHSV(*pix, h, s, v); |
422 | btnBorderDict.insert(blendColor.rgb(), pix); | 413 | btnBorderDict.insert(blendColor.rgb(), pix); |
423 | } | 414 | } |
424 | } | 415 | } |
425 | else{ | 416 | else{ |
426 | pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : | 417 | pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : |
427 | getPixmap(HTMLBtnBorder); | 418 | getPixmap(HTMLBtnBorder); |
428 | } | 419 | } |
429 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl | 420 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl |
430 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr | 421 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr |
431 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl | 422 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl |
432 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br | 423 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br |
433 | 424 | ||
434 | // edges | 425 | // edges |
435 | tilePix.resize(pix->width()-20, 10); | 426 | tilePix.resize(pix->width()-20, 10); |
436 | blendMask.resize(pix->width()-20, 10); | 427 | blendMask.resize(pix->width()-20, 10); |
437 | // top | 428 | // top |
438 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); | 429 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); |
439 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); | 430 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); |
440 | tilePix.setMask(blendMask); | 431 | tilePix.setMask(blendMask); |
441 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); | 432 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); |
442 | // bottom | 433 | // bottom |
443 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); | 434 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); |
444 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20); | 435 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20); |
445 | tilePix.setMask(blendMask); | 436 | tilePix.setMask(blendMask); |
446 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); | 437 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); |
447 | // left | 438 | // left |
448 | tilePix.resize(10, pix->height()-20); | 439 | tilePix.resize(10, pix->height()-20); |
449 | blendMask.resize(10, pix->height()-20); | 440 | blendMask.resize(10, pix->height()-20); |
450 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); | 441 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); |
451 | bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); | 442 | bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); |
452 | tilePix.setMask(blendMask); | 443 | tilePix.setMask(blendMask); |
453 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); | 444 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); |
454 | // right | 445 | // right |
455 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); | 446 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); |
456 | bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); | 447 | bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); |
457 | tilePix.setMask(blendMask); | 448 | tilePix.setMask(blendMask); |
458 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); | 449 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); |
459 | 450 | ||
460 | p.end(); | 451 | p.end(); |
461 | 452 | ||
462 | // do the button mask - we don't automask buttons | 453 | // do the button mask - we don't automask buttons |
463 | QBitmap btnMask(w, h); | 454 | QBitmap btnMask(w, h); |
464 | QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; | 455 | QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; |
465 | p.begin(&btnMask); | 456 | p.begin(&btnMask); |
466 | p.fillRect(0, 0, w, h, Qt::color0); | 457 | p.fillRect(0, 0, w, h, Qt::color0); |
467 | p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl | 458 | p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl |
468 | p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr | 459 | p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr |
469 | p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl | 460 | p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl |
470 | p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br | 461 | p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br |
471 | // fills | 462 | // fills |
472 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top | 463 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top |
473 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom | 464 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom |
474 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle | 465 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle |
475 | p.end(); | 466 | p.end(); |
476 | tmpPix.setMask(btnMask); | 467 | tmpPix.setMask(btnMask); |
477 | /*if(autoDefault){ | 468 | /*if(autoDefault){ |
478 | if(supportPushDown && pushedDown){ | 469 | if(supportPushDown && pushedDown){ |
479 | painter->drawPixmap(x+3, y+3, tmpPix); | 470 | painter->drawPixmap(x+3, y+3, tmpPix); |
480 | } | 471 | } |
481 | else{ | 472 | else{ |
482 | painter->drawPixmap(x+2, y+2, tmpPix); | 473 | painter->drawPixmap(x+2, y+2, tmpPix); |
483 | } | 474 | } |
484 | } | 475 | } |
485 | else */if(supportPushDown && pushedDown) | 476 | else */if(supportPushDown && pushedDown) |
486 | painter->drawPixmap(x+1, y+1, tmpPix); | 477 | painter->drawPixmap(x+1, y+1, tmpPix); |
487 | else | 478 | else |
488 | painter->drawPixmap(x, y, tmpPix); | 479 | painter->drawPixmap(x, y, tmpPix); |
489 | 480 | ||
490 | 481 | ||
491 | 482 | ||
492 | } | 483 | } |
493 | 484 | ||
494 | 485 | ||
495 | QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, | 486 | QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, |
496 | bool blend) | 487 | bool blend) |
497 | { | 488 | { |
498 | QImage img(qembed_findImage(label)); | 489 | QImage img(qembed_findImage(label)); |
499 | img.detach(); | 490 | img.detach(); |
500 | if(img.isNull()){ // shouldn't happen, been tested | 491 | if(img.isNull()){ // shouldn't happen, been tested |
501 | qWarning("Invalid embedded label %s", label); | 492 | qWarning("Invalid embedded label %s", label); |
502 | return(NULL); | 493 | return(NULL); |
503 | } | 494 | } |
504 | if(img.depth() != 32) | 495 | if(img.depth() != 32) |
505 | img = img.convertDepth(32); | 496 | img = img.convertDepth(32); |
506 | unsigned int *data = (unsigned int *)img.bits(); | 497 | unsigned int *data = (unsigned int *)img.bits(); |
507 | int total = img.width()*img.height(); | 498 | int total = img.width()*img.height(); |
508 | int current; | 499 | int current; |
509 | QColor c; | 500 | QColor c; |
510 | int oldH, oldS, oldV; | 501 | int oldH, oldS, oldV; |
511 | int alpha; | 502 | int alpha; |
512 | if(v < 235) | 503 | if(v < 235) |
513 | v += 20; | 504 | v += 20; |
514 | else | 505 | else |
515 | v = 255; | 506 | v = 255; |
516 | float intensity = v/255.0; | 507 | float intensity = v/255.0; |
517 | 508 | ||
518 | for(current=0; current<total; ++current){ | 509 | for(current=0; current<total; ++current){ |
519 | alpha = qAlpha(data[current]); | 510 | alpha = qAlpha(data[current]); |
520 | c.setRgb(data[current]); | 511 | c.setRgb(data[current]); |
521 | c.hsv(&oldH, &oldS, &oldV); | 512 | c.hsv(&oldH, &oldS, &oldV); |
522 | oldV = (int)(oldV*intensity); | 513 | oldV = (int)(oldV*intensity); |
523 | c.setHsv(h, s, oldV); | 514 | c.setHsv(h, s, oldV); |
524 | if(blend && alpha != 255 && alpha != 0){ | 515 | if(blend && alpha != 255 && alpha != 0){ |
525 | float srcPercent = ((float)alpha)/255.0; | 516 | float srcPercent = ((float)alpha)/255.0; |
526 | float destPercent = 1.0-srcPercent; | 517 | float destPercent = 1.0-srcPercent; |
527 | oldH = (int)((srcPercent*h) + (destPercent*bH)); | 518 | oldH = (int)((srcPercent*h) + (destPercent*bH)); |
528 | oldS = (int)((srcPercent*s) + (destPercent*bS)); | 519 | oldS = (int)((srcPercent*s) + (destPercent*bS)); |
529 | oldV = (int)((srcPercent*oldV) + (destPercent*bV)); | 520 | oldV = (int)((srcPercent*oldV) + (destPercent*bV)); |
530 | c.setHsv(oldH, oldS, oldV); | 521 | c.setHsv(oldH, oldS, oldV); |
531 | alpha = 255; | 522 | alpha = 255; |
532 | } | 523 | } |
533 | data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); | 524 | data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); |
534 | } | 525 | } |
535 | QPixmap *pix = new QPixmap; | 526 | QPixmap *pix = new QPixmap; |
536 | pix->convertFromImage(img); | 527 | pix->convertFromImage(img); |
537 | return(pix); | 528 | return(pix); |
538 | } | 529 | } |
539 | 530 | ||
540 | 531 | ||
541 | 532 | ||
542 | 533 | ||
543 | QPixmap* LiquidStyle::getPixmap(BitmapData item) | 534 | QPixmap* LiquidStyle::getPixmap(BitmapData item) |
544 | { | 535 | { |
545 | 536 | ||
546 | if(pixmaps[item]) | 537 | if(pixmaps[item]) |
547 | return(pixmaps[item]); | 538 | return(pixmaps[item]); |
548 | 539 | ||
549 | switch(item){ | 540 | switch(item){ |
550 | case HTMLBtnBorder: | 541 | case HTMLBtnBorder: |
551 | pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); | 542 | pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); |
552 | break; | 543 | break; |
553 | case HTMLBtnBorderDown: | 544 | case HTMLBtnBorderDown: |
554 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); | 545 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); |
555 | break; | 546 | break; |
556 | case HTMLCB: | 547 | case HTMLCB: |
557 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); | 548 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); |
558 | break; | 549 | break; |
559 | case HTMLCBDown: | 550 | case HTMLCBDown: |
560 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); | 551 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); |
561 | break; | 552 | break; |
562 | case HTMLCBHover: | 553 | case HTMLCBHover: |
563 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); | 554 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); |
564 | break; | 555 | break; |
565 | case HTMLCBDownHover: | 556 | case HTMLCBDownHover: |
566 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", | 557 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", |
567 | btnHoverH, btnHoverS, | 558 | btnHoverH, btnHoverS, |
568 | btnHoverV); | 559 | btnHoverV); |
569 | break; | 560 | break; |
570 | case HTMLRadio: | 561 | case HTMLRadio: |
571 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); | 562 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); |
572 | case HTMLRadioDown: | 563 | case HTMLRadioDown: |
573 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); | 564 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); |
574 | case HTMLRadioHover: | 565 | case HTMLRadioHover: |
575 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); | 566 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); |
576 | case HTMLRadioDownHover: | 567 | case HTMLRadioDownHover: |
577 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", | 568 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", |
578 | btnHoverH, btnHoverS, | 569 | btnHoverH, btnHoverS, |
579 | btnHoverV); | 570 | btnHoverV); |
580 | case RadioOn: | 571 | case RadioOn: |
581 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); | 572 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); |
582 | break; | 573 | break; |
583 | case RadioOnHover: | 574 | case RadioOnHover: |
584 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, | 575 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, |
585 | btnHoverV, true); | 576 | btnHoverV, true); |
586 | break; | 577 | break; |
587 | case RadioOffHover: | 578 | case RadioOffHover: |
588 | pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); | 579 | pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); |
589 | break; | 580 | break; |
590 | case TabDown: | 581 | case TabDown: |
591 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); | 582 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); |
592 | break; | 583 | break; |
593 | case TabFocus: | 584 | case TabFocus: |
594 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, | 585 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, |
595 | btnHoverS, true); | 586 | btnHoverS, true); |
596 | break; | 587 | break; |
597 | case CBDown: | 588 | case CBDown: |
598 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); | 589 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); |
599 | break; | 590 | break; |
600 | case CBDownHover: | 591 | case CBDownHover: |
601 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, | 592 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, |
602 | btnHoverS, btnHoverV, true); | 593 | btnHoverS, btnHoverV, true); |
603 | break; | 594 | break; |
604 | case CBHover: | 595 | case CBHover: |
605 | pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); | 596 | pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); |
606 | break; | 597 | break; |
607 | case HSlider: | 598 | case HSlider: |
608 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | 599 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); |
609 | break; | 600 | break; |
610 | case VSlider: | 601 | case VSlider: |
611 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | 602 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); |
612 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); | 603 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); |
613 | break; | 604 | break; |
614 | case RadioOff: | 605 | case RadioOff: |
615 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); | 606 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); |
616 | break; | 607 | break; |
617 | case Tab: | 608 | case Tab: |
618 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); | 609 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); |
619 | break; | 610 | break; |
620 | case CB: | 611 | case CB: |
621 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); | 612 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); |
622 | break; | 613 | break; |
623 | case VSBSliderTop: | 614 | case VSBSliderTop: |
624 | pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 615 | pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); |
625 | break; | 616 | break; |
626 | case VSBSliderBtm: | 617 | case VSBSliderBtm: |
627 | pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | 618 | pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); |
628 | break; | 619 | break; |
629 | case VSBSliderMid: | 620 | case VSBSliderMid: |
630 | pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | 621 | pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); |
631 | break; | 622 | break; |
632 | case VSBSliderTopHover: | 623 | case VSBSliderTopHover: |
633 | pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 624 | pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); |
634 | break; | 625 | break; |
635 | case VSBSliderBtmHover: | 626 | case VSBSliderBtmHover: |
636 | pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 627 | pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); |
637 | break; | 628 | break; |
638 | case VSBSliderMidHover: | 629 | case VSBSliderMidHover: |
639 | pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 630 | pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); |
640 | break; | 631 | break; |
641 | 632 | ||
642 | case HSBSliderTop: | 633 | case HSBSliderTop: |
643 | pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 634 | pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); |
644 | *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); | 635 | *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); |
645 | break; | 636 | break; |
646 | case HSBSliderBtm: | 637 | case HSBSliderBtm: |
647 | pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | 638 | pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); |
648 | *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); | 639 | *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); |
649 | break; | 640 | break; |
650 | case HSBSliderMid: | 641 | case HSBSliderMid: |
651 | pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | 642 | pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); |
652 | *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); | 643 | *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); |
653 | break; | 644 | break; |
654 | case HSBSliderTopHover: | 645 | case HSBSliderTopHover: |
655 | pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 646 | pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); |
656 | *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); | 647 | *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); |
657 | break; | 648 | break; |
658 | case HSBSliderBtmHover: | 649 | case HSBSliderBtmHover: |
659 | pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 650 | pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); |
660 | *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); | 651 | *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); |
661 | break; | 652 | break; |
662 | case HSBSliderMidHover: | 653 | case HSBSliderMidHover: |
663 | pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 654 | pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); |
664 | *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); | 655 | *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); |
665 | break; | 656 | break; |
666 | case VSBSliderTopBg: | 657 | case VSBSliderTopBg: |
667 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | 658 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); |
668 | break; | 659 | break; |
669 | case VSBSliderBtmBg: | 660 | case VSBSliderBtmBg: |
670 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | 661 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); |
671 | break; | 662 | break; |
672 | case VSBSliderMidBg: | 663 | case VSBSliderMidBg: |
673 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | 664 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); |
674 | break; | 665 | break; |
675 | case HSBSliderTopBg: | 666 | case HSBSliderTopBg: |
676 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | 667 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); |
677 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); | 668 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); |
678 | break; | 669 | break; |
679 | case HSBSliderBtmBg: | 670 | case HSBSliderBtmBg: |
680 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | 671 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); |
681 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); | 672 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); |
682 | break; | 673 | break; |
683 | case HSBSliderMidBg: | 674 | case HSBSliderMidBg: |
684 | pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | 675 | pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); |
685 | *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); | 676 | *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); |
686 | break; | 677 | break; |
687 | default: | 678 | default: |
688 | break; | 679 | break; |
689 | } | 680 | } |
690 | return(pixmaps[item]); | 681 | return(pixmaps[item]); |
691 | } | 682 | } |
692 | 683 | ||
693 | void LiquidStyle::polish(QPalette &appPal) | 684 | void LiquidStyle::polish(QPalette &appPal) |
694 | { | 685 | { |
695 | 686 | ||
696 | int i; | 687 | int i; |
697 | for(i=0; i < BITMAP_ITEMS; ++i){ | 688 | for(i=0; i < BITMAP_ITEMS; ++i){ |
698 | if(pixmaps[i]){ | 689 | if(pixmaps[i]){ |
699 | delete pixmaps[i]; | 690 | delete pixmaps[i]; |
700 | pixmaps[i] = NULL; | 691 | pixmaps[i] = NULL; |
701 | } | 692 | } |
702 | } | 693 | } |
703 | QWidgetList *list = QApplication::allWidgets(); | 694 | QWidgetList *list = QApplication::allWidgets(); |
704 | QWidgetListIt it( *list ); | 695 | QWidgetListIt it( *list ); |
705 | QWidget *w; | 696 | QWidget *w; |
706 | while ((w=it.current()) != 0 ){ | 697 | while ((w=it.current()) != 0 ){ |
707 | ++it; | 698 | ++it; |
708 | if(w->inherits("QPushButton")){ | 699 | if(w->inherits("QPushButton")){ |
709 | unapplyCustomAttributes((QPushButton *)w); | 700 | unapplyCustomAttributes((QPushButton *)w); |
710 | } | 701 | } |
711 | } | 702 | } |
712 | 703 | ||
713 | loadCustomButtons(); | 704 | loadCustomButtons(); |
714 | lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | 705 | lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; |
715 | btnDict.clear(); | 706 | btnDict.clear(); |
716 | btnBorderDict.clear(); | 707 | btnBorderDict.clear(); |
717 | bevelFillDict.clear(); | 708 | bevelFillDict.clear(); |
718 | smallBevelFillDict.clear(); | 709 | smallBevelFillDict.clear(); |
719 | 710 | ||
720 | Config config ( "qpe" ); | 711 | Config config ( "qpe" ); |
721 | QPalette pal = QApplication::palette(); | 712 | QPalette pal = QApplication::palette(); |
722 | 713 | ||
723 | // button color stuff | 714 | // button color stuff |
724 | config. setGroup ( "Appearance" ); | 715 | config. setGroup ( "Appearance" ); |
725 | QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 716 | QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); |
726 | if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { | 717 | if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { |
727 | // force button color to be different from background | 718 | // force button color to be different from background |
728 | QBrush btnBrush(QColor(200, 202, 228)); | 719 | QBrush btnBrush(QColor(200, 202, 228)); |
729 | appPal.setBrush(QColorGroup::Button, btnBrush); | 720 | appPal.setBrush(QColorGroup::Button, btnBrush); |
730 | } | 721 | } |
731 | c.hsv(&btnH, &btnS, &btnV); | 722 | c.hsv(&btnH, &btnS, &btnV); |
732 | c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); | 723 | c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); |
733 | 724 | ||
734 | // menu pixmap | 725 | // menu pixmap |
735 | if(!menuPix){ | 726 | if(!menuPix){ |
736 | menuPix = new QPixmap; | 727 | menuPix = new QPixmap; |
737 | menuPix->resize(64, 64); | 728 | menuPix->resize(64, 64); |
738 | } | 729 | } |
739 | QPainter painter; | 730 | QPainter painter; |
740 | menuPix->fill(c.rgb()); | 731 | menuPix->fill(c.rgb()); |
741 | painter.begin(menuPix); | 732 | painter.begin(menuPix); |
742 | painter.setPen(c.dark(105)); | 733 | painter.setPen(c.dark(105)); |
743 | for(i=0; i < 63; i+=4){ | 734 | for(i=0; i < 63; i+=4){ |
744 | painter.drawLine(0, i, 63, i); | 735 | painter.drawLine(0, i, 63, i); |
745 | painter.drawLine(0, i+1, 63, i+1); | 736 | painter.drawLine(0, i+1, 63, i+1); |
746 | }; | 737 | }; |
747 | painter.end(); | 738 | painter.end(); |
748 | menuBrush.setColor(c); | 739 | menuBrush.setColor(c); |
749 | menuBrush.setPixmap(*menuPix); | 740 | menuBrush.setPixmap(*menuPix); |
750 | 741 | ||
751 | // pager brush | 742 | // pager brush |
752 | c = c.dark(120); | 743 | c = c.dark(120); |
753 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 744 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
754 | if(!pix){ | 745 | if(!pix){ |
755 | int h, s, v; | 746 | int h, s, v; |
756 | c.hsv(&h, &s, &v); | 747 | c.hsv(&h, &s, &v); |
757 | pix = new QPixmap(*smallBevelFillPix); | 748 | pix = new QPixmap(*smallBevelFillPix); |
758 | adjustHSV(*pix, h, s, v); | 749 | adjustHSV(*pix, h, s, v); |
759 | smallBevelFillDict.insert(c.rgb(), pix); | 750 | smallBevelFillDict.insert(c.rgb(), pix); |
760 | } | 751 | } |
761 | pagerHoverBrush.setColor(c); | 752 | pagerHoverBrush.setColor(c); |
762 | pagerHoverBrush.setPixmap(*pix); | 753 | pagerHoverBrush.setPixmap(*pix); |
763 | 754 | ||
764 | c = c.dark(120); | 755 | c = c.dark(120); |
765 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 756 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
766 | if(!pix){ | 757 | if(!pix){ |
767 | int h, s, v; | 758 | int h, s, v; |
768 | c.hsv(&h, &s, &v); | 759 | c.hsv(&h, &s, &v); |
769 | pix = new QPixmap(*smallBevelFillPix); | 760 | pix = new QPixmap(*smallBevelFillPix); |
770 | adjustHSV(*pix, h, s, v); | 761 | adjustHSV(*pix, h, s, v); |
771 | smallBevelFillDict.insert(c.rgb(), pix); | 762 | smallBevelFillDict.insert(c.rgb(), pix); |
772 | } | 763 | } |
773 | pagerBrush.setColor(c); | 764 | pagerBrush.setColor(c); |
774 | pagerBrush.setPixmap(*pix); | 765 | pagerBrush.setPixmap(*pix); |
775 | 766 | ||
776 | // background color stuff | 767 | // background color stuff |
777 | c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); | 768 | c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); |
778 | c.hsv(&bH, &bS, &bV); | 769 | c.hsv(&bH, &bS, &bV); |
779 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 770 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
780 | 771 | ||
781 | // FIXME? | 772 | // FIXME? |
782 | if(vsbSliderFillPix) | 773 | if(vsbSliderFillPix) |
783 | delete vsbSliderFillPix; | 774 | delete vsbSliderFillPix; |
784 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); | 775 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); |
785 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); | 776 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); |
786 | 777 | ||
787 | // background brush | 778 | // background brush |
788 | QPixmap wallPaper(32, 32); | 779 | QPixmap wallPaper(32, 32); |
789 | wallPaper.fill(c.rgb()); | 780 | wallPaper.fill(c.rgb()); |
790 | painter.begin(&wallPaper); | 781 | painter.begin(&wallPaper); |
791 | for(i=0; i < 32; i+=4){ | 782 | for(i=0; i < 32; i+=4){ |
792 | painter.setPen(c.dark(105)); | 783 | painter.setPen(c.dark(105)); |
793 | painter.drawLine(0, i, 32, i); | 784 | painter.drawLine(0, i, 32, i); |
794 | painter.setPen(c.dark(103)); | 785 | painter.setPen(c.dark(103)); |
795 | painter.drawLine(0, i+1, 32, i+1); | 786 | painter.drawLine(0, i+1, 32, i+1); |
796 | }; | 787 | }; |
797 | painter.end(); | 788 | painter.end(); |
798 | bgBrush.setColor(c); | 789 | bgBrush.setColor(c); |
799 | bgBrush.setPixmap(wallPaper); | 790 | bgBrush.setPixmap(wallPaper); |
800 | appPal.setBrush(QColorGroup::Background, bgBrush); | 791 | appPal.setBrush(QColorGroup::Background, bgBrush); |
801 | 792 | ||
802 | // lineedits | 793 | // lineedits |
803 | c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); | 794 | c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); |
804 | QPixmap basePix; | 795 | QPixmap basePix; |
805 | basePix.resize(32, 32); | 796 | basePix.resize(32, 32); |
806 | basePix.fill(c.rgb()); | 797 | basePix.fill(c.rgb()); |
807 | painter.begin(&basePix); | 798 | painter.begin(&basePix); |
808 | painter.setPen(c.dark(105)); | 799 | painter.setPen(c.dark(105)); |
809 | for(i=0; i < 32; i+=4){ | 800 | for(i=0; i < 32; i+=4){ |
810 | painter.drawLine(0, i, 32, i); | 801 | painter.drawLine(0, i, 32, i); |
811 | painter.drawLine(0, i+1, 32, i+1); | 802 | painter.drawLine(0, i+1, 32, i+1); |
812 | }; | 803 | }; |
813 | painter.end(); | 804 | painter.end(); |
814 | baseBrush.setColor(c); | 805 | baseBrush.setColor(c); |
815 | baseBrush.setPixmap(basePix); | 806 | baseBrush.setPixmap(basePix); |
816 | it.toFirst(); | 807 | it.toFirst(); |
817 | while ((w=it.current()) != 0 ){ | 808 | while ((w=it.current()) != 0 ){ |
818 | ++it; | 809 | ++it; |
819 | if(w->inherits("QLineEdit")){ | 810 | if(w->inherits("QLineEdit")){ |
820 | QPalette pal = w->palette(); | 811 | QPalette pal = w->palette(); |
821 | pal.setBrush(QColorGroup::Base, baseBrush); | 812 | pal.setBrush(QColorGroup::Base, baseBrush); |
822 | w->setPalette(pal); | 813 | w->setPalette(pal); |
823 | } | 814 | } |
824 | else if(w->inherits("QPushButton")){ | 815 | else if(w->inherits("QPushButton")){ |
825 | applyCustomAttributes((QPushButton *)w); | 816 | applyCustomAttributes((QPushButton *)w); |
826 | } | 817 | } |
827 | } | 818 | } |
828 | 819 | ||
829 | } | 820 | } |
830 | 821 | ||
831 | void LiquidStyle::polish(QWidget *w) | 822 | void LiquidStyle::polish(QWidget *w) |
832 | { | 823 | { |
833 | if(w->inherits("QMenuBar")){ | 824 | if(w->inherits("QMenuBar")){ |
834 | //((QFrame*)w)->setLineWidth(0); | 825 | //((QFrame*)w)->setLineWidth(0); |
835 | w->setBackgroundMode(QWidget::PaletteBackground); | 826 | w->setBackgroundMode(QWidget::PaletteBackground); |
836 | return; | 827 | return; |
837 | } | 828 | } |
838 | if(w->inherits("QPopupMenu")) | 829 | if(w->inherits("QPopupMenu")) |
839 | w->setBackgroundMode(QWidget::NoBackground); | 830 | w->setBackgroundMode(QWidget::NoBackground); |
840 | else if(w-> testWFlags(Qt::WType_Popup)) { | 831 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
841 | printf("install popup: %s\n", w-> className ( )); | ||
842 | w->installEventFilter(menuHandler); | 832 | w->installEventFilter(menuHandler); |
843 | } | 833 | } |
844 | 834 | ||
845 | if(w->isTopLevel()){ | 835 | if(w->isTopLevel()){ |
846 | return; | 836 | return; |
847 | } | 837 | } |
848 | 838 | ||
849 | 839 | ||
850 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | 840 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); |
851 | 841 | ||
852 | if(w->inherits("QComboBox") || | 842 | if(w->inherits("QComboBox") || |
853 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 843 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
854 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 844 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
855 | w->installEventFilter(this); | 845 | w->installEventFilter(this); |
856 | } | 846 | } |
857 | if(w->inherits("QLineEdit")){ | 847 | if(w->inherits("QLineEdit")){ |
858 | QPalette pal = w->palette(); | 848 | QPalette pal = w->palette(); |
859 | pal.setBrush(QColorGroup::Base, baseBrush); | 849 | pal.setBrush(QColorGroup::Base, baseBrush); |
860 | w->setPalette(pal); | 850 | w->setPalette(pal); |
861 | } | 851 | } |
862 | if(w->inherits("QPushButton")){ | 852 | if(w->inherits("QPushButton")){ |
863 | applyCustomAttributes((QPushButton *)w); | 853 | applyCustomAttributes((QPushButton *)w); |
864 | w->installEventFilter(this); | 854 | w->installEventFilter(this); |
865 | } | 855 | } |
866 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 856 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
867 | w-> setBackgroundMode ( QWidget::PaletteBackground ); | 857 | w-> setBackgroundMode ( QWidget::PaletteBackground ); |
868 | } | 858 | } |
869 | 859 | ||
870 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 860 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
871 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 861 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
872 | bool isViewportChild = w->parent() && | 862 | bool isViewportChild = w->parent() && |
873 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 863 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
874 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 864 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
875 | 865 | ||
876 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ | 866 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ |
877 | w->setBackgroundMode(QWidget::X11ParentRelative); | 867 | w->setBackgroundMode(QWidget::X11ParentRelative); |
878 | return; | 868 | return; |
879 | } | 869 | } |
880 | if(isViewportChild){ | 870 | if(isViewportChild){ |
881 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 871 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
882 | if(w->parent()){ // heh, only way to test for KHTML children ;-) | 872 | if(w->parent()){ // heh, only way to test for KHTML children ;-) |
883 | if(w->parent()->parent()){ | 873 | if(w->parent()->parent()){ |
884 | if(w->parent()->parent()->parent() && | 874 | if(w->parent()->parent()->parent() && |
885 | w->parent()->parent()->parent()->inherits("KHTMLView")){ | 875 | w->parent()->parent()->parent()->inherits("KHTMLView")){ |
886 | w->setAutoMask(true); | 876 | w->setAutoMask(true); |
887 | w->setBackgroundMode(QWidget::NoBackground); | 877 | w->setBackgroundMode(QWidget::NoBackground); |
888 | } | 878 | } |
889 | } | 879 | } |
890 | } | 880 | } |
891 | return; | 881 | return; |
892 | } | 882 | } |
893 | } | 883 | } |
894 | if(w->inherits("QHeader")){ | 884 | if(w->inherits("QHeader")){ |
895 | w->setMouseTracking(true); | 885 | w->setMouseTracking(true); |
896 | w->installEventFilter(this); | 886 | w->installEventFilter(this); |
897 | } | 887 | } |
898 | if(w-> inherits("QToolButton")) { | 888 | if(w-> inherits("QToolButton")) { |
899 | ((QToolButton*)w)->setAutoRaise (false); | 889 | ((QToolButton*)w)->setAutoRaise (false); |
900 | } | 890 | } |
901 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 891 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
902 | return; | 892 | return; |
903 | } | 893 | } |
904 | 894 | ||
905 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 895 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
906 | palette().active().brush(QColorGroup::Background).pixmap()){ | 896 | palette().active().brush(QColorGroup::Background).pixmap()){ |
907 | qWarning("No parent pixmap for child widget %s", w->className()); | 897 | qWarning("No parent pixmap for child widget %s", w->className()); |
908 | return; | 898 | return; |
909 | } | 899 | } |
910 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 900 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
911 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 901 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
912 | if(w->backgroundMode() == QWidget::PaletteBackground || | 902 | if(w->backgroundMode() == QWidget::PaletteBackground || |
913 | w->backgroundMode() == QWidget::PaletteButton){ | 903 | w->backgroundMode() == QWidget::PaletteButton){ |
914 | w->setBackgroundMode(QWidget::X11ParentRelative); | 904 | w->setBackgroundMode(QWidget::X11ParentRelative); |
915 | } | 905 | } |
916 | } | 906 | } |
917 | if(w->inherits("QToolBar")){ | 907 | if(w->inherits("QToolBar")){ |
918 | w->installEventFilter(this); | 908 | w->installEventFilter(this); |
919 | w->setBackgroundMode(QWidget::PaletteBackground); | 909 | w->setBackgroundMode(QWidget::PaletteBackground); |
920 | return; | 910 | return; |
921 | } | 911 | } |
922 | 912 | ||
923 | } | 913 | } |
924 | 914 | ||
925 | void LiquidStyle::unPolish(QWidget *w) | 915 | void LiquidStyle::unPolish(QWidget *w) |
926 | { | 916 | { |
927 | if(w->inherits("QMenuBar")){ | 917 | if(w->inherits("QMenuBar")){ |
928 | ((QFrame *)w)->setLineWidth(1); | 918 | ((QFrame *)w)->setLineWidth(1); |
929 | w->setBackgroundMode(QWidget::PaletteBackground); | 919 | w->setBackgroundMode(QWidget::PaletteBackground); |
930 | return; | 920 | return; |
931 | } | 921 | } |
932 | 922 | ||
933 | if(w->inherits("QPopupMenu")) | 923 | if(w->inherits("QPopupMenu")) |
934 | w->setBackgroundMode(QWidget::PaletteButton); | 924 | w->setBackgroundMode(QWidget::PaletteButton); |
935 | else if(w-> testWFlags(Qt::WType_Popup)) { | 925 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
936 | w->removeEventFilter(menuHandler); | 926 | w->removeEventFilter(menuHandler); |
937 | } | 927 | } |
938 | 928 | ||
939 | if(w->isTopLevel()) | 929 | if(w->isTopLevel()) |
940 | return; | 930 | return; |
941 | 931 | ||
942 | // for viewport children, don't just check for NoBackground.... | 932 | // for viewport children, don't just check for NoBackground.... |
943 | bool isViewportChild = w->parent() && | 933 | bool isViewportChild = w->parent() && |
944 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 934 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
945 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 935 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
946 | 936 | ||
947 | w->setPalette(QApplication::palette()); | 937 | w->setPalette(QApplication::palette()); |
948 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 938 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
949 | if(w->inherits("QPushButton")) | 939 | if(w->inherits("QPushButton")) |
950 | w->setBackgroundMode(QWidget::PaletteButton); | 940 | w->setBackgroundMode(QWidget::PaletteButton); |
951 | else | 941 | else |
952 | w->setBackgroundMode(QWidget::PaletteBackground); | 942 | w->setBackgroundMode(QWidget::PaletteBackground); |
953 | } | 943 | } |
954 | 944 | ||
955 | if(isViewportChild) | 945 | if(isViewportChild) |
956 | w->setAutoMask(false); | 946 | w->setAutoMask(false); |
957 | 947 | ||
958 | if(w->inherits("QPushButton")){ | 948 | if(w->inherits("QPushButton")){ |
959 | unapplyCustomAttributes((QPushButton *)w); | 949 | unapplyCustomAttributes((QPushButton *)w); |
960 | w->removeEventFilter(this); | 950 | w->removeEventFilter(this); |
961 | } | 951 | } |
962 | /* | 952 | /* |
963 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 953 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
964 | w-> setBackgroundMode ( PaletteBackground ); | 954 | w-> setBackgroundMode ( PaletteBackground ); |
965 | } | 955 | } |
966 | */ | 956 | */ |
967 | if(w->inherits("QComboBox") || | 957 | if(w->inherits("QComboBox") || |
968 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 958 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
969 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 959 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
970 | w->removeEventFilter(this); | 960 | w->removeEventFilter(this); |
971 | } | 961 | } |
972 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 962 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
973 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ | 963 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ |
974 | w->setAutoMask(false); | 964 | w->setAutoMask(false); |
975 | } | 965 | } |
976 | } | 966 | } |
977 | if(w->inherits("QToolBar")){ | 967 | if(w->inherits("QToolBar")){ |
978 | w->removeEventFilter(this); | 968 | w->removeEventFilter(this); |
979 | w->setBackgroundMode(QWidget::PaletteBackground); | 969 | w->setBackgroundMode(QWidget::PaletteBackground); |
980 | return; | 970 | return; |
981 | } | 971 | } |
982 | if(w->inherits("QHeader")){ | 972 | if(w->inherits("QHeader")){ |
983 | w->setMouseTracking(false); | 973 | w->setMouseTracking(false); |
984 | w->removeEventFilter(this); | 974 | w->removeEventFilter(this); |
985 | } | 975 | } |
986 | } | 976 | } |
987 | 977 | ||
988 | void LiquidStyle::polish(QApplication *app) | 978 | void LiquidStyle::polish(QApplication *app) |
989 | { | 979 | { |
990 | 980 | ||
991 | QWindowsStyle::polish(app); | 981 | QWindowsStyle::polish(app); |
992 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | 982 | menuAni = app->isEffectEnabled(UI_AnimateMenu); |
993 | menuFade = app->isEffectEnabled(UI_FadeMenu); | 983 | menuFade = app->isEffectEnabled(UI_FadeMenu); |
994 | if(menuAni) | 984 | if(menuAni) |
995 | app->setEffectEnabled(UI_AnimateMenu, false); | 985 | app->setEffectEnabled(UI_AnimateMenu, false); |
996 | if(menuFade) | 986 | if(menuFade) |
997 | app->setEffectEnabled(UI_FadeMenu, false); | 987 | app->setEffectEnabled(UI_FadeMenu, false); |
998 | 988 | ||
999 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | 989 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); |
1000 | } | 990 | } |
1001 | 991 | ||
1002 | void LiquidStyle::unPolish(QApplication *app) | 992 | void LiquidStyle::unPolish(QApplication *app) |
1003 | { | 993 | { |
1004 | QWindowsStyle::unPolish(app); | 994 | QWindowsStyle::unPolish(app); |
1005 | app->setEffectEnabled(UI_AnimateMenu, menuAni); | 995 | app->setEffectEnabled(UI_AnimateMenu, menuAni); |
1006 | app->setEffectEnabled(UI_FadeMenu, menuFade); | 996 | app->setEffectEnabled(UI_FadeMenu, menuFade); |
1007 | 997 | ||
1008 | qt_set_draw_menu_bar_impl ( 0 ); | 998 | qt_set_draw_menu_bar_impl ( 0 ); |
1009 | } | 999 | } |
1010 | 1000 | ||
1011 | /* | 1001 | /* |
1012 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to | 1002 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to |
1013 | * force everything to erase and repaint on resize. This is going away, I'm | 1003 | * force everything to erase and repaint on resize. This is going away, I'm |
1014 | * trying to get shaped widgets to work right without masking. QPushButton, | 1004 | * trying to get shaped widgets to work right without masking. QPushButton, |
1015 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order | 1005 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order |
1016 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and | 1006 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and |
1017 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and | 1007 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and |
1018 | * caches them in QPixmapCache, which is bad for doing things like hover | 1008 | * caches them in QPixmapCache, which is bad for doing things like hover |
1019 | * because the style methods aren't called in paintEvents if everything | 1009 | * because the style methods aren't called in paintEvents if everything |
1020 | * is cached. We use our own Paint event handler instead. Taskbuttons and | 1010 | * is cached. We use our own Paint event handler instead. Taskbuttons and |
1021 | * pager buttons draw into a pixmap buffer, so we handle those with palette | 1011 | * pager buttons draw into a pixmap buffer, so we handle those with palette |
1022 | * modifications. For QHeader, different header items are actually one widget | 1012 | * modifications. For QHeader, different header items are actually one widget |
1023 | * that draws multiple items, so we need to check which ID is hightlighted | 1013 | * that draws multiple items, so we need to check which ID is hightlighted |
1024 | * and draw it. Finally, we also check enter and leave events for QLineEdit, | 1014 | * and draw it. Finally, we also check enter and leave events for QLineEdit, |
1025 | * since if it's inside a combobox we want to highlight the combobox during | 1015 | * since if it's inside a combobox we want to highlight the combobox during |
1026 | * hovering in the edit. | 1016 | * hovering in the edit. |
1027 | */ | 1017 | */ |
1028 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 1018 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
1029 | { | 1019 | { |
1030 | if(obj->inherits("QToolBar")){ | 1020 | if(obj->inherits("QToolBar")){ |
1031 | if(ev->type() == QEvent::Resize){ | 1021 | if(ev->type() == QEvent::Resize){ |
1032 | const QObjectList *tbChildList = obj->children(); | 1022 | const QObjectList *tbChildList = obj->children(); |
1033 | QObjectListIt it(*tbChildList); | 1023 | QObjectListIt it(*tbChildList); |
1034 | QObject *child; | 1024 | QObject *child; |
1035 | while((child = it.current()) != NULL){ | 1025 | while((child = it.current()) != NULL){ |
1036 | ++it; | 1026 | ++it; |
1037 | if(child->isWidgetType()) | 1027 | if(child->isWidgetType()) |
1038 | ((QWidget *)child)->repaint(true); | 1028 | ((QWidget *)child)->repaint(true); |
1039 | } | 1029 | } |
1040 | 1030 | ||
1041 | } | 1031 | } |
1042 | } | 1032 | } |
1043 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 1033 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ |
1044 | QWidget *btn = (QWidget *)obj; | 1034 | QWidget *btn = (QWidget *)obj; |
1045 | if(ev->type() == QEvent::Enter){ | 1035 | if(ev->type() == QEvent::Enter){ |
1046 | if(btn->isEnabled()){ | 1036 | if(btn->isEnabled()){ |
1047 | highlightWidget = btn; | 1037 | highlightWidget = btn; |
1048 | btn->repaint(false); | 1038 | btn->repaint(false); |
1049 | } | 1039 | } |
1050 | } | 1040 | } |
1051 | else if(ev->type() == QEvent::Leave){ | 1041 | else if(ev->type() == QEvent::Leave){ |
1052 | if(btn == highlightWidget){ | 1042 | if(btn == highlightWidget){ |
1053 | highlightWidget = NULL; | 1043 | highlightWidget = NULL; |
1054 | btn->repaint(false); | 1044 | btn->repaint(false); |
1055 | } | 1045 | } |
1056 | } | 1046 | } |
1057 | } | 1047 | } |
1058 | else if(obj->inherits("QToolButton")){ | 1048 | else if(obj->inherits("QToolButton")){ |
1059 | QToolButton *btn = (QToolButton *)btn; | 1049 | QToolButton *btn = (QToolButton *)btn; |
1060 | if(!btn->autoRaise()){ | 1050 | if(!btn->autoRaise()){ |
1061 | if(btn->isEnabled()){ | 1051 | if(btn->isEnabled()){ |
1062 | highlightWidget = btn; | 1052 | highlightWidget = btn; |
1063 | btn->repaint(false); | 1053 | btn->repaint(false); |
1064 | } | 1054 | } |
1065 | } | 1055 | } |
1066 | else if(ev->type() == QEvent::Leave){ | 1056 | else if(ev->type() == QEvent::Leave){ |
1067 | QWidget *btn = (QWidget *)obj; | 1057 | QWidget *btn = (QWidget *)obj; |
1068 | if(btn == highlightWidget){ | 1058 | if(btn == highlightWidget){ |
1069 | highlightWidget = NULL; | 1059 | highlightWidget = NULL; |
1070 | btn->repaint(false); | 1060 | btn->repaint(false); |
1071 | } | 1061 | } |
1072 | } | 1062 | } |
1073 | else | 1063 | else |
1074 | highlightWidget = NULL; | 1064 | highlightWidget = NULL; |
1075 | } | 1065 | } |
1076 | else if(obj->inherits("QScrollBar")){ | 1066 | else if(obj->inherits("QScrollBar")){ |
1077 | QScrollBar *sb = (QScrollBar *)obj; | 1067 | QScrollBar *sb = (QScrollBar *)obj; |
1078 | if(ev->type() == QEvent::Enter){ | 1068 | if(ev->type() == QEvent::Enter){ |
1079 | if(sb->isEnabled()){ | 1069 | if(sb->isEnabled()){ |
1080 | highlightWidget = sb; | 1070 | highlightWidget = sb; |
1081 | sb->repaint(false); | 1071 | sb->repaint(false); |
1082 | } | 1072 | } |
1083 | } | 1073 | } |
1084 | else if(ev->type() == QEvent::Leave){ | 1074 | else if(ev->type() == QEvent::Leave){ |
1085 | if(sb == highlightWidget && !sb->draggingSlider()){ | 1075 | if(sb == highlightWidget && !sb->draggingSlider()){ |
1086 | highlightWidget = NULL; | 1076 | highlightWidget = NULL; |
1087 | sb->repaint(false); | 1077 | sb->repaint(false); |
1088 | } | 1078 | } |
1089 | } | 1079 | } |
1090 | else if(ev->type() == QEvent::MouseButtonRelease){ | 1080 | else if(ev->type() == QEvent::MouseButtonRelease){ |
1091 | QMouseEvent *me = (QMouseEvent *)ev; | 1081 | QMouseEvent *me = (QMouseEvent *)ev; |
1092 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ | 1082 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ |
1093 | highlightWidget = NULL; | 1083 | highlightWidget = NULL; |
1094 | sb->repaint(false); | 1084 | sb->repaint(false); |
1095 | } | 1085 | } |
1096 | } | 1086 | } |
1097 | } | 1087 | } |
1098 | else if(obj->inherits("QLineEdit")){ | 1088 | else if(obj->inherits("QLineEdit")){ |
1099 | if(obj->parent() && obj->parent()->inherits("QComboBox")){ | 1089 | if(obj->parent() && obj->parent()->inherits("QComboBox")){ |
1100 | QWidget *btn = (QComboBox *)obj->parent(); | 1090 | QWidget *btn = (QComboBox *)obj->parent(); |
1101 | if(ev->type() == QEvent::Enter){ | 1091 | if(ev->type() == QEvent::Enter){ |
1102 | if (btn->isEnabled()){ | 1092 | if (btn->isEnabled()){ |
1103 | highlightWidget = btn; | 1093 | highlightWidget = btn; |
1104 | btn->repaint(false); | 1094 | btn->repaint(false); |
1105 | } | 1095 | } |
1106 | } | 1096 | } |
1107 | else if(ev->type() == QEvent::Leave){ | 1097 | else if(ev->type() == QEvent::Leave){ |
1108 | if (btn == highlightWidget) | 1098 | if (btn == highlightWidget) |
1109 | highlightWidget = NULL; | 1099 | highlightWidget = NULL; |
1110 | btn->repaint(false); | 1100 | btn->repaint(false); |
1111 | } | 1101 | } |
1112 | } | 1102 | } |
1113 | } | 1103 | } |
1114 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ | 1104 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ |
1115 | QButton *btn = (QButton *)obj; | 1105 | QButton *btn = (QButton *)obj; |
1116 | bool isRadio = obj->inherits("QRadioButton"); | 1106 | bool isRadio = obj->inherits("QRadioButton"); |
1117 | if(ev->type() == QEvent::Paint){ | 1107 | if(ev->type() == QEvent::Paint){ |
1118 | //if(btn->autoMask()) | 1108 | //if(btn->autoMask()) |
1119 | btn->erase(); | 1109 | btn->erase(); |
1120 | QPainter p; | 1110 | QPainter p; |
1121 | p.begin(btn); | 1111 | p.begin(btn); |
1122 | QFontMetrics fm = btn->fontMetrics(); | 1112 | QFontMetrics fm = btn->fontMetrics(); |
1123 | QSize lsz = fm.size(ShowPrefix, btn->text()); | 1113 | QSize lsz = fm.size(ShowPrefix, btn->text()); |
1124 | QSize sz = isRadio ? exclusiveIndicatorSize() | 1114 | QSize sz = isRadio ? exclusiveIndicatorSize() |
1125 | : indicatorSize(); | 1115 | : indicatorSize(); |
1126 | 1116 | ||
1127 | if(btn->hasFocus()){ | 1117 | if(btn->hasFocus()){ |
1128 | QRect r = QRect(0, 0, btn->width(), btn->height()); | 1118 | QRect r = QRect(0, 0, btn->width(), btn->height()); |
1129 | p.setPen(btn->colorGroup().button().dark(140)); | 1119 | p.setPen(btn->colorGroup().button().dark(140)); |
1130 | p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); | 1120 | p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); |
1131 | p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); | 1121 | p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); |
1132 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); | 1122 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); |
1133 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); | 1123 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); |
1134 | } | 1124 | } |
1135 | int x = 0; | 1125 | int x = 0; |
1136 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | 1126 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; |
1137 | if(isRadio) | 1127 | if(isRadio) |
1138 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | 1128 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), |
1139 | btn->colorGroup(), btn->isOn(), | 1129 | btn->colorGroup(), btn->isOn(), |
1140 | btn->isDown(), btn->isEnabled()); | 1130 | btn->isDown(), btn->isEnabled()); |
1141 | else | 1131 | else |
1142 | drawIndicator(&p, x, y, sz.width(), sz.height(), | 1132 | drawIndicator(&p, x, y, sz.width(), sz.height(), |
1143 | btn->colorGroup(), btn->state(), btn->isDown(), | 1133 | btn->colorGroup(), btn->state(), btn->isDown(), |
1144 | btn->isEnabled()); | 1134 | btn->isEnabled()); |
1145 | x = sz.width() + 6; | 1135 | x = sz.width() + 6; |
1146 | y = 0; | 1136 | y = 0; |
1147 | drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), | 1137 | drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), |
1148 | btn->height(), AlignLeft|AlignVCenter|ShowPrefix, | 1138 | btn->height(), AlignLeft|AlignVCenter|ShowPrefix, |
1149 | btn->colorGroup(), btn->isEnabled(), | 1139 | btn->colorGroup(), btn->isEnabled(), |
1150 | btn->pixmap(), btn->text()); | 1140 | btn->pixmap(), btn->text()); |
1151 | p.end(); | 1141 | p.end(); |
1152 | return(true); | 1142 | return(true); |
1153 | } | 1143 | } |
1154 | // for hover, just redraw the indicator (not the text) | 1144 | // for hover, just redraw the indicator (not the text) |
1155 | else if((ev->type() == QEvent::Enter && btn->isEnabled()) || | 1145 | else if((ev->type() == QEvent::Enter && btn->isEnabled()) || |
1156 | (ev->type() == QEvent::Leave && btn == highlightWidget)){ | 1146 | (ev->type() == QEvent::Leave && btn == highlightWidget)){ |
1157 | QButton *btn = (QButton *)obj; | 1147 | QButton *btn = (QButton *)obj; |
1158 | bool isRadio = obj->inherits("QRadioButton"); | 1148 | bool isRadio = obj->inherits("QRadioButton"); |
1159 | 1149 | ||
1160 | if(ev->type() == QEvent::Enter) | 1150 | if(ev->type() == QEvent::Enter) |
1161 | highlightWidget = btn; | 1151 | highlightWidget = btn; |
1162 | else | 1152 | else |
1163 | highlightWidget = NULL; | 1153 | highlightWidget = NULL; |
1164 | QFontMetrics fm = btn->fontMetrics(); | 1154 | QFontMetrics fm = btn->fontMetrics(); |
1165 | QSize lsz = fm.size(ShowPrefix, btn->text()); | 1155 | QSize lsz = fm.size(ShowPrefix, btn->text()); |
1166 | QSize sz = isRadio ? exclusiveIndicatorSize() | 1156 | QSize sz = isRadio ? exclusiveIndicatorSize() |
1167 | : indicatorSize(); | 1157 | : indicatorSize(); |
1168 | int x = 0; | 1158 | int x = 0; |
1169 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | 1159 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; |
1170 | //if(btn->autoMask()) | 1160 | //if(btn->autoMask()) |
1171 | // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); | 1161 | // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); |
1172 | QPainter p; | 1162 | QPainter p; |
1173 | p.begin(btn); | 1163 | p.begin(btn); |
1174 | if(isRadio) | 1164 | if(isRadio) |
1175 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | 1165 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), |
1176 | btn->colorGroup(), btn->isOn(), | 1166 | btn->colorGroup(), btn->isOn(), |
1177 | btn->isDown(), btn->isEnabled()); | 1167 | btn->isDown(), btn->isEnabled()); |
1178 | else | 1168 | else |
1179 | drawIndicator(&p, x, y, sz.width(), sz.height(), | 1169 | drawIndicator(&p, x, y, sz.width(), sz.height(), |
1180 | btn->colorGroup(), btn->state(), btn->isDown(), | 1170 | btn->colorGroup(), btn->state(), btn->isDown(), |
1181 | btn->isEnabled()); | 1171 | btn->isEnabled()); |
1182 | p.end(); | 1172 | p.end(); |
1183 | } | 1173 | } |
1184 | } | 1174 | } |
1185 | else if(obj->inherits("QHeader")){ | 1175 | else if(obj->inherits("QHeader")){ |
1186 | QHeader *hw = (QHeader *)obj; | 1176 | QHeader *hw = (QHeader *)obj; |
1187 | if(ev->type() == QEvent::Enter){ | 1177 | if(ev->type() == QEvent::Enter){ |
1188 | currentHeader = hw; | 1178 | currentHeader = hw; |
1189 | headerHoverID = -1; | 1179 | headerHoverID = -1; |
1190 | } | 1180 | } |
1191 | else if(ev->type() == QEvent::Leave){ | 1181 | else if(ev->type() == QEvent::Leave){ |
1192 | currentHeader = NULL; | 1182 | currentHeader = NULL; |
1193 | if(headerHoverID != -1){ | 1183 | if(headerHoverID != -1){ |
1194 | hw->repaint(hw->sectionPos(headerHoverID), 0, | 1184 | hw->repaint(hw->sectionPos(headerHoverID), 0, |
1195 | hw->sectionSize(headerHoverID), hw->height()); | 1185 | hw->sectionSize(headerHoverID), hw->height()); |
1196 | } | 1186 | } |
1197 | headerHoverID = -1; | 1187 | headerHoverID = -1; |
1198 | } | 1188 | } |
1199 | else if(ev->type() == QEvent::MouseMove){ | 1189 | else if(ev->type() == QEvent::MouseMove){ |
1200 | QMouseEvent *me = (QMouseEvent *)ev; | 1190 | QMouseEvent *me = (QMouseEvent *)ev; |
1201 | int oldHeader = headerHoverID; | 1191 | int oldHeader = headerHoverID; |
1202 | headerHoverID = hw->sectionAt(me->x()); | 1192 | headerHoverID = hw->sectionAt(me->x()); |
1203 | if(oldHeader != headerHoverID){ | 1193 | if(oldHeader != headerHoverID){ |
1204 | // reset old header | 1194 | // reset old header |
1205 | if(oldHeader != -1){ | 1195 | if(oldHeader != -1){ |
1206 | hw->repaint(hw->sectionPos(oldHeader), 0, | 1196 | hw->repaint(hw->sectionPos(oldHeader), 0, |
1207 | hw->sectionSize(oldHeader), hw->height()); | 1197 | hw->sectionSize(oldHeader), hw->height()); |
1208 | } | 1198 | } |
1209 | if(headerHoverID != -1){ | 1199 | if(headerHoverID != -1){ |
1210 | hw->repaint(hw->sectionPos(headerHoverID), 0, | 1200 | hw->repaint(hw->sectionPos(headerHoverID), 0, |
1211 | hw->sectionSize(headerHoverID), hw->height()); | 1201 | hw->sectionSize(headerHoverID), hw->height()); |
1212 | } | 1202 | } |
1213 | } | 1203 | } |
1214 | } | 1204 | } |
1215 | } | 1205 | } |
1216 | return(false); | 1206 | return(false); |
1217 | } | 1207 | } |
1218 | 1208 | ||
1219 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, | 1209 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, |
1220 | const QColorGroup &g, bool sunken, | 1210 | const QColorGroup &g, bool sunken, |
1221 | const QBrush *) | 1211 | const QBrush *) |
1222 | { | 1212 | { |
1223 | drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), | 1213 | drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), |
1224 | x, y, w, h); | 1214 | x, y, w, h); |
1225 | } | 1215 | } |
1226 | 1216 | ||
1227 | void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, | 1217 | void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, |
1228 | const QColorGroup &g, bool sunken, | 1218 | const QColorGroup &g, bool sunken, |
1229 | const QBrush *) | 1219 | const QBrush *) |
1230 | { | 1220 | { |
1231 | if(p->device()->devType() != QInternal::Widget){ | 1221 | if(p->device()->devType() != QInternal::Widget){ |
1232 | // drawing into a temp pixmap, don't use mask | 1222 | // drawing into a temp pixmap, don't use mask |
1233 | QColor c = sunken ? g.button() : g.background(); | 1223 | QColor c = sunken ? g.button() : g.background(); |
1234 | p->setPen(c.dark(130)); | 1224 | p->setPen(c.dark(130)); |
1235 | p->drawRect(x, y, w, h); | 1225 | p->drawRect(x, y, w, h); |
1236 | p->setPen(c.light(105)); | 1226 | p->setPen(c.light(105)); |
1237 | p->drawRect(x+1, y+1, w-2, h-2); | 1227 | p->drawRect(x+1, y+1, w-2, h-2); |
1238 | 1228 | ||
1239 | 1229 | ||
1240 | // fill | 1230 | // fill |
1241 | QPixmap *pix = bevelFillDict.find(c.rgb()); | 1231 | QPixmap *pix = bevelFillDict.find(c.rgb()); |
1242 | if(!pix){ | 1232 | if(!pix){ |
1243 | int h, s, v; | 1233 | int h, s, v; |
1244 | c.hsv(&h, &s, &v); | 1234 | c.hsv(&h, &s, &v); |
1245 | pix = new QPixmap(*bevelFillPix); | 1235 | pix = new QPixmap(*bevelFillPix); |
1246 | adjustHSV(*pix, h, s, v); | 1236 | adjustHSV(*pix, h, s, v); |
1247 | bevelFillDict.insert(c.rgb(), pix); | 1237 | bevelFillDict.insert(c.rgb(), pix); |
1248 | } | 1238 | } |
1249 | 1239 | ||
1250 | p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | 1240 | p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); |
1251 | } | 1241 | } |
1252 | else{ | 1242 | else{ |
1253 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : | 1243 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : |
1254 | highlightWidget == p->device() ? g.button().light(110) : | 1244 | highlightWidget == p->device() ? g.button().light(110) : |
1255 | g.background(), g.background()); | 1245 | g.background(), g.background()); |
1256 | } | 1246 | } |
1257 | } | 1247 | } |
1258 | 1248 | ||
1259 | void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) | 1249 | void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) |
1260 | { | 1250 | { |
1261 | QRect r = btn->rect(); | 1251 | QRect r = btn->rect(); |
1262 | bool sunken = btn->isOn() || btn->isDown(); | 1252 | bool sunken = btn->isOn() || btn->isDown(); |
1263 | QColorGroup g = btn->colorGroup(); | 1253 | QColorGroup g = btn->colorGroup(); |
1264 | 1254 | ||
1265 | 1255 | ||
1266 | //int dw = buttonDefaultIndicatorWidth(); | 1256 | //int dw = buttonDefaultIndicatorWidth(); |
1267 | if(btn->hasFocus() || btn->isDefault()){ | 1257 | if(btn->hasFocus() || btn->isDefault()){ |
1268 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); | 1258 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); |
1269 | QPixmap *pix = bevelFillDict.find(c.rgb()); | 1259 | QPixmap *pix = bevelFillDict.find(c.rgb()); |
1270 | if(!pix){ | 1260 | if(!pix){ |
1271 | int h, s, v; | 1261 | int h, s, v; |
1272 | c.hsv(&h, &s, &v); | 1262 | c.hsv(&h, &s, &v); |
1273 | pix = new QPixmap(*bevelFillPix); | 1263 | pix = new QPixmap(*bevelFillPix); |
1274 | adjustHSV(*pix, h, s, v); | 1264 | adjustHSV(*pix, h, s, v); |
1275 | bevelFillDict.insert(c.rgb(), pix); | 1265 | bevelFillDict.insert(c.rgb(), pix); |
1276 | } | 1266 | } |
1277 | p->setPen(c.dark(150)); | 1267 | p->setPen(c.dark(150)); |
1278 | p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); | 1268 | p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); |
1279 | p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); | 1269 | p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); |
1280 | p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); | 1270 | p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); |
1281 | p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); | 1271 | p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); |
1282 | p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); | 1272 | p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); |
1283 | } | 1273 | } |
1284 | 1274 | ||
1285 | QColor newColor = btn == highlightWidget || sunken ? | 1275 | QColor newColor = btn == highlightWidget || sunken ? |
1286 | g.button().light(120) : g.button(); | 1276 | g.button().light(120) : g.button(); |
1287 | 1277 | ||
1288 | drawRoundButton(p, newColor, g.background(), | 1278 | drawRoundButton(p, newColor, g.background(), |
1289 | r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), | 1279 | r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), |
1290 | sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), | 1280 | sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), |
1291 | btn->autoMask()); | 1281 | btn->autoMask()); |
1292 | } | 1282 | } |
1293 | 1283 | ||
1294 | void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) | 1284 | void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) |
1295 | { | 1285 | { |
1296 | int x1, y1, x2, y2, w, h; | 1286 | int x1, y1, x2, y2, w, h; |
1297 | btn->rect().coords(&x1, &y1, &x2, &y2); | 1287 | btn->rect().coords(&x1, &y1, &x2, &y2); |
1298 | w = btn->width(); | 1288 | w = btn->width(); |
1299 | h = btn->height(); | 1289 | h = btn->height(); |
1300 | 1290 | ||
1301 | bool act = btn->isOn() || btn->isDown(); | 1291 | bool act = btn->isOn() || btn->isDown(); |
1302 | if(act){ | 1292 | if(act){ |
1303 | ++x1, ++y1; | 1293 | ++x1, ++y1; |
1304 | } | 1294 | } |
1305 | 1295 | ||
1306 | // Draw iconset first, if any | 1296 | // Draw iconset first, if any |
1307 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) | 1297 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) |
1308 | { | 1298 | { |
1309 | QIconSet::Mode mode = btn->isEnabled() | 1299 | QIconSet::Mode mode = btn->isEnabled() |
1310 | ? QIconSet::Normal : QIconSet::Disabled; | 1300 | ? QIconSet::Normal : QIconSet::Disabled; |
1311 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 1301 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
1312 | mode = QIconSet::Active; | 1302 | mode = QIconSet::Active; |
1313 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); | 1303 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); |
1314 | int pixw = pixmap.width(); | 1304 | int pixw = pixmap.width(); |
1315 | int pixh = pixmap.height(); | 1305 | int pixh = pixmap.height(); |
1316 | 1306 | ||
1317 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); | 1307 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); |
1318 | x1 += pixw + 8; | 1308 | x1 += pixw + 8; |
1319 | w -= pixw + 8; | 1309 | w -= pixw + 8; |
diff --git a/noncore/styles/liquid/plugin.cpp b/noncore/styles/liquid/plugin.cpp index fca7c06..d9aa8ef 100644 --- a/noncore/styles/liquid/plugin.cpp +++ b/noncore/styles/liquid/plugin.cpp | |||
@@ -1,29 +1,29 @@ | |||
1 | #include "liquid.h" | 1 | #include "liquid.h" |
2 | 2 | ||
3 | 3 | ||
4 | extern "C" { | 4 | extern "C" { |
5 | QStyle* allocate ( ); | 5 | QStyle* allocate ( ); |
6 | int minor_version ( ); | 6 | int minor_version ( ); |
7 | int major_version ( ); | 7 | int major_version ( ); |
8 | const char *description ( ); | 8 | const char *description ( ); |
9 | } | 9 | } |
10 | 10 | ||
11 | QStyle* allocate ( ) | 11 | QStyle* allocate ( ) |
12 | { | 12 | { |
13 | return new LiquidStyle ( ); | 13 | return new LiquidStyle ( ); |
14 | } | 14 | } |
15 | 15 | ||
16 | int minor_version ( ) | 16 | int minor_version ( ) |
17 | { | 17 | { |
18 | return 0; | 18 | return 0; |
19 | } | 19 | } |
20 | 20 | ||
21 | int major_version ( ) | 21 | int major_version ( ) |
22 | { | 22 | { |
23 | return 1; | 23 | return 1; |
24 | } | 24 | } |
25 | 25 | ||
26 | const char *description ( ) | 26 | const char *description ( ) |
27 | { | 27 | { |
28 | return "High performance liquid plugin"; | 28 | return "High Performance Liquid"; |
29 | } | 29 | } |