summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-24 18:30:51 (UTC)
committer sandman <sandman>2002-11-24 18:30:51 (UTC)
commit1b2c3ce0d94f033e8ffe1aa8575b210cdfb3c1ec (patch) (unidiff)
treed816c0e06c067403b6e75515a27dde632ebb88a8
parentd6b3ed253bf86b63bb7a805cfea93b8d489135d1 (diff)
downloadopie-1b2c3ce0d94f033e8ffe1aa8575b210cdfb3c1ec.zip
opie-1b2c3ce0d94f033e8ffe1aa8575b210cdfb3c1ec.tar.gz
opie-1b2c3ce0d94f033e8ffe1aa8575b210cdfb3c1ec.tar.bz2
Valgrind complaint
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index c8f8d20..daac22c 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,694 +1,695 @@
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// (c) 2002 Robert 'sandman' Griebl 6// (c) 2002 Robert 'sandman' Griebl
7// 7//
8 8
9 9
10#ifndef INCLUDE_MENUITEM_DEF 10#ifndef INCLUDE_MENUITEM_DEF
11#define INCLUDE_MENUITEM_DEF 11#define INCLUDE_MENUITEM_DEF
12#endif 12#endif
13 13
14#include <qmenudata.h> 14#include <qmenudata.h>
15#include "liquid.h" 15#include "liquid.h"
16//#include "liquiddeco.h" 16//#include "liquiddeco.h"
17#include <qapplication.h> 17#include <qapplication.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include "effects.h" 19#include "effects.h"
20#include <qpalette.h> 20#include <qpalette.h>
21#include <qbitmap.h> 21#include <qbitmap.h>
22#include <qtabbar.h> 22#include <qtabbar.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qobjectlist.h> 24#include <qobjectlist.h>
25#include <qimage.h> 25#include <qimage.h>
26#include <qtimer.h> 26#include <qtimer.h>
27#include <qpixmapcache.h> 27#include <qpixmapcache.h>
28#include <qradiobutton.h> 28#include <qradiobutton.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qdrawutil.h> 30#include <qdrawutil.h>
31#include <qwidgetlist.h> 31#include <qwidgetlist.h>
32#include <qtoolbutton.h> 32#include <qtoolbutton.h>
33#include <qheader.h> 33#include <qheader.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <qmenubar.h> 35#include <qmenubar.h>
36#include <qprogressbar.h> 36#include <qprogressbar.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38 38
39#include <stdio.h> 39#include <stdio.h>
40 40
41#include "htmlmasks.h" 41#include "htmlmasks.h"
42#include "embeddata.h" 42#include "embeddata.h"
43 43
44typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 44typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
45 QColorGroup &, bool, bool); 45 QColorGroup &, bool, bool);
46 46
47QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 47QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
48 48
49void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 49void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
50{ 50{
51 QImage img(pix.convertToImage()); 51 QImage img(pix.convertToImage());
52 QImageEffect::fade(img, 0.9, color); 52 QImageEffect::fade(img, 0.9, color);
53 int x, y; 53 int x, y;
54 int r, g, b; 54 int r, g, b;
55 for(y=0; y < img.height(); y+=3){ 55 for(y=0; y < img.height(); y+=3){
56 unsigned int *data = (unsigned int *) img.scanLine(y); 56 unsigned int *data = (unsigned int *) img.scanLine(y);
57 for(x=0; x < img.width(); ++x){ 57 for(x=0; x < img.width(); ++x){
58 r = qRed(data[x]); 58 r = qRed(data[x]);
59 g = qGreen(data[x]); 59 g = qGreen(data[x]);
60 b = qBlue(data[x]); 60 b = qBlue(data[x]);
61 if(r-10) 61 if(r-10)
62 r-=10; 62 r-=10;
63 if(g-10) 63 if(g-10)
64 g-=10; 64 g-=10;
65 if(b-10) 65 if(b-10)
66 b-=10; 66 b-=10;
67 data[x] = qRgb(r, g, b); 67 data[x] = qRgb(r, g, b);
68 } 68 }
69 } 69 }
70 pix.convertFromImage(img); 70 pix.convertFromImage(img);
71} 71}
72 72
73TransMenuHandler::TransMenuHandler(QObject *parent) 73TransMenuHandler::TransMenuHandler(QObject *parent)
74 : QObject(parent) 74 : QObject(parent)
75{ 75{
76 pixDict.setAutoDelete(true); 76 pixDict.setAutoDelete(true);
77 reloadSettings(); 77 reloadSettings();
78} 78}
79 79
80void TransMenuHandler::reloadSettings() 80void TransMenuHandler::reloadSettings()
81{ 81{
82 pixDict.clear(); 82 pixDict.clear();
83 83
84 Config config ( "qpe" ); 84 Config config ( "qpe" );
85 config. setGroup ( "Liquid-Style" ); 85 config. setGroup ( "Liquid-Style" );
86 86
87 type = config. readNumEntry("Type", TransStippleBg); 87 type = config. readNumEntry("Type", TransStippleBg);
88 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 88 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
89 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 89 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
90 opacity = config. readNumEntry("Opacity", 10); 90 opacity = config. readNumEntry("Opacity", 10);
91 if ( opacity < -20 ) 91 if ( opacity < -20 )
92 opacity = 20; 92 opacity = 20;
93 else if ( opacity > 20 ) 93 else if ( opacity > 20 )
94 opacity = 20; 94 opacity = 20;
95 95
96 shadowText = config. readBoolEntry("ShadowText", true); 96 shadowText = config. readBoolEntry("ShadowText", true);
97} 97}
98 98
99bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 99bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
100{ 100{
101 QWidget *p = (QWidget *)obj; 101 QWidget *p = (QWidget *)obj;
102 102
103 if(ev->type() == QEvent::Show){ 103 if(ev->type() == QEvent::Show){
104 if(type == TransStippleBg || type == TransStippleBtn || 104 if(type == TransStippleBg || type == TransStippleBtn ||
105 type == Custom){ 105 type == Custom){
106 QApplication::syncX(); 106 QApplication::syncX();
107 QPixmap *pix = new QPixmap; 107 QPixmap *pix = new QPixmap;
108 if(p->testWFlags(Qt::WType_Popup)){ 108 if(p->testWFlags(Qt::WType_Popup)){
109 QRect r(p->x(), p->y(), p->width(), p->height()); 109 QRect r(p->x(), p->y(), p->width(), p->height());
110 QRect deskR = QApplication::desktop()->rect(); 110 QRect deskR = QApplication::desktop()->rect();
111 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 111 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
112 r.setBottom(deskR.bottom()); 112 r.setBottom(deskR.bottom());
113 r.setRight(deskR.right()); 113 r.setRight(deskR.right());
114 } 114 }
115 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 115 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
116 r.width(), r.height()); 116 r.width(), r.height());
117 } 117 }
118 else{ // tear off menu 118 else{ // tear off menu
119 pix->resize(p->width(), p->height()); 119 pix->resize(p->width(), p->height());
120 pix->fill(Qt::black.rgb()); 120 pix->fill(Qt::black.rgb());
121 } 121 }
122 if(type == TransStippleBg){ 122 if(type == TransStippleBg){
123 stripePixmap(*pix, p->colorGroup().background()); 123 stripePixmap(*pix, p->colorGroup().background());
124 } 124 }
125 else if(type == TransStippleBtn){ 125 else if(type == TransStippleBtn){
126 stripePixmap(*pix, p->colorGroup().button()); 126 stripePixmap(*pix, p->colorGroup().button());
127 } 127 }
128 else{ 128 else{
129 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 129 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
130 } 130 }
131 131
132 pixDict.insert(p->winId(), pix); 132 pixDict.insert(p->winId(), pix);
133 133
134 if ( !p->inherits("QPopupMenu")) 134 if ( !p->inherits("QPopupMenu"))
135 p->setBackgroundPixmap(*pix); 135 p->setBackgroundPixmap(*pix);
136 136
137 QObjectList *ol = p-> queryList("QWidget"); 137 QObjectList *ol = p-> queryList("QWidget");
138 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 138 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
139 QWidget *wid = (QWidget *) it.current ( ); 139 QWidget *wid = (QWidget *) it.current ( );
140 140
141 wid-> setBackgroundPixmap(*pix); 141 wid-> setBackgroundPixmap(*pix);
142 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 142 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
143 } 143 }
144 delete ol; 144 delete ol;
145 } 145 }
146 } 146 }
147 else if(ev->type() == QEvent::Hide){ 147 else if(ev->type() == QEvent::Hide){
148 if(type == TransStippleBg || type == TransStippleBtn || 148 if(type == TransStippleBg || type == TransStippleBtn ||
149 type == Custom){ 149 type == Custom){
150// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 150// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
151 151
152 pixDict.remove(p->winId()); 152 pixDict.remove(p->winId());
153 if ( !p->inherits("QPopupMenu")) 153 if ( !p->inherits("QPopupMenu"))
154 p->setBackgroundMode(QWidget::PaletteBackground); 154 p->setBackgroundMode(QWidget::PaletteBackground);
155 155
156 QObjectList *ol = p-> queryList("QWidget"); 156 QObjectList *ol = p-> queryList("QWidget");
157 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 157 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
158 QWidget *wid = (QWidget *) it.current ( ); 158 QWidget *wid = (QWidget *) it.current ( );
159 159
160 wid-> setBackgroundMode( QWidget::PaletteBackground ); 160 wid-> setBackgroundMode( QWidget::PaletteBackground );
161 } 161 }
162 delete ol; 162 delete ol;
163 } 163 }
164 } 164 }
165 return(false); 165 return(false);
166} 166}
167 167
168 168
169static int qt_version ( ) 169static int qt_version ( )
170{ 170{
171 const char *qver = qVersion ( ); 171 const char *qver = qVersion ( );
172 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 172 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
173} 173}
174 174
175 175
176LiquidStyle::LiquidStyle() 176LiquidStyle::LiquidStyle()
177 :QWindowsStyle() 177 :QWindowsStyle()
178{ 178{
179 setName ( "LiquidStyle" ); 179 setName ( "LiquidStyle" );
180 180
181 oldqte = ( qt_version ( ) < 234 ); 181 oldqte = ( qt_version ( ) < 234 );
182 flatTBButtons = false; 182 flatTBButtons = false;
183 currentHeader = 0;
183 184
184 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 185 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
185 btnMaskBmp.setMask(btnMaskBmp); 186 btnMaskBmp.setMask(btnMaskBmp);
186 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 187 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
187 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 188 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
188 headerHoverID = -1; 189 headerHoverID = -1;
189 highlightWidget = NULL; 190 highlightWidget = NULL;
190 setButtonDefaultIndicatorWidth(0); 191 setButtonDefaultIndicatorWidth(0);
191 btnDict.setAutoDelete(true); 192 btnDict.setAutoDelete(true);
192 bevelFillDict.setAutoDelete(true); 193 bevelFillDict.setAutoDelete(true);
193 smallBevelFillDict.setAutoDelete(true); 194 smallBevelFillDict.setAutoDelete(true);
194 195
195 rMatrix.rotate(270.0); 196 rMatrix.rotate(270.0);
196 btnBorderPix = new QPixmap; 197 btnBorderPix = new QPixmap;
197 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 198 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
198 btnBlendPix = new QPixmap; 199 btnBlendPix = new QPixmap;
199 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 200 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
200 bevelFillPix = new QPixmap; 201 bevelFillPix = new QPixmap;
201 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 202 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
202 smallBevelFillPix = new QPixmap; 203 smallBevelFillPix = new QPixmap;
203 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 204 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
204 // new stuff 205 // new stuff
205 vsbSliderFillPix = menuPix = NULL; 206 vsbSliderFillPix = menuPix = NULL;
206 menuHandler = new TransMenuHandler(this); 207 menuHandler = new TransMenuHandler(this);
207 setScrollBarExtent(15, 15); 208 setScrollBarExtent(15, 15);
208 int i; 209 int i;
209 for(i=0; i < BITMAP_ITEMS; ++i){ 210 for(i=0; i < BITMAP_ITEMS; ++i){
210 pixmaps[i] = NULL; 211 pixmaps[i] = NULL;
211 } 212 }
212 oldSliderThickness = sliderThickness(); 213 oldSliderThickness = sliderThickness();
213 setSliderThickness(11); 214 setSliderThickness(11);
214} 215}
215 216
216LiquidStyle::~LiquidStyle() 217LiquidStyle::~LiquidStyle()
217{ 218{
218 if(btnBorderPix) 219 if(btnBorderPix)
219 delete btnBorderPix; 220 delete btnBorderPix;
220 if(btnBlendPix) 221 if(btnBlendPix)
221 delete btnBlendPix; 222 delete btnBlendPix;
222 if(bevelFillPix) 223 if(bevelFillPix)
223 delete bevelFillPix; 224 delete bevelFillPix;
224 if(smallBevelFillPix) 225 if(smallBevelFillPix)
225 delete smallBevelFillPix; 226 delete smallBevelFillPix;
226 if(vsbSliderFillPix) 227 if(vsbSliderFillPix)
227 delete vsbSliderFillPix; 228 delete vsbSliderFillPix;
228 if(menuPix) 229 if(menuPix)
229 delete menuPix; 230 delete menuPix;
230 231
231 setScrollBarExtent(16, 16); 232 setScrollBarExtent(16, 16);
232 setSliderThickness(oldSliderThickness); 233 setSliderThickness(oldSliderThickness);
233 int i; 234 int i;
234 for(i=0; i < BITMAP_ITEMS; ++i){ 235 for(i=0; i < BITMAP_ITEMS; ++i){
235 if(pixmaps[i]) 236 if(pixmaps[i])
236 delete pixmaps[i]; 237 delete pixmaps[i];
237 } 238 }
238} 239}
239 240
240void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 241void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
241 const QColor &c, const QColor &bg) 242 const QColor &c, const QColor &bg)
242{ 243{
243 244
244 QPen oldPen = p->pen(); // headers need this 245 QPen oldPen = p->pen(); // headers need this
245 int x2 = x+w-1; 246 int x2 = x+w-1;
246 int y2 = y+h-1; 247 int y2 = y+h-1;
247 // outer dark rect 248 // outer dark rect
248 p->setPen(c.dark(130)); 249 p->setPen(c.dark(130));
249 p->drawLine(x, y+2, x, y2-2); // l 250 p->drawLine(x, y+2, x, y2-2); // l
250 p->drawLine(x2, y+2, x2, y2-2); // r 251 p->drawLine(x2, y+2, x2, y2-2); // r
251 p->drawLine(x+2, y, x2-2, y); // t 252 p->drawLine(x+2, y, x2-2, y); // t
252 p->drawLine(x+2, y2, x2-2, y2); // b 253 p->drawLine(x+2, y2, x2-2, y2); // b
253 p->drawPoint(x+1, y+1); // tl 254 p->drawPoint(x+1, y+1); // tl
254 p->drawPoint(x2-1, y+1); // tr 255 p->drawPoint(x2-1, y+1); // tr
255 p->drawPoint(x+1, y2-1); // bl 256 p->drawPoint(x+1, y2-1); // bl
256 p->drawPoint(x2-1, y2-1); // br 257 p->drawPoint(x2-1, y2-1); // br
257 258
258 // inner top light lines 259 // inner top light lines
259 p->setPen(c.light(105)); 260 p->setPen(c.light(105));
260 p->drawLine(x+2, y+1, x2-2, y+1); 261 p->drawLine(x+2, y+1, x2-2, y+1);
261 p->drawLine(x+1, y+2, x2-1, y+2); 262 p->drawLine(x+1, y+2, x2-1, y+2);
262 p->drawLine(x+1, y+3, x+2, y+3); 263 p->drawLine(x+1, y+3, x+2, y+3);
263 p->drawLine(x2-2, y+3, x2-1, y+3); 264 p->drawLine(x2-2, y+3, x2-1, y+3);
264 p->drawPoint(x+1, y+4); 265 p->drawPoint(x+1, y+4);
265 p->drawPoint(x2-1, y+4); 266 p->drawPoint(x2-1, y+4);
266 267
267 // inner bottom light lines 268 // inner bottom light lines
268 p->setPen(c.light(110)); 269 p->setPen(c.light(110));
269 p->drawLine(x+2, y2-1, x2-2, y2-1); 270 p->drawLine(x+2, y2-1, x2-2, y2-1);
270 p->drawLine(x+1, y2-2, x2-1, y2-2); 271 p->drawLine(x+1, y2-2, x2-1, y2-2);
271 p->drawLine(x+1, y2-3, x+2, y2-3); 272 p->drawLine(x+1, y2-3, x+2, y2-3);
272 p->drawLine(x2-2, y2-3, x2-1, y2-3); 273 p->drawLine(x2-2, y2-3, x2-1, y2-3);
273 p->drawPoint(x+1, y2-4); 274 p->drawPoint(x+1, y2-4);
274 p->drawPoint(x2-1, y2-4); 275 p->drawPoint(x2-1, y2-4);
275 276
276 // inner left mid lines 277 // inner left mid lines
277 //p->setPen(c.light(105)); 278 //p->setPen(c.light(105));
278 p->setPen(c); 279 p->setPen(c);
279 p->drawLine(x+1, y+5, x+1, y2-5); 280 p->drawLine(x+1, y+5, x+1, y2-5);
280 p->drawLine(x+2, y+4, x+2, y2-4); 281 p->drawLine(x+2, y+4, x+2, y2-4);
281 282
282 // inner right mid lines 283 // inner right mid lines
283 p->drawLine(x2-1, y+5, x2-1, y2-5); 284 p->drawLine(x2-1, y+5, x2-1, y2-5);
284 p->drawLine(x2-2, y+4, x2-2, y2-4); 285 p->drawLine(x2-2, y+4, x2-2, y2-4);
285 286
286 // fill 287 // fill
287 QPixmap *pix; 288 QPixmap *pix;
288 if(h >= 32){ 289 if(h >= 32){
289 pix = bevelFillDict.find(c.rgb()); 290 pix = bevelFillDict.find(c.rgb());
290 if(!pix){ 291 if(!pix){
291 int h, s, v; 292 int h, s, v;
292 c.hsv(&h, &s, &v); 293 c.hsv(&h, &s, &v);
293 pix = new QPixmap(*bevelFillPix); 294 pix = new QPixmap(*bevelFillPix);
294 adjustHSV(*pix, h, s, v); 295 adjustHSV(*pix, h, s, v);
295 bevelFillDict.insert(c.rgb(), pix); 296 bevelFillDict.insert(c.rgb(), pix);
296 } 297 }
297 } 298 }
298 else{ 299 else{
299 pix = smallBevelFillDict.find(c.rgb()); 300 pix = smallBevelFillDict.find(c.rgb());
300 if(!pix){ 301 if(!pix){
301 int h, s, v; 302 int h, s, v;
302 c.hsv(&h, &s, &v); 303 c.hsv(&h, &s, &v);
303 pix = new QPixmap(*smallBevelFillPix); 304 pix = new QPixmap(*smallBevelFillPix);
304 adjustHSV(*pix, h, s, v); 305 adjustHSV(*pix, h, s, v);
305 smallBevelFillDict.insert(c.rgb(), pix); 306 smallBevelFillDict.insert(c.rgb(), pix);
306 } 307 }
307 } 308 }
308 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); 309 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix);
309 // blend 310 // blend
310 int red, green, blue; 311 int red, green, blue;
311 QColor btnColor(c.dark(130)); 312 QColor btnColor(c.dark(130));
312 red = (btnColor.red() >> 1) + (bg.red() >> 1); 313 red = (btnColor.red() >> 1) + (bg.red() >> 1);
313 green = (btnColor.green() >> 1) + (bg.green() >> 1); 314 green = (btnColor.green() >> 1) + (bg.green() >> 1);
314 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); 315 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1);
315 btnColor.setRgb(red, green, blue); 316 btnColor.setRgb(red, green, blue);
316 317
317 p->setPen(btnColor); 318 p->setPen(btnColor);
318 p->drawPoint(x+1, y); 319 p->drawPoint(x+1, y);
319 p->drawPoint(x, y+1); 320 p->drawPoint(x, y+1);
320 p->drawPoint(x+1, y2); 321 p->drawPoint(x+1, y2);
321 p->drawPoint(x, y2-1); 322 p->drawPoint(x, y2-1);
322 323
323 p->drawPoint(x2-1, y); 324 p->drawPoint(x2-1, y);
324 p->drawPoint(x2, y+1); 325 p->drawPoint(x2, y+1);
325 p->drawPoint(x2-1, y2); 326 p->drawPoint(x2-1, y2);
326 p->drawPoint(x2, y2-1); 327 p->drawPoint(x2, y2-1);
327 328
328 p->setPen(oldPen); 329 p->setPen(oldPen);
329 330
330} 331}
331 332
332void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, 333void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
333 const QColor &back, int x, int y, int w, int h, 334 const QColor &back, int x, int y, int w, int h,
334 bool supportPushDown, bool pushedDown, 335 bool supportPushDown, bool pushedDown,
335 bool autoDefault, bool isMasked) 336 bool autoDefault, bool isMasked)
336{ 337{
337 if(w < 21 || h < 21){ 338 if(w < 21 || h < 21){
338 drawClearBevel(painter, x, y, w, h, c, back); 339 drawClearBevel(painter, x, y, w, h, c, back);
339 return; 340 return;
340 } 341 }
341 if(supportPushDown){ 342 if(supportPushDown){
342 --w, --h; 343 --w, --h;
343 } 344 }
344 /* We don't make the round buttons smaller, since they don't look as good 345 /* We don't make the round buttons smaller, since they don't look as good
345 if(autoDefault){ 346 if(autoDefault){
346 w = w-buttonDefaultIndicatorWidth()*2; 347 w = w-buttonDefaultIndicatorWidth()*2;
347 h = h-buttonDefaultIndicatorWidth()*2; 348 h = h-buttonDefaultIndicatorWidth()*2;
348 }*/ 349 }*/
349 350
350 351
351 QPixmap *pix = btnDict.find(c.rgb()); 352 QPixmap *pix = btnDict.find(c.rgb());
352 if(!pix){ 353 if(!pix){
353 int h, s, v; 354 int h, s, v;
354 c.hsv(&h, &s, &v); 355 c.hsv(&h, &s, &v);
355 pix = new QPixmap(*btnBorderPix); 356 pix = new QPixmap(*btnBorderPix);
356 adjustHSV(*pix, h, s, v); 357 adjustHSV(*pix, h, s, v);
357 btnDict.insert(c.rgb(), pix); 358 btnDict.insert(c.rgb(), pix);
358 } 359 }
359 int x2 = x+w-1; 360 int x2 = x+w-1;
360 int y2 = y+h-1; 361 int y2 = y+h-1;
361 int bx2 = pix->width()-1; 362 int bx2 = pix->width()-1;
362 int by2 = pix->height()-1; 363 int by2 = pix->height()-1;
363 364
364 QPixmap tmpPix(w, h); 365 QPixmap tmpPix(w, h);
365 QPixmap tilePix; 366 QPixmap tilePix;
366 QPainter p; 367 QPainter p;
367 p.begin(&tmpPix); 368 p.begin(&tmpPix);
368 369
369 // do the fill 370 // do the fill
370 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 371 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
371 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 372 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr
372 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl 373 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl
373 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br 374 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
374 375
375 // edges 376 // edges
376 tilePix.resize(pix->width()-20, 10); 377 tilePix.resize(pix->width()-20, 10);
377 // top 378 // top
378 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 379 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
379 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 380 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
380 // bottom 381 // bottom
381 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 382 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
382 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 383 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
383 // left 384 // left
384 tilePix.resize(10, pix->height()-20); 385 tilePix.resize(10, pix->height()-20);
385 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 386 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
386 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 387 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
387 // right 388 // right
388 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 389 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
389 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 390 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
390 391
391 // middle 392 // middle
392 tilePix.resize(pix->width()-20, pix->height()-20); 393 tilePix.resize(pix->width()-20, pix->height()-20);
393 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); 394 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20);
394 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); 395 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix);
395 396
396 397
397 // do the blend 398 // do the blend
398 QBitmap blendMask; 399 QBitmap blendMask;
399 if(!isMasked){ 400 if(!isMasked){
400 //QRgb bgRgb = back.rgb(); 401 //QRgb bgRgb = back.rgb();
401 //QRgb fgRgb = c.rgb(); 402 //QRgb fgRgb = c.rgb();
402 //int r, g, b; 403 //int r, g, b;
403 404
404 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); 405 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25);
405 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); 406 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25);
406 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); 407 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25);
407 //QColor blendColor(r, g, b); 408 //QColor blendColor(r, g, b);
408 int hue, sat, v1, v2; 409 int hue, sat, v1, v2;
409 QColor blendColor(autoDefault ? c : back); 410 QColor blendColor(autoDefault ? c : back);
410 back.hsv(&hue, &sat, &v1); 411 back.hsv(&hue, &sat, &v1);
411 blendColor.hsv(&hue, &sat, &v2); 412 blendColor.hsv(&hue, &sat, &v2);
412 if(v2 > v1) 413 if(v2 > v1)
413 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); 414 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25));
414 415
415 pix = btnBorderDict.find(blendColor.rgb()); 416 pix = btnBorderDict.find(blendColor.rgb());
416 if(!pix){ 417 if(!pix){
417 int h, s, v; 418 int h, s, v;
418 blendColor.hsv(&h, &s, &v); 419 blendColor.hsv(&h, &s, &v);
419 pix = new QPixmap(*btnBlendPix); 420 pix = new QPixmap(*btnBlendPix);
420 adjustHSV(*pix, h, s, v); 421 adjustHSV(*pix, h, s, v);
421 btnBorderDict.insert(blendColor.rgb(), pix); 422 btnBorderDict.insert(blendColor.rgb(), pix);
422 } 423 }
423 } 424 }
424 else{ 425 else{
425 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : 426 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) :
426 getPixmap(HTMLBtnBorder); 427 getPixmap(HTMLBtnBorder);
427 } 428 }
428 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 429 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
429 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 430 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr
430 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl 431 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl
431 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br 432 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
432 433
433 // edges 434 // edges
434 tilePix.resize(pix->width()-20, 10); 435 tilePix.resize(pix->width()-20, 10);
435 blendMask.resize(pix->width()-20, 10); 436 blendMask.resize(pix->width()-20, 10);
436 // top 437 // top
437 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 438 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
438 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); 439 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10);
439 tilePix.setMask(blendMask); 440 tilePix.setMask(blendMask);
440 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 441 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
441 // bottom 442 // bottom
442 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 443 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
443 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20); 444 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20);
444 tilePix.setMask(blendMask); 445 tilePix.setMask(blendMask);
445 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 446 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
446 // left 447 // left
447 tilePix.resize(10, pix->height()-20); 448 tilePix.resize(10, pix->height()-20);
448 blendMask.resize(10, pix->height()-20); 449 blendMask.resize(10, pix->height()-20);
449 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 450 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
450 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); 451 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20);
451 tilePix.setMask(blendMask); 452 tilePix.setMask(blendMask);
452 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 453 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
453 // right 454 // right
454 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 455 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
455 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); 456 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20);
456 tilePix.setMask(blendMask); 457 tilePix.setMask(blendMask);
457 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 458 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
458 459
459 p.end(); 460 p.end();
460 461
461 // do the button mask - we don't automask buttons 462 // do the button mask - we don't automask buttons
462 QBitmap btnMask(w, h); 463 QBitmap btnMask(w, h);
463 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 464 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
464 p.begin(&btnMask); 465 p.begin(&btnMask);
465 p.fillRect(0, 0, w, h, Qt::color0); 466 p.fillRect(0, 0, w, h, Qt::color0);
466 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 467 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
467 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 468 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
468 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 469 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
469 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 470 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
470 // fills 471 // fills
471 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 472 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
472 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 473 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
473 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 474 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
474 p.end(); 475 p.end();
475 tmpPix.setMask(btnMask); 476 tmpPix.setMask(btnMask);
476 /*if(autoDefault){ 477 /*if(autoDefault){
477 if(supportPushDown && pushedDown){ 478 if(supportPushDown && pushedDown){
478 painter->drawPixmap(x+3, y+3, tmpPix); 479 painter->drawPixmap(x+3, y+3, tmpPix);
479 } 480 }
480 else{ 481 else{
481 painter->drawPixmap(x+2, y+2, tmpPix); 482 painter->drawPixmap(x+2, y+2, tmpPix);
482 } 483 }
483 } 484 }
484 else */if(supportPushDown && pushedDown) 485 else */if(supportPushDown && pushedDown)
485 painter->drawPixmap(x+1, y+1, tmpPix); 486 painter->drawPixmap(x+1, y+1, tmpPix);
486 else 487 else
487 painter->drawPixmap(x, y, tmpPix); 488 painter->drawPixmap(x, y, tmpPix);
488 489
489 490
490 491
491} 492}
492 493
493 494
494QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, 495QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
495 bool blend) 496 bool blend)
496{ 497{
497 QImage img(qembed_findImage(label)); 498 QImage img(qembed_findImage(label));
498 img.detach(); 499 img.detach();
499 if(img.isNull()){ // shouldn't happen, been tested 500 if(img.isNull()){ // shouldn't happen, been tested
500 qWarning("Invalid embedded label %s", label); 501 qWarning("Invalid embedded label %s", label);
501 return(NULL); 502 return(NULL);
502 } 503 }
503 if(img.depth() != 32) 504 if(img.depth() != 32)
504 img = img.convertDepth(32); 505 img = img.convertDepth(32);
505 unsigned int *data = (unsigned int *)img.bits(); 506 unsigned int *data = (unsigned int *)img.bits();
506 int total = img.width()*img.height(); 507 int total = img.width()*img.height();
507 int current; 508 int current;
508 QColor c; 509 QColor c;
509 int oldH, oldS, oldV; 510 int oldH, oldS, oldV;
510 int alpha; 511 int alpha;
511 if(v < 235) 512 if(v < 235)
512 v += 20; 513 v += 20;
513 else 514 else
514 v = 255; 515 v = 255;
515 float intensity = v/255.0; 516 float intensity = v/255.0;
516 517
517 for(current=0; current<total; ++current){ 518 for(current=0; current<total; ++current){
518 alpha = qAlpha(data[current]); 519 alpha = qAlpha(data[current]);
519 c.setRgb(data[current]); 520 c.setRgb(data[current]);
520 c.hsv(&oldH, &oldS, &oldV); 521 c.hsv(&oldH, &oldS, &oldV);
521 oldV = (int)(oldV*intensity); 522 oldV = (int)(oldV*intensity);
522 c.setHsv(h, s, oldV); 523 c.setHsv(h, s, oldV);
523 if(blend && alpha != 255 && alpha != 0){ 524 if(blend && alpha != 255 && alpha != 0){
524 float srcPercent = ((float)alpha)/255.0; 525 float srcPercent = ((float)alpha)/255.0;
525 float destPercent = 1.0-srcPercent; 526 float destPercent = 1.0-srcPercent;
526 oldH = (int)((srcPercent*h) + (destPercent*bH)); 527 oldH = (int)((srcPercent*h) + (destPercent*bH));
527 oldS = (int)((srcPercent*s) + (destPercent*bS)); 528 oldS = (int)((srcPercent*s) + (destPercent*bS));
528 oldV = (int)((srcPercent*oldV) + (destPercent*bV)); 529 oldV = (int)((srcPercent*oldV) + (destPercent*bV));
529 c.setHsv(oldH, oldS, oldV); 530 c.setHsv(oldH, oldS, oldV);
530 alpha = 255; 531 alpha = 255;
531 } 532 }
532 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); 533 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha);
533 } 534 }
534 QPixmap *pix = new QPixmap; 535 QPixmap *pix = new QPixmap;
535 pix->convertFromImage(img); 536 pix->convertFromImage(img);
536 return(pix); 537 return(pix);
537} 538}
538 539
539 540
540 541
541 542
542QPixmap* LiquidStyle::getPixmap(BitmapData item) 543QPixmap* LiquidStyle::getPixmap(BitmapData item)
543{ 544{
544 545
545 if(pixmaps[item]) 546 if(pixmaps[item])
546 return(pixmaps[item]); 547 return(pixmaps[item]);
547 548
548 switch(item){ 549 switch(item){
549 case HTMLBtnBorder: 550 case HTMLBtnBorder:
550 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); 551 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV);
551 break; 552 break;
552 case HTMLBtnBorderDown: 553 case HTMLBtnBorderDown:
553 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 554 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
554 break; 555 break;
555 556
556 case HTMLCB: 557 case HTMLCB:
557 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 558 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
558 break; 559 break;
559 case HTMLCBHover: 560 case HTMLCBHover:
560 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); 561 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV);
561 break; 562 break;
562 case HTMLCBDown: 563 case HTMLCBDown:
563 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 564 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
564 break; 565 break;
565 case HTMLCBDownHover: 566 case HTMLCBDownHover:
566 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); 567 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV);
567 break; 568 break;
568 569
569 case HTMLRadio: 570 case HTMLRadio:
570 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 571 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
571 break; 572 break;
572 case HTMLRadioHover: 573 case HTMLRadioHover:
573 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); 574 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV);
574 break; 575 break;
575 case HTMLRadioDown: 576 case HTMLRadioDown:
576 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 577 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
577 break; 578 break;
578 case HTMLRadioDownHover: 579 case HTMLRadioDownHover:
579 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); 580 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV);
580 break; 581 break;
581 582
582 case RadioOff: 583 case RadioOff:
583 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); 584 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/);
584 break; 585 break;
585 case RadioOffHover: 586 case RadioOffHover:
586 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); 587 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/);
587 break; 588 break;
588 case RadioOn: 589 case RadioOn:
589 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); 590 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/);
590 break; 591 break;
591 case RadioOnHover: 592 case RadioOnHover:
592 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); 593 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/);
593 break; 594 break;
594 595
595 case Tab: 596 case Tab:
596 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); 597 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/);
597 break; 598 break;
598 case TabDown: 599 case TabDown:
599 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); 600 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/);
600 break; 601 break;
601 case TabFocus: 602 case TabFocus:
602 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); 603 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/);
603 break; 604 break;
604 605
605 case CB: 606 case CB:
606 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); 607 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/);
607 break; 608 break;
608 case CBHover: 609 case CBHover:
609 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); 610 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/);
610 break; 611 break;
611 case CBDown: 612 case CBDown:
612 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); 613 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/);
613 break; 614 break;
614 case CBDownHover: 615 case CBDownHover:
615 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); 616 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/);
616 break; 617 break;
617 618
618 case VSlider: 619 case VSlider:
619 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); 620 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true );
620 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 621 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
621 break; 622 break;
622 case VSBSliderTop: 623 case VSBSliderTop:
623 case VSBSliderTopHover: 624 case VSBSliderTopHover:
624 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); 625 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/);
625 break; 626 break;
626 case VSBSliderBtm: 627 case VSBSliderBtm:
627 case VSBSliderBtmHover: 628 case VSBSliderBtmHover:
628 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); 629 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/);
629 break; 630 break;
630 case VSBSliderMid: 631 case VSBSliderMid:
631 case VSBSliderMidHover: 632 case VSBSliderMidHover:
632 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 633 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
633 break; 634 break;
634 case VSBSliderTopBg: 635 case VSBSliderTopBg:
635 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); 636 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/);
636 break; 637 break;
637 case VSBSliderBtmBg: 638 case VSBSliderBtmBg:
638 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); 639 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/);
639 break; 640 break;
640 case VSBSliderMidBg: 641 case VSBSliderMidBg:
641 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 642 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
642 break; 643 break;
643 644
644 case HSlider: 645 case HSlider:
645 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); 646 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/);
646 break; 647 break;
647 case HSBSliderTop: 648 case HSBSliderTop:
648 case HSBSliderTopHover: 649 case HSBSliderTopHover:
649 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); 650 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true );
650 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 651 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
651 break; 652 break;
652 case HSBSliderBtm: 653 case HSBSliderBtm:
653 case HSBSliderBtmHover: 654 case HSBSliderBtmHover:
654 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); 655 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true );
655 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 656 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
656 break; 657 break;
657 case HSBSliderMid: 658 case HSBSliderMid:
658 case HSBSliderMidHover: 659 case HSBSliderMidHover:
659 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 660 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
660 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 661 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
661 break; 662 break;
662 case HSBSliderTopBg: 663 case HSBSliderTopBg:
663 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); 664 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true );
664 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 665 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
665 break; 666 break;
666 case HSBSliderBtmBg: 667 case HSBSliderBtmBg:
667 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); 668 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true );
668 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 669 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
669 break; 670 break;
670 case HSBSliderMidBg: 671 case HSBSliderMidBg:
671 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 672 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
672 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 673 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
673 break; 674 break;
674 default: 675 default:
675 break; 676 break;
676 } 677 }
677 return(pixmaps[item]); 678 return(pixmaps[item]);
678} 679}
679 680
680void LiquidStyle::polish(QPalette &appPal) 681void LiquidStyle::polish(QPalette &appPal)
681{ 682{
682 int i; 683 int i;
683 for(i=0; i < BITMAP_ITEMS; ++i){ 684 for(i=0; i < BITMAP_ITEMS; ++i){
684 if(pixmaps[i]){ 685 if(pixmaps[i]){
685 delete pixmaps[i]; 686 delete pixmaps[i];
686 pixmaps[i] = NULL; 687 pixmaps[i] = NULL;
687 } 688 }
688 } 689 }
689 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 690 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
690 btnDict.clear(); 691 btnDict.clear();
691 btnBorderDict.clear(); 692 btnBorderDict.clear();
692 bevelFillDict.clear(); 693 bevelFillDict.clear();
693 smallBevelFillDict.clear(); 694 smallBevelFillDict.clear();
694 695