summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 4a65952..bac882c 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -43,269 +43,263 @@
43#include "embeddata.h" 43#include "embeddata.h"
44 44
45 45
46typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 46typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
47 QColorGroup &, bool, bool); 47 QColorGroup &, bool, bool);
48 48
49QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 49QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
50 50
51void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 51void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
52{ 52{
53 QImage img(pix.convertToImage()); 53 QImage img(pix.convertToImage());
54 QImageEffect::fade(img, 0.9, color); 54 QImageEffect::fade(img, 0.9, color);
55 int x, y; 55 int x, y;
56 int r, g, b; 56 int r, g, b;
57 for(y=0; y < img.height(); y+=3){ 57 for(y=0; y < img.height(); y+=3){
58 unsigned int *data = (unsigned int *) img.scanLine(y); 58 unsigned int *data = (unsigned int *) img.scanLine(y);
59 for(x=0; x < img.width(); ++x){ 59 for(x=0; x < img.width(); ++x){
60 r = qRed(data[x]); 60 r = qRed(data[x]);
61 g = qGreen(data[x]); 61 g = qGreen(data[x]);
62 b = qBlue(data[x]); 62 b = qBlue(data[x]);
63 if(r-10) 63 if(r-10)
64 r-=10; 64 r-=10;
65 if(g-10) 65 if(g-10)
66 g-=10; 66 g-=10;
67 if(b-10) 67 if(b-10)
68 b-=10; 68 b-=10;
69 data[x] = qRgb(r, g, b); 69 data[x] = qRgb(r, g, b);
70 } 70 }
71 } 71 }
72 pix.convertFromImage(img); 72 pix.convertFromImage(img);
73} 73}
74 74
75TransMenuHandler::TransMenuHandler(QObject *parent) 75TransMenuHandler::TransMenuHandler(QObject *parent)
76 : QObject(parent) 76 : QObject(parent)
77{ 77{
78 pixDict.setAutoDelete(true); 78 pixDict.setAutoDelete(true);
79 reloadSettings(); 79 reloadSettings();
80} 80}
81 81
82void TransMenuHandler::reloadSettings() 82void TransMenuHandler::reloadSettings()
83{ 83{
84 pixDict.clear(); 84 pixDict.clear();
85 85
86 Config config ( "qpe" ); 86 Config config ( "qpe" );
87 config. setGroup ( "Liquid-Style" ); 87 config. setGroup ( "Liquid-Style" );
88 88
89 type = config. readNumEntry("Type", TransStippleBg); 89 type = config. readNumEntry("Type", TransStippleBg);
90 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 90 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
91 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 91 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
92 opacity = config. readNumEntry("Opacity", 10); 92 opacity = config. readNumEntry("Opacity", 10);
93 if ( opacity < -20 ) 93 if ( opacity < -20 )
94 opacity = 20; 94 opacity = 20;
95 else if ( opacity > 20 ) 95 else if ( opacity > 20 )
96 opacity = 20; 96 opacity = 20;
97 97
98 shadowText = config. readBoolEntry("ShadowText", true); 98 shadowText = config. readBoolEntry("ShadowText", true);
99} 99}
100 100
101bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 101bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
102{ 102{
103 QWidget *p = (QWidget *)obj; 103 QWidget *p = (QWidget *)obj;
104 104
105 if(ev->type() == QEvent::Show){ 105 if(ev->type() == QEvent::Show){
106 if(type == TransStippleBg || type == TransStippleBtn || 106 if(type == TransStippleBg || type == TransStippleBtn ||
107 type == Custom){ 107 type == Custom){
108 QApplication::syncX(); 108 QApplication::syncX();
109 QPixmap *pix = new QPixmap; 109 QPixmap *pix = new QPixmap;
110 if(p->testWFlags(Qt::WType_Popup)){ 110 if(p->testWFlags(Qt::WType_Popup)){
111 QRect r(p->x(), p->y(), p->width(), p->height()); 111 QRect r(p->x(), p->y(), p->width(), p->height());
112 QRect deskR = QApplication::desktop()->rect(); 112 QRect deskR = QApplication::desktop()->rect();
113 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 113 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
114 r.setBottom(deskR.bottom()); 114 r.setBottom(deskR.bottom());
115 r.setRight(deskR.right()); 115 r.setRight(deskR.right());
116 } 116 }
117 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 117 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
118 r.width(), r.height()); 118 r.width(), r.height());
119 } 119 }
120 else{ // tear off menu 120 else{ // tear off menu
121 pix->resize(p->width(), p->height()); 121 pix->resize(p->width(), p->height());
122 pix->fill(Qt::black.rgb()); 122 pix->fill(Qt::black.rgb());
123 } 123 }
124 if(type == TransStippleBg){ 124 if(type == TransStippleBg){
125 stripePixmap(*pix, p->colorGroup().background()); 125 stripePixmap(*pix, p->colorGroup().background());
126 } 126 }
127 else if(type == TransStippleBtn){ 127 else if(type == TransStippleBtn){
128 stripePixmap(*pix, p->colorGroup().button()); 128 stripePixmap(*pix, p->colorGroup().button());
129 } 129 }
130 else{ 130 else{
131 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 131 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
132 } 132 }
133 133
134 pixDict.insert(p->winId(), pix); 134 pixDict.insert(p->winId(), pix);
135 135
136 if ( !p->inherits("QPopupMenu")) 136 if ( !p->inherits("QPopupMenu"))
137 p->setBackgroundPixmap(*pix); 137 p->setBackgroundPixmap(*pix);
138 138
139 QObjectList *ol = p-> queryList("QWidget"); 139 QObjectList *ol = p-> queryList("QWidget");
140 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 140 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
141 QWidget *wid = (QWidget *) it.current ( ); 141 QWidget *wid = (QWidget *) it.current ( );
142 142
143 wid-> setBackgroundPixmap(*pix); 143 wid-> setBackgroundPixmap(*pix);
144 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 144 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
145 } 145 }
146 delete ol; 146 delete ol;
147 } 147 }
148 } 148 }
149 else if(ev->type() == QEvent::Hide){ 149 else if(ev->type() == QEvent::Hide){
150 if(type == TransStippleBg || type == TransStippleBtn || 150 if(type == TransStippleBg || type == TransStippleBtn ||
151 type == Custom){ 151 type == Custom){
152// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 152// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
153 153
154 pixDict.remove(p->winId()); 154 pixDict.remove(p->winId());
155 if ( !p->inherits("QPopupMenu")) 155 if ( !p->inherits("QPopupMenu"))
156 p->setBackgroundMode(QWidget::PaletteBackground); 156 p->setBackgroundMode(QWidget::PaletteBackground);
157 157
158 QObjectList *ol = p-> queryList("QWidget"); 158 QObjectList *ol = p-> queryList("QWidget");
159 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 159 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
160 QWidget *wid = (QWidget *) it.current ( ); 160 QWidget *wid = (QWidget *) it.current ( );
161 161
162 wid-> setBackgroundMode( QWidget::PaletteBackground ); 162 wid-> setBackgroundMode( QWidget::PaletteBackground );
163 } 163 }
164 delete ol; 164 delete ol;
165 } 165 }
166 } 166 }
167 return(false); 167 return(false);
168} 168}
169 169
170 170
171static int qt_version ( )
172{
173 const char *qver = qVersion ( );
174 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
175}
176 171
177 172
178LiquidStyle::LiquidStyle() 173LiquidStyle::LiquidStyle()
179 :QWindowsStyle() 174 :QWindowsStyle()
180{ 175{
181 setName ( "LiquidStyle" ); 176 setName ( "LiquidStyle" );
182 177
183 oldqte = ( qt_version ( ) < 234 );
184 flatTBButtons = false; 178 flatTBButtons = false;
185 currentHeader = 0; 179 currentHeader = 0;
186 180
187 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 181 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
188 btnMaskBmp.setMask(btnMaskBmp); 182 btnMaskBmp.setMask(btnMaskBmp);
189 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 183 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
190 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 184 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
191 headerHoverID = -1; 185 headerHoverID = -1;
192 highlightWidget = NULL; 186 highlightWidget = NULL;
193 setButtonDefaultIndicatorWidth(0); 187 setButtonDefaultIndicatorWidth(0);
194 btnDict.setAutoDelete(true); 188 btnDict.setAutoDelete(true);
195 bevelFillDict.setAutoDelete(true); 189 bevelFillDict.setAutoDelete(true);
196 smallBevelFillDict.setAutoDelete(true); 190 smallBevelFillDict.setAutoDelete(true);
197 191
198 rMatrix.rotate(270.0); 192 rMatrix.rotate(270.0);
199 btnBorderPix = new QPixmap; 193 btnBorderPix = new QPixmap;
200 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 194 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
201 btnBlendPix = new QPixmap; 195 btnBlendPix = new QPixmap;
202 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 196 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
203 bevelFillPix = new QPixmap; 197 bevelFillPix = new QPixmap;
204 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 198 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
205 smallBevelFillPix = new QPixmap; 199 smallBevelFillPix = new QPixmap;
206 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 200 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
207 // new stuff 201 // new stuff
208 vsbSliderFillPix = menuPix = NULL; 202 vsbSliderFillPix = menuPix = NULL;
209 menuHandler = new TransMenuHandler(this); 203 menuHandler = new TransMenuHandler(this);
210 setScrollBarExtent(15, 15); 204 setScrollBarExtent(15, 15);
211 int i; 205 int i;
212 for(i=0; i < BITMAP_ITEMS; ++i){ 206 for(i=0; i < BITMAP_ITEMS; ++i){
213 pixmaps[i] = NULL; 207 pixmaps[i] = NULL;
214 } 208 }
215 oldSliderThickness = sliderThickness(); 209 oldSliderThickness = sliderThickness();
216 setSliderThickness(11); 210 setSliderThickness(11);
217} 211}
218 212
219LiquidStyle::~LiquidStyle() 213LiquidStyle::~LiquidStyle()
220{ 214{
221 if(btnBorderPix) 215 if(btnBorderPix)
222 delete btnBorderPix; 216 delete btnBorderPix;
223 if(btnBlendPix) 217 if(btnBlendPix)
224 delete btnBlendPix; 218 delete btnBlendPix;
225 if(bevelFillPix) 219 if(bevelFillPix)
226 delete bevelFillPix; 220 delete bevelFillPix;
227 if(smallBevelFillPix) 221 if(smallBevelFillPix)
228 delete smallBevelFillPix; 222 delete smallBevelFillPix;
229 if(vsbSliderFillPix) 223 if(vsbSliderFillPix)
230 delete vsbSliderFillPix; 224 delete vsbSliderFillPix;
231 if(menuPix) 225 if(menuPix)
232 delete menuPix; 226 delete menuPix;
233 227
234 setScrollBarExtent(16, 16); 228 setScrollBarExtent(16, 16);
235 setSliderThickness(oldSliderThickness); 229 setSliderThickness(oldSliderThickness);
236 int i; 230 int i;
237 for(i=0; i < BITMAP_ITEMS; ++i){ 231 for(i=0; i < BITMAP_ITEMS; ++i){
238 if(pixmaps[i]) 232 if(pixmaps[i])
239 delete pixmaps[i]; 233 delete pixmaps[i];
240 } 234 }
241} 235}
242 236
243void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 237void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
244 const QColor &c, const QColor &bg) 238 const QColor &c, const QColor &bg)
245{ 239{
246 240
247 QPen oldPen = p->pen(); // headers need this 241 QPen oldPen = p->pen(); // headers need this
248 int x2 = x+w-1; 242 int x2 = x+w-1;
249 int y2 = y+h-1; 243 int y2 = y+h-1;
250 // outer dark rect 244 // outer dark rect
251 p->setPen(c.dark(130)); 245 p->setPen(c.dark(130));
252 p->drawLine(x, y+2, x, y2-2); // l 246 p->drawLine(x, y+2, x, y2-2); // l
253 p->drawLine(x2, y+2, x2, y2-2); // r 247 p->drawLine(x2, y+2, x2, y2-2); // r
254 p->drawLine(x+2, y, x2-2, y); // t 248 p->drawLine(x+2, y, x2-2, y); // t
255 p->drawLine(x+2, y2, x2-2, y2); // b 249 p->drawLine(x+2, y2, x2-2, y2); // b
256 p->drawPoint(x+1, y+1); // tl 250 p->drawPoint(x+1, y+1); // tl
257 p->drawPoint(x2-1, y+1); // tr 251 p->drawPoint(x2-1, y+1); // tr
258 p->drawPoint(x+1, y2-1); // bl 252 p->drawPoint(x+1, y2-1); // bl
259 p->drawPoint(x2-1, y2-1); // br 253 p->drawPoint(x2-1, y2-1); // br
260 254
261 // inner top light lines 255 // inner top light lines
262 p->setPen(c.light(105)); 256 p->setPen(c.light(105));
263 p->drawLine(x+2, y+1, x2-2, y+1); 257 p->drawLine(x+2, y+1, x2-2, y+1);
264 p->drawLine(x+1, y+2, x2-1, y+2); 258 p->drawLine(x+1, y+2, x2-1, y+2);
265 p->drawLine(x+1, y+3, x+2, y+3); 259 p->drawLine(x+1, y+3, x+2, y+3);
266 p->drawLine(x2-2, y+3, x2-1, y+3); 260 p->drawLine(x2-2, y+3, x2-1, y+3);
267 p->drawPoint(x+1, y+4); 261 p->drawPoint(x+1, y+4);
268 p->drawPoint(x2-1, y+4); 262 p->drawPoint(x2-1, y+4);
269 263
270 // inner bottom light lines 264 // inner bottom light lines
271 p->setPen(c.light(110)); 265 p->setPen(c.light(110));
272 p->drawLine(x+2, y2-1, x2-2, y2-1); 266 p->drawLine(x+2, y2-1, x2-2, y2-1);
273 p->drawLine(x+1, y2-2, x2-1, y2-2); 267 p->drawLine(x+1, y2-2, x2-1, y2-2);
274 p->drawLine(x+1, y2-3, x+2, y2-3); 268 p->drawLine(x+1, y2-3, x+2, y2-3);
275 p->drawLine(x2-2, y2-3, x2-1, y2-3); 269 p->drawLine(x2-2, y2-3, x2-1, y2-3);
276 p->drawPoint(x+1, y2-4); 270 p->drawPoint(x+1, y2-4);
277 p->drawPoint(x2-1, y2-4); 271 p->drawPoint(x2-1, y2-4);
278 272
279 // inner left mid lines 273 // inner left mid lines
280 //p->setPen(c.light(105)); 274 //p->setPen(c.light(105));
281 p->setPen(c); 275 p->setPen(c);
282 p->drawLine(x+1, y+5, x+1, y2-5); 276 p->drawLine(x+1, y+5, x+1, y2-5);
283 p->drawLine(x+2, y+4, x+2, y2-4); 277 p->drawLine(x+2, y+4, x+2, y2-4);
284 278
285 // inner right mid lines 279 // inner right mid lines
286 p->drawLine(x2-1, y+5, x2-1, y2-5); 280 p->drawLine(x2-1, y+5, x2-1, y2-5);
287 p->drawLine(x2-2, y+4, x2-2, y2-4); 281 p->drawLine(x2-2, y+4, x2-2, y2-4);
288 282
289 // fill 283 // fill
290 QPixmap *pix; 284 QPixmap *pix;
291 if(h >= 32){ 285 if(h >= 32){
292 pix = bevelFillDict.find(c.rgb()); 286 pix = bevelFillDict.find(c.rgb());
293 if(!pix){ 287 if(!pix){
294 int h, s, v; 288 int h, s, v;
295 c.hsv(&h, &s, &v); 289 c.hsv(&h, &s, &v);
296 pix = new QPixmap(*bevelFillPix); 290 pix = new QPixmap(*bevelFillPix);
297 adjustHSV(*pix, h, s, v); 291 adjustHSV(*pix, h, s, v);
298 bevelFillDict.insert(c.rgb(), pix); 292 bevelFillDict.insert(c.rgb(), pix);
299 } 293 }
300 } 294 }
301 else{ 295 else{
302 pix = smallBevelFillDict.find(c.rgb()); 296 pix = smallBevelFillDict.find(c.rgb());
303 if(!pix){ 297 if(!pix){
304 int h, s, v; 298 int h, s, v;
305 c.hsv(&h, &s, &v); 299 c.hsv(&h, &s, &v);
306 pix = new QPixmap(*smallBevelFillPix); 300 pix = new QPixmap(*smallBevelFillPix);
307 adjustHSV(*pix, h, s, v); 301 adjustHSV(*pix, h, s, v);
308 smallBevelFillDict.insert(c.rgb(), pix); 302 smallBevelFillDict.insert(c.rgb(), pix);
309 } 303 }
310 } 304 }
311 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); 305 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix);
@@ -582,312 +576,309 @@ QPixmap* LiquidStyle::getPixmap(BitmapData item)
582 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); 576 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV);
583 break; 577 break;
584 578
585 case RadioOff: 579 case RadioOff:
586 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); 580 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/);
587 break; 581 break;
588 case RadioOffHover: 582 case RadioOffHover:
589 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); 583 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/);
590 break; 584 break;
591 case RadioOn: 585 case RadioOn:
592 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); 586 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/);
593 break; 587 break;
594 case RadioOnHover: 588 case RadioOnHover:
595 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); 589 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/);
596 break; 590 break;
597 591
598 case Tab: 592 case Tab:
599 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); 593 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/);
600 break; 594 break;
601 case TabDown: 595 case TabDown:
602 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); 596 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/);
603 break; 597 break;
604 case TabFocus: 598 case TabFocus:
605 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); 599 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/);
606 break; 600 break;
607 601
608 case CB: 602 case CB:
609 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); 603 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/);
610 break; 604 break;
611 case CBHover: 605 case CBHover:
612 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); 606 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/);
613 break; 607 break;
614 case CBDown: 608 case CBDown:
615 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); 609 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/);
616 break; 610 break;
617 case CBDownHover: 611 case CBDownHover:
618 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); 612 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/);
619 break; 613 break;
620 614
621 case VSlider: 615 case VSlider:
622 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); 616 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true );
623 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 617 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
624 break; 618 break;
625 case VSBSliderTop: 619 case VSBSliderTop:
626 case VSBSliderTopHover: 620 case VSBSliderTopHover:
627 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); 621 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/);
628 break; 622 break;
629 case VSBSliderBtm: 623 case VSBSliderBtm:
630 case VSBSliderBtmHover: 624 case VSBSliderBtmHover:
631 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); 625 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/);
632 break; 626 break;
633 case VSBSliderMid: 627 case VSBSliderMid:
634 case VSBSliderMidHover: 628 case VSBSliderMidHover:
635 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 629 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
636 break; 630 break;
637 case VSBSliderTopBg: 631 case VSBSliderTopBg:
638 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); 632 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/);
639 break; 633 break;
640 case VSBSliderBtmBg: 634 case VSBSliderBtmBg:
641 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); 635 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/);
642 break; 636 break;
643 case VSBSliderMidBg: 637 case VSBSliderMidBg:
644 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 638 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
645 break; 639 break;
646 640
647 case HSlider: 641 case HSlider:
648 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); 642 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/);
649 break; 643 break;
650 case HSBSliderTop: 644 case HSBSliderTop:
651 case HSBSliderTopHover: 645 case HSBSliderTopHover:
652 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); 646 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true );
653 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 647 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
654 break; 648 break;
655 case HSBSliderBtm: 649 case HSBSliderBtm:
656 case HSBSliderBtmHover: 650 case HSBSliderBtmHover:
657 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); 651 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true );
658 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 652 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
659 break; 653 break;
660 case HSBSliderMid: 654 case HSBSliderMid:
661 case HSBSliderMidHover: 655 case HSBSliderMidHover:
662 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 656 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
663 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 657 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
664 break; 658 break;
665 case HSBSliderTopBg: 659 case HSBSliderTopBg:
666 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); 660 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true );
667 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 661 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
668 break; 662 break;
669 case HSBSliderBtmBg: 663 case HSBSliderBtmBg:
670 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); 664 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true );
671 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 665 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
672 break; 666 break;
673 case HSBSliderMidBg: 667 case HSBSliderMidBg:
674 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 668 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
675 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 669 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
676 break; 670 break;
677 default: 671 default:
678 break; 672 break;
679 } 673 }
680 return(pixmaps[item]); 674 return(pixmaps[item]);
681} 675}
682 676
683void LiquidStyle::polish(QPalette &appPal) 677void LiquidStyle::polish(QPalette &appPal)
684{ 678{
685 int i; 679 int i;
686 for(i=0; i < BITMAP_ITEMS; ++i){ 680 for(i=0; i < BITMAP_ITEMS; ++i){
687 if(pixmaps[i]){ 681 if(pixmaps[i]){
688 delete pixmaps[i]; 682 delete pixmaps[i];
689 pixmaps[i] = NULL; 683 pixmaps[i] = NULL;
690 } 684 }
691 } 685 }
692 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 686 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
693 btnDict.clear(); 687 btnDict.clear();
694 btnBorderDict.clear(); 688 btnBorderDict.clear();
695 bevelFillDict.clear(); 689 bevelFillDict.clear();
696 smallBevelFillDict.clear(); 690 smallBevelFillDict.clear();
697 691
698 Config config ( "qpe" ); 692 Config config ( "qpe" );
699 config. setGroup ( "Liquid-Style" ); 693 config. setGroup ( "Liquid-Style" );
700 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 694 int contrast = config. readNumEntry ( "StippleContrast", 5 );
701 if ( contrast < 0 ) 695 if ( contrast < 0 )
702 contrast = 0; 696 contrast = 0;
703 else if ( contrast > 10 ) 697 else if ( contrast > 10 )
704 contrast = 10; 698 contrast = 10;
705 699
706// QPalette pal = QApplication::palette(); 700// QPalette pal = QApplication::palette();
707 701
708 // button color stuff 702 // button color stuff
709 config. setGroup ( "Appearance" ); 703 config. setGroup ( "Appearance" );
710 QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) 704 QColor c = appPal. color ( QPalette::Active, QColorGroup::Button );
711 : appPal. color ( QPalette::Active, QColorGroup::Button ); 705 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )) {
712 if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
713 : appPal. color ( QPalette::Active, QColorGroup::Background ))) {
714 // force button color to be different from background 706 // force button color to be different from background
715 QBrush btnBrush(QColor(200, 202, 228)); 707 QBrush btnBrush(QColor(200, 202, 228));
716 appPal.setBrush(QColorGroup::Button, btnBrush); 708 appPal.setBrush(QColorGroup::Button, btnBrush);
717 } 709 }
718 c.hsv(&btnH, &btnS, &btnV); 710 c.hsv(&btnH, &btnS, &btnV);
719 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 711 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
720 712
721 // menu pixmap 713 // menu pixmap
722 if(!menuPix){ 714 if(!menuPix){
723 menuPix = new QPixmap; 715 menuPix = new QPixmap;
724 menuPix->resize(64, 64); 716 menuPix->resize(64, 64);
725 } 717 }
726 QPainter painter; 718 QPainter painter;
727 menuPix->fill(c.rgb()); 719 menuPix->fill(c.rgb());
728 painter.begin(menuPix); 720 painter.begin(menuPix);
729 painter.setPen(c.dark(105)); 721 painter.setPen(c.dark(105));
730 for(i=0; i < 63; i+=4){ 722 for(i=0; i < 63; i+=4){
731 painter.drawLine(0, i, 63, i); 723 painter.drawLine(0, i, 63, i);
732 painter.drawLine(0, i+1, 63, i+1); 724 painter.drawLine(0, i+1, 63, i+1);
733 }; 725 };
734 painter.end(); 726 painter.end();
735 menuBrush.setColor(c); 727 menuBrush.setColor(c);
736 menuBrush.setPixmap(*menuPix); 728 menuBrush.setPixmap(*menuPix);
737 729
738 // pager brush 730 // pager brush
739 c = c.dark(120); 731 c = c.dark(120);
740 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 732 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
741 if(!pix){ 733 if(!pix){
742 int h, s, v; 734 int h, s, v;
743 c.hsv(&h, &s, &v); 735 c.hsv(&h, &s, &v);
744 pix = new QPixmap(*smallBevelFillPix); 736 pix = new QPixmap(*smallBevelFillPix);
745 adjustHSV(*pix, h, s, v); 737 adjustHSV(*pix, h, s, v);
746 smallBevelFillDict.insert(c.rgb(), pix); 738 smallBevelFillDict.insert(c.rgb(), pix);
747 } 739 }
748// pagerHoverBrush.setColor(c); 740// pagerHoverBrush.setColor(c);
749// pagerHoverBrush.setPixmap(*pix); 741// pagerHoverBrush.setPixmap(*pix);
750 742
751 c = c.dark(120); 743 c = c.dark(120);
752 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 744 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
753 if(!pix){ 745 if(!pix){
754 int h, s, v; 746 int h, s, v;
755 c.hsv(&h, &s, &v); 747 c.hsv(&h, &s, &v);
756 pix = new QPixmap(*smallBevelFillPix); 748 pix = new QPixmap(*smallBevelFillPix);
757 adjustHSV(*pix, h, s, v); 749 adjustHSV(*pix, h, s, v);
758 smallBevelFillDict.insert(c.rgb(), pix); 750 smallBevelFillDict.insert(c.rgb(), pix);
759 } 751 }
760// pagerBrush.setColor(c); 752// pagerBrush.setColor(c);
761// pagerBrush.setPixmap(*pix); 753// pagerBrush.setPixmap(*pix);
762 754
763 // background color stuff 755 // background color stuff
764 c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) 756 c = appPal. color ( QPalette::Active, QColorGroup::Background );
765 : appPal. color ( QPalette::Active, QColorGroup::Background );
766 757
767 c.hsv(&bH, &bS, &bV); 758 c.hsv(&bH, &bS, &bV);
768 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 759 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
769 760
770 // FIXME? 761 // FIXME?
771 if(vsbSliderFillPix) 762 if(vsbSliderFillPix)
772 delete vsbSliderFillPix; 763 delete vsbSliderFillPix;
773 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 764 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
774 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 765 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
775 766
776 // background brush 767 // background brush
777 QPixmap wallPaper(32, 32); 768 QPixmap wallPaper(32, 32);
778 wallPaper.fill(c.rgb()); 769 wallPaper.fill(c.rgb());
779 painter.begin(&wallPaper); 770 painter.begin(&wallPaper);
780 for(i=0; i < 32; i+=4){ 771 for(i=0; i < 32; i+=4){
781 painter.setPen(c.dark(100 + contrast)); 772 painter.setPen(c.dark(100 + contrast));
782 painter.drawLine(0, i, 32, i); 773 painter.drawLine(0, i, 32, i);
783 painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 774 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
784 painter.drawLine(0, i+1, 32, i+1); 775 painter.drawLine(0, i+1, 32, i+1);
785 }; 776 };
786 painter.end(); 777 painter.end();
787 bgBrush.setColor(c); 778 bgBrush.setColor(c);
788 bgBrush.setPixmap(wallPaper); 779 bgBrush.setPixmap(wallPaper);
789 appPal.setBrush(QColorGroup::Background, bgBrush); 780 appPal.setBrush(QColorGroup::Background, bgBrush);
790} 781}
791 782
792void LiquidStyle::polish(QWidget *w) 783void LiquidStyle::polish(QWidget *w)
793{ 784{
794 if(w->inherits("QMenuBar")){ 785 if(w->inherits("QMenuBar")){
795 //((QFrame*)w)->setLineWidth(0); 786 //((QFrame*)w)->setLineWidth(0);
796 w->setBackgroundMode(QWidget::PaletteBackground); 787 w->setBackgroundMode(QWidget::PaletteBackground);
797 w->setBackgroundOrigin(QWidget::ParentOrigin); 788 w->setBackgroundOrigin(QWidget::ParentOrigin);
798 return; 789 return;
799 } 790 }
800 if(w->inherits("QToolBar")){ 791 if(w->inherits("QToolBar")){
801 w->installEventFilter(this); 792 w->installEventFilter(this);
802 w->setBackgroundMode(QWidget::PaletteBackground); 793 w->setBackgroundMode(QWidget::PaletteBackground);
803 w->setBackgroundOrigin(QWidget::WidgetOrigin); 794 w->setBackgroundOrigin(QWidget::WidgetOrigin);
804 return; 795 return;
805 } 796 }
806 if(w->inherits("QPopupMenu")) 797 if(w->inherits("QPopupMenu"))
807 w->setBackgroundMode(QWidget::NoBackground); 798 w->setBackgroundMode(QWidget::NoBackground);
808 else if(w-> testWFlags(Qt::WType_Popup) && 799 else if(w-> testWFlags(Qt::WType_Popup) &&
809 !w->inherits("QListBox") && 800 !w->inherits("QListBox") &&
810 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 801 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
811 w->installEventFilter(menuHandler); 802 w->installEventFilter(menuHandler);
812 } 803 }
813 804
814 if(w->isTopLevel()){ 805 if(w->isTopLevel()){
815 return; 806 return;
816 } 807 }
817 808
818 if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 809 if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
819 w->installEventFilter(this); 810 w->installEventFilter(this);
820 } 811 }
821 812
822 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 813 if(w->inherits("QButton") || w-> inherits("QComboBox")){
823 w-> setBackgroundMode ( QWidget::PaletteBackground ); 814 w-> setBackgroundMode ( QWidget::PaletteBackground );
824 w->setBackgroundOrigin ( QWidget::ParentOrigin); 815 w->setBackgroundOrigin ( QWidget::ParentOrigin);
825 } 816 }
826 817
827 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 818 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
828 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 819 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
829 bool isViewportChild = w->parent() && 820 bool isViewportChild = w->parent() &&
830 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 821 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
831 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 822 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
832 823
833 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 824 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
834 w->setBackgroundMode(QWidget::X11ParentRelative); 825 w->setBackgroundMode(QWidget::X11ParentRelative);
835 return; 826 return;
836 } 827 }
837 if(isViewportChild){ 828 if(isViewportChild){
838 if(w->inherits("QButton") || w->inherits("QComboBox")){ 829 if(w->inherits("QButton") || w->inherits("QComboBox")){
839 if(w->parent()){ // heh, only way to test for KHTML children ;-) 830 if(w->parent()){ // heh, only way to test for KHTML children ;-)
840 if(w->parent()->parent()){ 831 if(w->parent()->parent()){
841 if(w->parent()->parent()->parent() && 832 if(w->parent()->parent()->parent() &&
842 w->parent()->parent()->parent()->inherits("KHTMLView")){ 833 w->parent()->parent()->parent()->inherits("KHTMLView")){
843 w->setAutoMask(true); 834 w->setAutoMask(true);
844 w->setBackgroundMode(QWidget::NoBackground); 835 w->setBackgroundMode(QWidget::NoBackground);
845 } 836 }
846 } 837 }
847 } 838 }
848 return; 839 return;
849 } 840 }
850 } 841 }
851 if(w->inherits("QHeader")){ 842 if(w->inherits("QHeader")){
852 w->setMouseTracking(true); 843 w->setMouseTracking(true);
853 w->installEventFilter(this); 844 w->installEventFilter(this);
854 } 845 }
855 if(w-> inherits("QToolButton")) { 846 if(w-> inherits("QToolButton")) {
856 if (w->parent()->inherits("QToolBar")) { 847 if (w->parent()->inherits("QToolBar")) {
857 ((QToolButton*)w)->setAutoRaise (flatTBButtons); 848 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
858 if ( flatTBButtons ) 849 if ( flatTBButtons )
859 w->setBackgroundOrigin(QWidget::ParentOrigin); 850 w->setBackgroundOrigin(QWidget::ParentOrigin);
860 } 851 }
861 w-> installEventFilter ( this ); 852 w-> installEventFilter ( this );
862 } 853 }
863 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 854 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
864 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 855 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
865 } 856 }
866 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 857 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
867 return; 858 return;
868 } 859 }
869 860
870 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 861 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
871 palette().active().brush(QColorGroup::Background).pixmap()){ 862 palette().active().brush(QColorGroup::Background).pixmap()){
872 qWarning("No parent pixmap for child widget %s", w->className()); 863 qWarning("No parent pixmap for child widget %s", w->className());
873 return; 864 return;
874 } 865 }
875 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 866 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
876 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 867 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
877 if(w->backgroundMode() == QWidget::PaletteBackground || 868 if(w->backgroundMode() == QWidget::PaletteBackground ||
878 w->backgroundMode() == QWidget::PaletteButton){ 869 w->backgroundMode() == QWidget::PaletteButton){
879 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 870 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
880 w->setBackgroundOrigin(QWidget::ParentOrigin); 871 w->setBackgroundOrigin(QWidget::ParentOrigin);
881 // w->setBackgroundMode(QWidget::NoBackground); 872 // w->setBackgroundMode(QWidget::NoBackground);
882 } 873 }
883 } 874 }
884 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 875 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
885 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 876 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
886 else if ( w-> inherits("QFrame") ) 877 else if ( w-> inherits("QFrame") )
887 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 878 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
888 879
889 if ( w->parentWidget()->inherits ( "QWidgetStack" )) { 880 if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
890 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 881 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
891 } 882 }
892} 883}
893 884