-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.pro | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.cpp | 31 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.h | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.cpp | 81 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.h | 26 | ||||
-rw-r--r-- | noncore/styles/metal/plugin.cpp | 22 | ||||
-rw-r--r-- | noncore/styles/metal/plugin.h | 9 | ||||
-rw-r--r-- | noncore/styles/theme/plugin.cpp | 80 | ||||
-rw-r--r-- | noncore/styles/theme/plugin.h | 23 |
10 files changed, 71 insertions, 207 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 0d9d259..1d01c65 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -1,1549 +1,1549 @@ | |||
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 | ||
40 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, | 40 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, |
41 | QColorGroup &, bool, bool); | 41 | QColorGroup &, bool, bool); |
42 | 42 | ||
43 | QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); | 43 | QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); |
44 | 44 | ||
45 | void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) | 45 | void 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 | ||
69 | TransMenuHandler::TransMenuHandler(QObject *parent) | 69 | TransMenuHandler::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 | ||
76 | void TransMenuHandler::reloadSettings() | 76 | void TransMenuHandler::reloadSettings() |
77 | { | 77 | { |
78 | pixDict.clear(); | 78 | pixDict.clear(); |
79 | 79 | ||
80 | Config config ( "qpe" ); | 80 | Config config ( "qpe" ); |
81 | config. setGroup ( "Liquid-Style" ); | 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 | ||
95 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | 95 | bool 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 | pixDict.insert(p->winId(), pix); | 128 | pixDict.insert(p->winId(), pix); |
129 | 129 | ||
130 | if (!p->inherits("QPopupMenu")) { | 130 | if (!p->inherits("QPopupMenu")) { |
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 | pixDict.remove(p->winId()); | 149 | pixDict.remove(p->winId()); |
150 | if (!p->inherits("QPopupMenu")) { | 150 | if (!p->inherits("QPopupMenu")) { |
151 | p->setBackgroundMode(QWidget::PaletteBackground); | 151 | p->setBackgroundMode(QWidget::PaletteBackground); |
152 | 152 | ||
153 | QObjectList *ol = p-> queryList("QWidget"); | 153 | QObjectList *ol = p-> queryList("QWidget"); |
154 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 154 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
155 | QWidget *wid = (QWidget *) it.current ( ); | 155 | QWidget *wid = (QWidget *) it.current ( ); |
156 | 156 | ||
157 | wid-> setBackgroundMode( QWidget::PaletteBackground ); | 157 | wid-> setBackgroundMode( QWidget::PaletteBackground ); |
158 | } | 158 | } |
159 | delete ol; | 159 | delete ol; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
163 | return(false); | 163 | return(false); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | LiquidStyle::LiquidStyle() | 167 | LiquidStyle::LiquidStyle() |
168 | :QWindowsStyle() | 168 | :QWindowsStyle() |
169 | { | 169 | { |
170 | setName ( "LiquidStyle" ); | 170 | setName ( "LiquidStyle" ); |
171 | 171 | ||
172 | flatTBButtons = false; | 172 | flatTBButtons = false; |
173 | 173 | ||
174 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 174 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
175 | btnMaskBmp.setMask(btnMaskBmp); | 175 | btnMaskBmp.setMask(btnMaskBmp); |
176 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 176 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
177 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); | 177 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); |
178 | headerHoverID = -1; | 178 | headerHoverID = -1; |
179 | highlightWidget = NULL; | 179 | highlightWidget = NULL; |
180 | setButtonDefaultIndicatorWidth(0); | 180 | setButtonDefaultIndicatorWidth(0); |
181 | btnDict.setAutoDelete(true); | 181 | btnDict.setAutoDelete(true); |
182 | bevelFillDict.setAutoDelete(true); | 182 | bevelFillDict.setAutoDelete(true); |
183 | smallBevelFillDict.setAutoDelete(true); | 183 | smallBevelFillDict.setAutoDelete(true); |
184 | customBtnColorList.setAutoDelete(true); | 184 | customBtnColorList.setAutoDelete(true); |
185 | customBtnIconList.setAutoDelete(true); | 185 | customBtnIconList.setAutoDelete(true); |
186 | customBtnLabelList.setAutoDelete(true); | 186 | customBtnLabelList.setAutoDelete(true); |
187 | 187 | ||
188 | rMatrix.rotate(270.0); | 188 | rMatrix.rotate(270.0); |
189 | highcolor = QPixmap::defaultDepth() > 8; | 189 | highcolor = QPixmap::defaultDepth() > 8; |
190 | btnBorderPix = new QPixmap; | 190 | btnBorderPix = new QPixmap; |
191 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); | 191 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); |
192 | btnBlendPix = new QPixmap; | 192 | btnBlendPix = new QPixmap; |
193 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); | 193 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); |
194 | bevelFillPix = new QPixmap; | 194 | bevelFillPix = new QPixmap; |
195 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); | 195 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); |
196 | smallBevelFillPix = new QPixmap; | 196 | smallBevelFillPix = new QPixmap; |
197 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); | 197 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); |
198 | // new stuff | 198 | // new stuff |
199 | vsbSliderFillPix = menuPix = NULL; | 199 | vsbSliderFillPix = menuPix = NULL; |
200 | menuHandler = new TransMenuHandler(this); | 200 | menuHandler = new TransMenuHandler(this); |
201 | setScrollBarExtent(15, 15); | 201 | setScrollBarExtent(15, 15); |
202 | int i; | 202 | int i; |
203 | for(i=0; i < BITMAP_ITEMS; ++i){ | 203 | for(i=0; i < BITMAP_ITEMS; ++i){ |
204 | pixmaps[i] = NULL; | 204 | pixmaps[i] = NULL; |
205 | } | 205 | } |
206 | oldSliderThickness = sliderThickness(); | 206 | oldSliderThickness = sliderThickness(); |
207 | setSliderThickness(11); | 207 | setSliderThickness(11); |
208 | } | 208 | } |
209 | 209 | ||
210 | LiquidStyle::~LiquidStyle() | 210 | LiquidStyle::~LiquidStyle() |
211 | { | 211 | { |
212 | if(btnBorderPix) | 212 | if(btnBorderPix) |
213 | delete btnBorderPix; | 213 | delete btnBorderPix; |
214 | if(btnBlendPix) | 214 | if(btnBlendPix) |
215 | delete btnBlendPix; | 215 | delete btnBlendPix; |
216 | if(bevelFillPix) | 216 | if(bevelFillPix) |
217 | delete bevelFillPix; | 217 | delete bevelFillPix; |
218 | if(smallBevelFillPix) | 218 | if(smallBevelFillPix) |
219 | delete smallBevelFillPix; | 219 | delete smallBevelFillPix; |
220 | if(vsbSliderFillPix) | 220 | if(vsbSliderFillPix) |
221 | delete vsbSliderFillPix; | 221 | delete vsbSliderFillPix; |
222 | if(menuPix) | 222 | if(menuPix) |
223 | delete menuPix; | 223 | delete menuPix; |
224 | 224 | ||
225 | setScrollBarExtent(16, 16); | 225 | setScrollBarExtent(16, 16); |
226 | setSliderThickness(oldSliderThickness); | 226 | setSliderThickness(oldSliderThickness); |
227 | int i; | 227 | int i; |
228 | for(i=0; i < BITMAP_ITEMS; ++i){ | 228 | for(i=0; i < BITMAP_ITEMS; ++i){ |
229 | if(pixmaps[i]) | 229 | if(pixmaps[i]) |
230 | delete pixmaps[i]; | 230 | delete pixmaps[i]; |
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, | 234 | void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, |
235 | const QColor &c, const QColor &bg) | 235 | const QColor &c, const QColor &bg) |
236 | { | 236 | { |
237 | 237 | ||
238 | QPen oldPen = p->pen(); // headers need this | 238 | QPen oldPen = p->pen(); // headers need this |
239 | int x2 = x+w-1; | 239 | int x2 = x+w-1; |
240 | int y2 = y+h-1; | 240 | int y2 = y+h-1; |
241 | // outer dark rect | 241 | // outer dark rect |
242 | p->setPen(c.dark(130)); | 242 | p->setPen(c.dark(130)); |
243 | p->drawLine(x, y+2, x, y2-2); // l | 243 | p->drawLine(x, y+2, x, y2-2); // l |
244 | p->drawLine(x2, y+2, x2, y2-2); // r | 244 | p->drawLine(x2, y+2, x2, y2-2); // r |
245 | p->drawLine(x+2, y, x2-2, y); // t | 245 | p->drawLine(x+2, y, x2-2, y); // t |
246 | p->drawLine(x+2, y2, x2-2, y2); // b | 246 | p->drawLine(x+2, y2, x2-2, y2); // b |
247 | p->drawPoint(x+1, y+1); // tl | 247 | p->drawPoint(x+1, y+1); // tl |
248 | p->drawPoint(x2-1, y+1); // tr | 248 | p->drawPoint(x2-1, y+1); // tr |
249 | p->drawPoint(x+1, y2-1); // bl | 249 | p->drawPoint(x+1, y2-1); // bl |
250 | p->drawPoint(x2-1, y2-1); // br | 250 | p->drawPoint(x2-1, y2-1); // br |
251 | 251 | ||
252 | // inner top light lines | 252 | // inner top light lines |
253 | p->setPen(c.light(105)); | 253 | p->setPen(c.light(105)); |
254 | p->drawLine(x+2, y+1, x2-2, y+1); | 254 | p->drawLine(x+2, y+1, x2-2, y+1); |
255 | p->drawLine(x+1, y+2, x2-1, y+2); | 255 | p->drawLine(x+1, y+2, x2-1, y+2); |
256 | p->drawLine(x+1, y+3, x+2, y+3); | 256 | p->drawLine(x+1, y+3, x+2, y+3); |
257 | p->drawLine(x2-2, y+3, x2-1, y+3); | 257 | p->drawLine(x2-2, y+3, x2-1, y+3); |
258 | p->drawPoint(x+1, y+4); | 258 | p->drawPoint(x+1, y+4); |
259 | p->drawPoint(x2-1, y+4); | 259 | p->drawPoint(x2-1, y+4); |
260 | 260 | ||
261 | // inner bottom light lines | 261 | // inner bottom light lines |
262 | p->setPen(c.light(110)); | 262 | p->setPen(c.light(110)); |
263 | p->drawLine(x+2, y2-1, x2-2, y2-1); | 263 | p->drawLine(x+2, y2-1, x2-2, y2-1); |
264 | p->drawLine(x+1, y2-2, x2-1, y2-2); | 264 | p->drawLine(x+1, y2-2, x2-1, y2-2); |
265 | p->drawLine(x+1, y2-3, x+2, y2-3); | 265 | p->drawLine(x+1, y2-3, x+2, y2-3); |
266 | p->drawLine(x2-2, y2-3, x2-1, y2-3); | 266 | p->drawLine(x2-2, y2-3, x2-1, y2-3); |
267 | p->drawPoint(x+1, y2-4); | 267 | p->drawPoint(x+1, y2-4); |
268 | p->drawPoint(x2-1, y2-4); | 268 | p->drawPoint(x2-1, y2-4); |
269 | 269 | ||
270 | // inner left mid lines | 270 | // inner left mid lines |
271 | //p->setPen(c.light(105)); | 271 | //p->setPen(c.light(105)); |
272 | p->setPen(c); | 272 | p->setPen(c); |
273 | p->drawLine(x+1, y+5, x+1, y2-5); | 273 | p->drawLine(x+1, y+5, x+1, y2-5); |
274 | p->drawLine(x+2, y+4, x+2, y2-4); | 274 | p->drawLine(x+2, y+4, x+2, y2-4); |
275 | 275 | ||
276 | // inner right mid lines | 276 | // inner right mid lines |
277 | p->drawLine(x2-1, y+5, x2-1, y2-5); | 277 | p->drawLine(x2-1, y+5, x2-1, y2-5); |
278 | p->drawLine(x2-2, y+4, x2-2, y2-4); | 278 | p->drawLine(x2-2, y+4, x2-2, y2-4); |
279 | 279 | ||
280 | // fill | 280 | // fill |
281 | QPixmap *pix; | 281 | QPixmap *pix; |
282 | if(h >= 32){ | 282 | if(h >= 32){ |
283 | pix = bevelFillDict.find(c.rgb()); | 283 | pix = bevelFillDict.find(c.rgb()); |
284 | if(!pix){ | 284 | if(!pix){ |
285 | int h, s, v; | 285 | int h, s, v; |
286 | c.hsv(&h, &s, &v); | 286 | c.hsv(&h, &s, &v); |
287 | pix = new QPixmap(*bevelFillPix); | 287 | pix = new QPixmap(*bevelFillPix); |
288 | adjustHSV(*pix, h, s, v); | 288 | adjustHSV(*pix, h, s, v); |
289 | bevelFillDict.insert(c.rgb(), pix); | 289 | bevelFillDict.insert(c.rgb(), pix); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | else{ | 292 | else{ |
293 | pix = smallBevelFillDict.find(c.rgb()); | 293 | pix = smallBevelFillDict.find(c.rgb()); |
294 | if(!pix){ | 294 | if(!pix){ |
295 | int h, s, v; | 295 | int h, s, v; |
296 | c.hsv(&h, &s, &v); | 296 | c.hsv(&h, &s, &v); |
297 | pix = new QPixmap(*smallBevelFillPix); | 297 | pix = new QPixmap(*smallBevelFillPix); |
298 | adjustHSV(*pix, h, s, v); | 298 | adjustHSV(*pix, h, s, v); |
299 | smallBevelFillDict.insert(c.rgb(), pix); | 299 | smallBevelFillDict.insert(c.rgb(), pix); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); | 302 | p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); |
303 | // blend | 303 | // blend |
304 | int red, green, blue; | 304 | int red, green, blue; |
305 | QColor btnColor(c.dark(130)); | 305 | QColor btnColor(c.dark(130)); |
306 | red = (btnColor.red() >> 1) + (bg.red() >> 1); | 306 | red = (btnColor.red() >> 1) + (bg.red() >> 1); |
307 | green = (btnColor.green() >> 1) + (bg.green() >> 1); | 307 | green = (btnColor.green() >> 1) + (bg.green() >> 1); |
308 | blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); | 308 | blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); |
309 | btnColor.setRgb(red, green, blue); | 309 | btnColor.setRgb(red, green, blue); |
310 | 310 | ||
311 | p->setPen(btnColor); | 311 | p->setPen(btnColor); |
312 | p->drawPoint(x+1, y); | 312 | p->drawPoint(x+1, y); |
313 | p->drawPoint(x, y+1); | 313 | p->drawPoint(x, y+1); |
314 | p->drawPoint(x+1, y2); | 314 | p->drawPoint(x+1, y2); |
315 | p->drawPoint(x, y2-1); | 315 | p->drawPoint(x, y2-1); |
316 | 316 | ||
317 | p->drawPoint(x2-1, y); | 317 | p->drawPoint(x2-1, y); |
318 | p->drawPoint(x2, y+1); | 318 | p->drawPoint(x2, y+1); |
319 | p->drawPoint(x2-1, y2); | 319 | p->drawPoint(x2-1, y2); |
320 | p->drawPoint(x2, y2-1); | 320 | p->drawPoint(x2, y2-1); |
321 | 321 | ||
322 | p->setPen(oldPen); | 322 | p->setPen(oldPen); |
323 | 323 | ||
324 | } | 324 | } |
325 | 325 | ||
326 | void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, | 326 | void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, |
327 | const QColor &back, int x, int y, int w, int h, | 327 | const QColor &back, int x, int y, int w, int h, |
328 | bool supportPushDown, bool pushedDown, | 328 | bool supportPushDown, bool pushedDown, |
329 | bool autoDefault, bool isMasked) | 329 | bool autoDefault, bool isMasked) |
330 | { | 330 | { |
331 | if(w < 21 || h < 21){ | 331 | if(w < 21 || h < 21){ |
332 | drawClearBevel(painter, x, y, w, h, c, back); | 332 | drawClearBevel(painter, x, y, w, h, c, back); |
333 | return; | 333 | return; |
334 | } | 334 | } |
335 | if(supportPushDown){ | 335 | if(supportPushDown){ |
336 | --w, --h; | 336 | --w, --h; |
337 | } | 337 | } |
338 | /* We don't make the round buttons smaller, since they don't look as good | 338 | /* We don't make the round buttons smaller, since they don't look as good |
339 | if(autoDefault){ | 339 | if(autoDefault){ |
340 | w = w-buttonDefaultIndicatorWidth()*2; | 340 | w = w-buttonDefaultIndicatorWidth()*2; |
341 | h = h-buttonDefaultIndicatorWidth()*2; | 341 | h = h-buttonDefaultIndicatorWidth()*2; |
342 | }*/ | 342 | }*/ |
343 | 343 | ||
344 | 344 | ||
345 | QPixmap *pix = btnDict.find(c.rgb()); | 345 | QPixmap *pix = btnDict.find(c.rgb()); |
346 | if(!pix){ | 346 | if(!pix){ |
347 | int h, s, v; | 347 | int h, s, v; |
348 | c.hsv(&h, &s, &v); | 348 | c.hsv(&h, &s, &v); |
349 | pix = new QPixmap(*btnBorderPix); | 349 | pix = new QPixmap(*btnBorderPix); |
350 | adjustHSV(*pix, h, s, v); | 350 | adjustHSV(*pix, h, s, v); |
351 | btnDict.insert(c.rgb(), pix); | 351 | btnDict.insert(c.rgb(), pix); |
352 | } | 352 | } |
353 | int x2 = x+w-1; | 353 | int x2 = x+w-1; |
354 | int y2 = y+h-1; | 354 | int y2 = y+h-1; |
355 | int bx2 = pix->width()-1; | 355 | int bx2 = pix->width()-1; |
356 | int by2 = pix->height()-1; | 356 | int by2 = pix->height()-1; |
357 | 357 | ||
358 | QPixmap tmpPix(w, h); | 358 | QPixmap tmpPix(w, h); |
359 | QPixmap tilePix; | 359 | QPixmap tilePix; |
360 | QPainter p; | 360 | QPainter p; |
361 | p.begin(&tmpPix); | 361 | p.begin(&tmpPix); |
362 | 362 | ||
363 | // do the fill | 363 | // do the fill |
364 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl | 364 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl |
365 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr | 365 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr |
366 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl | 366 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl |
367 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br | 367 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br |
368 | 368 | ||
369 | // edges | 369 | // edges |
370 | tilePix.resize(pix->width()-20, 10); | 370 | tilePix.resize(pix->width()-20, 10); |
371 | // top | 371 | // top |
372 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); | 372 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); |
373 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); | 373 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); |
374 | // bottom | 374 | // bottom |
375 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); | 375 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); |
376 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); | 376 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); |
377 | // left | 377 | // left |
378 | tilePix.resize(10, pix->height()-20); | 378 | tilePix.resize(10, pix->height()-20); |
379 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); | 379 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); |
380 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); | 380 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); |
381 | // right | 381 | // right |
382 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); | 382 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); |
383 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); | 383 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); |
384 | 384 | ||
385 | // middle | 385 | // middle |
386 | tilePix.resize(pix->width()-20, pix->height()-20); | 386 | tilePix.resize(pix->width()-20, pix->height()-20); |
387 | bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); | 387 | bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); |
388 | p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); | 388 | p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); |
389 | 389 | ||
390 | 390 | ||
391 | // do the blend | 391 | // do the blend |
392 | QBitmap blendMask; | 392 | QBitmap blendMask; |
393 | if(!isMasked){ | 393 | if(!isMasked){ |
394 | //QRgb bgRgb = back.rgb(); | 394 | //QRgb bgRgb = back.rgb(); |
395 | //QRgb fgRgb = c.rgb(); | 395 | //QRgb fgRgb = c.rgb(); |
396 | //int r, g, b; | 396 | //int r, g, b; |
397 | 397 | ||
398 | //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); | 398 | //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); |
399 | //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); | 399 | //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); |
400 | //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); | 400 | //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); |
401 | //QColor blendColor(r, g, b); | 401 | //QColor blendColor(r, g, b); |
402 | int hue, sat, v1, v2; | 402 | int hue, sat, v1, v2; |
403 | QColor blendColor(autoDefault ? c : back); | 403 | QColor blendColor(autoDefault ? c : back); |
404 | back.hsv(&hue, &sat, &v1); | 404 | back.hsv(&hue, &sat, &v1); |
405 | blendColor.hsv(&hue, &sat, &v2); | 405 | blendColor.hsv(&hue, &sat, &v2); |
406 | if(v2 > v1) | 406 | if(v2 > v1) |
407 | blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); | 407 | blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); |
408 | 408 | ||
409 | pix = btnBorderDict.find(blendColor.rgb()); | 409 | pix = btnBorderDict.find(blendColor.rgb()); |
410 | if(!pix){ | 410 | if(!pix){ |
411 | int h, s, v; | 411 | int h, s, v; |
412 | blendColor.hsv(&h, &s, &v); | 412 | blendColor.hsv(&h, &s, &v); |
413 | pix = new QPixmap(*btnBlendPix); | 413 | pix = new QPixmap(*btnBlendPix); |
414 | adjustHSV(*pix, h, s, v); | 414 | adjustHSV(*pix, h, s, v); |
415 | btnBorderDict.insert(blendColor.rgb(), pix); | 415 | btnBorderDict.insert(blendColor.rgb(), pix); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | else{ | 418 | else{ |
419 | pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : | 419 | pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : |
420 | getPixmap(HTMLBtnBorder); | 420 | getPixmap(HTMLBtnBorder); |
421 | } | 421 | } |
422 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl | 422 | p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl |
423 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr | 423 | p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr |
424 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl | 424 | p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl |
425 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br | 425 | p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br |
426 | 426 | ||
427 | // edges | 427 | // edges |
428 | tilePix.resize(pix->width()-20, 10); | 428 | tilePix.resize(pix->width()-20, 10); |
429 | blendMask.resize(pix->width()-20, 10); | 429 | blendMask.resize(pix->width()-20, 10); |
430 | // top | 430 | // top |
431 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); | 431 | bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); |
432 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); | 432 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); |
433 | tilePix.setMask(blendMask); | 433 | tilePix.setMask(blendMask); |
434 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); | 434 | p.drawTiledPixmap(10, 0, w-20, 10, tilePix); |
435 | // bottom | 435 | // bottom |
436 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); | 436 | bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); |
437 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20); | 437 | bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20); |
438 | tilePix.setMask(blendMask); | 438 | tilePix.setMask(blendMask); |
439 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); | 439 | p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); |
440 | // left | 440 | // left |
441 | tilePix.resize(10, pix->height()-20); | 441 | tilePix.resize(10, pix->height()-20); |
442 | blendMask.resize(10, pix->height()-20); | 442 | blendMask.resize(10, pix->height()-20); |
443 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); | 443 | bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); |
444 | bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); | 444 | bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); |
445 | tilePix.setMask(blendMask); | 445 | tilePix.setMask(blendMask); |
446 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); | 446 | p.drawTiledPixmap(0, 10, 10, h-20, tilePix); |
447 | // right | 447 | // right |
448 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); | 448 | bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); |
449 | bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); | 449 | bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); |
450 | tilePix.setMask(blendMask); | 450 | tilePix.setMask(blendMask); |
451 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); | 451 | p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); |
452 | 452 | ||
453 | p.end(); | 453 | p.end(); |
454 | 454 | ||
455 | // do the button mask - we don't automask buttons | 455 | // do the button mask - we don't automask buttons |
456 | QBitmap btnMask(w, h); | 456 | QBitmap btnMask(w, h); |
457 | QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; | 457 | QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; |
458 | p.begin(&btnMask); | 458 | p.begin(&btnMask); |
459 | p.fillRect(0, 0, w, h, Qt::color0); | 459 | p.fillRect(0, 0, w, h, Qt::color0); |
460 | p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl | 460 | p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl |
461 | p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr | 461 | p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr |
462 | p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl | 462 | p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl |
463 | p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br | 463 | p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br |
464 | // fills | 464 | // fills |
465 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top | 465 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top |
466 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom | 466 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom |
467 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle | 467 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle |
468 | p.end(); | 468 | p.end(); |
469 | tmpPix.setMask(btnMask); | 469 | tmpPix.setMask(btnMask); |
470 | /*if(autoDefault){ | 470 | /*if(autoDefault){ |
471 | if(supportPushDown && pushedDown){ | 471 | if(supportPushDown && pushedDown){ |
472 | painter->drawPixmap(x+3, y+3, tmpPix); | 472 | painter->drawPixmap(x+3, y+3, tmpPix); |
473 | } | 473 | } |
474 | else{ | 474 | else{ |
475 | painter->drawPixmap(x+2, y+2, tmpPix); | 475 | painter->drawPixmap(x+2, y+2, tmpPix); |
476 | } | 476 | } |
477 | } | 477 | } |
478 | else */if(supportPushDown && pushedDown) | 478 | else */if(supportPushDown && pushedDown) |
479 | painter->drawPixmap(x+1, y+1, tmpPix); | 479 | painter->drawPixmap(x+1, y+1, tmpPix); |
480 | else | 480 | else |
481 | painter->drawPixmap(x, y, tmpPix); | 481 | painter->drawPixmap(x, y, tmpPix); |
482 | 482 | ||
483 | 483 | ||
484 | 484 | ||
485 | } | 485 | } |
486 | 486 | ||
487 | 487 | ||
488 | QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, | 488 | QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, |
489 | bool blend) | 489 | bool blend) |
490 | { | 490 | { |
491 | QImage img(qembed_findImage(label)); | 491 | QImage img(qembed_findImage(label)); |
492 | img.detach(); | 492 | img.detach(); |
493 | if(img.isNull()){ // shouldn't happen, been tested | 493 | if(img.isNull()){ // shouldn't happen, been tested |
494 | qWarning("Invalid embedded label %s", label); | 494 | qWarning("Invalid embedded label %s", label); |
495 | return(NULL); | 495 | return(NULL); |
496 | } | 496 | } |
497 | if(img.depth() != 32) | 497 | if(img.depth() != 32) |
498 | img = img.convertDepth(32); | 498 | img = img.convertDepth(32); |
499 | unsigned int *data = (unsigned int *)img.bits(); | 499 | unsigned int *data = (unsigned int *)img.bits(); |
500 | int total = img.width()*img.height(); | 500 | int total = img.width()*img.height(); |
501 | int current; | 501 | int current; |
502 | QColor c; | 502 | QColor c; |
503 | int oldH, oldS, oldV; | 503 | int oldH, oldS, oldV; |
504 | int alpha; | 504 | int alpha; |
505 | if(v < 235) | 505 | if(v < 235) |
506 | v += 20; | 506 | v += 20; |
507 | else | 507 | else |
508 | v = 255; | 508 | v = 255; |
509 | float intensity = v/255.0; | 509 | float intensity = v/255.0; |
510 | 510 | ||
511 | for(current=0; current<total; ++current){ | 511 | for(current=0; current<total; ++current){ |
512 | alpha = qAlpha(data[current]); | 512 | alpha = qAlpha(data[current]); |
513 | c.setRgb(data[current]); | 513 | c.setRgb(data[current]); |
514 | c.hsv(&oldH, &oldS, &oldV); | 514 | c.hsv(&oldH, &oldS, &oldV); |
515 | oldV = (int)(oldV*intensity); | 515 | oldV = (int)(oldV*intensity); |
516 | c.setHsv(h, s, oldV); | 516 | c.setHsv(h, s, oldV); |
517 | if(blend && alpha != 255 && alpha != 0){ | 517 | if(blend && alpha != 255 && alpha != 0){ |
518 | float srcPercent = ((float)alpha)/255.0; | 518 | float srcPercent = ((float)alpha)/255.0; |
519 | float destPercent = 1.0-srcPercent; | 519 | float destPercent = 1.0-srcPercent; |
520 | oldH = (int)((srcPercent*h) + (destPercent*bH)); | 520 | oldH = (int)((srcPercent*h) + (destPercent*bH)); |
521 | oldS = (int)((srcPercent*s) + (destPercent*bS)); | 521 | oldS = (int)((srcPercent*s) + (destPercent*bS)); |
522 | oldV = (int)((srcPercent*oldV) + (destPercent*bV)); | 522 | oldV = (int)((srcPercent*oldV) + (destPercent*bV)); |
523 | c.setHsv(oldH, oldS, oldV); | 523 | c.setHsv(oldH, oldS, oldV); |
524 | alpha = 255; | 524 | alpha = 255; |
525 | } | 525 | } |
526 | data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); | 526 | data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); |
527 | } | 527 | } |
528 | QPixmap *pix = new QPixmap; | 528 | QPixmap *pix = new QPixmap; |
529 | pix->convertFromImage(img); | 529 | pix->convertFromImage(img); |
530 | return(pix); | 530 | return(pix); |
531 | } | 531 | } |
532 | 532 | ||
533 | 533 | ||
534 | 534 | ||
535 | 535 | ||
536 | QPixmap* LiquidStyle::getPixmap(BitmapData item) | 536 | QPixmap* LiquidStyle::getPixmap(BitmapData item) |
537 | { | 537 | { |
538 | 538 | ||
539 | if(pixmaps[item]) | 539 | if(pixmaps[item]) |
540 | return(pixmaps[item]); | 540 | return(pixmaps[item]); |
541 | 541 | ||
542 | switch(item){ | 542 | switch(item){ |
543 | case HTMLBtnBorder: | 543 | case HTMLBtnBorder: |
544 | pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); | 544 | pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); |
545 | break; | 545 | break; |
546 | case HTMLBtnBorderDown: | 546 | case HTMLBtnBorderDown: |
547 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); | 547 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); |
548 | break; | 548 | break; |
549 | case HTMLCB: | 549 | case HTMLCB: |
550 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); | 550 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); |
551 | break; | 551 | break; |
552 | case HTMLCBDown: | 552 | case HTMLCBDown: |
553 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); | 553 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); |
554 | break; | 554 | break; |
555 | case HTMLCBHover: | 555 | case HTMLCBHover: |
556 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); | 556 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); |
557 | break; | 557 | break; |
558 | case HTMLCBDownHover: | 558 | case HTMLCBDownHover: |
559 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", | 559 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", |
560 | btnHoverH, btnHoverS, | 560 | btnHoverH, btnHoverS, |
561 | btnHoverV); | 561 | btnHoverV); |
562 | break; | 562 | break; |
563 | case HTMLRadio: | 563 | case HTMLRadio: |
564 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); | 564 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); |
565 | case HTMLRadioDown: | 565 | case HTMLRadioDown: |
566 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); | 566 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); |
567 | case HTMLRadioHover: | 567 | case HTMLRadioHover: |
568 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); | 568 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); |
569 | case HTMLRadioDownHover: | 569 | case HTMLRadioDownHover: |
570 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", | 570 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", |
571 | btnHoverH, btnHoverS, | 571 | btnHoverH, btnHoverS, |
572 | btnHoverV); | 572 | btnHoverV); |
573 | case RadioOn: | 573 | case RadioOn: |
574 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); | 574 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); |
575 | break; | 575 | break; |
576 | case RadioOnHover: | 576 | case RadioOnHover: |
577 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, | 577 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, |
578 | btnHoverV, true); | 578 | btnHoverV, true); |
579 | break; | 579 | break; |
580 | case RadioOffHover: | 580 | case RadioOffHover: |
581 | pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); | 581 | pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); |
582 | break; | 582 | break; |
583 | case TabDown: | 583 | case TabDown: |
584 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); | 584 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); |
585 | break; | 585 | break; |
586 | case TabFocus: | 586 | case TabFocus: |
587 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, | 587 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, |
588 | btnHoverS, true); | 588 | btnHoverS, true); |
589 | break; | 589 | break; |
590 | case CBDown: | 590 | case CBDown: |
591 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); | 591 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); |
592 | break; | 592 | break; |
593 | case CBDownHover: | 593 | case CBDownHover: |
594 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, | 594 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, |
595 | btnHoverS, btnHoverV, true); | 595 | btnHoverS, btnHoverV, true); |
596 | break; | 596 | break; |
597 | case CBHover: | 597 | case CBHover: |
598 | pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); | 598 | pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); |
599 | break; | 599 | break; |
600 | case HSlider: | 600 | case HSlider: |
601 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | 601 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); |
602 | break; | 602 | break; |
603 | case VSlider: | 603 | case VSlider: |
604 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | 604 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); |
605 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); | 605 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); |
606 | break; | 606 | break; |
607 | case RadioOff: | 607 | case RadioOff: |
608 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); | 608 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); |
609 | break; | 609 | break; |
610 | case Tab: | 610 | case Tab: |
611 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); | 611 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); |
612 | break; | 612 | break; |
613 | case CB: | 613 | case CB: |
614 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); | 614 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); |
615 | break; | 615 | break; |
616 | case VSBSliderTop: | 616 | case VSBSliderTop: |
617 | pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 617 | pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); |
618 | break; | 618 | break; |
619 | case VSBSliderBtm: | 619 | case VSBSliderBtm: |
620 | pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | 620 | pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); |
621 | break; | 621 | break; |
622 | case VSBSliderMid: | 622 | case VSBSliderMid: |
623 | pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | 623 | pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); |
624 | break; | 624 | break; |
625 | case VSBSliderTopHover: | 625 | case VSBSliderTopHover: |
626 | pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 626 | pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); |
627 | break; | 627 | break; |
628 | case VSBSliderBtmHover: | 628 | case VSBSliderBtmHover: |
629 | pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 629 | pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); |
630 | break; | 630 | break; |
631 | case VSBSliderMidHover: | 631 | case VSBSliderMidHover: |
632 | pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 632 | pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); |
633 | break; | 633 | break; |
634 | 634 | ||
635 | case HSBSliderTop: | 635 | case HSBSliderTop: |
636 | pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 636 | pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); |
637 | *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); | 637 | *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); |
638 | break; | 638 | break; |
639 | case HSBSliderBtm: | 639 | case HSBSliderBtm: |
640 | pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | 640 | pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); |
641 | *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); | 641 | *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); |
642 | break; | 642 | break; |
643 | case HSBSliderMid: | 643 | case HSBSliderMid: |
644 | pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | 644 | pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); |
645 | *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); | 645 | *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); |
646 | break; | 646 | break; |
647 | case HSBSliderTopHover: | 647 | case HSBSliderTopHover: |
648 | pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 648 | pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); |
649 | *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); | 649 | *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); |
650 | break; | 650 | break; |
651 | case HSBSliderBtmHover: | 651 | case HSBSliderBtmHover: |
652 | pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 652 | pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); |
653 | *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); | 653 | *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); |
654 | break; | 654 | break; |
655 | case HSBSliderMidHover: | 655 | case HSBSliderMidHover: |
656 | pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 656 | pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); |
657 | *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); | 657 | *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); |
658 | break; | 658 | break; |
659 | case VSBSliderTopBg: | 659 | case VSBSliderTopBg: |
660 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | 660 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); |
661 | break; | 661 | break; |
662 | case VSBSliderBtmBg: | 662 | case VSBSliderBtmBg: |
663 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | 663 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); |
664 | break; | 664 | break; |
665 | case VSBSliderMidBg: | 665 | case VSBSliderMidBg: |
666 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | 666 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); |
667 | break; | 667 | break; |
668 | case HSBSliderTopBg: | 668 | case HSBSliderTopBg: |
669 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | 669 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); |
670 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); | 670 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); |
671 | break; | 671 | break; |
672 | case HSBSliderBtmBg: | 672 | case HSBSliderBtmBg: |
673 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | 673 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); |
674 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); | 674 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); |
675 | break; | 675 | break; |
676 | case HSBSliderMidBg: | 676 | case HSBSliderMidBg: |
677 | pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | 677 | pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); |
678 | *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); | 678 | *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); |
679 | break; | 679 | break; |
680 | default: | 680 | default: |
681 | break; | 681 | break; |
682 | } | 682 | } |
683 | return(pixmaps[item]); | 683 | return(pixmaps[item]); |
684 | } | 684 | } |
685 | 685 | ||
686 | void LiquidStyle::polish(QPalette &appPal) | 686 | void LiquidStyle::polish(QPalette &appPal) |
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" ); | 713 | config. setGroup ( "Liquid-Style" ); |
714 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); | 714 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); |
715 | if ( contrast < 0 ) | 715 | if ( contrast < 0 ) |
716 | contrast = 0; | 716 | contrast = 0; |
717 | else if ( contrast > 10 ) | 717 | else if ( contrast > 10 ) |
718 | contrast = 10; | 718 | contrast = 10; |
719 | 719 | ||
720 | // QPalette pal = QApplication::palette(); | 720 | // QPalette pal = QApplication::palette(); |
721 | 721 | ||
722 | // button color stuff | 722 | // button color stuff |
723 | config. setGroup ( "Appearance" ); | 723 | config. setGroup ( "Appearance" ); |
724 | QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 724 | QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); |
725 | appPal. color ( QPalette::Active, QColorGroup::Button ); | 725 | appPal. color ( QPalette::Active, QColorGroup::Button ); |
726 | if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) | 726 | if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) |
727 | //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) | 727 | //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) |
728 | ) { | 728 | ) { |
729 | // force button color to be different from background | 729 | // force button color to be different from background |
730 | QBrush btnBrush(QColor(200, 202, 228)); | 730 | QBrush btnBrush(QColor(200, 202, 228)); |
731 | appPal.setBrush(QColorGroup::Button, btnBrush); | 731 | appPal.setBrush(QColorGroup::Button, btnBrush); |
732 | } | 732 | } |
733 | c.hsv(&btnH, &btnS, &btnV); | 733 | c.hsv(&btnH, &btnS, &btnV); |
734 | c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); | 734 | c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); |
735 | 735 | ||
736 | // menu pixmap | 736 | // menu pixmap |
737 | if(!menuPix){ | 737 | if(!menuPix){ |
738 | menuPix = new QPixmap; | 738 | menuPix = new QPixmap; |
739 | menuPix->resize(64, 64); | 739 | menuPix->resize(64, 64); |
740 | } | 740 | } |
741 | QPainter painter; | 741 | QPainter painter; |
742 | menuPix->fill(c.rgb()); | 742 | menuPix->fill(c.rgb()); |
743 | painter.begin(menuPix); | 743 | painter.begin(menuPix); |
744 | painter.setPen(c.dark(105)); | 744 | painter.setPen(c.dark(105)); |
745 | for(i=0; i < 63; i+=4){ | 745 | for(i=0; i < 63; i+=4){ |
746 | painter.drawLine(0, i, 63, i); | 746 | painter.drawLine(0, i, 63, i); |
747 | painter.drawLine(0, i+1, 63, i+1); | 747 | painter.drawLine(0, i+1, 63, i+1); |
748 | }; | 748 | }; |
749 | painter.end(); | 749 | painter.end(); |
750 | menuBrush.setColor(c); | 750 | menuBrush.setColor(c); |
751 | menuBrush.setPixmap(*menuPix); | 751 | menuBrush.setPixmap(*menuPix); |
752 | 752 | ||
753 | // pager brush | 753 | // pager brush |
754 | c = c.dark(120); | 754 | c = c.dark(120); |
755 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 755 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
756 | if(!pix){ | 756 | if(!pix){ |
757 | int h, s, v; | 757 | int h, s, v; |
758 | c.hsv(&h, &s, &v); | 758 | c.hsv(&h, &s, &v); |
759 | pix = new QPixmap(*smallBevelFillPix); | 759 | pix = new QPixmap(*smallBevelFillPix); |
760 | adjustHSV(*pix, h, s, v); | 760 | adjustHSV(*pix, h, s, v); |
761 | smallBevelFillDict.insert(c.rgb(), pix); | 761 | smallBevelFillDict.insert(c.rgb(), pix); |
762 | } | 762 | } |
763 | pagerHoverBrush.setColor(c); | 763 | pagerHoverBrush.setColor(c); |
764 | pagerHoverBrush.setPixmap(*pix); | 764 | pagerHoverBrush.setPixmap(*pix); |
765 | 765 | ||
766 | c = c.dark(120); | 766 | c = c.dark(120); |
767 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 767 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
768 | if(!pix){ | 768 | if(!pix){ |
769 | int h, s, v; | 769 | int h, s, v; |
770 | c.hsv(&h, &s, &v); | 770 | c.hsv(&h, &s, &v); |
771 | pix = new QPixmap(*smallBevelFillPix); | 771 | pix = new QPixmap(*smallBevelFillPix); |
772 | adjustHSV(*pix, h, s, v); | 772 | adjustHSV(*pix, h, s, v); |
773 | smallBevelFillDict.insert(c.rgb(), pix); | 773 | smallBevelFillDict.insert(c.rgb(), pix); |
774 | } | 774 | } |
775 | pagerBrush.setColor(c); | 775 | pagerBrush.setColor(c); |
776 | pagerBrush.setPixmap(*pix); | 776 | pagerBrush.setPixmap(*pix); |
777 | 777 | ||
778 | // background color stuff | 778 | // background color stuff |
779 | c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); | 779 | c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); |
780 | c.hsv(&bH, &bS, &bV); | 780 | c.hsv(&bH, &bS, &bV); |
781 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 781 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
782 | 782 | ||
783 | // FIXME? | 783 | // FIXME? |
784 | if(vsbSliderFillPix) | 784 | if(vsbSliderFillPix) |
785 | delete vsbSliderFillPix; | 785 | delete vsbSliderFillPix; |
786 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); | 786 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); |
787 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); | 787 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); |
788 | 788 | ||
789 | // background brush | 789 | // background brush |
790 | QPixmap wallPaper(32, 32); | 790 | QPixmap wallPaper(32, 32); |
791 | wallPaper.fill(c.rgb()); | 791 | wallPaper.fill(c.rgb()); |
792 | painter.begin(&wallPaper); | 792 | painter.begin(&wallPaper); |
793 | for(i=0; i < 32; i+=4){ | 793 | for(i=0; i < 32; i+=4){ |
794 | painter.setPen(c.dark(100 + contrast)); | 794 | painter.setPen(c.dark(100 + contrast)); |
795 | painter.drawLine(0, i, 32, i); | 795 | painter.drawLine(0, i, 32, i); |
796 | painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); | 796 | painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); |
797 | painter.drawLine(0, i+1, 32, i+1); | 797 | painter.drawLine(0, i+1, 32, i+1); |
798 | }; | 798 | }; |
799 | painter.end(); | 799 | painter.end(); |
800 | bgBrush.setColor(c); | 800 | bgBrush.setColor(c); |
801 | bgBrush.setPixmap(wallPaper); | 801 | bgBrush.setPixmap(wallPaper); |
802 | appPal.setBrush(QColorGroup::Background, bgBrush); | 802 | appPal.setBrush(QColorGroup::Background, bgBrush); |
803 | 803 | ||
804 | // lineedits | 804 | // lineedits |
805 | c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); | 805 | c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); |
806 | QPixmap basePix; | 806 | QPixmap basePix; |
807 | basePix.resize(32, 32); | 807 | basePix.resize(32, 32); |
808 | basePix.fill(c.rgb()); | 808 | basePix.fill(c.rgb()); |
809 | painter.begin(&basePix); | 809 | painter.begin(&basePix); |
810 | painter.setPen(c.dark(105)); | 810 | painter.setPen(c.dark(105)); |
811 | for(i=0; i < 32; i+=4){ | 811 | for(i=0; i < 32; i+=4){ |
812 | painter.drawLine(0, i, 32, i); | 812 | painter.drawLine(0, i, 32, i); |
813 | painter.drawLine(0, i+1, 32, i+1); | 813 | painter.drawLine(0, i+1, 32, i+1); |
814 | }; | 814 | }; |
815 | painter.end(); | 815 | painter.end(); |
816 | baseBrush.setColor(c); | 816 | baseBrush.setColor(c); |
817 | baseBrush.setPixmap(basePix); | 817 | baseBrush.setPixmap(basePix); |
818 | it.toFirst(); | 818 | it.toFirst(); |
819 | while ((w=it.current()) != 0 ){ | 819 | while ((w=it.current()) != 0 ){ |
820 | ++it; | 820 | ++it; |
821 | if(w->inherits("QLineEdit")){ | 821 | if(w->inherits("QLineEdit")){ |
822 | QPalette pal = w->palette(); | 822 | QPalette pal = w->palette(); |
823 | pal.setBrush(QColorGroup::Base, baseBrush); | 823 | pal.setBrush(QColorGroup::Base, baseBrush); |
824 | w->setPalette(pal); | 824 | w->setPalette(pal); |
825 | } | 825 | } |
826 | else if(w->inherits("QPushButton")){ | 826 | else if(w->inherits("QPushButton")){ |
827 | applyCustomAttributes((QPushButton *)w); | 827 | applyCustomAttributes((QPushButton *)w); |
828 | } | 828 | } |
829 | } | 829 | } |
830 | } | 830 | } |
831 | 831 | ||
832 | void LiquidStyle::polish(QWidget *w) | 832 | void LiquidStyle::polish(QWidget *w) |
833 | { | 833 | { |
834 | if(w->inherits("QMenuBar")){ | 834 | if(w->inherits("QMenuBar")){ |
835 | //((QFrame*)w)->setLineWidth(0); | 835 | //((QFrame*)w)->setLineWidth(0); |
836 | w->setBackgroundMode(QWidget::PaletteBackground); | 836 | w->setBackgroundMode(QWidget::PaletteBackground); |
837 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 837 | w->setBackgroundOrigin(QWidget::ParentOrigin); |
838 | return; | 838 | return; |
839 | } | 839 | } |
840 | if(w->inherits("QToolBar")){ | 840 | if(w->inherits("QToolBar")){ |
841 | w->installEventFilter(this); | 841 | w->installEventFilter(this); |
842 | w->setBackgroundMode(QWidget::PaletteBackground); | 842 | w->setBackgroundMode(QWidget::PaletteBackground); |
843 | w->setBackgroundOrigin(QWidget::WidgetOrigin); | 843 | w->setBackgroundOrigin(QWidget::WidgetOrigin); |
844 | return; | 844 | return; |
845 | } | 845 | } |
846 | if(w->inherits("QPopupMenu")) | 846 | if(w->inherits("QPopupMenu")) |
847 | w->setBackgroundMode(QWidget::NoBackground); | 847 | w->setBackgroundMode(QWidget::NoBackground); |
848 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 848 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
849 | w->installEventFilter(menuHandler); | 849 | w->installEventFilter(menuHandler); |
850 | } | 850 | } |
851 | 851 | ||
852 | if(w->isTopLevel()){ | 852 | if(w->isTopLevel()){ |
853 | return; | 853 | return; |
854 | } | 854 | } |
855 | 855 | ||
856 | 856 | ||
857 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) | 857 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) |
858 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | 858 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); |
859 | 859 | ||
860 | if(w->inherits("QComboBox") || | 860 | if(w->inherits("QComboBox") || |
861 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 861 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
862 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 862 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
863 | w->installEventFilter(this); | 863 | w->installEventFilter(this); |
864 | } | 864 | } |
865 | if(w->inherits("QLineEdit")){ | 865 | if(w->inherits("QLineEdit")){ |
866 | QPalette pal = w->palette(); | 866 | QPalette pal = w->palette(); |
867 | pal.setBrush(QColorGroup::Base, baseBrush); | 867 | pal.setBrush(QColorGroup::Base, baseBrush); |
868 | w->setPalette(pal); | 868 | w->setPalette(pal); |
869 | } | 869 | } |
870 | if(w->inherits("QPushButton")){ | 870 | if(w->inherits("QPushButton")){ |
871 | applyCustomAttributes((QPushButton *)w); | 871 | applyCustomAttributes((QPushButton *)w); |
872 | w->installEventFilter(this); | 872 | w->installEventFilter(this); |
873 | } | 873 | } |
874 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 874 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
875 | w-> setBackgroundMode ( QWidget::PaletteBackground ); | 875 | w-> setBackgroundMode ( QWidget::PaletteBackground ); |
876 | } | 876 | } |
877 | 877 | ||
878 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 878 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
879 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 879 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
880 | bool isViewportChild = w->parent() && | 880 | bool isViewportChild = w->parent() && |
881 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 881 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
882 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 882 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
883 | 883 | ||
884 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ | 884 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ |
885 | w->setBackgroundMode(QWidget::X11ParentRelative); | 885 | w->setBackgroundMode(QWidget::X11ParentRelative); |
886 | return; | 886 | return; |
887 | } | 887 | } |
888 | if(isViewportChild){ | 888 | if(isViewportChild){ |
889 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 889 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
890 | if(w->parent()){ // heh, only way to test for KHTML children ;-) | 890 | if(w->parent()){ // heh, only way to test for KHTML children ;-) |
891 | if(w->parent()->parent()){ | 891 | if(w->parent()->parent()){ |
892 | if(w->parent()->parent()->parent() && | 892 | if(w->parent()->parent()->parent() && |
893 | w->parent()->parent()->parent()->inherits("KHTMLView")){ | 893 | w->parent()->parent()->parent()->inherits("KHTMLView")){ |
894 | w->setAutoMask(true); | 894 | w->setAutoMask(true); |
895 | w->setBackgroundMode(QWidget::NoBackground); | 895 | w->setBackgroundMode(QWidget::NoBackground); |
896 | } | 896 | } |
897 | } | 897 | } |
898 | } | 898 | } |
899 | return; | 899 | return; |
900 | } | 900 | } |
901 | } | 901 | } |
902 | if(w->inherits("QHeader")){ | 902 | if(w->inherits("QHeader")){ |
903 | w->setMouseTracking(true); | 903 | w->setMouseTracking(true); |
904 | w->installEventFilter(this); | 904 | w->installEventFilter(this); |
905 | } | 905 | } |
906 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { | 906 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { |
907 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); | 907 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
908 | if ( flatTBButtons ) | 908 | if ( flatTBButtons ) |
909 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 909 | w->setBackgroundOrigin(QWidget::ParentOrigin); |
910 | } | 910 | } |
911 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 911 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
912 | return; | 912 | return; |
913 | } | 913 | } |
914 | 914 | ||
915 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 915 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
916 | palette().active().brush(QColorGroup::Background).pixmap()){ | 916 | palette().active().brush(QColorGroup::Background).pixmap()){ |
917 | qWarning("No parent pixmap for child widget %s", w->className()); | 917 | qWarning("No parent pixmap for child widget %s", w->className()); |
918 | return; | 918 | return; |
919 | } | 919 | } |
920 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 920 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
921 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 921 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
922 | if(w->backgroundMode() == QWidget::PaletteBackground || | 922 | if(w->backgroundMode() == QWidget::PaletteBackground || |
923 | w->backgroundMode() == QWidget::PaletteButton){ | 923 | w->backgroundMode() == QWidget::PaletteButton){ |
924 | w->setBackgroundMode(QWidget::X11ParentRelative); | 924 | w->setBackgroundMode(QWidget::X11ParentRelative); |
925 | } | 925 | } |
926 | } | 926 | } |
927 | 927 | ||
928 | } | 928 | } |
929 | 929 | ||
930 | void LiquidStyle::unPolish(QWidget *w) | 930 | void LiquidStyle::unPolish(QWidget *w) |
931 | { | 931 | { |
932 | if(w->inherits("QMenuBar")){ | 932 | if(w->inherits("QMenuBar")){ |
933 | ((QFrame *)w)->setLineWidth(1); | 933 | ((QFrame *)w)->setLineWidth(1); |
934 | w->setBackgroundMode(QWidget::PaletteBackground); | 934 | w->setBackgroundMode(QWidget::PaletteBackground); |
935 | return; | 935 | return; |
936 | } | 936 | } |
937 | 937 | ||
938 | if(w->inherits("QPopupMenu")) | 938 | if(w->inherits("QPopupMenu")) |
939 | w->setBackgroundMode(QWidget::PaletteButton); | 939 | w->setBackgroundMode(QWidget::PaletteButton); |
940 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 940 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
941 | w->removeEventFilter(menuHandler); | 941 | w->removeEventFilter(menuHandler); |
942 | } | 942 | } |
943 | 943 | ||
944 | if(w->isTopLevel()) | 944 | if(w->isTopLevel()) |
945 | return; | 945 | return; |
946 | 946 | ||
947 | // for viewport children, don't just check for NoBackground.... | 947 | // for viewport children, don't just check for NoBackground.... |
948 | bool isViewportChild = w->parent() && | 948 | bool isViewportChild = w->parent() && |
949 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 949 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
950 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 950 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
951 | 951 | ||
952 | w->unsetPalette(); | 952 | w->unsetPalette(); |
953 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 953 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
954 | if(w->inherits("QPushButton")) | 954 | if(w->inherits("QPushButton")) |
955 | w->setBackgroundMode(QWidget::PaletteButton); | 955 | w->setBackgroundMode(QWidget::PaletteButton); |
956 | else | 956 | else |
957 | w->setBackgroundMode(QWidget::PaletteBackground); | 957 | w->setBackgroundMode(QWidget::PaletteBackground); |
958 | } | 958 | } |
959 | 959 | ||
960 | if(isViewportChild) | 960 | if(isViewportChild) |
961 | w->setAutoMask(false); | 961 | w->setAutoMask(false); |
962 | 962 | ||
963 | if(w->inherits("QPushButton")){ | 963 | if(w->inherits("QPushButton")){ |
964 | unapplyCustomAttributes((QPushButton *)w); | 964 | unapplyCustomAttributes((QPushButton *)w); |
965 | w->removeEventFilter(this); | 965 | w->removeEventFilter(this); |
966 | } | 966 | } |
967 | /* | 967 | /* |
968 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 968 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
969 | w-> setBackgroundMode ( PaletteBackground ); | 969 | w-> setBackgroundMode ( PaletteBackground ); |
970 | } | 970 | } |
971 | */ | 971 | */ |
972 | if(w->inherits("QComboBox") || | 972 | if(w->inherits("QComboBox") || |
973 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 973 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
974 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 974 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
975 | w->removeEventFilter(this); | 975 | w->removeEventFilter(this); |
976 | } | 976 | } |
977 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 977 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
978 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ | 978 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ |
979 | w->setAutoMask(false); | 979 | w->setAutoMask(false); |
980 | } | 980 | } |
981 | } | 981 | } |
982 | if(w->inherits("QToolBar")){ | 982 | if(w->inherits("QToolBar")){ |
983 | w->removeEventFilter(this); | 983 | w->removeEventFilter(this); |
984 | w->setBackgroundMode(QWidget::PaletteBackground); | 984 | w->setBackgroundMode(QWidget::PaletteBackground); |
985 | return; | 985 | return; |
986 | } | 986 | } |
987 | if(w->inherits("QHeader")){ | 987 | if(w->inherits("QHeader")){ |
988 | w->setMouseTracking(false); | 988 | w->setMouseTracking(false); |
989 | w->removeEventFilter(this); | 989 | w->removeEventFilter(this); |
990 | } | 990 | } |
991 | } | 991 | } |
992 | 992 | ||
993 | void LiquidStyle::polish(QApplication *app) | 993 | void LiquidStyle::polish(QApplication *app) |
994 | { | 994 | { |
995 | 995 | ||
996 | QWindowsStyle::polish(app); | 996 | QWindowsStyle::polish(app); |
997 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | 997 | menuAni = app->isEffectEnabled(UI_AnimateMenu); |
998 | menuFade = app->isEffectEnabled(UI_FadeMenu); | 998 | menuFade = app->isEffectEnabled(UI_FadeMenu); |
999 | if(menuAni) | 999 | if(menuAni) |
1000 | app->setEffectEnabled(UI_AnimateMenu, false); | 1000 | app->setEffectEnabled(UI_AnimateMenu, false); |
1001 | if(menuFade) | 1001 | if(menuFade) |
1002 | app->setEffectEnabled(UI_FadeMenu, false); | 1002 | app->setEffectEnabled(UI_FadeMenu, false); |
1003 | 1003 | ||
1004 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | 1004 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); |
1005 | 1005 | ||
1006 | Config config ( "qpe" ); | 1006 | Config config ( "qpe" ); |
1007 | config. setGroup ( "Liquid-Style" ); | 1007 | config. setGroup ( "Liquid-Style" ); |
1008 | 1008 | ||
1009 | // if ( config. readBoolEntry ( "WinDecoration", true )) | 1009 | // if ( config. readBoolEntry ( "WinDecoration", true )) |
1010 | // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | 1010 | // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); |
1011 | 1011 | ||
1012 | flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); | 1012 | flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | void LiquidStyle::unPolish(QApplication *app) | 1015 | void LiquidStyle::unPolish(QApplication *app) |
1016 | { | 1016 | { |
1017 | QWindowsStyle::unPolish(app); | 1017 | QWindowsStyle::unPolish(app); |
1018 | app->setEffectEnabled(UI_AnimateMenu, menuAni); | 1018 | app->setEffectEnabled(UI_AnimateMenu, menuAni); |
1019 | app->setEffectEnabled(UI_FadeMenu, menuFade); | 1019 | app->setEffectEnabled(UI_FadeMenu, menuFade); |
1020 | 1020 | ||
1021 | qt_set_draw_menu_bar_impl ( 0 ); | 1021 | qt_set_draw_menu_bar_impl ( 0 ); |
1022 | 1022 | ||
1023 | // QApplication::qwsSetDecoration ( new QPEDecoration ( )); | 1023 | // QApplication::qwsSetDecoration ( new QPEDecoration ( )); |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | /* | 1026 | /* |
1027 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to | 1027 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to |
1028 | * force everything to erase and repaint on resize. This is going away, I'm | 1028 | * force everything to erase and repaint on resize. This is going away, I'm |
1029 | * trying to get shaped widgets to work right without masking. QPushButton, | 1029 | * trying to get shaped widgets to work right without masking. QPushButton, |
1030 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order | 1030 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order |
1031 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and | 1031 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and |
1032 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and | 1032 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and |
1033 | * caches them in QPixmapCache, which is bad for doing things like hover | 1033 | * caches them in QPixmapCache, which is bad for doing things like hover |
1034 | * because the style methods aren't called in paintEvents if everything | 1034 | * because the style methods aren't called in paintEvents if everything |
1035 | * is cached. We use our own Paint event handler instead. Taskbuttons and | 1035 | * is cached. We use our own Paint event handler instead. Taskbuttons and |
1036 | * pager buttons draw into a pixmap buffer, so we handle those with palette | 1036 | * pager buttons draw into a pixmap buffer, so we handle those with palette |
1037 | * modifications. For QHeader, different header items are actually one widget | 1037 | * modifications. For QHeader, different header items are actually one widget |
1038 | * that draws multiple items, so we need to check which ID is hightlighted | 1038 | * that draws multiple items, so we need to check which ID is hightlighted |
1039 | * and draw it. Finally, we also check enter and leave events for QLineEdit, | 1039 | * and draw it. Finally, we also check enter and leave events for QLineEdit, |
1040 | * since if it's inside a combobox we want to highlight the combobox during | 1040 | * since if it's inside a combobox we want to highlight the combobox during |
1041 | * hovering in the edit. | 1041 | * hovering in the edit. |
1042 | */ | 1042 | */ |
1043 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 1043 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
1044 | { | 1044 | { |
1045 | if(obj->inherits("QToolBar")){ | 1045 | if(obj->inherits("QToolBar")){ |
1046 | if(ev->type() == QEvent::Resize){ | 1046 | if(ev->type() == QEvent::Resize){ |
1047 | const QObjectList *tbChildList = obj->children(); | 1047 | const QObjectList *tbChildList = obj->children(); |
1048 | QObjectListIt it(*tbChildList); | 1048 | QObjectListIt it(*tbChildList); |
1049 | QObject *child; | 1049 | QObject *child; |
1050 | while((child = it.current()) != NULL){ | 1050 | while((child = it.current()) != NULL){ |
1051 | ++it; | 1051 | ++it; |
1052 | if(child->isWidgetType()) | 1052 | if(child->isWidgetType()) |
1053 | ((QWidget *)child)->repaint(true); | 1053 | ((QWidget *)child)->repaint(true); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | } | 1056 | } |
1057 | } | 1057 | } |
1058 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 1058 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ |
1059 | QWidget *btn = (QWidget *)obj; | 1059 | QWidget *btn = (QWidget *)obj; |
1060 | if(ev->type() == QEvent::Enter){ | 1060 | if(ev->type() == QEvent::Enter){ |
1061 | if(btn->isEnabled()){ | 1061 | if(btn->isEnabled()){ |
1062 | highlightWidget = btn; | 1062 | highlightWidget = btn; |
1063 | btn->repaint(false); | 1063 | btn->repaint(false); |
1064 | } | 1064 | } |
1065 | } | 1065 | } |
1066 | else if(ev->type() == QEvent::Leave){ | 1066 | else if(ev->type() == QEvent::Leave){ |
1067 | if(btn == highlightWidget){ | 1067 | if(btn == highlightWidget){ |
1068 | highlightWidget = NULL; | 1068 | highlightWidget = NULL; |
1069 | btn->repaint(false); | 1069 | btn->repaint(false); |
1070 | } | 1070 | } |
1071 | } | 1071 | } |
1072 | } | 1072 | } |
1073 | else if(obj->inherits("QToolButton")){ | 1073 | else if(obj->inherits("QToolButton")){ |
1074 | QToolButton *btn = (QToolButton *)btn; | 1074 | QToolButton *btn = (QToolButton *)btn; |
1075 | if(!btn->autoRaise()){ | 1075 | if(!btn->autoRaise()){ |
1076 | if(btn->isEnabled()){ | 1076 | if(btn->isEnabled()){ |
1077 | highlightWidget = btn; | 1077 | highlightWidget = btn; |
1078 | btn->repaint(false); | 1078 | btn->repaint(false); |
1079 | } | 1079 | } |
1080 | } | 1080 | } |
1081 | else if(ev->type() == QEvent::Leave){ | 1081 | else if(ev->type() == QEvent::Leave){ |
1082 | QWidget *btn = (QWidget *)obj; | 1082 | QWidget *btn = (QWidget *)obj; |
1083 | if(btn == highlightWidget){ | 1083 | if(btn == highlightWidget){ |
1084 | highlightWidget = NULL; | 1084 | highlightWidget = NULL; |
1085 | btn->repaint(false); | 1085 | btn->repaint(false); |
1086 | } | 1086 | } |
1087 | } | 1087 | } |
1088 | else | 1088 | else |
1089 | highlightWidget = NULL; | 1089 | highlightWidget = NULL; |
1090 | } | 1090 | } |
1091 | else if(obj->inherits("QScrollBar")){ | 1091 | else if(obj->inherits("QScrollBar")){ |
1092 | QScrollBar *sb = (QScrollBar *)obj; | 1092 | QScrollBar *sb = (QScrollBar *)obj; |
1093 | if(ev->type() == QEvent::Enter){ | 1093 | if(ev->type() == QEvent::Enter){ |
1094 | if(sb->isEnabled()){ | 1094 | if(sb->isEnabled()){ |
1095 | highlightWidget = sb; | 1095 | highlightWidget = sb; |
1096 | sb->repaint(false); | 1096 | sb->repaint(false); |
1097 | } | 1097 | } |
1098 | } | 1098 | } |
1099 | else if(ev->type() == QEvent::Leave){ | 1099 | else if(ev->type() == QEvent::Leave){ |
1100 | if(sb == highlightWidget && !sb->draggingSlider()){ | 1100 | if(sb == highlightWidget && !sb->draggingSlider()){ |
1101 | highlightWidget = NULL; | 1101 | highlightWidget = NULL; |
1102 | sb->repaint(false); | 1102 | sb->repaint(false); |
1103 | } | 1103 | } |
1104 | } | 1104 | } |
1105 | else if(ev->type() == QEvent::MouseButtonRelease){ | 1105 | else if(ev->type() == QEvent::MouseButtonRelease){ |
1106 | QMouseEvent *me = (QMouseEvent *)ev; | 1106 | QMouseEvent *me = (QMouseEvent *)ev; |
1107 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ | 1107 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ |
1108 | highlightWidget = NULL; | 1108 | highlightWidget = NULL; |
1109 | sb->repaint(false); | 1109 | sb->repaint(false); |
1110 | } | 1110 | } |
1111 | } | 1111 | } |
1112 | } | 1112 | } |
1113 | else if(obj->inherits("QLineEdit")){ | 1113 | else if(obj->inherits("QLineEdit")){ |
1114 | if(obj->parent() && obj->parent()->inherits("QComboBox")){ | 1114 | if(obj->parent() && obj->parent()->inherits("QComboBox")){ |
1115 | QWidget *btn = (QComboBox *)obj->parent(); | 1115 | QWidget *btn = (QComboBox *)obj->parent(); |
1116 | if(ev->type() == QEvent::Enter){ | 1116 | if(ev->type() == QEvent::Enter){ |
1117 | if (btn->isEnabled()){ | 1117 | if (btn->isEnabled()){ |
1118 | highlightWidget = btn; | 1118 | highlightWidget = btn; |
1119 | btn->repaint(false); | 1119 | btn->repaint(false); |
1120 | } | 1120 | } |
1121 | } | 1121 | } |
1122 | else if(ev->type() == QEvent::Leave){ | 1122 | else if(ev->type() == QEvent::Leave){ |
1123 | if (btn == highlightWidget) | 1123 | if (btn == highlightWidget) |
1124 | highlightWidget = NULL; | 1124 | highlightWidget = NULL; |
1125 | btn->repaint(false); | 1125 | btn->repaint(false); |
1126 | } | 1126 | } |
1127 | } | 1127 | } |
1128 | } | 1128 | } |
1129 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ | 1129 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ |
1130 | QButton *btn = (QButton *)obj; | 1130 | QButton *btn = (QButton *)obj; |
1131 | bool isRadio = obj->inherits("QRadioButton"); | 1131 | bool isRadio = obj->inherits("QRadioButton"); |
1132 | if(ev->type() == QEvent::Paint){ | 1132 | if(ev->type() == QEvent::Paint){ |
1133 | //if(btn->autoMask()) | 1133 | //if(btn->autoMask()) |
1134 | btn->erase(); | 1134 | btn->erase(); |
1135 | QPainter p; | 1135 | QPainter p; |
1136 | p.begin(btn); | 1136 | p.begin(btn); |
1137 | QFontMetrics fm = btn->fontMetrics(); | 1137 | QFontMetrics fm = btn->fontMetrics(); |
1138 | QSize lsz = fm.size(ShowPrefix, btn->text()); | 1138 | QSize lsz = fm.size(ShowPrefix, btn->text()); |
1139 | QSize sz = isRadio ? exclusiveIndicatorSize() | 1139 | QSize sz = isRadio ? exclusiveIndicatorSize() |
1140 | : indicatorSize(); | 1140 | : indicatorSize(); |
1141 | 1141 | ||
1142 | if(btn->hasFocus()){ | 1142 | if(btn->hasFocus()){ |
1143 | QRect r = QRect(0, 0, btn->width(), btn->height()); | 1143 | QRect r = QRect(0, 0, btn->width(), btn->height()); |
1144 | p.setPen(btn->colorGroup().button().dark(140)); | 1144 | p.setPen(btn->colorGroup().button().dark(140)); |
1145 | p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); | 1145 | p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); |
1146 | p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); | 1146 | p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); |
1147 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); | 1147 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); |
1148 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); | 1148 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); |
1149 | } | 1149 | } |
1150 | int x = 0; | 1150 | int x = 0; |
1151 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | 1151 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; |
1152 | if(isRadio) | 1152 | if(isRadio) |
1153 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | 1153 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), |
1154 | btn->colorGroup(), btn->isOn(), | 1154 | btn->colorGroup(), btn->isOn(), |
1155 | btn->isDown(), btn->isEnabled()); | 1155 | btn->isDown(), btn->isEnabled()); |
1156 | else | 1156 | else |
1157 | drawIndicator(&p, x, y, sz.width(), sz.height(), | 1157 | drawIndicator(&p, x, y, sz.width(), sz.height(), |
1158 | btn->colorGroup(), btn->state(), btn->isDown(), | 1158 | btn->colorGroup(), btn->state(), btn->isDown(), |
1159 | btn->isEnabled()); | 1159 | btn->isEnabled()); |
1160 | x = sz.width() + 6; | 1160 | x = sz.width() + 6; |
1161 | y = 0; | 1161 | y = 0; |
1162 | drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), | 1162 | drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), |
1163 | btn->height(), AlignLeft|AlignVCenter|ShowPrefix, | 1163 | btn->height(), AlignLeft|AlignVCenter|ShowPrefix, |
1164 | btn->colorGroup(), btn->isEnabled(), | 1164 | btn->colorGroup(), btn->isEnabled(), |
1165 | btn->pixmap(), btn->text()); | 1165 | btn->pixmap(), btn->text()); |
1166 | p.end(); | 1166 | p.end(); |
1167 | return(true); | 1167 | return(true); |
1168 | } | 1168 | } |
1169 | // for hover, just redraw the indicator (not the text) | 1169 | // for hover, just redraw the indicator (not the text) |
1170 | else if((ev->type() == QEvent::Enter && btn->isEnabled()) || | 1170 | else if((ev->type() == QEvent::Enter && btn->isEnabled()) || |
1171 | (ev->type() == QEvent::Leave && btn == highlightWidget)){ | 1171 | (ev->type() == QEvent::Leave && btn == highlightWidget)){ |
1172 | QButton *btn = (QButton *)obj; | 1172 | QButton *btn = (QButton *)obj; |
1173 | bool isRadio = obj->inherits("QRadioButton"); | 1173 | bool isRadio = obj->inherits("QRadioButton"); |
1174 | 1174 | ||
1175 | if(ev->type() == QEvent::Enter) | 1175 | if(ev->type() == QEvent::Enter) |
1176 | highlightWidget = btn; | 1176 | highlightWidget = btn; |
1177 | else | 1177 | else |
1178 | highlightWidget = NULL; | 1178 | highlightWidget = NULL; |
1179 | QFontMetrics fm = btn->fontMetrics(); | 1179 | QFontMetrics fm = btn->fontMetrics(); |
1180 | QSize lsz = fm.size(ShowPrefix, btn->text()); | 1180 | QSize lsz = fm.size(ShowPrefix, btn->text()); |
1181 | QSize sz = isRadio ? exclusiveIndicatorSize() | 1181 | QSize sz = isRadio ? exclusiveIndicatorSize() |
1182 | : indicatorSize(); | 1182 | : indicatorSize(); |
1183 | int x = 0; | 1183 | int x = 0; |
1184 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | 1184 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; |
1185 | //if(btn->autoMask()) | 1185 | //if(btn->autoMask()) |
1186 | // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); | 1186 | // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); |
1187 | QPainter p; | 1187 | QPainter p; |
1188 | p.begin(btn); | 1188 | p.begin(btn); |
1189 | if(isRadio) | 1189 | if(isRadio) |
1190 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | 1190 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), |
1191 | btn->colorGroup(), btn->isOn(), | 1191 | btn->colorGroup(), btn->isOn(), |
1192 | btn->isDown(), btn->isEnabled()); | 1192 | btn->isDown(), btn->isEnabled()); |
1193 | else | 1193 | else |
1194 | drawIndicator(&p, x, y, sz.width(), sz.height(), | 1194 | drawIndicator(&p, x, y, sz.width(), sz.height(), |
1195 | btn->colorGroup(), btn->state(), btn->isDown(), | 1195 | btn->colorGroup(), btn->state(), btn->isDown(), |
1196 | btn->isEnabled()); | 1196 | btn->isEnabled()); |
1197 | p.end(); | 1197 | p.end(); |
1198 | } | 1198 | } |
1199 | } | 1199 | } |
1200 | else if(obj->inherits("QHeader")){ | 1200 | else if(obj->inherits("QHeader")){ |
1201 | QHeader *hw = (QHeader *)obj; | 1201 | QHeader *hw = (QHeader *)obj; |
1202 | if(ev->type() == QEvent::Enter){ | 1202 | if(ev->type() == QEvent::Enter){ |
1203 | currentHeader = hw; | 1203 | currentHeader = hw; |
1204 | headerHoverID = -1; | 1204 | headerHoverID = -1; |
1205 | } | 1205 | } |
1206 | else if(ev->type() == QEvent::Leave){ | 1206 | else if(ev->type() == QEvent::Leave){ |
1207 | currentHeader = NULL; | 1207 | currentHeader = NULL; |
1208 | if(headerHoverID != -1){ | 1208 | if(headerHoverID != -1){ |
1209 | hw->repaint(hw->sectionPos(headerHoverID), 0, | 1209 | hw->repaint(hw->sectionPos(headerHoverID), 0, |
1210 | hw->sectionSize(headerHoverID), hw->height()); | 1210 | hw->sectionSize(headerHoverID), hw->height()); |
1211 | } | 1211 | } |
1212 | headerHoverID = -1; | 1212 | headerHoverID = -1; |
1213 | } | 1213 | } |
1214 | else if(ev->type() == QEvent::MouseMove){ | 1214 | else if(ev->type() == QEvent::MouseMove){ |
1215 | QMouseEvent *me = (QMouseEvent *)ev; | 1215 | QMouseEvent *me = (QMouseEvent *)ev; |
1216 | int oldHeader = headerHoverID; | 1216 | int oldHeader = headerHoverID; |
1217 | headerHoverID = hw->sectionAt(me->x()); | 1217 | headerHoverID = hw->sectionAt(me->x()); |
1218 | if(oldHeader != headerHoverID){ | 1218 | if(oldHeader != headerHoverID){ |
1219 | // reset old header | 1219 | // reset old header |
1220 | if(oldHeader != -1){ | 1220 | if(oldHeader != -1){ |
1221 | hw->repaint(hw->sectionPos(oldHeader), 0, | 1221 | hw->repaint(hw->sectionPos(oldHeader), 0, |
1222 | hw->sectionSize(oldHeader), hw->height()); | 1222 | hw->sectionSize(oldHeader), hw->height()); |
1223 | } | 1223 | } |
1224 | if(headerHoverID != -1){ | 1224 | if(headerHoverID != -1){ |
1225 | hw->repaint(hw->sectionPos(headerHoverID), 0, | 1225 | hw->repaint(hw->sectionPos(headerHoverID), 0, |
1226 | hw->sectionSize(headerHoverID), hw->height()); | 1226 | hw->sectionSize(headerHoverID), hw->height()); |
1227 | } | 1227 | } |
1228 | } | 1228 | } |
1229 | } | 1229 | } |
1230 | } | 1230 | } |
1231 | return(false); | 1231 | return(false); |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, | 1234 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, |
1235 | const QColorGroup &g, bool sunken, | 1235 | const QColorGroup &g, bool sunken, |
1236 | const QBrush *) | 1236 | const QBrush *) |
1237 | { | 1237 | { |
1238 | drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), | 1238 | drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), |
1239 | x, y, w, h); | 1239 | x, y, w, h); |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, | 1242 | void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, |
1243 | const QColorGroup &g, bool sunken, | 1243 | const QColorGroup &g, bool sunken, |
1244 | const QBrush *) | 1244 | const QBrush *) |
1245 | { | 1245 | { |
1246 | if(p->device()->devType() != QInternal::Widget){ | 1246 | if(p->device()->devType() != QInternal::Widget){ |
1247 | // drawing into a temp pixmap, don't use mask | 1247 | // drawing into a temp pixmap, don't use mask |
1248 | QColor c = sunken ? g.button() : g.background(); | 1248 | QColor c = sunken ? g.button() : g.background(); |
1249 | p->setPen(c.dark(130)); | 1249 | p->setPen(c.dark(130)); |
1250 | p->drawRect(x, y, w, h); | 1250 | p->drawRect(x, y, w, h); |
1251 | p->setPen(c.light(105)); | 1251 | p->setPen(c.light(105)); |
1252 | p->drawRect(x+1, y+1, w-2, h-2); | 1252 | p->drawRect(x+1, y+1, w-2, h-2); |
1253 | 1253 | ||
1254 | 1254 | ||
1255 | // fill | 1255 | // fill |
1256 | QPixmap *pix = bevelFillDict.find(c.rgb()); | 1256 | QPixmap *pix = bevelFillDict.find(c.rgb()); |
1257 | if(!pix){ | 1257 | if(!pix){ |
1258 | int h, s, v; | 1258 | int h, s, v; |
1259 | c.hsv(&h, &s, &v); | 1259 | c.hsv(&h, &s, &v); |
1260 | pix = new QPixmap(*bevelFillPix); | 1260 | pix = new QPixmap(*bevelFillPix); |
1261 | adjustHSV(*pix, h, s, v); | 1261 | adjustHSV(*pix, h, s, v); |
1262 | bevelFillDict.insert(c.rgb(), pix); | 1262 | bevelFillDict.insert(c.rgb(), pix); |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | 1265 | p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); |
1266 | } | 1266 | } |
1267 | else{ | 1267 | else{ |
1268 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : | 1268 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : |
1269 | highlightWidget == p->device() ? g.button().light(110) : | 1269 | highlightWidget == p->device() ? g.button().light(110) : |
1270 | g.background(), g.background()); | 1270 | g.background(), g.background()); |
1271 | } | 1271 | } |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) | 1274 | void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) |
1275 | { | 1275 | { |
1276 | QRect r = btn->rect(); | 1276 | QRect r = btn->rect(); |
1277 | bool sunken = btn->isOn() || btn->isDown(); | 1277 | bool sunken = btn->isOn() || btn->isDown(); |
1278 | QColorGroup g = btn->colorGroup(); | 1278 | QColorGroup g = btn->colorGroup(); |
1279 | 1279 | ||
1280 | 1280 | ||
1281 | //int dw = buttonDefaultIndicatorWidth(); | 1281 | //int dw = buttonDefaultIndicatorWidth(); |
1282 | if(btn->hasFocus() || btn->isDefault()){ | 1282 | if(btn->hasFocus() || btn->isDefault()){ |
1283 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); | 1283 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); |
1284 | QPixmap *pix = bevelFillDict.find(c.rgb()); | 1284 | QPixmap *pix = bevelFillDict.find(c.rgb()); |
1285 | if(!pix){ | 1285 | if(!pix){ |
1286 | int h, s, v; | 1286 | int h, s, v; |
1287 | c.hsv(&h, &s, &v); | 1287 | c.hsv(&h, &s, &v); |
1288 | pix = new QPixmap(*bevelFillPix); | 1288 | pix = new QPixmap(*bevelFillPix); |
1289 | adjustHSV(*pix, h, s, v); | 1289 | adjustHSV(*pix, h, s, v); |
1290 | bevelFillDict.insert(c.rgb(), pix); | 1290 | bevelFillDict.insert(c.rgb(), pix); |
1291 | } | 1291 | } |
1292 | p->setPen(c.dark(150)); | 1292 | p->setPen(c.dark(150)); |
1293 | p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); | 1293 | p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); |
1294 | p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); | 1294 | p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); |
1295 | p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); | 1295 | p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); |
1296 | p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); | 1296 | p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); |
1297 | p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); | 1297 | p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | QColor newColor = btn == highlightWidget || sunken ? | 1300 | QColor newColor = btn == highlightWidget || sunken ? |
1301 | g.button().light(120) : g.button(); | 1301 | g.button().light(120) : g.button(); |
1302 | 1302 | ||
1303 | drawRoundButton(p, newColor, g.background(), | 1303 | drawRoundButton(p, newColor, g.background(), |
1304 | r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), | 1304 | r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), |
1305 | sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), | 1305 | sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), |
1306 | btn->autoMask()); | 1306 | btn->autoMask()); |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) | 1309 | void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) |
1310 | { | 1310 | { |
1311 | int x1, y1, x2, y2, w, h; | 1311 | int x1, y1, x2, y2, w, h; |
1312 | btn->rect().coords(&x1, &y1, &x2, &y2); | 1312 | btn->rect().coords(&x1, &y1, &x2, &y2); |
1313 | w = btn->width(); | 1313 | w = btn->width(); |
1314 | h = btn->height(); | 1314 | h = btn->height(); |
1315 | 1315 | ||
1316 | bool act = btn->isOn() || btn->isDown(); | 1316 | bool act = btn->isOn() || btn->isDown(); |
1317 | if(act){ | 1317 | if(act){ |
1318 | ++x1, ++y1; | 1318 | ++x1, ++y1; |
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | // Draw iconset first, if any | 1321 | // Draw iconset first, if any |
1322 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) | 1322 | if ( btn->iconSet() && !btn->iconSet()->isNull() ) |
1323 | { | 1323 | { |
1324 | QIconSet::Mode mode = btn->isEnabled() | 1324 | QIconSet::Mode mode = btn->isEnabled() |
1325 | ? QIconSet::Normal : QIconSet::Disabled; | 1325 | ? QIconSet::Normal : QIconSet::Disabled; |
1326 | if ( mode == QIconSet::Normal && btn->hasFocus() ) | 1326 | if ( mode == QIconSet::Normal && btn->hasFocus() ) |
1327 | mode = QIconSet::Active; | 1327 | mode = QIconSet::Active; |
1328 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); | 1328 | QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); |
1329 | int pixw = pixmap.width(); | 1329 | int pixw = pixmap.width(); |
1330 | int pixh = pixmap.height(); | 1330 | int pixh = pixmap.height(); |
1331 | 1331 | ||
1332 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); | 1332 | p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); |
1333 | x1 += pixw + 8; | 1333 | x1 += pixw + 8; |
1334 | w -= pixw + 8; | 1334 | w -= pixw + 8; |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | if(act){ | 1337 | if(act){ |
1338 | QFont font = btn->font(); | 1338 | QFont font = btn->font(); |
1339 | font.setBold(true); | 1339 | font.setBold(true); |
1340 | p->setFont(font); | 1340 | p->setFont(font); |
1341 | QColor shadow(btn->colorGroup().button().dark(130)); | 1341 | QColor shadow(btn->colorGroup().button().dark(130)); |
1342 | drawItem( p, x1+1, y1+1, w, h, | 1342 | drawItem( p, x1+1, y1+1, w, h, |
1343 | AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), | 1343 | AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), |
1344 | btn->pixmap(), btn->text(), -1, | 1344 | btn->pixmap(), btn->text(), -1, |
1345 | &shadow); | 1345 | &shadow); |
1346 | 1346 | ||
1347 | drawItem( p, x1, y1, w, h, | 1347 | drawItem( p, x1, y1, w, h, |
1348 | AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), | 1348 | AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), |
1349 | btn->pixmap(), btn->text(), -1, &btn->colorGroup().light()); | 1349 | btn->pixmap(), btn->text(), -1, &btn->colorGroup().light()); |
1350 | } | 1350 | } |
1351 | else{ | 1351 | else{ |
1352 | /* Too blurry | 1352 | /* Too blurry |
1353 | drawItem( p, x1+1, y1+1, w, h, | 1353 | drawItem( p, x1+1, y1+1, w, h, |
1354 | AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), | 1354 | AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), |
1355 | btn->pixmap(), btn->text(), -1, | 1355 | btn->pixmap(), btn->text(), -1, |
1356 | &btn->colorGroup().button().dark(115)); | 1356 | &btn->colorGroup().button().dark(115)); |
1357 | */ | 1357 | */ |
1358 | drawItem( p, x1, y1, w, h, | 1358 | drawItem( p, x1, y1, w, h, |
1359 | AlignCenter | ShowPrefix, | 1359 | AlignCenter | ShowPrefix, |
1360 | btn->colorGroup(), btn->isEnabled(), | 1360 | btn->colorGroup(), btn->isEnabled(), |
1361 | btn->pixmap(), btn->text(), -1, | 1361 | btn->pixmap(), btn->text(), -1, |
1362 | &btn->colorGroup().buttonText()); | 1362 | &btn->colorGroup().buttonText()); |
1363 | } | 1363 | } |
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h) | 1366 | void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h) |
1367 | { | 1367 | { |
1368 | int x2 = x+w-1; | 1368 | int x2 = x+w-1; |
1369 | int y2 = y+h-1; | 1369 | int y2 = y+h-1; |
1370 | 1370 | ||
1371 | p->setPen(Qt::color1); | 1371 | p->setPen(Qt::color1); |
1372 | p->fillRect(x, y, w, h, Qt::color0); | 1372 | p->fillRect(x, y, w, h, Qt::color0); |
1373 | if(w < 21 || h < 21){ | 1373 | if(w < 21 || h < 21){ |
1374 | // outer rect | 1374 | // outer rect |
1375 | p->drawLine(x, y+2, x, y2-2); // l | 1375 | p->drawLine(x, y+2, x, y2-2); // l |
1376 | p->drawLine(x2, y+2, x2, y2-2); // r | 1376 | p->drawLine(x2, y+2, x2, y2-2); // r |
1377 | p->drawLine(x+2, y, x2-2, y); // t | 1377 | p->drawLine(x+2, y, x2-2, y); // t |
1378 | p->drawLine(x+2, y2, x2-2, y2); // b | 1378 | p->drawLine(x+2, y2, x2-2, y2); // b |
1379 | p->drawLine(x+1, y+1, x2-1, y+1); // top second line | 1379 | p->drawLine(x+1, y+1, x2-1, y+1); // top second line |
1380 | p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line | 1380 | p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line |
1381 | p->fillRect(x+1, y+2, w-2, h-4, Qt::color1); | 1381 | p->fillRect(x+1, y+2, w-2, h-4, Qt::color1); |
1382 | } | 1382 | } |
1383 | else{ | 1383 | else{ |
1384 | int x2 = x+w-1; | 1384 | int x2 = x+w-1; |
1385 | int y2 = y+h-1; | 1385 | int y2 = y+h-1; |
1386 | int bx2 = htmlBtnMaskBmp.width()-1; | 1386 | int bx2 = htmlBtnMaskBmp.width()-1; |
1387 | int by2 = htmlBtnMaskBmp.height()-1; | 1387 | int by2 = htmlBtnMaskBmp.height()-1; |
1388 | p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl | 1388 | p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl |
1389 | p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr | 1389 | p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr |
1390 | p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl | 1390 | p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl |
1391 | p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br | 1391 | p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br |
1392 | // fills | 1392 | // fills |
1393 | p->fillRect(10, 0, w-20, 10, Qt::color1); // top | 1393 | p->fillRect(10, 0, w-20, 10, Qt::color1); // top |
1394 | p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom | 1394 | p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom |
1395 | p->fillRect(0, 10, w, h-20, Qt::color1); // middle | 1395 | p->fillRect(0, 10, w, h-20, Qt::color1); // middle |
1396 | } | 1396 | } |
1397 | } | 1397 | } |
1398 | 1398 | ||
1399 | void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, | 1399 | void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, |
1400 | const QColorGroup &g, bool sunken, | 1400 | const QColorGroup &g, bool sunken, |
1401 | const QBrush */*fill*/) | 1401 | const QBrush */*fill*/) |
1402 | { | 1402 | { |
1403 | if(currentHeader && p->device() == currentHeader){ | 1403 | if(currentHeader && p->device() == currentHeader){ |
1404 | int id = currentHeader->sectionAt(x); | 1404 | int id = currentHeader->sectionAt(x); |
1405 | bool isHeaderHover = id != -1 && id == headerHoverID; | 1405 | bool isHeaderHover = id != -1 && id == headerHoverID; |
1406 | drawClearBevel(p, x, y, w, h, sunken ? | 1406 | drawClearBevel(p, x, y, w, h, sunken ? |
1407 | g.button() : isHeaderHover ? g.button().light(110) : | 1407 | g.button() : isHeaderHover ? g.button().light(110) : |
1408 | g.background(), g.background()); | 1408 | g.background(), g.background()); |
1409 | } | 1409 | } |
1410 | else | 1410 | else |
1411 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), | 1411 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), |
1412 | g.background()); | 1412 | g.background()); |
1413 | } | 1413 | } |
1414 | 1414 | ||
1415 | QRect LiquidStyle::buttonRect(int x, int y, int w, int h) | 1415 | QRect LiquidStyle::buttonRect(int x, int y, int w, int h) |
1416 | { | 1416 | { |
1417 | return(QRect(x+5, y+5, w-10, h-10)); | 1417 | return(QRect(x+5, y+5, w-10, h-10)); |
1418 | } | 1418 | } |
1419 | 1419 | ||
1420 | void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, | 1420 | void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, |
1421 | const QColorGroup &g, bool sunken, | 1421 | const QColorGroup &g, bool sunken, |
1422 | bool edit, bool, const QBrush *) | 1422 | bool edit, bool, const QBrush *) |
1423 | { | 1423 | { |
1424 | bool isHover = highlightWidget == painter->device(); | 1424 | bool isHover = highlightWidget == painter->device(); |
1425 | bool isMasked = false; | 1425 | bool isMasked = false; |
1426 | if(painter->device()->devType() == QInternal::Widget) | 1426 | if(painter->device()->devType() == QInternal::Widget) |
1427 | isMasked = ((QWidget*)painter->device())->autoMask(); | 1427 | isMasked = ((QWidget*)painter->device())->autoMask(); |
1428 | // TODO: Do custom code, don't just call drawRoundButton into a pixmap | 1428 | // TODO: Do custom code, don't just call drawRoundButton into a pixmap |
1429 | QPixmap tmpPix(w, h); | 1429 | QPixmap tmpPix(w, h); |
1430 | QPainter p(&tmpPix); | 1430 | QPainter p(&tmpPix); |
1431 | 1431 | ||
1432 | drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, | 1432 | drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, |
1433 | sunken, false, isMasked); | 1433 | sunken, false, isMasked); |
1434 | if(!isHover){ | 1434 | if(!isHover){ |
1435 | p.setClipRect(0, 0, w-17, h); | 1435 | p.setClipRect(0, 0, w-17, h); |
1436 | drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, | 1436 | drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, |
1437 | sunken, false, isMasked); | 1437 | sunken, false, isMasked); |
1438 | } | 1438 | } |
1439 | p.end(); | 1439 | p.end(); |
1440 | int x2 = x+w-1; | 1440 | int x2 = x+w-1; |
1441 | int y2 = y+h-1; | 1441 | int y2 = y+h-1; |
1442 | int bx2 = btnMaskBmp.width()-1; | 1442 | int bx2 = btnMaskBmp.width()-1; |
1443 | int by2 = btnMaskBmp.height()-1; | 1443 | int by2 = btnMaskBmp.height()-1; |
1444 | QBitmap btnMask(w, h); | 1444 | QBitmap btnMask(w, h); |
1445 | QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; | 1445 | QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; |
1446 | p.begin(&btnMask); | 1446 | p.begin(&btnMask); |
1447 | p.fillRect(0, 0, w, h, Qt::color0); | 1447 | p.fillRect(0, 0, w, h, Qt::color0); |
1448 | p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl | 1448 | p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl |
1449 | p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr | 1449 | p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr |
1450 | p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl | 1450 | p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl |
1451 | p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br | 1451 | p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br |
1452 | // fills | 1452 | // fills |
1453 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top | 1453 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top |
1454 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom | 1454 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom |
1455 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle | 1455 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle |
1456 | p.end(); | 1456 | p.end(); |
1457 | tmpPix.setMask(btnMask); | 1457 | tmpPix.setMask(btnMask); |
1458 | 1458 | ||
1459 | painter->drawPixmap(x, y, tmpPix); | 1459 | painter->drawPixmap(x, y, tmpPix); |
1460 | 1460 | ||
1461 | painter->setPen(g.button().dark(120)); | 1461 | painter->setPen(g.button().dark(120)); |
1462 | painter->drawLine(x2-16, y+1, x2-16, y2-1); | 1462 | painter->drawLine(x2-16, y+1, x2-16, y2-1); |
1463 | 1463 | ||
1464 | if(edit){ | 1464 | if(edit){ |
1465 | painter->setPen(g.mid()); | 1465 | painter->setPen(g.mid()); |
1466 | painter->drawRect(x+8, y+2, w-25, h-4); | 1466 | painter->drawRect(x+8, y+2, w-25, h-4); |
1467 | } | 1467 | } |
1468 | int arrow_h = h / 3; | 1468 | int arrow_h = h / 3; |
1469 | int arrow_w = arrow_h; | 1469 | int arrow_w = arrow_h; |
1470 | int arrow_x = w - arrow_w - 6; | 1470 | int arrow_x = w - arrow_w - 6; |
1471 | int arrow_y = (h - arrow_h) / 2; | 1471 | int arrow_y = (h - arrow_h) / 2; |
1472 | drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true); | 1472 | drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true); |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h) | 1475 | void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h) |
1476 | { | 1476 | { |
1477 | drawButtonMask(p, x, y, w, h); | 1477 | drawButtonMask(p, x, y, w, h); |
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h) | 1480 | QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h) |
1481 | { | 1481 | { |
1482 | //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6)); | 1482 | //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6)); |
1483 | return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); | 1483 | return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) | 1486 | QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) |
1487 | { | 1487 | { |
1488 | return(QRect(x+5, y+3, w-(h/3)-13, h-5)); | 1488 | return(QRect(x+5, y+3, w-(h/3)-13, h-5)); |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, | 1491 | void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, |
1492 | int sliderStart, uint controls, | 1492 | int sliderStart, uint controls, |
1493 | uint activeControl) | 1493 | uint activeControl) |
1494 | { | 1494 | { |
1495 | bool isHover = highlightWidget == p->device(); | 1495 | bool isHover = highlightWidget == p->device(); |
1496 | int sliderMin, sliderMax, sliderLength, buttonDim; | 1496 | int sliderMin, sliderMax, sliderLength, buttonDim; |
1497 | scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); | 1497 | scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); |
1498 | 1498 | ||
1499 | if (sliderStart > sliderMax) | 1499 | if (sliderStart > sliderMax) |
1500 | sliderStart = sliderMax; | 1500 | sliderStart = sliderMax; |
1501 | 1501 | ||
1502 | bool horiz = sb->orientation() == QScrollBar::Horizontal; | 1502 | bool horiz = sb->orientation() == QScrollBar::Horizontal; |
1503 | QColorGroup g = sb->colorGroup(); | 1503 | QColorGroup g = sb->colorGroup(); |
1504 | QRect addB, subHC, subB; | 1504 | QRect addB, subHC, subB; |
1505 | QRect addPageR, subPageR, sliderR; | 1505 | QRect addPageR, subPageR, sliderR; |
1506 | int addX, addY, subX, subY; | 1506 | int addX, addY, subX, subY; |
1507 | int len = horiz ? sb->width() : sb->height(); | 1507 | int len = horiz ? sb->width() : sb->height(); |
1508 | int extent = horiz ? sb->height() : sb->width(); | 1508 | int extent = horiz ? sb->height() : sb->width(); |
1509 | 1509 | ||
1510 | // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar | 1510 | // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar |
1511 | // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now. | 1511 | // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now. |
1512 | bool brokenApp; | 1512 | bool brokenApp; |
1513 | if(extent == 16) | 1513 | if(extent == 16) |
1514 | brokenApp = true; | 1514 | brokenApp = true; |
1515 | else | 1515 | else |
1516 | brokenApp = false; | 1516 | brokenApp = false; |
1517 | 1517 | ||
1518 | if (horiz) { | 1518 | if (horiz) { |
1519 | subY = addY = ( extent - buttonDim ) / 2; | 1519 | subY = addY = ( extent - buttonDim ) / 2; |
1520 | subX = 0; | 1520 | subX = 0; |
1521 | addX = len - buttonDim; | 1521 | addX = len - buttonDim; |
1522 | if(sbBuffer.size() != sb->size()) | 1522 | if(sbBuffer.size() != sb->size()) |
1523 | sbBuffer.resize(sb->size()); | 1523 | sbBuffer.resize(sb->size()); |
1524 | } | 1524 | } |
1525 | else { | 1525 | else { |
1526 | subX = addX = ( extent - buttonDim ) / 2; | 1526 | subX = addX = ( extent - buttonDim ) / 2; |
1527 | subY = 0; | 1527 | subY = 0; |
1528 | addY = len - buttonDim; | 1528 | addY = len - buttonDim; |
1529 | if(sbBuffer.size() != sb->size()) | 1529 | if(sbBuffer.size() != sb->size()) |
1530 | sbBuffer.resize(sb->size()); | 1530 | sbBuffer.resize(sb->size()); |
1531 | } | 1531 | } |
1532 | subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); | 1532 | subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); |
1533 | addB.setRect( addX,addY,buttonDim,buttonDim ); | 1533 | addB.setRect( addX,addY,buttonDim,buttonDim ); |
1534 | if(horiz) | 1534 | if(horiz) |
1535 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); | 1535 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); |
1536 | else | 1536 | else |
1537 | subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim ); | 1537 | subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim ); |
1538 | 1538 | ||
1539 | int sliderEnd = sliderStart + sliderLength; | 1539 | int sliderEnd = sliderStart + sliderLength; |
1540 | int sliderW = extent; | 1540 | int sliderW = extent; |
1541 | 1541 | ||
1542 | if (horiz) { | 1542 | if (horiz) { |
1543 | subPageR.setRect( subB.right() + 1, 0, | 1543 | subPageR.setRect( subB.right() + 1, 0, |
1544 | sliderStart - subB.right() - 1 , sliderW ); | 1544 | sliderStart - subB.right() - 1 , sliderW ); |
1545 | addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW ); | 1545 | addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW ); |
1546 | sliderR .setRect( sliderStart, 0, sliderLength, sliderW ); | 1546 | sliderR .setRect( sliderStart, 0, sliderLength, sliderW ); |
1547 | } | 1547 | } |
1548 | else { | 1548 | else { |
1549 | subPageR.setRect( 0, subB.bottom() + 1, sliderW, | 1549 | subPageR.setRect( 0, subB.bottom() + 1, sliderW, |
diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro index ed1c2f1..0e3716f 100644 --- a/noncore/styles/liquid/liquid.pro +++ b/noncore/styles/liquid/liquid.pro | |||
@@ -1,34 +1,32 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG = qt embedded release warn_on | 2 | CONFIG = qt embedded release warn_on |
3 | SOURCES = liquid.cpp \ | 3 | SOURCES = liquid.cpp \ |
4 | liquiddeco.cpp \ | ||
5 | effects.cpp \ | 4 | effects.cpp \ |
6 | liquidset.cpp \ | 5 | liquidset.cpp \ |
7 | plugin.cpp | 6 | plugin.cpp |
8 | 7 | ||
9 | HEADERS = liquid.h \ | 8 | HEADERS = liquid.h \ |
10 | liquiddeco.h \ | ||
11 | effects.h \ | 9 | effects.h \ |
12 | liquidset.h \ | 10 | liquidset.h \ |
13 | plugin.h | 11 | plugin.h |
14 | 12 | ||
15 | LIBS += -lqpe -lopie | 13 | LIBS += -lqpe -lopie |
16 | INCLUDEPATH += $(OPIEDIR)/include | 14 | INCLUDEPATH += $(OPIEDIR)/include |
17 | DESTDIR = $(OPIEDIR)/plugins/styles | 15 | DESTDIR = $(OPIEDIR)/plugins/styles |
18 | TARGET = liquid | 16 | TARGET = liquid |
19 | VERSION = 1.0.0 | 17 | VERSION = 1.0.0 |
20 | 18 | ||
21 | TRANSLATIONS = ../../../i18n/de/libliquid.ts \ | 19 | TRANSLATIONS = ../../../i18n/de/libliquid.ts \ |
22 | ../../../i18n/en/libliquid.ts \ | 20 | ../../../i18n/en/libliquid.ts \ |
23 | ../../../i18n/es/libliquid.ts \ | 21 | ../../../i18n/es/libliquid.ts \ |
24 | ../../../i18n/fr/libliquid.ts \ | 22 | ../../../i18n/fr/libliquid.ts \ |
25 | ../../../i18n/hu/libliquid.ts \ | 23 | ../../../i18n/hu/libliquid.ts \ |
26 | ../../../i18n/ja/libliquid.ts \ | 24 | ../../../i18n/ja/libliquid.ts \ |
27 | ../../../i18n/ko/libliquid.ts \ | 25 | ../../../i18n/ko/libliquid.ts \ |
28 | ../../../i18n/no/libliquid.ts \ | 26 | ../../../i18n/no/libliquid.ts \ |
29 | ../../../i18n/pl/libliquid.ts \ | 27 | ../../../i18n/pl/libliquid.ts \ |
30 | ../../../i18n/pt/libliquid.ts \ | 28 | ../../../i18n/pt/libliquid.ts \ |
31 | ../../../i18n/pt_BR/libliquid.ts \ | 29 | ../../../i18n/pt_BR/libliquid.ts \ |
32 | ../../../i18n/sl/libliquid.ts \ | 30 | ../../../i18n/sl/libliquid.ts \ |
33 | ../../../i18n/zh_CN/libliquid.ts \ | 31 | ../../../i18n/zh_CN/libliquid.ts \ |
34 | ../../../i18n/zh_TW/libliquid.ts | 32 | ../../../i18n/zh_TW/libliquid.ts |
diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp index 4fffe12..ea0b3c9 100644 --- a/noncore/styles/liquid/liquidset.cpp +++ b/noncore/styles/liquid/liquidset.cpp | |||
@@ -1,200 +1,169 @@ | |||
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 <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qradiobutton.h> | 31 | #include <qradiobutton.h> |
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | 37 | ||
38 | #include <opie/ocolorbutton.h> | 38 | #include <opie/ocolorbutton.h> |
39 | 39 | ||
40 | 40 | ||
41 | static void changeButtonColor ( QWidget *btn, const QColor &col ) | ||
42 | { | ||
43 | QPalette pal = btn-> palette ( ); | ||
44 | |||
45 | pal. setColor ( QPalette::Normal, QColorGroup::Button, col ); | ||
46 | pal. setColor ( QPalette::Active, QColorGroup::Button, col ); | ||
47 | pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); | ||
48 | pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); | ||
49 | pal. setColor ( QPalette::Normal, QColorGroup::Background, col ); | ||
50 | pal. setColor ( QPalette::Active, QColorGroup::Background, col ); | ||
51 | pal. setColor ( QPalette::Disabled, QColorGroup::Background, col ); | ||
52 | pal. setColor ( QPalette::Inactive, QColorGroup::Background, col ); | ||
53 | |||
54 | btn-> setPalette ( pal ); | ||
55 | } | ||
56 | |||
57 | |||
58 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) | 41 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) |
59 | : QWidget ( parent, name, fl ) | 42 | : QWidget ( parent, name, fl ) |
60 | { | 43 | { |
61 | setCaption ( tr( "Liquid Style" ) ); | 44 | setCaption ( tr( "Liquid Style" ) ); |
62 | 45 | ||
63 | Config config ( "qpe" ); | 46 | Config config ( "qpe" ); |
64 | config. setGroup ( "Liquid-Style" ); | 47 | config. setGroup ( "Liquid-Style" ); |
65 | 48 | ||
66 | m_type = config. readNumEntry ( "Type", TransStippleBg ); | 49 | m_type = config. readNumEntry ( "Type", TransStippleBg ); |
67 | QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); | 50 | QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); |
68 | QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); | 51 | QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); |
69 | int opacity = config. readNumEntry ( "Opacity", 10 ); | 52 | int opacity = config. readNumEntry ( "Opacity", 10 ); |
70 | m_shadow = config. readBoolEntry ( "ShadowText", true ); | 53 | m_shadow = config. readBoolEntry ( "ShadowText", true ); |
71 | m_deco = config. readBoolEntry ( "WinDecoration", true ); | ||
72 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); | 54 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); |
73 | m_flat = config. readBoolEntry ( "FlatToolButtons", false ); | 55 | m_flat = config. readBoolEntry ( "FlatToolButtons", false ); |
74 | 56 | ||
75 | QVBoxLayout *vbox = new QVBoxLayout ( this ); | 57 | QVBoxLayout *vbox = new QVBoxLayout ( this ); |
76 | vbox-> setSpacing ( 3 ); | 58 | vbox-> setSpacing ( 3 ); |
77 | vbox-> setMargin ( 4 ); | 59 | vbox-> setMargin ( 4 ); |
78 | 60 | ||
79 | QComboBox *cb = new QComboBox ( this ); | 61 | QComboBox *cb = new QComboBox ( this ); |
80 | cb-> insertItem ( tr( "No translucency" ), None ); | 62 | cb-> insertItem ( tr( "No translucency" ), None ); |
81 | cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); | 63 | cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); |
82 | cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); | 64 | cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); |
83 | cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); | 65 | cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); |
84 | cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); | 66 | cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); |
85 | cb-> insertItem ( tr( "Custom translucency" ), Custom ); | 67 | cb-> insertItem ( tr( "Custom translucency" ), Custom ); |
86 | 68 | ||
87 | cb-> setCurrentItem ( m_type ); | 69 | cb-> setCurrentItem ( m_type ); |
88 | vbox-> addWidget ( cb ); | 70 | vbox-> addWidget ( cb ); |
89 | 71 | ||
90 | 72 | ||
91 | QGridLayout *grid = new QGridLayout ( vbox ); | 73 | QGridLayout *grid = new QGridLayout ( vbox ); |
92 | grid-> addColSpacing ( 0, 16 ); | 74 | grid-> addColSpacing ( 0, 16 ); |
93 | grid-> addColSpacing ( 3, 8 ); | 75 | grid-> addColSpacing ( 3, 8 ); |
94 | 76 | ||
95 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); | 77 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); |
96 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); | 78 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); |
97 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); | 79 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); |
98 | 80 | ||
99 | m_menubtn = new OColorButton ( this ); | 81 | m_menubtn = new OColorButton ( this ); |
100 | m_menubtn-> setColor ( mcol ); | 82 | m_menubtn-> setColor ( mcol ); |
101 | grid-> addWidget ( m_menubtn, 0, 2 ); | 83 | grid-> addWidget ( m_menubtn, 0, 2 ); |
102 | 84 | ||
103 | m_textbtn = new OColorButton ( this ); | 85 | m_textbtn = new OColorButton ( this ); |
104 | m_textbtn-> setColor ( tcol ); | 86 | m_textbtn-> setColor ( tcol ); |
105 | grid-> addWidget ( m_textbtn, 0, 5 ); | 87 | grid-> addWidget ( m_textbtn, 0, 5 ); |
106 | 88 | ||
107 | m_opacsld = new QSlider ( Horizontal, this ); | 89 | m_opacsld = new QSlider ( Horizontal, this ); |
108 | m_opacsld-> setRange ( -20, 20 ); | 90 | m_opacsld-> setRange ( -20, 20 ); |
109 | m_opacsld-> setValue ( opacity ); | 91 | m_opacsld-> setValue ( opacity ); |
110 | m_opacsld-> setTickmarks ( QSlider::Below ); | 92 | m_opacsld-> setTickmarks ( QSlider::Below ); |
111 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); | 93 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); |
112 | 94 | ||
113 | vbox-> addSpacing ( 4 ); | 95 | vbox-> addSpacing ( 4 ); |
114 | 96 | ||
115 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); | 97 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); |
116 | shadow-> setChecked ( m_shadow ); | 98 | shadow-> setChecked ( m_shadow ); |
117 | vbox-> addWidget ( shadow ); | 99 | vbox-> addWidget ( shadow ); |
118 | 100 | ||
119 | vbox-> addSpacing ( 4 ); | 101 | vbox-> addSpacing ( 4 ); |
120 | 102 | ||
121 | QCheckBox *windeco = new QCheckBox ( tr( "Draw liquid window title bars" ), this ); | ||
122 | windeco-> setChecked ( m_deco ); | ||
123 | vbox-> addWidget ( windeco ); | ||
124 | |||
125 | vbox-> addSpacing ( 4 ); | ||
126 | |||
127 | QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); | 103 | QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); |
128 | flattb-> setChecked ( m_flat ); | 104 | flattb-> setChecked ( m_flat ); |
129 | vbox-> addWidget ( flattb ); | 105 | vbox-> addWidget ( flattb ); |
130 | 106 | ||
131 | vbox-> addSpacing ( 4 ); | 107 | vbox-> addSpacing ( 4 ); |
132 | 108 | ||
133 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); | 109 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); |
134 | 110 | ||
135 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); | 111 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); |
136 | 112 | ||
137 | m_contsld = new QSlider ( Horizontal, this ); | 113 | m_contsld = new QSlider ( Horizontal, this ); |
138 | m_contsld-> setRange ( 0, 10 ); | 114 | m_contsld-> setRange ( 0, 10 ); |
139 | m_contsld-> setValue ( contrast ); | 115 | m_contsld-> setValue ( contrast ); |
140 | m_contsld-> setTickmarks ( QSlider::Below ); | 116 | m_contsld-> setTickmarks ( QSlider::Below ); |
141 | hbox-> addWidget ( m_contsld, 10 ); | 117 | hbox-> addWidget ( m_contsld, 10 ); |
142 | 118 | ||
143 | vbox-> addStretch ( 10 ); | 119 | vbox-> addStretch ( 10 ); |
144 | 120 | ||
145 | changeType ( m_type ); | 121 | changeType ( m_type ); |
146 | 122 | ||
147 | connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); | 123 | connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); |
148 | connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); | 124 | connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); |
149 | connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) ); | ||
150 | connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); | 125 | connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); |
151 | } | 126 | } |
152 | 127 | ||
153 | void LiquidSettings::changeType ( int t ) | 128 | void LiquidSettings::changeType ( int t ) |
154 | { | 129 | { |
155 | bool custom = ( t == Custom ); | 130 | bool custom = ( t == Custom ); |
156 | 131 | ||
157 | m_menulbl-> setEnabled ( custom ); | 132 | m_menulbl-> setEnabled ( custom ); |
158 | m_textlbl-> setEnabled ( custom ); | 133 | m_textlbl-> setEnabled ( custom ); |
159 | m_opaclbl-> setEnabled ( custom ); | 134 | m_opaclbl-> setEnabled ( custom ); |
160 | m_menubtn-> setEnabled ( custom ); | 135 | m_menubtn-> setEnabled ( custom ); |
161 | m_textbtn-> setEnabled ( custom ); | 136 | m_textbtn-> setEnabled ( custom ); |
162 | m_opacsld-> setEnabled ( custom ); | 137 | m_opacsld-> setEnabled ( custom ); |
163 | 138 | ||
164 | m_type = t; | 139 | m_type = t; |
165 | } | 140 | } |
166 | 141 | ||
167 | void LiquidSettings::changeShadow ( bool b ) | 142 | void LiquidSettings::changeShadow ( bool b ) |
168 | { | 143 | { |
169 | m_shadow = b; | 144 | m_shadow = b; |
170 | } | 145 | } |
171 | 146 | ||
172 | void LiquidSettings::changeDeco ( bool b ) | ||
173 | { | ||
174 | m_deco = b; | ||
175 | } | ||
176 | |||
177 | void LiquidSettings::changeFlat ( bool b ) | 147 | void LiquidSettings::changeFlat ( bool b ) |
178 | { | 148 | { |
179 | m_flat = b; | 149 | m_flat = b; |
180 | } | 150 | } |
181 | 151 | ||
182 | 152 | ||
183 | bool LiquidSettings::writeConfig ( ) | 153 | bool LiquidSettings::writeConfig ( ) |
184 | { | 154 | { |
185 | Config config ( "qpe" ); | 155 | Config config ( "qpe" ); |
186 | config. setGroup ( "Liquid-Style" ); | 156 | config. setGroup ( "Liquid-Style" ); |
187 | 157 | ||
188 | config. writeEntry ( "Type", m_type ); | 158 | config. writeEntry ( "Type", m_type ); |
189 | config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); | 159 | config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); |
190 | config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); | 160 | config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); |
191 | config. writeEntry ( "Opacity", m_opacsld-> value ( )); | 161 | config. writeEntry ( "Opacity", m_opacsld-> value ( )); |
192 | config. writeEntry ( "ShadowText", m_shadow ); | 162 | config. writeEntry ( "ShadowText", m_shadow ); |
193 | config. writeEntry ( "WinDecoration", m_deco ); | ||
194 | config. writeEntry ( "StippleContrast", m_contsld-> value ( )); | 163 | config. writeEntry ( "StippleContrast", m_contsld-> value ( )); |
195 | config. writeEntry ( "FlatToolButtons", m_flat ); | 164 | config. writeEntry ( "FlatToolButtons", m_flat ); |
196 | config. write ( ); | 165 | config. write ( ); |
197 | 166 | ||
198 | return true; | 167 | return true; |
199 | } | 168 | } |
200 | 169 | ||
diff --git a/noncore/styles/liquid/liquidset.h b/noncore/styles/liquid/liquidset.h index 8a03447..6d9555a 100644 --- a/noncore/styles/liquid/liquidset.h +++ b/noncore/styles/liquid/liquidset.h | |||
@@ -1,39 +1,37 @@ | |||
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 | ||
7 | class QLabel; | 7 | class QLabel; |
8 | class OColorButton; | 8 | class OColorButton; |
9 | class QSlider; | 9 | class QSlider; |
10 | 10 | ||
11 | class LiquidSettings : public QWidget { | 11 | class LiquidSettings : public QWidget { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public: | 14 | public: |
15 | LiquidSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | 15 | LiquidSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
16 | 16 | ||
17 | public slots: | 17 | public slots: |
18 | void changeType ( int t ); | 18 | void changeType ( int t ); |
19 | void changeShadow ( bool b ); | 19 | void changeShadow ( bool b ); |
20 | void changeDeco ( bool b ); | ||
21 | void changeFlat ( bool b ); | 20 | void changeFlat ( bool b ); |
22 | 21 | ||
23 | virtual bool writeConfig ( ); | 22 | virtual bool writeConfig ( ); |
24 | 23 | ||
25 | private: | 24 | private: |
26 | int m_type; | 25 | int m_type; |
27 | bool m_shadow; | 26 | bool m_shadow; |
28 | bool m_deco; | ||
29 | bool m_flat; | 27 | bool m_flat; |
30 | 28 | ||
31 | QSlider * m_opacsld; | 29 | QSlider * m_opacsld; |
32 | QSlider * m_contsld; | 30 | QSlider * m_contsld; |
33 | QLabel * m_menulbl; | 31 | QLabel * m_menulbl; |
34 | QLabel * m_textlbl; | 32 | QLabel * m_textlbl; |
35 | QLabel * m_opaclbl; | 33 | QLabel * m_opaclbl; |
36 | OColorButton *m_menubtn; | 34 | OColorButton *m_menubtn; |
37 | OColorButton *m_textbtn; | 35 | OColorButton *m_textbtn; |
38 | }; | 36 | }; |
39 | #endif | 37 | #endif |
diff --git a/noncore/styles/liquid/plugin.cpp b/noncore/styles/liquid/plugin.cpp index 5f4c8e5..0740420 100644 --- a/noncore/styles/liquid/plugin.cpp +++ b/noncore/styles/liquid/plugin.cpp | |||
@@ -1,113 +1,84 @@ | |||
1 | #include <qapplication.h> | ||
2 | |||
1 | #include "liquid.h" | 3 | #include "liquid.h" |
2 | #include "liquidset.h" | 4 | #include "liquidset.h" |
3 | #include "plugin.h" | 5 | #include "plugin.h" |
4 | 6 | ||
5 | 7 | ||
6 | 8 | ||
7 | LiquidInterface::LiquidInterface ( ) : ref ( 0 ) | 9 | LiquidInterface::LiquidInterface ( ) : ref ( 0 ) |
8 | { | 10 | { |
11 | m_widget = 0; | ||
9 | } | 12 | } |
10 | 13 | ||
11 | LiquidInterface::~LiquidInterface ( ) | 14 | LiquidInterface::~LiquidInterface ( ) |
12 | { | 15 | { |
13 | } | 16 | } |
14 | 17 | ||
15 | QStyle *LiquidInterface::create ( ) | 18 | QStyle *LiquidInterface::style ( ) |
16 | { | 19 | { |
17 | return new LiquidStyle ( ); | 20 | return new LiquidStyle ( ); |
18 | } | 21 | } |
19 | 22 | ||
20 | QString LiquidInterface::name ( ) | 23 | QString LiquidInterface::name ( ) const |
21 | { | ||
22 | return QObject::tr( "Liquid", "name" ); | ||
23 | } | ||
24 | |||
25 | QString LiquidInterface::description ( ) | ||
26 | { | ||
27 | return QObject::tr( "High Performance Liquid style by Mosfet", "description" ); | ||
28 | } | ||
29 | |||
30 | QCString LiquidInterface::key ( ) | ||
31 | { | 24 | { |
32 | return QCString ( "liquid" ); | 25 | return qApp-> translate ( "Styles", "Liquid" ); |
33 | } | 26 | } |
34 | 27 | ||
35 | unsigned int LiquidInterface::version ( ) | 28 | QString LiquidInterface::description ( ) const |
36 | { | 29 | { |
37 | return 100; // 1.0.0 (\d+.\d.\d) | 30 | return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); |
38 | } | 31 | } |
39 | 32 | ||
40 | QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 33 | bool LiquidInterface::hasSettings ( ) const |
41 | { | 34 | { |
42 | static LiquidSettingsInterface *setiface = 0; | 35 | return true; |
43 | |||
44 | *iface = 0; | ||
45 | |||
46 | if ( uuid == IID_QUnknown ) | ||
47 | *iface = this; | ||
48 | else if ( uuid == IID_Style ) | ||
49 | *iface = this; | ||
50 | else if ( uuid == IID_StyleSettings ) { | ||
51 | if ( !setiface ) | ||
52 | setiface = new LiquidSettingsInterface ( ); | ||
53 | *iface = setiface; | ||
54 | } | ||
55 | |||
56 | if ( *iface ) | ||
57 | (*iface)-> addRef ( ); | ||
58 | |||
59 | return QS_OK; | ||
60 | } | 36 | } |
61 | 37 | ||
62 | Q_EXPORT_INTERFACE() | 38 | QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) |
63 | { | ||
64 | Q_CREATE_INSTANCE( LiquidInterface ) | ||
65 | } | ||
66 | |||
67 | |||
68 | LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) | ||
69 | { | ||
70 | m_widget = 0; | ||
71 | } | ||
72 | |||
73 | LiquidSettingsInterface::~LiquidSettingsInterface ( ) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) | ||
78 | { | 39 | { |
79 | m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); | 40 | m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); |
80 | 41 | ||
81 | return m_widget; | 42 | return m_widget; |
82 | } | 43 | } |
83 | 44 | ||
84 | bool LiquidSettingsInterface::accept ( ) | 45 | bool LiquidInterface::accept ( ) |
85 | { | 46 | { |
86 | if ( !m_widget ) | 47 | if ( !m_widget ) |
87 | return false; | 48 | return false; |
88 | 49 | ||
89 | return m_widget-> writeConfig ( ); | 50 | return m_widget-> writeConfig ( ); |
90 | } | 51 | } |
91 | 52 | ||
92 | void LiquidSettingsInterface::reject ( ) | 53 | void LiquidInterface::reject ( ) |
93 | { | 54 | { |
94 | } | 55 | } |
95 | 56 | ||
96 | QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 57 | |
58 | QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
97 | { | 59 | { |
98 | *iface = 0; | 60 | *iface = 0; |
99 | 61 | ||
100 | |||
101 | if ( uuid == IID_QUnknown ) | 62 | if ( uuid == IID_QUnknown ) |
102 | *iface = this; | 63 | *iface = this; |
103 | else if ( uuid == IID_StyleSettings ) | 64 | else if ( uuid == IID_Style ) |
65 | *iface = this; | ||
66 | else if ( uuid == IID_StyleExtended ) | ||
104 | *iface = this; | 67 | *iface = this; |
105 | 68 | ||
106 | if ( *iface ) | 69 | if ( *iface ) |
107 | (*iface)-> addRef ( ); | 70 | (*iface)-> addRef ( ); |
108 | 71 | ||
109 | return QS_OK; | 72 | return QS_OK; |
110 | } | 73 | } |
111 | 74 | ||
75 | Q_EXPORT_INTERFACE() | ||
76 | { | ||
77 | Q_CREATE_INSTANCE( LiquidInterface ) | ||
78 | } | ||
79 | |||
80 | |||
81 | |||
82 | |||
112 | // Hack for Retail Z experiments | 83 | // Hack for Retail Z experiments |
113 | extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } | 84 | extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } |
diff --git a/noncore/styles/liquid/plugin.h b/noncore/styles/liquid/plugin.h index 759577f..6a9b7ac 100644 --- a/noncore/styles/liquid/plugin.h +++ b/noncore/styles/liquid/plugin.h | |||
@@ -1,46 +1,34 @@ | |||
1 | #ifndef __OPIE_LIQUID_PLUGIN_H__ | 1 | #ifndef __OPIE_LIQUID_PLUGIN_H__ |
2 | #define __OPIE_LIQUID_PLUGIN_H__ | 2 | #define __OPIE_LIQUID_PLUGIN_H__ |
3 | 3 | ||
4 | #include <qpe/styleinterface.h> | 4 | #include <qpe/styleinterface.h> |
5 | 5 | ||
6 | class LiquidSettings; | 6 | class LiquidSettings; |
7 | 7 | ||
8 | class LiquidInterface : public StyleInterface { | 8 | class LiquidInterface : public StyleExtendedInterface { |
9 | public: | 9 | public: |
10 | LiquidInterface ( ); | 10 | LiquidInterface ( ); |
11 | virtual ~LiquidInterface ( ); | 11 | virtual ~LiquidInterface ( ); |
12 | 12 | ||
13 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); | 13 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); |
14 | Q_REFCOUNT | 14 | Q_REFCOUNT |
15 | 15 | ||
16 | virtual QStyle *create ( ); | 16 | virtual QStyle *style ( ); |
17 | 17 | ||
18 | virtual QString description ( ); | 18 | virtual QString name ( ) const; |
19 | virtual QString name ( ); | ||
20 | virtual QCString key ( ); | ||
21 | |||
22 | virtual unsigned int version ( ); | ||
23 | |||
24 | private: | ||
25 | ulong ref; | ||
26 | }; | ||
27 | 19 | ||
28 | class LiquidSettingsInterface : public StyleSettingsInterface { | 20 | virtual QString description ( ) const; |
29 | public: | 21 | |
30 | LiquidSettingsInterface ( ); | 22 | virtual bool hasSettings ( ) const; |
31 | virtual ~LiquidSettingsInterface ( ); | ||
32 | 23 | ||
33 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); | ||
34 | Q_REFCOUNT | ||
35 | |||
36 | virtual QWidget *create ( QWidget *parent, const char *name = 0 ); | 24 | virtual QWidget *create ( QWidget *parent, const char *name = 0 ); |
37 | 25 | ||
38 | virtual bool accept ( ); | 26 | virtual bool accept ( ); |
39 | virtual void reject ( ); | 27 | virtual void reject ( ); |
40 | 28 | ||
41 | private: | 29 | private: |
42 | LiquidSettings *m_widget; | 30 | LiquidSettings *m_widget; |
43 | ulong ref; | 31 | ulong ref; |
44 | }; | 32 | }; |
45 | 33 | ||
46 | #endif | 34 | #endif |
diff --git a/noncore/styles/metal/plugin.cpp b/noncore/styles/metal/plugin.cpp index 1db4aac..4c9f64d 100644 --- a/noncore/styles/metal/plugin.cpp +++ b/noncore/styles/metal/plugin.cpp | |||
@@ -1,57 +1,45 @@ | |||
1 | #include <qapplication.h> | ||
2 | |||
1 | #include "metal.h" | 3 | #include "metal.h" |
2 | #include "plugin.h" | 4 | #include "plugin.h" |
3 | 5 | ||
4 | 6 | ||
5 | MetalInterface::MetalInterface ( ) : ref ( 0 ) | 7 | MetalInterface::MetalInterface ( ) : ref ( 0 ) |
6 | { | 8 | { |
7 | } | 9 | } |
8 | 10 | ||
9 | MetalInterface::~MetalInterface ( ) | 11 | MetalInterface::~MetalInterface ( ) |
10 | { | 12 | { |
11 | } | 13 | } |
12 | 14 | ||
13 | QStyle *MetalInterface::create ( ) | 15 | QStyle *MetalInterface::style ( ) |
14 | { | 16 | { |
15 | return new MetalStyle ( ); | 17 | return new MetalStyle ( ); |
16 | } | 18 | } |
17 | 19 | ||
18 | QString MetalInterface::name ( ) | 20 | QString MetalInterface::name ( ) const |
19 | { | 21 | { |
20 | return QObject::tr( "Metal", "name" ); | 22 | return qApp-> translate ( "Styles", "Metal" ); |
21 | } | 23 | } |
22 | 24 | ||
23 | QString MetalInterface::description ( ) | ||
24 | { | ||
25 | return QObject::tr( "Metal style", "description" ); | ||
26 | } | ||
27 | |||
28 | QCString MetalInterface::key ( ) | ||
29 | { | ||
30 | return QCString ( "metal" ); | ||
31 | } | ||
32 | |||
33 | unsigned int MetalInterface::version ( ) | ||
34 | { | ||
35 | return 100; // 1.0.0 (\d+.\d.\d) | ||
36 | } | ||
37 | 25 | ||
38 | QRESULT MetalInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 26 | QRESULT MetalInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
39 | { | 27 | { |
40 | *iface = 0; | 28 | *iface = 0; |
41 | 29 | ||
42 | if ( uuid == IID_QUnknown ) | 30 | if ( uuid == IID_QUnknown ) |
43 | *iface = this; | 31 | *iface = this; |
44 | else if ( uuid == IID_Style ) | 32 | else if ( uuid == IID_Style ) |
45 | *iface = this; | 33 | *iface = this; |
46 | 34 | ||
47 | if ( *iface ) | 35 | if ( *iface ) |
48 | (*iface)-> addRef ( ); | 36 | (*iface)-> addRef ( ); |
49 | 37 | ||
50 | return QS_OK; | 38 | return QS_OK; |
51 | } | 39 | } |
52 | 40 | ||
53 | Q_EXPORT_INTERFACE() | 41 | Q_EXPORT_INTERFACE() |
54 | { | 42 | { |
55 | Q_CREATE_INSTANCE( MetalInterface ) | 43 | Q_CREATE_INSTANCE( MetalInterface ) |
56 | } | 44 | } |
57 | 45 | ||
diff --git a/noncore/styles/metal/plugin.h b/noncore/styles/metal/plugin.h index f61c833..545aea9 100644 --- a/noncore/styles/metal/plugin.h +++ b/noncore/styles/metal/plugin.h | |||
@@ -1,27 +1,22 @@ | |||
1 | #ifndef __OPIE_METAL_PLUGIN_H__ | 1 | #ifndef __OPIE_METAL_PLUGIN_H__ |
2 | #define __OPIE_METAL_PLUGIN_H__ | 2 | #define __OPIE_METAL_PLUGIN_H__ |
3 | 3 | ||
4 | #include <qpe/styleinterface.h> | 4 | #include <qpe/styleinterface.h> |
5 | 5 | ||
6 | 6 | ||
7 | class MetalInterface : public StyleInterface { | 7 | class MetalInterface : public StyleInterface { |
8 | public: | 8 | public: |
9 | MetalInterface ( ); | 9 | MetalInterface ( ); |
10 | virtual ~MetalInterface ( ); | 10 | virtual ~MetalInterface ( ); |
11 | 11 | ||
12 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); | 12 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); |
13 | Q_REFCOUNT | 13 | Q_REFCOUNT |
14 | 14 | ||
15 | virtual QStyle *create ( ); | 15 | virtual QStyle *style ( ); |
16 | 16 | virtual QString name ( ) const; | |
17 | virtual QString description ( ); | ||
18 | virtual QString name ( ); | ||
19 | virtual QCString key ( ); | ||
20 | |||
21 | virtual unsigned int version ( ); | ||
22 | 17 | ||
23 | private: | 18 | private: |
24 | ulong ref; | 19 | ulong ref; |
25 | }; | 20 | }; |
26 | 21 | ||
27 | #endif | 22 | #endif |
diff --git a/noncore/styles/theme/plugin.cpp b/noncore/styles/theme/plugin.cpp index 4383693..2560720 100644 --- a/noncore/styles/theme/plugin.cpp +++ b/noncore/styles/theme/plugin.cpp | |||
@@ -1,111 +1,81 @@ | |||
1 | #include <qapplication.h> | ||
2 | |||
1 | #include "othemestyle.h" | 3 | #include "othemestyle.h" |
2 | #include "themeset.h" | 4 | #include "themeset.h" |
3 | #include "plugin.h" | 5 | #include "plugin.h" |
4 | 6 | ||
5 | 7 | ||
6 | 8 | ||
7 | ThemeInterface::ThemeInterface ( ) : ref ( 0 ) | 9 | ThemeInterface::ThemeInterface ( ) : ref ( 0 ) |
8 | { | 10 | { |
11 | m_widget = 0; | ||
9 | } | 12 | } |
10 | 13 | ||
11 | ThemeInterface::~ThemeInterface ( ) | 14 | ThemeInterface::~ThemeInterface ( ) |
12 | { | 15 | { |
13 | } | 16 | } |
14 | 17 | ||
15 | QStyle *ThemeInterface::create ( ) | 18 | QStyle *ThemeInterface::style ( ) |
16 | { | 19 | { |
17 | return new OThemeStyle ( "" ); | 20 | return new OThemeStyle ( "" ); |
18 | } | 21 | } |
19 | 22 | ||
20 | QString ThemeInterface::name ( ) | 23 | QString ThemeInterface::name ( ) const |
21 | { | ||
22 | return QObject::tr( "Themed style", "name" ); | ||
23 | } | ||
24 | |||
25 | QString ThemeInterface::description ( ) | ||
26 | { | ||
27 | return QObject::tr( "KDE2 theme compatible style engine", "description" ); | ||
28 | } | ||
29 | |||
30 | QCString ThemeInterface::key ( ) | ||
31 | { | ||
32 | return QCString ( "theme" ); | ||
33 | } | ||
34 | |||
35 | unsigned int ThemeInterface::version ( ) | ||
36 | { | 24 | { |
37 | return 100; // 1.0.0 (\d+.\d.\d) | 25 | return qApp-> translate ( "Styles", "Themed style" ); |
38 | } | 26 | } |
39 | 27 | ||
40 | QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 28 | QString ThemeInterface::description ( ) const |
41 | { | 29 | { |
42 | static ThemeSettingsInterface *setiface = 0; | 30 | return qApp-> translate ( "Styles", "KDE2 theme compatible style engine" ); |
43 | |||
44 | *iface = 0; | ||
45 | |||
46 | if ( uuid == IID_QUnknown ) | ||
47 | *iface = this; | ||
48 | else if ( uuid == IID_Style ) | ||
49 | *iface = this; | ||
50 | else if ( uuid == IID_StyleSettings ) { | ||
51 | if ( !setiface ) | ||
52 | setiface = new ThemeSettingsInterface ( ); | ||
53 | *iface = setiface; | ||
54 | } | ||
55 | |||
56 | if ( *iface ) | ||
57 | (*iface)-> addRef ( ); | ||
58 | |||
59 | return QS_OK; | ||
60 | } | 31 | } |
61 | 32 | ||
62 | Q_EXPORT_INTERFACE() | 33 | bool ThemeInterface::hasSettings ( ) const |
63 | { | 34 | { |
64 | Q_CREATE_INSTANCE( ThemeInterface ) | 35 | return true; |
65 | } | 36 | } |
66 | 37 | ||
67 | 38 | QWidget *ThemeInterface::create ( QWidget *parent, const char *name ) | |
68 | ThemeSettingsInterface::ThemeSettingsInterface ( ) : ref ( 0 ) | ||
69 | { | ||
70 | m_widget = 0; | ||
71 | } | ||
72 | |||
73 | ThemeSettingsInterface::~ThemeSettingsInterface ( ) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | QWidget *ThemeSettingsInterface::create ( QWidget *parent, const char *name ) | ||
78 | { | 39 | { |
79 | m_widget = new ThemeSettings ( parent, name ? name : "THEME-SETTINGS" ); | 40 | m_widget = new ThemeSettings ( parent, name ? name : "THEME-SETTINGS" ); |
80 | 41 | ||
81 | return m_widget; | 42 | return m_widget; |
82 | } | 43 | } |
83 | 44 | ||
84 | bool ThemeSettingsInterface::accept ( ) | 45 | bool ThemeInterface::accept ( ) |
85 | { | 46 | { |
86 | if ( !m_widget ) | 47 | if ( !m_widget ) |
87 | return false; | 48 | return false; |
88 | 49 | ||
89 | return m_widget-> writeConfig ( ); | 50 | return m_widget-> writeConfig ( ); |
90 | } | 51 | } |
91 | 52 | ||
92 | void ThemeSettingsInterface::reject ( ) | 53 | void ThemeInterface::reject ( ) |
93 | { | 54 | { |
94 | } | 55 | } |
95 | 56 | ||
96 | QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 57 | |
58 | QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
97 | { | 59 | { |
98 | *iface = 0; | 60 | *iface = 0; |
99 | 61 | ||
100 | |||
101 | if ( uuid == IID_QUnknown ) | 62 | if ( uuid == IID_QUnknown ) |
102 | *iface = this; | 63 | *iface = this; |
103 | else if ( uuid == IID_StyleSettings ) | 64 | else if ( uuid == IID_Style ) |
65 | *iface = this; | ||
66 | else if ( uuid == IID_StyleExtended ) | ||
104 | *iface = this; | 67 | *iface = this; |
105 | 68 | ||
106 | if ( *iface ) | 69 | if ( *iface ) |
107 | (*iface)-> addRef ( ); | 70 | (*iface)-> addRef ( ); |
108 | 71 | ||
109 | return QS_OK; | 72 | return QS_OK; |
110 | } | 73 | } |
111 | 74 | ||
75 | Q_EXPORT_INTERFACE() | ||
76 | { | ||
77 | Q_CREATE_INSTANCE( ThemeInterface ) | ||
78 | } | ||
79 | |||
80 | |||
81 | |||
diff --git a/noncore/styles/theme/plugin.h b/noncore/styles/theme/plugin.h index d13fc5d..60cae97 100644 --- a/noncore/styles/theme/plugin.h +++ b/noncore/styles/theme/plugin.h | |||
@@ -1,46 +1,33 @@ | |||
1 | #ifndef __OPIE_THEME_PLUGIN_H__ | 1 | #ifndef __OPIE_THEME_PLUGIN_H__ |
2 | #define __OPIE_THEME_PLUGIN_H__ | 2 | #define __OPIE_THEME_PLUGIN_H__ |
3 | 3 | ||
4 | #include <qpe/styleinterface.h> | 4 | #include <qpe/styleinterface.h> |
5 | 5 | ||
6 | class ThemeSettings; | 6 | class ThemeSettings; |
7 | 7 | ||
8 | class ThemeInterface : public StyleInterface { | 8 | class ThemeInterface : public StyleExtendedInterface { |
9 | public: | 9 | public: |
10 | ThemeInterface ( ); | 10 | ThemeInterface ( ); |
11 | virtual ~ThemeInterface ( ); | 11 | virtual ~ThemeInterface ( ); |
12 | 12 | ||
13 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); | 13 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); |
14 | Q_REFCOUNT | 14 | Q_REFCOUNT |
15 | 15 | ||
16 | virtual QStyle *create ( ); | 16 | virtual QStyle *style ( ); |
17 | virtual QString name ( ) const; | ||
17 | 18 | ||
18 | virtual QString description ( ); | 19 | virtual QString description ( ) const; |
19 | virtual QString name ( ); | ||
20 | virtual QCString key ( ); | ||
21 | 20 | ||
22 | virtual unsigned int version ( ); | 21 | virtual bool hasSettings ( ) const; |
23 | 22 | ||
24 | private: | ||
25 | ulong ref; | ||
26 | }; | ||
27 | |||
28 | class ThemeSettingsInterface : public StyleSettingsInterface { | ||
29 | public: | ||
30 | ThemeSettingsInterface ( ); | ||
31 | virtual ~ThemeSettingsInterface ( ); | ||
32 | |||
33 | QRESULT queryInterface ( const QUuid &, QUnknownInterface ** ); | ||
34 | Q_REFCOUNT | ||
35 | |||
36 | virtual QWidget *create ( QWidget *parent, const char *name = 0 ); | 23 | virtual QWidget *create ( QWidget *parent, const char *name = 0 ); |
37 | 24 | ||
38 | virtual bool accept ( ); | 25 | virtual bool accept ( ); |
39 | virtual void reject ( ); | 26 | virtual void reject ( ); |
40 | 27 | ||
41 | private: | 28 | private: |
42 | ThemeSettings *m_widget; | 29 | ThemeSettings *m_widget; |
43 | ulong ref; | 30 | ulong ref; |
44 | }; | 31 | }; |
45 | 32 | ||
46 | #endif | 33 | #endif |