summaryrefslogtreecommitdiff
authorsandman <sandman>2002-07-01 23:39:51 (UTC)
committer sandman <sandman>2002-07-01 23:39:51 (UTC)
commit329ea43b68180058bcd8e9d2af4d09d9c03c55a3 (patch) (unidiff)
tree8cb75f0d18be170c2def7ce8968fcbddeb004e82
parent7191d788415f190680c8a699b2b7bb88ddf28917 (diff)
downloadopie-329ea43b68180058bcd8e9d2af4d09d9c03c55a3.zip
opie-329ea43b68180058bcd8e9d2af4d09d9c03c55a3.tar.gz
opie-329ea43b68180058bcd8e9d2af4d09d9c03c55a3.tar.bz2
Added two new settings to liquid-style / Liquid-Settings:
- en/disable the new window decoration - set the stipple contrast (from no stipple to twice the normal value)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp19
-rw-r--r--noncore/styles/liquid/liquiddeco.cpp18
-rw-r--r--noncore/styles/liquid/settings/liquidset.cpp55
-rw-r--r--noncore/styles/liquid/settings/liquidset.h3
4 files changed, 69 insertions, 26 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 313d52c..acf0a42 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,273 +1,273 @@
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 "liquiddeco.h" 13#include "liquiddeco.h"
14#include <qapplication.h> 14#include <qapplication.h>
15#include <qpe/config.h> 15#include <qpe/config.h>
16#include "effects.h" 16#include "effects.h"
17#include <qpalette.h> 17#include <qpalette.h>
18#include <qbitmap.h> 18#include <qbitmap.h>
19#include <qtabbar.h> 19#include <qtabbar.h>
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qobjectlist.h> 21#include <qobjectlist.h>
22#include <qimage.h> 22#include <qimage.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qpixmapcache.h> 24#include <qpixmapcache.h>
25#include <qradiobutton.h> 25#include <qradiobutton.h>
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qwidgetlist.h> 28#include <qwidgetlist.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qheader.h> 30#include <qheader.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <qmenubar.h> 32#include <qmenubar.h>
33 33
34 34
35#include <stdio.h> 35#include <stdio.h>
36 36
37#include "htmlmasks.h" 37#include "htmlmasks.h"
38#include "embeddata.h" 38#include "embeddata.h"
39 39
40typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 40typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
41 QColorGroup &, bool, bool); 41 QColorGroup &, bool, bool);
42 42
43QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 43QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
44 44
45void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 45void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
46{ 46{
47 QImage img(pix.convertToImage()); 47 QImage img(pix.convertToImage());
48 QImageEffect::fade(img, 0.9, color); 48 QImageEffect::fade(img, 0.9, color);
49 int x, y; 49 int x, y;
50 int r, g, b; 50 int r, g, b;
51 for(y=0; y < img.height(); y+=3){ 51 for(y=0; y < img.height(); y+=3){
52 unsigned int *data = (unsigned int *) img.scanLine(y); 52 unsigned int *data = (unsigned int *) img.scanLine(y);
53 for(x=0; x < img.width(); ++x){ 53 for(x=0; x < img.width(); ++x){
54 r = qRed(data[x]); 54 r = qRed(data[x]);
55 g = qGreen(data[x]); 55 g = qGreen(data[x]);
56 b = qBlue(data[x]); 56 b = qBlue(data[x]);
57 if(r-10) 57 if(r-10)
58 r-=10; 58 r-=10;
59 if(g-10) 59 if(g-10)
60 g-=10; 60 g-=10;
61 if(b-10) 61 if(b-10)
62 b-=10; 62 b-=10;
63 data[x] = qRgb(r, g, b); 63 data[x] = qRgb(r, g, b);
64 } 64 }
65 } 65 }
66 pix.convertFromImage(img); 66 pix.convertFromImage(img);
67} 67}
68 68
69TransMenuHandler::TransMenuHandler(QObject *parent) 69TransMenuHandler::TransMenuHandler(QObject *parent)
70 : QObject(parent) 70 : QObject(parent)
71{ 71{
72 pixDict.setAutoDelete(true); 72 pixDict.setAutoDelete(true);
73 reloadSettings(); 73 reloadSettings();
74} 74}
75 75
76void TransMenuHandler::reloadSettings() 76void TransMenuHandler::reloadSettings()
77{ 77{
78 pixDict.clear(); 78 pixDict.clear();
79 79
80 Config config ( "qpe" ); 80 Config config ( "qpe" );
81 config. setGroup ( "MosfetMenus" ); 81 config. setGroup ( "Liquid-Style" );
82 82
83 type = config. readNumEntry("Type", TransStippleBg); 83 type = config. readNumEntry("Type", TransStippleBg);
84 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 84 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
85 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 85 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
86 opacity = config. readNumEntry("Opacity", 10); 86 opacity = config. readNumEntry("Opacity", 10);
87 if ( opacity < -20 ) 87 if ( opacity < -20 )
88 opacity = 20; 88 opacity = 20;
89 else if ( opacity > 20 ) 89 else if ( opacity > 20 )
90 opacity = 20; 90 opacity = 20;
91 91
92 shadowText = config. readBoolEntry("ShadowText", true); 92 shadowText = config. readBoolEntry("ShadowText", true);
93} 93}
94 94
95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
96{ 96{
97 QWidget *p = (QWidget *)obj; 97 QWidget *p = (QWidget *)obj;
98 98
99 if(ev->type() == QEvent::Show){ 99 if(ev->type() == QEvent::Show){
100 if(type == TransStippleBg || type == TransStippleBtn || 100 if(type == TransStippleBg || type == TransStippleBtn ||
101 type == Custom){ 101 type == Custom){
102 QApplication::syncX(); 102 QApplication::syncX();
103 QPixmap *pix = new QPixmap; 103 QPixmap *pix = new QPixmap;
104 if(p->testWFlags(Qt::WType_Popup)){ 104 if(p->testWFlags(Qt::WType_Popup)){
105 QRect r(p->x(), p->y(), p->width(), p->height()); 105 QRect r(p->x(), p->y(), p->width(), p->height());
106 QRect deskR = QApplication::desktop()->rect(); 106 QRect deskR = QApplication::desktop()->rect();
107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
108 r.setBottom(deskR.bottom()); 108 r.setBottom(deskR.bottom());
109 r.setRight(deskR.right()); 109 r.setRight(deskR.right());
110 } 110 }
111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
112 r.width(), r.height()); 112 r.width(), r.height());
113 } 113 }
114 else{ // tear off menu 114 else{ // tear off menu
115 pix->resize(p->width(), p->height()); 115 pix->resize(p->width(), p->height());
116 pix->fill(Qt::black.rgb()); 116 pix->fill(Qt::black.rgb());
117 } 117 }
118 if(type == TransStippleBg){ 118 if(type == TransStippleBg){
119 stripePixmap(*pix, p->colorGroup().background()); 119 stripePixmap(*pix, p->colorGroup().background());
120 } 120 }
121 else if(type == TransStippleBtn){ 121 else if(type == TransStippleBtn){
122 stripePixmap(*pix, p->colorGroup().button()); 122 stripePixmap(*pix, p->colorGroup().button());
123 } 123 }
124 else{ 124 else{
125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
126 } 126 }
127 127
128 if (p->inherits("QPopupMenu")) 128 if (p->inherits("QPopupMenu"))
129 pixDict.insert(p->winId(), pix); 129 pixDict.insert(p->winId(), pix);
130 else { 130 else {
131 p->setBackgroundPixmap(*pix); 131 p->setBackgroundPixmap(*pix);
132 132
133 QObjectList *ol = p-> queryList("QWidget"); 133 QObjectList *ol = p-> queryList("QWidget");
134 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 134 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
135 QWidget *wid = (QWidget *) it.current ( ); 135 QWidget *wid = (QWidget *) it.current ( );
136 136
137 wid-> setBackgroundPixmap(*pix); 137 wid-> setBackgroundPixmap(*pix);
138 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 138 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
139 } 139 }
140 delete ol; 140 delete ol;
141 } 141 }
142 } 142 }
143 } 143 }
144 else if(ev->type() == QEvent::Hide){ 144 else if(ev->type() == QEvent::Hide){
145 if(type == TransStippleBg || type == TransStippleBtn || 145 if(type == TransStippleBg || type == TransStippleBtn ||
146 type == Custom){ 146 type == Custom){
147// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 147// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
148 148
149 if (p->inherits("QPopupMenu")) 149 if (p->inherits("QPopupMenu"))
150 pixDict.remove(p->winId()); 150 pixDict.remove(p->winId());
151 else { 151 else {
152 p->setBackgroundMode(QWidget::PaletteBackground); 152 p->setBackgroundMode(QWidget::PaletteBackground);
153 153
154 QObjectList *ol = p-> queryList("QWidget"); 154 QObjectList *ol = p-> queryList("QWidget");
155 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 155 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
156 QWidget *wid = (QWidget *) it.current ( ); 156 QWidget *wid = (QWidget *) it.current ( );
157 157
158 wid-> setBackgroundMode( QWidget::PaletteBackground ); 158 wid-> setBackgroundMode( QWidget::PaletteBackground );
159 } 159 }
160 delete ol; 160 delete ol;
161 } 161 }
162 } 162 }
163 } 163 }
164 return(false); 164 return(false);
165} 165}
166 166
167 167
168LiquidStyle::LiquidStyle() 168LiquidStyle::LiquidStyle()
169 :QWindowsStyle() 169 :QWindowsStyle()
170{ 170{
171 setName ( "LiquidStyle" ); 171 setName ( "LiquidStyle" );
172 172
173 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 173 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
174 btnMaskBmp.setMask(btnMaskBmp); 174 btnMaskBmp.setMask(btnMaskBmp);
175 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 175 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
176 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 176 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
177 headerHoverID = -1; 177 headerHoverID = -1;
178 highlightWidget = NULL; 178 highlightWidget = NULL;
179 setButtonDefaultIndicatorWidth(0); 179 setButtonDefaultIndicatorWidth(0);
180 btnDict.setAutoDelete(true); 180 btnDict.setAutoDelete(true);
181 bevelFillDict.setAutoDelete(true); 181 bevelFillDict.setAutoDelete(true);
182 smallBevelFillDict.setAutoDelete(true); 182 smallBevelFillDict.setAutoDelete(true);
183 customBtnColorList.setAutoDelete(true); 183 customBtnColorList.setAutoDelete(true);
184 customBtnIconList.setAutoDelete(true); 184 customBtnIconList.setAutoDelete(true);
185 customBtnLabelList.setAutoDelete(true); 185 customBtnLabelList.setAutoDelete(true);
186 186
187 rMatrix.rotate(270.0); 187 rMatrix.rotate(270.0);
188 highcolor = QPixmap::defaultDepth() > 8; 188 highcolor = QPixmap::defaultDepth() > 8;
189 btnBorderPix = new QPixmap; 189 btnBorderPix = new QPixmap;
190 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 190 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
191 btnBlendPix = new QPixmap; 191 btnBlendPix = new QPixmap;
192 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 192 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
193 bevelFillPix = new QPixmap; 193 bevelFillPix = new QPixmap;
194 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 194 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
195 smallBevelFillPix = new QPixmap; 195 smallBevelFillPix = new QPixmap;
196 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 196 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
197 // new stuff 197 // new stuff
198 vsbSliderFillPix = menuPix = NULL; 198 vsbSliderFillPix = menuPix = NULL;
199 menuHandler = new TransMenuHandler(this); 199 menuHandler = new TransMenuHandler(this);
200 setScrollBarExtent(15, 15); 200 setScrollBarExtent(15, 15);
201 int i; 201 int i;
202 for(i=0; i < BITMAP_ITEMS; ++i){ 202 for(i=0; i < BITMAP_ITEMS; ++i){
203 pixmaps[i] = NULL; 203 pixmaps[i] = NULL;
204 } 204 }
205 oldSliderThickness = sliderThickness(); 205 oldSliderThickness = sliderThickness();
206 setSliderThickness(11); 206 setSliderThickness(11);
207} 207}
208 208
209LiquidStyle::~LiquidStyle() 209LiquidStyle::~LiquidStyle()
210{ 210{
211 if(btnBorderPix) 211 if(btnBorderPix)
212 delete btnBorderPix; 212 delete btnBorderPix;
213 if(btnBlendPix) 213 if(btnBlendPix)
214 delete btnBlendPix; 214 delete btnBlendPix;
215 if(bevelFillPix) 215 if(bevelFillPix)
216 delete bevelFillPix; 216 delete bevelFillPix;
217 if(smallBevelFillPix) 217 if(smallBevelFillPix)
218 delete smallBevelFillPix; 218 delete smallBevelFillPix;
219 if(vsbSliderFillPix) 219 if(vsbSliderFillPix)
220 delete vsbSliderFillPix; 220 delete vsbSliderFillPix;
221 if(menuPix) 221 if(menuPix)
222 delete menuPix; 222 delete menuPix;
223 223
224 setScrollBarExtent(16, 16); 224 setScrollBarExtent(16, 16);
225 setSliderThickness(oldSliderThickness); 225 setSliderThickness(oldSliderThickness);
226 int i; 226 int i;
227 for(i=0; i < BITMAP_ITEMS; ++i){ 227 for(i=0; i < BITMAP_ITEMS; ++i){
228 if(pixmaps[i]) 228 if(pixmaps[i])
229 delete pixmaps[i]; 229 delete pixmaps[i];
230 } 230 }
231} 231}
232 232
233void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 233void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
234 const QColor &c, const QColor &bg) 234 const QColor &c, const QColor &bg)
235{ 235{
236 236
237 QPen oldPen = p->pen(); // headers need this 237 QPen oldPen = p->pen(); // headers need this
238 int x2 = x+w-1; 238 int x2 = x+w-1;
239 int y2 = y+h-1; 239 int y2 = y+h-1;
240 // outer dark rect 240 // outer dark rect
241 p->setPen(c.dark(130)); 241 p->setPen(c.dark(130));
242 p->drawLine(x, y+2, x, y2-2); // l 242 p->drawLine(x, y+2, x, y2-2); // l
243 p->drawLine(x2, y+2, x2, y2-2); // r 243 p->drawLine(x2, y+2, x2, y2-2); // r
244 p->drawLine(x+2, y, x2-2, y); // t 244 p->drawLine(x+2, y, x2-2, y); // t
245 p->drawLine(x+2, y2, x2-2, y2); // b 245 p->drawLine(x+2, y2, x2-2, y2); // b
246 p->drawPoint(x+1, y+1); // tl 246 p->drawPoint(x+1, y+1); // tl
247 p->drawPoint(x2-1, y+1); // tr 247 p->drawPoint(x2-1, y+1); // tr
248 p->drawPoint(x+1, y2-1); // bl 248 p->drawPoint(x+1, y2-1); // bl
249 p->drawPoint(x2-1, y2-1); // br 249 p->drawPoint(x2-1, y2-1); // br
250 250
251 // inner top light lines 251 // inner top light lines
252 p->setPen(c.light(105)); 252 p->setPen(c.light(105));
253 p->drawLine(x+2, y+1, x2-2, y+1); 253 p->drawLine(x+2, y+1, x2-2, y+1);
254 p->drawLine(x+1, y+2, x2-1, y+2); 254 p->drawLine(x+1, y+2, x2-1, y+2);
255 p->drawLine(x+1, y+3, x+2, y+3); 255 p->drawLine(x+1, y+3, x+2, y+3);
256 p->drawLine(x2-2, y+3, x2-1, y+3); 256 p->drawLine(x2-2, y+3, x2-1, y+3);
257 p->drawPoint(x+1, y+4); 257 p->drawPoint(x+1, y+4);
258 p->drawPoint(x2-1, y+4); 258 p->drawPoint(x2-1, y+4);
259 259
260 // inner bottom light lines 260 // inner bottom light lines
261 p->setPen(c.light(110)); 261 p->setPen(c.light(110));
262 p->drawLine(x+2, y2-1, x2-2, y2-1); 262 p->drawLine(x+2, y2-1, x2-2, y2-1);
263 p->drawLine(x+1, y2-2, x2-1, y2-2); 263 p->drawLine(x+1, y2-2, x2-1, y2-2);
264 p->drawLine(x+1, y2-3, x+2, y2-3); 264 p->drawLine(x+1, y2-3, x+2, y2-3);
265 p->drawLine(x2-2, y2-3, x2-1, y2-3); 265 p->drawLine(x2-2, y2-3, x2-1, y2-3);
266 p->drawPoint(x+1, y2-4); 266 p->drawPoint(x+1, y2-4);
267 p->drawPoint(x2-1, y2-4); 267 p->drawPoint(x2-1, y2-4);
268 268
269 // inner left mid lines 269 // inner left mid lines
270 //p->setPen(c.light(105)); 270 //p->setPen(c.light(105));
271 p->setPen(c); 271 p->setPen(c);
272 p->drawLine(x+1, y+5, x+1, y2-5); 272 p->drawLine(x+1, y+5, x+1, y2-5);
273 p->drawLine(x+2, y+4, x+2, y2-4); 273 p->drawLine(x+2, y+4, x+2, y2-4);
@@ -521,664 +521,675 @@ QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
521 oldV = (int)((srcPercent*oldV) + (destPercent*bV)); 521 oldV = (int)((srcPercent*oldV) + (destPercent*bV));
522 c.setHsv(oldH, oldS, oldV); 522 c.setHsv(oldH, oldS, oldV);
523 alpha = 255; 523 alpha = 255;
524 } 524 }
525 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); 525 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha);
526 } 526 }
527 QPixmap *pix = new QPixmap; 527 QPixmap *pix = new QPixmap;
528 pix->convertFromImage(img); 528 pix->convertFromImage(img);
529 return(pix); 529 return(pix);
530} 530}
531 531
532 532
533 533
534 534
535QPixmap* LiquidStyle::getPixmap(BitmapData item) 535QPixmap* LiquidStyle::getPixmap(BitmapData item)
536{ 536{
537 537
538 if(pixmaps[item]) 538 if(pixmaps[item])
539 return(pixmaps[item]); 539 return(pixmaps[item]);
540 540
541 switch(item){ 541 switch(item){
542 case HTMLBtnBorder: 542 case HTMLBtnBorder:
543 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); 543 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV);
544 break; 544 break;
545 case HTMLBtnBorderDown: 545 case HTMLBtnBorderDown:
546 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 546 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
547 break; 547 break;
548 case HTMLCB: 548 case HTMLCB:
549 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 549 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
550 break; 550 break;
551 case HTMLCBDown: 551 case HTMLCBDown:
552 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 552 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
553 break; 553 break;
554 case HTMLCBHover: 554 case HTMLCBHover:
555 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); 555 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV);
556 break; 556 break;
557 case HTMLCBDownHover: 557 case HTMLCBDownHover:
558 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", 558 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown",
559 btnHoverH, btnHoverS, 559 btnHoverH, btnHoverS,
560 btnHoverV); 560 btnHoverV);
561 break; 561 break;
562 case HTMLRadio: 562 case HTMLRadio:
563 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 563 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
564 case HTMLRadioDown: 564 case HTMLRadioDown:
565 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 565 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
566 case HTMLRadioHover: 566 case HTMLRadioHover:
567 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); 567 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV);
568 case HTMLRadioDownHover: 568 case HTMLRadioDownHover:
569 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", 569 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown",
570 btnHoverH, btnHoverS, 570 btnHoverH, btnHoverS,
571 btnHoverV); 571 btnHoverV);
572 case RadioOn: 572 case RadioOn:
573 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); 573 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true);
574 break; 574 break;
575 case RadioOnHover: 575 case RadioOnHover:
576 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, 576 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS,
577 btnHoverV, true); 577 btnHoverV, true);
578 break; 578 break;
579 case RadioOffHover: 579 case RadioOffHover:
580 pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); 580 pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true);
581 break; 581 break;
582 case TabDown: 582 case TabDown:
583 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); 583 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true);
584 break; 584 break;
585 case TabFocus: 585 case TabFocus:
586 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, 586 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS,
587 btnHoverS, true); 587 btnHoverS, true);
588 break; 588 break;
589 case CBDown: 589 case CBDown:
590 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); 590 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true);
591 break; 591 break;
592 case CBDownHover: 592 case CBDownHover:
593 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, 593 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH,
594 btnHoverS, btnHoverV, true); 594 btnHoverS, btnHoverV, true);
595 break; 595 break;
596 case CBHover: 596 case CBHover:
597 pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); 597 pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true);
598 break; 598 break;
599 case HSlider: 599 case HSlider:
600 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 600 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
601 break; 601 break;
602 case VSlider: 602 case VSlider:
603 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 603 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
604 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 604 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
605 break; 605 break;
606 case RadioOff: 606 case RadioOff:
607 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); 607 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true);
608 break; 608 break;
609 case Tab: 609 case Tab:
610 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); 610 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true);
611 break; 611 break;
612 case CB: 612 case CB:
613 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); 613 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true);
614 break; 614 break;
615 case VSBSliderTop: 615 case VSBSliderTop:
616 pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 616 pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
617 break; 617 break;
618 case VSBSliderBtm: 618 case VSBSliderBtm:
619 pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 619 pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
620 break; 620 break;
621 case VSBSliderMid: 621 case VSBSliderMid:
622 pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 622 pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
623 break; 623 break;
624 case VSBSliderTopHover: 624 case VSBSliderTopHover:
625 pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 625 pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
626 break; 626 break;
627 case VSBSliderBtmHover: 627 case VSBSliderBtmHover:
628 pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 628 pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
629 break; 629 break;
630 case VSBSliderMidHover: 630 case VSBSliderMidHover:
631 pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 631 pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
632 break; 632 break;
633 633
634 case HSBSliderTop: 634 case HSBSliderTop:
635 pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 635 pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
636 *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); 636 *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix);
637 break; 637 break;
638 case HSBSliderBtm: 638 case HSBSliderBtm:
639 pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 639 pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
640 *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); 640 *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix);
641 break; 641 break;
642 case HSBSliderMid: 642 case HSBSliderMid:
643 pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 643 pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
644 *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); 644 *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix);
645 break; 645 break;
646 case HSBSliderTopHover: 646 case HSBSliderTopHover:
647 pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 647 pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
648 *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); 648 *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix);
649 break; 649 break;
650 case HSBSliderBtmHover: 650 case HSBSliderBtmHover:
651 pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 651 pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
652 *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); 652 *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix);
653 break; 653 break;
654 case HSBSliderMidHover: 654 case HSBSliderMidHover:
655 pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 655 pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
656 *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); 656 *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix);
657 break; 657 break;
658 case VSBSliderTopBg: 658 case VSBSliderTopBg:
659 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 659 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
660 break; 660 break;
661 case VSBSliderBtmBg: 661 case VSBSliderBtmBg:
662 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 662 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
663 break; 663 break;
664 case VSBSliderMidBg: 664 case VSBSliderMidBg:
665 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 665 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
666 break; 666 break;
667 case HSBSliderTopBg: 667 case HSBSliderTopBg:
668 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 668 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
669 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 669 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
670 break; 670 break;
671 case HSBSliderBtmBg: 671 case HSBSliderBtmBg:
672 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 672 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
673 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 673 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
674 break; 674 break;
675 case HSBSliderMidBg: 675 case HSBSliderMidBg:
676 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 676 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
677 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 677 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
678 break; 678 break;
679 default: 679 default:
680 break; 680 break;
681 } 681 }
682 return(pixmaps[item]); 682 return(pixmaps[item]);
683} 683}
684 684
685void LiquidStyle::polish(QPalette &appPal) 685void LiquidStyle::polish(QPalette &appPal)
686{ 686{
687 687
688 int i; 688 int i;
689 for(i=0; i < BITMAP_ITEMS; ++i){ 689 for(i=0; i < BITMAP_ITEMS; ++i){
690 if(pixmaps[i]){ 690 if(pixmaps[i]){
691 delete pixmaps[i]; 691 delete pixmaps[i];
692 pixmaps[i] = NULL; 692 pixmaps[i] = NULL;
693 } 693 }
694 } 694 }
695 QWidgetList *list = QApplication::allWidgets(); 695 QWidgetList *list = QApplication::allWidgets();
696 QWidgetListIt it( *list ); 696 QWidgetListIt it( *list );
697 QWidget *w; 697 QWidget *w;
698 while ((w=it.current()) != 0 ){ 698 while ((w=it.current()) != 0 ){
699 ++it; 699 ++it;
700 if(w->inherits("QPushButton")){ 700 if(w->inherits("QPushButton")){
701 unapplyCustomAttributes((QPushButton *)w); 701 unapplyCustomAttributes((QPushButton *)w);
702 } 702 }
703 } 703 }
704 704
705 loadCustomButtons(); 705 loadCustomButtons();
706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
707 btnDict.clear(); 707 btnDict.clear();
708 btnBorderDict.clear(); 708 btnBorderDict.clear();
709 bevelFillDict.clear(); 709 bevelFillDict.clear();
710 smallBevelFillDict.clear(); 710 smallBevelFillDict.clear();
711 711
712 Config config ( "qpe" ); 712 Config config ( "qpe" );
713 config. setGroup ( "Liquid-Style" );
714 int contrast = config. readNumEntry ( "StippleContrast", 5 );
715 if ( contrast < 0 )
716 contrast = 0;
717 else if ( contrast > 10 )
718 contrast = 10;
719
713 QPalette pal = QApplication::palette(); 720 QPalette pal = QApplication::palette();
714 721
715 // button color stuff 722 // button color stuff
716 config. setGroup ( "Appearance" ); 723 config. setGroup ( "Appearance" );
717 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 724 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
718 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { 725 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) {
719 // force button color to be different from background 726 // force button color to be different from background
720 QBrush btnBrush(QColor(200, 202, 228)); 727 QBrush btnBrush(QColor(200, 202, 228));
721 appPal.setBrush(QColorGroup::Button, btnBrush); 728 appPal.setBrush(QColorGroup::Button, btnBrush);
722 } 729 }
723 c.hsv(&btnH, &btnS, &btnV); 730 c.hsv(&btnH, &btnS, &btnV);
724 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 731 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
725 732
726 // menu pixmap 733 // menu pixmap
727 if(!menuPix){ 734 if(!menuPix){
728 menuPix = new QPixmap; 735 menuPix = new QPixmap;
729 menuPix->resize(64, 64); 736 menuPix->resize(64, 64);
730 } 737 }
731 QPainter painter; 738 QPainter painter;
732 menuPix->fill(c.rgb()); 739 menuPix->fill(c.rgb());
733 painter.begin(menuPix); 740 painter.begin(menuPix);
734 painter.setPen(c.dark(105)); 741 painter.setPen(c.dark(105));
735 for(i=0; i < 63; i+=4){ 742 for(i=0; i < 63; i+=4){
736 painter.drawLine(0, i, 63, i); 743 painter.drawLine(0, i, 63, i);
737 painter.drawLine(0, i+1, 63, i+1); 744 painter.drawLine(0, i+1, 63, i+1);
738 }; 745 };
739 painter.end(); 746 painter.end();
740 menuBrush.setColor(c); 747 menuBrush.setColor(c);
741 menuBrush.setPixmap(*menuPix); 748 menuBrush.setPixmap(*menuPix);
742 749
743 // pager brush 750 // pager brush
744 c = c.dark(120); 751 c = c.dark(120);
745 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 752 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
746 if(!pix){ 753 if(!pix){
747 int h, s, v; 754 int h, s, v;
748 c.hsv(&h, &s, &v); 755 c.hsv(&h, &s, &v);
749 pix = new QPixmap(*smallBevelFillPix); 756 pix = new QPixmap(*smallBevelFillPix);
750 adjustHSV(*pix, h, s, v); 757 adjustHSV(*pix, h, s, v);
751 smallBevelFillDict.insert(c.rgb(), pix); 758 smallBevelFillDict.insert(c.rgb(), pix);
752 } 759 }
753 pagerHoverBrush.setColor(c); 760 pagerHoverBrush.setColor(c);
754 pagerHoverBrush.setPixmap(*pix); 761 pagerHoverBrush.setPixmap(*pix);
755 762
756 c = c.dark(120); 763 c = c.dark(120);
757 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 764 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
758 if(!pix){ 765 if(!pix){
759 int h, s, v; 766 int h, s, v;
760 c.hsv(&h, &s, &v); 767 c.hsv(&h, &s, &v);
761 pix = new QPixmap(*smallBevelFillPix); 768 pix = new QPixmap(*smallBevelFillPix);
762 adjustHSV(*pix, h, s, v); 769 adjustHSV(*pix, h, s, v);
763 smallBevelFillDict.insert(c.rgb(), pix); 770 smallBevelFillDict.insert(c.rgb(), pix);
764 } 771 }
765 pagerBrush.setColor(c); 772 pagerBrush.setColor(c);
766 pagerBrush.setPixmap(*pix); 773 pagerBrush.setPixmap(*pix);
767 774
768 // background color stuff 775 // background color stuff
769 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); 776 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));
770 c.hsv(&bH, &bS, &bV); 777 c.hsv(&bH, &bS, &bV);
771 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 778 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
772 779
773 // FIXME? 780 // FIXME?
774 if(vsbSliderFillPix) 781 if(vsbSliderFillPix)
775 delete vsbSliderFillPix; 782 delete vsbSliderFillPix;
776 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 783 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
777 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 784 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
778 785
779 // background brush 786 // background brush
780 QPixmap wallPaper(32, 32); 787 QPixmap wallPaper(32, 32);
781 wallPaper.fill(c.rgb()); 788 wallPaper.fill(c.rgb());
782 painter.begin(&wallPaper); 789 painter.begin(&wallPaper);
783 for(i=0; i < 32; i+=4){ 790 for(i=0; i < 32; i+=4){
784 painter.setPen(c.dark(105)); 791 painter.setPen(c.dark(100 + contrast));
785 painter.drawLine(0, i, 32, i); 792 painter.drawLine(0, i, 32, i);
786 painter.setPen(c.dark(103)); 793 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
787 painter.drawLine(0, i+1, 32, i+1); 794 painter.drawLine(0, i+1, 32, i+1);
788 }; 795 };
789 painter.end(); 796 painter.end();
790 bgBrush.setColor(c); 797 bgBrush.setColor(c);
791 bgBrush.setPixmap(wallPaper); 798 bgBrush.setPixmap(wallPaper);
792 appPal.setBrush(QColorGroup::Background, bgBrush); 799 appPal.setBrush(QColorGroup::Background, bgBrush);
793 800
794 // lineedits 801 // lineedits
795 c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); 802 c = QColor ( config. readEntry("Base", ( Qt::white). name ( )));
796 QPixmap basePix; 803 QPixmap basePix;
797 basePix.resize(32, 32); 804 basePix.resize(32, 32);
798 basePix.fill(c.rgb()); 805 basePix.fill(c.rgb());
799 painter.begin(&basePix); 806 painter.begin(&basePix);
800 painter.setPen(c.dark(105)); 807 painter.setPen(c.dark(105));
801 for(i=0; i < 32; i+=4){ 808 for(i=0; i < 32; i+=4){
802 painter.drawLine(0, i, 32, i); 809 painter.drawLine(0, i, 32, i);
803 painter.drawLine(0, i+1, 32, i+1); 810 painter.drawLine(0, i+1, 32, i+1);
804 }; 811 };
805 painter.end(); 812 painter.end();
806 baseBrush.setColor(c); 813 baseBrush.setColor(c);
807 baseBrush.setPixmap(basePix); 814 baseBrush.setPixmap(basePix);
808 it.toFirst(); 815 it.toFirst();
809 while ((w=it.current()) != 0 ){ 816 while ((w=it.current()) != 0 ){
810 ++it; 817 ++it;
811 if(w->inherits("QLineEdit")){ 818 if(w->inherits("QLineEdit")){
812 QPalette pal = w->palette(); 819 QPalette pal = w->palette();
813 pal.setBrush(QColorGroup::Base, baseBrush); 820 pal.setBrush(QColorGroup::Base, baseBrush);
814 w->setPalette(pal); 821 w->setPalette(pal);
815 } 822 }
816 else if(w->inherits("QPushButton")){ 823 else if(w->inherits("QPushButton")){
817 applyCustomAttributes((QPushButton *)w); 824 applyCustomAttributes((QPushButton *)w);
818 } 825 }
819 } 826 }
820 827
821} 828}
822 829
823void LiquidStyle::polish(QWidget *w) 830void LiquidStyle::polish(QWidget *w)
824{ 831{
825 if(w->inherits("QMenuBar")){ 832 if(w->inherits("QMenuBar")){
826 //((QFrame*)w)->setLineWidth(0); 833 //((QFrame*)w)->setLineWidth(0);
827 w->setBackgroundMode(QWidget::PaletteBackground); 834 w->setBackgroundMode(QWidget::PaletteBackground);
828 return; 835 return;
829 } 836 }
830 if(w->inherits("QPopupMenu")) 837 if(w->inherits("QPopupMenu"))
831 w->setBackgroundMode(QWidget::NoBackground); 838 w->setBackgroundMode(QWidget::NoBackground);
832 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 839 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
833 w->installEventFilter(menuHandler); 840 w->installEventFilter(menuHandler);
834 } 841 }
835 842
836 if(w->isTopLevel()){ 843 if(w->isTopLevel()){
837 return; 844 return;
838 } 845 }
839 846
840 847
841 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 848 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
842 849
843 if(w->inherits("QComboBox") || 850 if(w->inherits("QComboBox") ||
844 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 851 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
845 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 852 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
846 w->installEventFilter(this); 853 w->installEventFilter(this);
847 } 854 }
848 if(w->inherits("QLineEdit")){ 855 if(w->inherits("QLineEdit")){
849 QPalette pal = w->palette(); 856 QPalette pal = w->palette();
850 pal.setBrush(QColorGroup::Base, baseBrush); 857 pal.setBrush(QColorGroup::Base, baseBrush);
851 w->setPalette(pal); 858 w->setPalette(pal);
852 } 859 }
853 if(w->inherits("QPushButton")){ 860 if(w->inherits("QPushButton")){
854 applyCustomAttributes((QPushButton *)w); 861 applyCustomAttributes((QPushButton *)w);
855 w->installEventFilter(this); 862 w->installEventFilter(this);
856 } 863 }
857 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 864 if(w->inherits("QButton") || w-> inherits("QComboBox")){
858 w-> setBackgroundMode ( QWidget::PaletteBackground ); 865 w-> setBackgroundMode ( QWidget::PaletteBackground );
859 } 866 }
860 867
861 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 868 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
862 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 869 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
863 bool isViewportChild = w->parent() && 870 bool isViewportChild = w->parent() &&
864 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 871 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
865 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 872 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
866 873
867 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 874 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
868 w->setBackgroundMode(QWidget::X11ParentRelative); 875 w->setBackgroundMode(QWidget::X11ParentRelative);
869 return; 876 return;
870 } 877 }
871 if(isViewportChild){ 878 if(isViewportChild){
872 if(w->inherits("QButton") || w->inherits("QComboBox")){ 879 if(w->inherits("QButton") || w->inherits("QComboBox")){
873 if(w->parent()){ // heh, only way to test for KHTML children ;-) 880 if(w->parent()){ // heh, only way to test for KHTML children ;-)
874 if(w->parent()->parent()){ 881 if(w->parent()->parent()){
875 if(w->parent()->parent()->parent() && 882 if(w->parent()->parent()->parent() &&
876 w->parent()->parent()->parent()->inherits("KHTMLView")){ 883 w->parent()->parent()->parent()->inherits("KHTMLView")){
877 w->setAutoMask(true); 884 w->setAutoMask(true);
878 w->setBackgroundMode(QWidget::NoBackground); 885 w->setBackgroundMode(QWidget::NoBackground);
879 } 886 }
880 } 887 }
881 } 888 }
882 return; 889 return;
883 } 890 }
884 } 891 }
885 if(w->inherits("QHeader")){ 892 if(w->inherits("QHeader")){
886 w->setMouseTracking(true); 893 w->setMouseTracking(true);
887 w->installEventFilter(this); 894 w->installEventFilter(this);
888 } 895 }
889 if(w-> inherits("QToolButton")) { 896 if(w-> inherits("QToolButton")) {
890 ((QToolButton*)w)->setAutoRaise (false); 897 ((QToolButton*)w)->setAutoRaise (false);
891 } 898 }
892 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 899 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
893 return; 900 return;
894 } 901 }
895 902
896 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 903 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
897 palette().active().brush(QColorGroup::Background).pixmap()){ 904 palette().active().brush(QColorGroup::Background).pixmap()){
898 qWarning("No parent pixmap for child widget %s", w->className()); 905 qWarning("No parent pixmap for child widget %s", w->className());
899 return; 906 return;
900 } 907 }
901 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 908 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
902 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 909 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
903 if(w->backgroundMode() == QWidget::PaletteBackground || 910 if(w->backgroundMode() == QWidget::PaletteBackground ||
904 w->backgroundMode() == QWidget::PaletteButton){ 911 w->backgroundMode() == QWidget::PaletteButton){
905 w->setBackgroundMode(QWidget::X11ParentRelative); 912 w->setBackgroundMode(QWidget::X11ParentRelative);
906 } 913 }
907 } 914 }
908 if(w->inherits("QToolBar")){ 915 if(w->inherits("QToolBar")){
909 w->installEventFilter(this); 916 w->installEventFilter(this);
910 w->setBackgroundMode(QWidget::PaletteBackground); 917 w->setBackgroundMode(QWidget::PaletteBackground);
911 return; 918 return;
912 } 919 }
913 920
914} 921}
915 922
916void LiquidStyle::unPolish(QWidget *w) 923void LiquidStyle::unPolish(QWidget *w)
917{ 924{
918 if(w->inherits("QMenuBar")){ 925 if(w->inherits("QMenuBar")){
919 ((QFrame *)w)->setLineWidth(1); 926 ((QFrame *)w)->setLineWidth(1);
920 w->setBackgroundMode(QWidget::PaletteBackground); 927 w->setBackgroundMode(QWidget::PaletteBackground);
921 return; 928 return;
922 } 929 }
923 930
924 if(w->inherits("QPopupMenu")) 931 if(w->inherits("QPopupMenu"))
925 w->setBackgroundMode(QWidget::PaletteButton); 932 w->setBackgroundMode(QWidget::PaletteButton);
926 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 933 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
927 w->removeEventFilter(menuHandler); 934 w->removeEventFilter(menuHandler);
928 } 935 }
929 936
930 if(w->isTopLevel()) 937 if(w->isTopLevel())
931 return; 938 return;
932 939
933 // for viewport children, don't just check for NoBackground.... 940 // for viewport children, don't just check for NoBackground....
934 bool isViewportChild = w->parent() && 941 bool isViewportChild = w->parent() &&
935 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 942 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
936 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 943 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
937 944
938 w->setPalette(QApplication::palette()); 945 w->setPalette(QApplication::palette());
939 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 946 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
940 if(w->inherits("QPushButton")) 947 if(w->inherits("QPushButton"))
941 w->setBackgroundMode(QWidget::PaletteButton); 948 w->setBackgroundMode(QWidget::PaletteButton);
942 else 949 else
943 w->setBackgroundMode(QWidget::PaletteBackground); 950 w->setBackgroundMode(QWidget::PaletteBackground);
944 } 951 }
945 952
946 if(isViewportChild) 953 if(isViewportChild)
947 w->setAutoMask(false); 954 w->setAutoMask(false);
948 955
949 if(w->inherits("QPushButton")){ 956 if(w->inherits("QPushButton")){
950 unapplyCustomAttributes((QPushButton *)w); 957 unapplyCustomAttributes((QPushButton *)w);
951 w->removeEventFilter(this); 958 w->removeEventFilter(this);
952 } 959 }
953/* 960/*
954 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 961 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
955 w-> setBackgroundMode ( PaletteBackground ); 962 w-> setBackgroundMode ( PaletteBackground );
956 } 963 }
957*/ 964*/
958 if(w->inherits("QComboBox") || 965 if(w->inherits("QComboBox") ||
959 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 966 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
960 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 967 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
961 w->removeEventFilter(this); 968 w->removeEventFilter(this);
962 } 969 }
963 if(w->inherits("QButton") || w->inherits("QComboBox")){ 970 if(w->inherits("QButton") || w->inherits("QComboBox")){
964 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 971 if(w->parent() && w->parent()->inherits("KHTMLPart")){
965 w->setAutoMask(false); 972 w->setAutoMask(false);
966 } 973 }
967 } 974 }
968 if(w->inherits("QToolBar")){ 975 if(w->inherits("QToolBar")){
969 w->removeEventFilter(this); 976 w->removeEventFilter(this);
970 w->setBackgroundMode(QWidget::PaletteBackground); 977 w->setBackgroundMode(QWidget::PaletteBackground);
971 return; 978 return;
972 } 979 }
973 if(w->inherits("QHeader")){ 980 if(w->inherits("QHeader")){
974 w->setMouseTracking(false); 981 w->setMouseTracking(false);
975 w->removeEventFilter(this); 982 w->removeEventFilter(this);
976 } 983 }
977} 984}
978 985
979void LiquidStyle::polish(QApplication *app) 986void LiquidStyle::polish(QApplication *app)
980{ 987{
981 988
982 QWindowsStyle::polish(app); 989 QWindowsStyle::polish(app);
983 menuAni = app->isEffectEnabled(UI_AnimateMenu); 990 menuAni = app->isEffectEnabled(UI_AnimateMenu);
984 menuFade = app->isEffectEnabled(UI_FadeMenu); 991 menuFade = app->isEffectEnabled(UI_FadeMenu);
985 if(menuAni) 992 if(menuAni)
986 app->setEffectEnabled(UI_AnimateMenu, false); 993 app->setEffectEnabled(UI_AnimateMenu, false);
987 if(menuFade) 994 if(menuFade)
988 app->setEffectEnabled(UI_FadeMenu, false); 995 app->setEffectEnabled(UI_FadeMenu, false);
989 996
990 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 997 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
991 998
992 QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 999 Config config ( "qpe" );
1000 config. setGroup ( "Liquid-Style" );
1001
1002 if ( config. readBoolEntry ( "WinDecoration", true ))
1003 QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
993} 1004}
994 1005
995void LiquidStyle::unPolish(QApplication *app) 1006void LiquidStyle::unPolish(QApplication *app)
996{ 1007{
997 QWindowsStyle::unPolish(app); 1008 QWindowsStyle::unPolish(app);
998 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1009 app->setEffectEnabled(UI_AnimateMenu, menuAni);
999 app->setEffectEnabled(UI_FadeMenu, menuFade); 1010 app->setEffectEnabled(UI_FadeMenu, menuFade);
1000 1011
1001 qt_set_draw_menu_bar_impl ( 0 ); 1012 qt_set_draw_menu_bar_impl ( 0 );
1002 1013
1003 QApplication::qwsSetDecoration ( new QPEDecoration ( )); 1014 QApplication::qwsSetDecoration ( new QPEDecoration ( ));
1004} 1015}
1005 1016
1006/* 1017/*
1007 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1018 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1008 * force everything to erase and repaint on resize. This is going away, I'm 1019 * force everything to erase and repaint on resize. This is going away, I'm
1009 * trying to get shaped widgets to work right without masking. QPushButton, 1020 * trying to get shaped widgets to work right without masking. QPushButton,
1010 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1021 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1011 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1022 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1012 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1023 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1013 * caches them in QPixmapCache, which is bad for doing things like hover 1024 * caches them in QPixmapCache, which is bad for doing things like hover
1014 * because the style methods aren't called in paintEvents if everything 1025 * because the style methods aren't called in paintEvents if everything
1015 * is cached. We use our own Paint event handler instead. Taskbuttons and 1026 * is cached. We use our own Paint event handler instead. Taskbuttons and
1016 * pager buttons draw into a pixmap buffer, so we handle those with palette 1027 * pager buttons draw into a pixmap buffer, so we handle those with palette
1017 * modifications. For QHeader, different header items are actually one widget 1028 * modifications. For QHeader, different header items are actually one widget
1018 * that draws multiple items, so we need to check which ID is hightlighted 1029 * that draws multiple items, so we need to check which ID is hightlighted
1019 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1030 * and draw it. Finally, we also check enter and leave events for QLineEdit,
1020 * since if it's inside a combobox we want to highlight the combobox during 1031 * since if it's inside a combobox we want to highlight the combobox during
1021 * hovering in the edit. 1032 * hovering in the edit.
1022 */ 1033 */
1023bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1034bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1024{ 1035{
1025 if(obj->inherits("QToolBar")){ 1036 if(obj->inherits("QToolBar")){
1026 if(ev->type() == QEvent::Resize){ 1037 if(ev->type() == QEvent::Resize){
1027 const QObjectList *tbChildList = obj->children(); 1038 const QObjectList *tbChildList = obj->children();
1028 QObjectListIt it(*tbChildList); 1039 QObjectListIt it(*tbChildList);
1029 QObject *child; 1040 QObject *child;
1030 while((child = it.current()) != NULL){ 1041 while((child = it.current()) != NULL){
1031 ++it; 1042 ++it;
1032 if(child->isWidgetType()) 1043 if(child->isWidgetType())
1033 ((QWidget *)child)->repaint(true); 1044 ((QWidget *)child)->repaint(true);
1034 } 1045 }
1035 1046
1036 } 1047 }
1037 } 1048 }
1038 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ 1049 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){
1039 QWidget *btn = (QWidget *)obj; 1050 QWidget *btn = (QWidget *)obj;
1040 if(ev->type() == QEvent::Enter){ 1051 if(ev->type() == QEvent::Enter){
1041 if(btn->isEnabled()){ 1052 if(btn->isEnabled()){
1042 highlightWidget = btn; 1053 highlightWidget = btn;
1043 btn->repaint(false); 1054 btn->repaint(false);
1044 } 1055 }
1045 } 1056 }
1046 else if(ev->type() == QEvent::Leave){ 1057 else if(ev->type() == QEvent::Leave){
1047 if(btn == highlightWidget){ 1058 if(btn == highlightWidget){
1048 highlightWidget = NULL; 1059 highlightWidget = NULL;
1049 btn->repaint(false); 1060 btn->repaint(false);
1050 } 1061 }
1051 } 1062 }
1052 } 1063 }
1053 else if(obj->inherits("QToolButton")){ 1064 else if(obj->inherits("QToolButton")){
1054 QToolButton *btn = (QToolButton *)btn; 1065 QToolButton *btn = (QToolButton *)btn;
1055 if(!btn->autoRaise()){ 1066 if(!btn->autoRaise()){
1056 if(btn->isEnabled()){ 1067 if(btn->isEnabled()){
1057 highlightWidget = btn; 1068 highlightWidget = btn;
1058 btn->repaint(false); 1069 btn->repaint(false);
1059 } 1070 }
1060 } 1071 }
1061 else if(ev->type() == QEvent::Leave){ 1072 else if(ev->type() == QEvent::Leave){
1062 QWidget *btn = (QWidget *)obj; 1073 QWidget *btn = (QWidget *)obj;
1063 if(btn == highlightWidget){ 1074 if(btn == highlightWidget){
1064 highlightWidget = NULL; 1075 highlightWidget = NULL;
1065 btn->repaint(false); 1076 btn->repaint(false);
1066 } 1077 }
1067 } 1078 }
1068 else 1079 else
1069 highlightWidget = NULL; 1080 highlightWidget = NULL;
1070 } 1081 }
1071 else if(obj->inherits("QScrollBar")){ 1082 else if(obj->inherits("QScrollBar")){
1072 QScrollBar *sb = (QScrollBar *)obj; 1083 QScrollBar *sb = (QScrollBar *)obj;
1073 if(ev->type() == QEvent::Enter){ 1084 if(ev->type() == QEvent::Enter){
1074 if(sb->isEnabled()){ 1085 if(sb->isEnabled()){
1075 highlightWidget = sb; 1086 highlightWidget = sb;
1076 sb->repaint(false); 1087 sb->repaint(false);
1077 } 1088 }
1078 } 1089 }
1079 else if(ev->type() == QEvent::Leave){ 1090 else if(ev->type() == QEvent::Leave){
1080 if(sb == highlightWidget && !sb->draggingSlider()){ 1091 if(sb == highlightWidget && !sb->draggingSlider()){
1081 highlightWidget = NULL; 1092 highlightWidget = NULL;
1082 sb->repaint(false); 1093 sb->repaint(false);
1083 } 1094 }
1084 } 1095 }
1085 else if(ev->type() == QEvent::MouseButtonRelease){ 1096 else if(ev->type() == QEvent::MouseButtonRelease){
1086 QMouseEvent *me = (QMouseEvent *)ev; 1097 QMouseEvent *me = (QMouseEvent *)ev;
1087 if(sb == highlightWidget && !sb->rect().contains(me->pos())){ 1098 if(sb == highlightWidget && !sb->rect().contains(me->pos())){
1088 highlightWidget = NULL; 1099 highlightWidget = NULL;
1089 sb->repaint(false); 1100 sb->repaint(false);
1090 } 1101 }
1091 } 1102 }
1092 } 1103 }
1093 else if(obj->inherits("QLineEdit")){ 1104 else if(obj->inherits("QLineEdit")){
1094 if(obj->parent() && obj->parent()->inherits("QComboBox")){ 1105 if(obj->parent() && obj->parent()->inherits("QComboBox")){
1095 QWidget *btn = (QComboBox *)obj->parent(); 1106 QWidget *btn = (QComboBox *)obj->parent();
1096 if(ev->type() == QEvent::Enter){ 1107 if(ev->type() == QEvent::Enter){
1097 if (btn->isEnabled()){ 1108 if (btn->isEnabled()){
1098 highlightWidget = btn; 1109 highlightWidget = btn;
1099 btn->repaint(false); 1110 btn->repaint(false);
1100 } 1111 }
1101 } 1112 }
1102 else if(ev->type() == QEvent::Leave){ 1113 else if(ev->type() == QEvent::Leave){
1103 if (btn == highlightWidget) 1114 if (btn == highlightWidget)
1104 highlightWidget = NULL; 1115 highlightWidget = NULL;
1105 btn->repaint(false); 1116 btn->repaint(false);
1106 } 1117 }
1107 } 1118 }
1108 } 1119 }
1109 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ 1120 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){
1110 QButton *btn = (QButton *)obj; 1121 QButton *btn = (QButton *)obj;
1111 bool isRadio = obj->inherits("QRadioButton"); 1122 bool isRadio = obj->inherits("QRadioButton");
1112 if(ev->type() == QEvent::Paint){ 1123 if(ev->type() == QEvent::Paint){
1113 //if(btn->autoMask()) 1124 //if(btn->autoMask())
1114 btn->erase(); 1125 btn->erase();
1115 QPainter p; 1126 QPainter p;
1116 p.begin(btn); 1127 p.begin(btn);
1117 QFontMetrics fm = btn->fontMetrics(); 1128 QFontMetrics fm = btn->fontMetrics();
1118 QSize lsz = fm.size(ShowPrefix, btn->text()); 1129 QSize lsz = fm.size(ShowPrefix, btn->text());
1119 QSize sz = isRadio ? exclusiveIndicatorSize() 1130 QSize sz = isRadio ? exclusiveIndicatorSize()
1120 : indicatorSize(); 1131 : indicatorSize();
1121 1132
1122 if(btn->hasFocus()){ 1133 if(btn->hasFocus()){
1123 QRect r = QRect(0, 0, btn->width(), btn->height()); 1134 QRect r = QRect(0, 0, btn->width(), btn->height());
1124 p.setPen(btn->colorGroup().button().dark(140)); 1135 p.setPen(btn->colorGroup().button().dark(140));
1125 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1136 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1126 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1137 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1127 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1138 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1128 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1139 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1129 } 1140 }
1130 int x = 0; 1141 int x = 0;
1131 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1142 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1132 if(isRadio) 1143 if(isRadio)
1133 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1144 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1134 btn->colorGroup(), btn->isOn(), 1145 btn->colorGroup(), btn->isOn(),
1135 btn->isDown(), btn->isEnabled()); 1146 btn->isDown(), btn->isEnabled());
1136 else 1147 else
1137 drawIndicator(&p, x, y, sz.width(), sz.height(), 1148 drawIndicator(&p, x, y, sz.width(), sz.height(),
1138 btn->colorGroup(), btn->state(), btn->isDown(), 1149 btn->colorGroup(), btn->state(), btn->isDown(),
1139 btn->isEnabled()); 1150 btn->isEnabled());
1140 x = sz.width() + 6; 1151 x = sz.width() + 6;
1141 y = 0; 1152 y = 0;
1142 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), 1153 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1),
1143 btn->height(), AlignLeft|AlignVCenter|ShowPrefix, 1154 btn->height(), AlignLeft|AlignVCenter|ShowPrefix,
1144 btn->colorGroup(), btn->isEnabled(), 1155 btn->colorGroup(), btn->isEnabled(),
1145 btn->pixmap(), btn->text()); 1156 btn->pixmap(), btn->text());
1146 p.end(); 1157 p.end();
1147 return(true); 1158 return(true);
1148 } 1159 }
1149 // for hover, just redraw the indicator (not the text) 1160 // for hover, just redraw the indicator (not the text)
1150 else if((ev->type() == QEvent::Enter && btn->isEnabled()) || 1161 else if((ev->type() == QEvent::Enter && btn->isEnabled()) ||
1151 (ev->type() == QEvent::Leave && btn == highlightWidget)){ 1162 (ev->type() == QEvent::Leave && btn == highlightWidget)){
1152 QButton *btn = (QButton *)obj; 1163 QButton *btn = (QButton *)obj;
1153 bool isRadio = obj->inherits("QRadioButton"); 1164 bool isRadio = obj->inherits("QRadioButton");
1154 1165
1155 if(ev->type() == QEvent::Enter) 1166 if(ev->type() == QEvent::Enter)
1156 highlightWidget = btn; 1167 highlightWidget = btn;
1157 else 1168 else
1158 highlightWidget = NULL; 1169 highlightWidget = NULL;
1159 QFontMetrics fm = btn->fontMetrics(); 1170 QFontMetrics fm = btn->fontMetrics();
1160 QSize lsz = fm.size(ShowPrefix, btn->text()); 1171 QSize lsz = fm.size(ShowPrefix, btn->text());
1161 QSize sz = isRadio ? exclusiveIndicatorSize() 1172 QSize sz = isRadio ? exclusiveIndicatorSize()
1162 : indicatorSize(); 1173 : indicatorSize();
1163 int x = 0; 1174 int x = 0;
1164 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1175 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1165 //if(btn->autoMask()) 1176 //if(btn->autoMask())
1166 // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); 1177 // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2);
1167 QPainter p; 1178 QPainter p;
1168 p.begin(btn); 1179 p.begin(btn);
1169 if(isRadio) 1180 if(isRadio)
1170 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1181 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1171 btn->colorGroup(), btn->isOn(), 1182 btn->colorGroup(), btn->isOn(),
1172 btn->isDown(), btn->isEnabled()); 1183 btn->isDown(), btn->isEnabled());
1173 else 1184 else
1174 drawIndicator(&p, x, y, sz.width(), sz.height(), 1185 drawIndicator(&p, x, y, sz.width(), sz.height(),
1175 btn->colorGroup(), btn->state(), btn->isDown(), 1186 btn->colorGroup(), btn->state(), btn->isDown(),
1176 btn->isEnabled()); 1187 btn->isEnabled());
1177 p.end(); 1188 p.end();
1178 } 1189 }
1179 } 1190 }
1180 else if(obj->inherits("QHeader")){ 1191 else if(obj->inherits("QHeader")){
1181 QHeader *hw = (QHeader *)obj; 1192 QHeader *hw = (QHeader *)obj;
1182 if(ev->type() == QEvent::Enter){ 1193 if(ev->type() == QEvent::Enter){
1183 currentHeader = hw; 1194 currentHeader = hw;
1184 headerHoverID = -1; 1195 headerHoverID = -1;
diff --git a/noncore/styles/liquid/liquiddeco.cpp b/noncore/styles/liquid/liquiddeco.cpp
index 8eee1b1..5488c67 100644
--- a/noncore/styles/liquid/liquiddeco.cpp
+++ b/noncore/styles/liquid/liquiddeco.cpp
@@ -1,183 +1,177 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qapplication.h> 21#include <qapplication.h>
22#include <qstyle.h> 22#include <qstyle.h>
23#include <qwidget.h> 23#include <qwidget.h>
24#include <qpainter.h> 24#include <qpainter.h>
25#include <qtimer.h> 25#include <qtimer.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/qpedecoration_qws.h> 28#include <qpe/qpedecoration_qws.h>
29#include <qdialog.h> 29#include <qdialog.h>
30#include <qdrawutil.h> 30#include <qdrawutil.h>
31#include <qgfx_qws.h> 31#include <qgfx_qws.h>
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/resource.h> 33#include <qpe/resource.h>
34#include <qpe/global.h> 34#include <qpe/global.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <qsignal.h> 36#include <qsignal.h>
37 37
38#include "liquiddeco.h" 38#include "liquiddeco.h"
39 39
40#include <stdlib.h> 40#include <stdlib.h>
41 41
42extern QRect qt_maxWindowRect; 42extern QRect qt_maxWindowRect;
43 43
44class HackWidget : public QWidget 44class HackWidget : public QWidget
45{ 45{
46public: 46public:
47 bool needsOk() 47 bool needsOk()
48 { 48 {
49 return ( getWState() & WState_Reserved1 ); 49 return ( getWState() & WState_Reserved1 );
50 } 50 }
51}; 51};
52 52
53 53
54LiquidDecoration::LiquidDecoration() 54LiquidDecoration::LiquidDecoration()
55 : QPEDecoration() 55 : QPEDecoration()
56{} 56{}
57 57
58LiquidDecoration::~LiquidDecoration() 58LiquidDecoration::~LiquidDecoration()
59{} 59{}
60 60
61int LiquidDecoration::getTitleHeight( const QWidget * ) 61int LiquidDecoration::getTitleHeight( const QWidget * )
62{ 62{
63 return 15; 63 return 15;
64} 64}
65 65
66 66
67void LiquidDecoration::paint( QPainter *painter, const QWidget *widget ) 67void LiquidDecoration::paint( QPainter *painter, const QWidget *widget )
68{ 68{
69 int titleWidth = getTitleWidth( widget ); 69 int titleWidth = getTitleWidth( widget );
70 int titleHeight = getTitleHeight( widget ); 70 int titleHeight = getTitleHeight( widget );
71 71
72 QRect rect( widget->rect() ); 72 QRect rect( widget->rect() );
73 73
74 // Border rect 74 // Border rect
75 QRect br( rect.left() - BORDER_WIDTH, 75 QRect br( rect.left() - BORDER_WIDTH,
76 rect.top() - BORDER_WIDTH - titleHeight, 76 rect.top() - BORDER_WIDTH - titleHeight,
77 rect.width() + 2 * BORDER_WIDTH, 77 rect.width() + 2 * BORDER_WIDTH,
78 rect.height() + BORDER_WIDTH + BOTTOM_BORDER_WIDTH + titleHeight ); 78 rect.height() + BORDER_WIDTH + BOTTOM_BORDER_WIDTH + titleHeight );
79 79
80 // title bar rect 80 // title bar rect
81 QRect tr; 81 QRect tr;
82 82
83 tr = QRect( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); 83 tr = QRect( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight );
84 84
85 QRegion oldClip = painter->clipRegion(); 85 QRegion oldClip = painter->clipRegion();
86 painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker 86 painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker
87 87
88 bool isActive = ( widget == qApp->activeWindow() ); 88 bool isActive = ( widget == qApp->activeWindow() );
89 89
90 QColorGroup cg = QApplication::palette().active(); 90 QColorGroup cg = QApplication::palette().active();
91 if ( isActive ) 91 if ( isActive )
92 cg. setBrush ( QColorGroup::Button, cg. brush ( QColorGroup::Highlight ) ); 92 cg. setBrush ( QColorGroup::Button, cg. brush ( QColorGroup::Highlight ) );
93 93
94 qDrawWinPanel( painter, br.x(), br.y(), br.width(), 94 qDrawWinPanel( painter, br.x(), br.y(), br.width(),
95 br.height() - 4, cg, FALSE, 95 br.height() - 4, cg, FALSE,
96 &cg.brush( QColorGroup::Background ) ); 96 &cg.brush( QColorGroup::Background ) );
97 97
98 painter->setClipRegion( oldClip ); 98 painter->setClipRegion( oldClip );
99 99
100 if ( titleWidth > 0 ) { 100 if ( titleWidth > 0 ) {
101 QBrush titleBrush;
102 QPen titlePen;
103 QPen titleLines;
104 int titleLeft = titleHeight + 4;
105
106 titleLeft = rect.left() + 5;
107 painter->setPen( cg.midlight() ); 101 painter->setPen( cg.midlight() );
108 painter->drawLine( rect.left() - BORDER_WIDTH + 2, 102 painter->drawLine( rect.left() - BORDER_WIDTH + 2,
109 rect.bottom() + 1, rect.right() + BORDER_WIDTH - 2, 103 rect.bottom() + 1, rect.right() + BORDER_WIDTH - 2,
110 rect.bottom() + 1 ); 104 rect.bottom() + 1 );
111 105
112 QRect t ( rect.left() - 2, rect.top() - titleHeight - 2, rect.width() + 3, titleHeight + 2 ); 106 QRect t ( rect.left() - 2, rect.top() - titleHeight - 2, rect.width() + 3, titleHeight + 2 );
113 107
114 108
115 109
116 QApplication::style().drawBevelButton( painter, t.x(), t.y(), t.width(), t.height(), cg, isActive ); 110 QApplication::style().drawBevelButton( painter, t.x(), t.y(), t.width(), t.height(), cg, isActive );
117 111
118 t.setLeft( t.left() + 4 ); 112 t .setLeft ( t. left ( ) + 4 );
119 t.setRight( t.right() - 2 ); 113 t .setRight ( t. right ( ) - 2 );
120 114
121 QFont f( QApplication::font() ); 115 QFont f ( QApplication::font ( ));
122 f.setWeight( QFont::Bold ); 116 f. setWeight ( QFont::Bold );
123 117
124 painter-> setFont( f ); 118 painter-> setFont ( f );
125 119
126 QColor textcol = cg.color( isActive ? QColorGroup::HighlightedText : QColorGroup::Text ); 120 QColor textcol = cg.color( isActive ? QColorGroup::HighlightedText : QColorGroup::Text );
127 QColor shadecol = ( qGray ( textcol. rgb ( ) ) > 128 ) ? textcol. dark ( 130 ) : textcol.light( 200 ); 121 QColor shadecol = ( qGray ( textcol. rgb ( ) ) > 128 ) ? textcol. dark ( 230 ) : textcol.light( 300 );
128 122
129 if ( textcol == shadecol ) { 123 if ( textcol == shadecol ) {
130 if ( qGray ( shadecol. rgb ( ) ) < 128 ) 124 if ( qGray ( shadecol. rgb ( ) ) < 128 )
131 shadecol = QColor ( 225, 225, 225 ); 125 shadecol = QColor ( 225, 225, 225 );
132 else 126 else
133 shadecol = QColor ( 30, 30, 30 ); 127 shadecol = QColor ( 30, 30, 30 );
134 } 128 }
135 129
136 painter-> setPen( shadecol ); 130 painter-> setPen( shadecol );
137 painter-> drawText( t.x() + 1, t.y() + 1, t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() ); 131 painter-> drawText( t.x() + 1, t.y() + 1, t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() );
138 painter-> setPen( textcol ); 132 painter-> setPen( textcol );
139 painter-> drawText( t.x(), t.y(), t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() ); 133 painter-> drawText( t.x(), t.y(), t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() );
140 } 134 }
141 135
142#ifndef MINIMIZE_HELP_HACK 136#ifndef MINIMIZE_HELP_HACK
143 paintButton( painter, widget, ( QWSDecoration::Region ) Help, 0 ); 137 paintButton( painter, widget, ( QWSDecoration::Region ) Help, 0 );
144#endif 138#endif
145} 139}
146 140
147void LiquidDecoration::paintButton( QPainter *painter, const QWidget *w, 141void LiquidDecoration::paintButton( QPainter *painter, const QWidget *w,
148 QWSDecoration::Region type, int state ) 142 QWSDecoration::Region type, int state )
149{ 143{
150 const QColorGroup & cg = w->palette().active(); 144 const QColorGroup & cg = w->palette().active();
151 145
152 QRect brect( region( w, w->rect(), type ).boundingRect() ); 146 QRect brect( region( w, w->rect(), type ).boundingRect() );
153 147
154 const QImage *img = 0; 148 const QImage *img = 0;
155 149
156 switch ( ( int ) type ) { 150 switch ( ( int ) type ) {
157 case Close: 151 case Close:
158 img = &imageClose; 152 img = &imageClose;
159 break; 153 break;
160 case Minimize: 154 case Minimize:
161 if ( ( ( HackWidget * ) w ) ->needsOk() || 155 if ( ( ( HackWidget * ) w ) ->needsOk() ||
162 ( w->inherits( "QDialog" ) && !w->inherits( "QMessageBox" ) ) ) 156 ( w->inherits( "QDialog" ) && !w->inherits( "QMessageBox" ) ) )
163 img = &imageOk; 157 img = &imageOk;
164 else if ( helpExists ) 158 else if ( helpExists )
165 img = &imageHelp; 159 img = &imageHelp;
166 break; 160 break;
167 case Help: 161 case Help:
168 img = &imageHelp; 162 img = &imageHelp;
169 break; 163 break;
170 default: 164 default:
171 return ; 165 return ;
172 } 166 }
173 167
174 if ( img ) { 168 if ( img ) {
175 if ( ( state & QWSButton::MouseOver ) && ( state & QWSButton::Clicked ) ) 169 if ( ( state & QWSButton::MouseOver ) && ( state & QWSButton::Clicked ) )
176 painter->drawImage( brect.x() + 1, brect.y() + 3, *img ); 170 painter->drawImage( brect.x() + 1, brect.y() + 3, *img );
177 else 171 else
178 painter->drawImage( brect.x(), brect.y() + 2, *img ); 172 painter->drawImage( brect.x(), brect.y() + 2, *img );
179 } 173 }
180} 174}
181 175
182 176
183 177
diff --git a/noncore/styles/liquid/settings/liquidset.cpp b/noncore/styles/liquid/settings/liquidset.cpp
index 0ef5dbe..1479ac0 100644
--- a/noncore/styles/liquid/settings/liquidset.cpp
+++ b/noncore/styles/liquid/settings/liquidset.cpp
@@ -1,199 +1,234 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21 21
22 22
23#include "liquidset.h" 23#include "liquidset.h"
24#include "../liquid.h" 24#include "../liquid.h"
25 25
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28 28
29#include <qslider.h> 29#include <qslider.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31#include <qbuttongroup.h> 31#include <qbuttongroup.h>
32#include <qradiobutton.h> 32#include <qradiobutton.h>
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qpalette.h> 36#include <qpalette.h>
37 37
38#include <qpe/config.h> 38#include <qpe/config.h>
39 39
40#include <opie/colorpopupmenu.h> 40#include <opie/colorpopupmenu.h>
41 41
42 42
43static void changeButtonColor ( QWidget *btn, const QColor &col ) 43static void changeButtonColor ( QWidget *btn, const QColor &col )
44{ 44{
45 QPalette pal = btn-> palette ( ); 45 QPalette pal = btn-> palette ( );
46 46
47 pal. setColor ( QPalette::Normal, QColorGroup::Button, col );
47 pal. setColor ( QPalette::Active, QColorGroup::Button, col ); 48 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
48 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); 49 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col );
49 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); 50 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col );
51 pal. setColor ( QPalette::Normal, QColorGroup::Background, col );
52 pal. setColor ( QPalette::Active, QColorGroup::Background, col );
53 pal. setColor ( QPalette::Disabled, QColorGroup::Background, col );
54 pal. setColor ( QPalette::Inactive, QColorGroup::Background, col );
50 55
51 btn-> setPalette ( pal ); 56 btn-> setPalette ( pal );
52} 57}
53 58
54 59
55LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) 60LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl )
56 : QDialog ( parent, name, fl ) 61 : QDialog ( parent, name, fl )
57{ 62{
58 setCaption ( tr( "Liquid Style" ) ); 63 setCaption ( tr( "Liquid Style" ) );
59 64
60 Config config ( "qpe" ); 65 Config config ( "qpe" );
61 config. setGroup ( "MosfetMenus" ); 66 config. setGroup ( "Liquid-Style" );
62 67
63 m_type = config. readNumEntry ( "Type", TransStippleBg ); 68 m_type = config. readNumEntry ( "Type", TransStippleBg );
64 m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); 69 m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( )));
65 m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); 70 m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( )));
66 int opacity = config. readNumEntry ( "Opacity", 10 ); 71 int opacity = config. readNumEntry ( "Opacity", 10 );
67 m_shadow = config. readBoolEntry ( "ShadowText", true ); 72 m_shadow = config. readBoolEntry ( "ShadowText", true );
73 m_deco = config. readBoolEntry ( "WinDecoration", true );
74 int contrast = config. readNumEntry ( "StippleContrast", 5 );
68 75
69 QVBoxLayout *vbox = new QVBoxLayout ( this ); 76 QVBoxLayout *vbox = new QVBoxLayout ( this );
70 vbox-> setSpacing ( 3 ); 77 vbox-> setSpacing ( 3 );
71 vbox-> setMargin ( 6 ); 78 vbox-> setMargin ( 6 );
72 79
73 QButtonGroup *btngrp = new QButtonGroup ( this ); 80 QButtonGroup *btngrp = new QButtonGroup ( this );
74 btngrp-> hide ( ); 81 btngrp-> hide ( );
75 82
76 QRadioButton *rad; 83 QRadioButton *rad;
77 84
78 rad = new QRadioButton ( tr( "No translucency" ), this ); 85 rad = new QRadioButton ( tr( "No translucency" ), this );
79 btngrp-> insert ( rad, None ); 86 btngrp-> insert ( rad, None );
80 vbox-> addWidget ( rad ); 87 vbox-> addWidget ( rad );
81 88
82 rad = new QRadioButton ( tr( "Stippled, background color" ), this ); 89 rad = new QRadioButton ( tr( "Stippled, background color" ), this );
83 btngrp-> insert ( rad, StippledBg ); 90 btngrp-> insert ( rad, StippledBg );
84 vbox-> addWidget ( rad ); 91 vbox-> addWidget ( rad );
85 92
86 rad = new QRadioButton ( tr( "Stippled, button color" ), this ); 93 rad = new QRadioButton ( tr( "Stippled, button color" ), this );
87 btngrp-> insert ( rad, StippledBtn ); 94 btngrp-> insert ( rad, StippledBtn );
88 vbox-> addWidget ( rad ); 95 vbox-> addWidget ( rad );
89 96
90 rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this ); 97 rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this );
91 btngrp-> insert ( rad, TransStippleBg ); 98 btngrp-> insert ( rad, TransStippleBg );
92 vbox-> addWidget ( rad ); 99 vbox-> addWidget ( rad );
93 100
94 rad = new QRadioButton ( tr( "Translucent stippled, button color" ), this ); 101 rad = new QRadioButton ( tr( "Translucent stippled, button color" ), this );
95 btngrp-> insert ( rad, TransStippleBtn ); 102 btngrp-> insert ( rad, TransStippleBtn );
96 vbox-> addWidget ( rad ); 103 vbox-> addWidget ( rad );
97 104
98 rad = new QRadioButton ( tr( "Custom translucency" ), this ); 105 rad = new QRadioButton ( tr( "Custom translucency" ), this );
99 btngrp-> insert ( rad, Custom ); 106 btngrp-> insert ( rad, Custom );
100 vbox-> addWidget ( rad ); 107 vbox-> addWidget ( rad );
101 108
102 btngrp-> setExclusive ( true ); 109 btngrp-> setExclusive ( true );
103 btngrp-> setButton ( m_type ); 110 btngrp-> setButton ( m_type );
104 111
105 QGridLayout *grid = new QGridLayout ( vbox ); 112 QGridLayout *grid = new QGridLayout ( vbox );
106 grid-> addColSpacing ( 0, 16 ); 113 grid-> addColSpacing ( 0, 16 );
107 grid-> addColSpacing ( 3, 8 ); 114 grid-> addColSpacing ( 3, 8 );
108 115
109 grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); 116 grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 );
110 grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); 117 grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 );
111 grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); 118 grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 );
112 119
113 m_menubtn = new QToolButton ( this ); 120 m_menubtn = new QToolButton ( this );
114 grid-> addWidget ( m_menubtn, 0, 2 ); 121 grid-> addWidget ( m_menubtn, 0, 2 );
115 122
116 QPopupMenu *popup; 123 QPopupMenu *popup;
117 124
118 popup = new ColorPopupMenu ( m_menucol, this ); 125 popup = new ColorPopupMenu ( m_menucol, this );
119 m_menubtn-> setPopup ( popup ); 126 m_menubtn-> setPopup ( popup );
120 m_menubtn-> setPopupDelay ( 0 ); 127 m_menubtn-> setPopupDelay ( 0 );
121 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & ))); 128 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & )));
122 changeMenuColor ( m_menucol ); 129 changeMenuColor ( m_menucol );
123 130
124 m_textbtn = new QToolButton ( this ); 131 m_textbtn = new QToolButton ( this );
125 grid-> addWidget ( m_textbtn, 0, 5 ); 132 grid-> addWidget ( m_textbtn, 0, 5 );
126 133
127 popup = new ColorPopupMenu ( m_textcol, this ); 134 popup = new ColorPopupMenu ( m_textcol, this );
128 m_textbtn-> setPopup ( popup ); 135 m_textbtn-> setPopup ( popup );
129 m_textbtn-> setPopupDelay ( 0 ); 136 m_textbtn-> setPopupDelay ( 0 );
130 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & ))); 137 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & )));
131 changeTextColor ( m_textcol ); 138 changeTextColor ( m_textcol );
132 139
133 m_opacsld = new QSlider ( Horizontal, this ); 140 m_opacsld = new QSlider ( Horizontal, this );
134 m_opacsld-> setRange ( -20, 20 ); 141 m_opacsld-> setRange ( -20, 20 );
135 m_opacsld-> setValue ( opacity ); 142 m_opacsld-> setValue ( opacity );
136 m_opacsld-> setTickmarks ( QSlider::Below ); 143 m_opacsld-> setTickmarks ( QSlider::Below );
137 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); 144 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 );
138 145
139 vbox-> addSpacing ( 4 ); 146 vbox-> addSpacing ( 4 );
140 147
141 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed text" ), this ); 148 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this );
142 shadow-> setChecked ( m_shadow ); 149 shadow-> setChecked ( m_shadow );
143 vbox-> addWidget ( shadow ); 150 vbox-> addWidget ( shadow );
144 151
152 vbox-> addSpacing ( 4 );
153
154 QCheckBox *windeco = new QCheckBox ( tr( "Draw liquid window title bars" ), this );
155 windeco-> setChecked ( m_deco );
156 vbox-> addWidget ( windeco );
157
158 vbox-> addSpacing ( 4 );
159
160 QHBoxLayout *hbox = new QHBoxLayout ( vbox );
161
162 hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this ));
163
164 m_contsld = new QSlider ( Horizontal, this );
165 m_contsld-> setRange ( 0, 10 );
166 m_contsld-> setValue ( contrast );
167 m_contsld-> setTickmarks ( QSlider::Below );
168 hbox-> addWidget ( m_contsld, 10 );
169
145 vbox-> addStretch ( 10 ); 170 vbox-> addStretch ( 10 );
171
172 changeType ( m_type );
146 173
147 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) ); 174 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) );
148 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); 175 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) );
176 connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) );
149} 177}
150 178
151void LiquidSet::changeType ( int t ) 179void LiquidSet::changeType ( int t )
152{ 180{
153 bool custom = ( t == Custom ); 181 bool custom = ( t == Custom );
154 182
155 m_menulbl-> setEnabled ( custom ); 183 m_menulbl-> setEnabled ( custom );
156 m_textlbl-> setEnabled ( custom ); 184 m_textlbl-> setEnabled ( custom );
157 m_opaclbl-> setEnabled ( custom ); 185 m_opaclbl-> setEnabled ( custom );
158 m_menubtn-> setEnabled ( custom ); 186 m_menubtn-> setEnabled ( custom );
159 m_textbtn-> setEnabled ( custom ); 187 m_textbtn-> setEnabled ( custom );
160 m_opacsld-> setEnabled ( custom ); 188 m_opacsld-> setEnabled ( custom );
161 189
162 m_type = t; 190 m_type = t;
163} 191}
164 192
165void LiquidSet::changeMenuColor ( const QColor &col ) 193void LiquidSet::changeMenuColor ( const QColor &col )
166{ 194{
167 m_menubtn-> setPalette ( col ); 195 changeButtonColor ( m_menubtn, col );
168 m_menucol = col; 196 m_menucol = col;
169} 197}
170 198
171void LiquidSet::changeTextColor ( const QColor &col ) 199void LiquidSet::changeTextColor ( const QColor &col )
172{ 200{
173 m_textbtn-> setPalette ( col ); 201 changeButtonColor ( m_textbtn, col );
174 m_textcol = col; 202 m_textcol = col;
175} 203}
176 204
177void LiquidSet::changeShadow ( bool b ) 205void LiquidSet::changeShadow ( bool b )
178{ 206{
179 m_shadow = b; 207 m_shadow = b;
180} 208}
181 209
210void LiquidSet::changeDeco ( bool b )
211{
212 m_deco = b;
213}
214
182 215
183void LiquidSet::accept ( ) 216void LiquidSet::accept ( )
184{ 217{
185 Config config ( "qpe" ); 218 Config config ( "qpe" );
186 config. setGroup ( "MosfetMenus" ); 219 config. setGroup ( "Liquid-Style" );
187 220
188 config. writeEntry ( "Type", m_type ); 221 config. writeEntry ( "Type", m_type );
189 config. writeEntry ( "Color", m_menucol. name ( )); 222 config. writeEntry ( "Color", m_menucol. name ( ));
190 config. writeEntry ( "TextColor", m_textcol. name ( )); 223 config. writeEntry ( "TextColor", m_textcol. name ( ));
191 config. writeEntry ( "Opacity", m_opacsld-> value ( )); 224 config. writeEntry ( "Opacity", m_opacsld-> value ( ));
192 config. writeEntry ( "ShadowText", m_shadow ); 225 config. writeEntry ( "ShadowText", m_shadow );
226 config. writeEntry ( "WinDecoration", m_deco );
227 config. writeEntry ( "StippleContrast", m_contsld-> value ( ));
193 config. write ( ); 228 config. write ( );
194 229
195 Global::applyStyle ( ); 230 Global::applyStyle ( );
196 231
197 QDialog::accept ( ); 232 QDialog::accept ( );
198} 233}
199 234
diff --git a/noncore/styles/liquid/settings/liquidset.h b/noncore/styles/liquid/settings/liquidset.h
index 944b1ec..a0f590a 100644
--- a/noncore/styles/liquid/settings/liquidset.h
+++ b/noncore/styles/liquid/settings/liquidset.h
@@ -1,39 +1,42 @@
1#ifndef __OPIE_LIQUID_SET_H__ 1#ifndef __OPIE_LIQUID_SET_H__
2#define __OPIE_LIQUID_SET_H__ 2#define __OPIE_LIQUID_SET_H__
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5#include <qcolor.h> 5#include <qcolor.h>
6 6
7class QLabel; 7class QLabel;
8class QToolButton; 8class QToolButton;
9class QSlider; 9class QSlider;
10 10
11class LiquidSet : public QDialog { 11class LiquidSet : public QDialog {
12 Q_OBJECT 12 Q_OBJECT
13 13
14public: 14public:
15 LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); 15 LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
16 16
17public slots: 17public slots:
18 void changeType ( int t ); 18 void changeType ( int t );
19 void changeMenuColor ( const QColor &col ); 19 void changeMenuColor ( const QColor &col );
20 void changeTextColor ( const QColor &col ); 20 void changeTextColor ( const QColor &col );
21 void changeShadow ( bool b ); 21 void changeShadow ( bool b );
22 void changeDeco ( bool b );
22 23
23protected: 24protected:
24 virtual void accept ( ); 25 virtual void accept ( );
25 26
26private: 27private:
27 QColor m_menucol; 28 QColor m_menucol;
28 QColor m_textcol; 29 QColor m_textcol;
29 int m_type; 30 int m_type;
30 bool m_shadow; 31 bool m_shadow;
32 bool m_deco;
31 33
32 QSlider * m_opacsld; 34 QSlider * m_opacsld;
35 QSlider * m_contsld;
33 QLabel * m_menulbl; 36 QLabel * m_menulbl;
34 QLabel * m_textlbl; 37 QLabel * m_textlbl;
35 QLabel * m_opaclbl; 38 QLabel * m_opaclbl;
36 QToolButton *m_menubtn; 39 QToolButton *m_menubtn;
37 QToolButton *m_textbtn; 40 QToolButton *m_textbtn;
38}; 41};
39#endif 42#endif