summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp2
-rw-r--r--noncore/styles/liquid/liquid.pro2
-rw-r--r--noncore/styles/liquid/liquidset.cpp31
-rw-r--r--noncore/styles/liquid/liquidset.h2
-rw-r--r--noncore/styles/liquid/plugin.cpp81
-rw-r--r--noncore/styles/liquid/plugin.h26
-rw-r--r--noncore/styles/metal/plugin.cpp22
-rw-r--r--noncore/styles/metal/plugin.h9
-rw-r--r--noncore/styles/theme/plugin.cpp80
-rw-r--r--noncore/styles/theme/plugin.h23
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,397 +1,397 @@
1/*- 1/*-
2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
3 */ 3 */
4 4
5 5
6 6
7#ifndef INCLUDE_MENUITEM_DEF 7#ifndef INCLUDE_MENUITEM_DEF
8#define INCLUDE_MENUITEM_DEF 8#define INCLUDE_MENUITEM_DEF
9#endif 9#endif
10 10
11#include <qmenudata.h> 11#include <qmenudata.h>
12#include "liquid.h" 12#include "liquid.h"
13#include "liquiddeco.h" 13//#include "liquiddeco.h"
14#include <qapplication.h> 14#include <qapplication.h>
15#include <qpe/config.h> 15#include <qpe/config.h>
16#include "effects.h" 16#include "effects.h"
17#include <qpalette.h> 17#include <qpalette.h>
18#include <qbitmap.h> 18#include <qbitmap.h>
19#include <qtabbar.h> 19#include <qtabbar.h>
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qobjectlist.h> 21#include <qobjectlist.h>
22#include <qimage.h> 22#include <qimage.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qpixmapcache.h> 24#include <qpixmapcache.h>
25#include <qradiobutton.h> 25#include <qradiobutton.h>
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qwidgetlist.h> 28#include <qwidgetlist.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qheader.h> 30#include <qheader.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <qmenubar.h> 32#include <qmenubar.h>
33 33
34 34
35#include <stdio.h> 35#include <stdio.h>
36 36
37#include "htmlmasks.h" 37#include "htmlmasks.h"
38#include "embeddata.h" 38#include "embeddata.h"
39 39
40typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 40typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
41 QColorGroup &, bool, bool); 41 QColorGroup &, bool, bool);
42 42
43QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 43QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
44 44
45void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 45void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
46{ 46{
47 QImage img(pix.convertToImage()); 47 QImage img(pix.convertToImage());
48 QImageEffect::fade(img, 0.9, color); 48 QImageEffect::fade(img, 0.9, color);
49 int x, y; 49 int x, y;
50 int r, g, b; 50 int r, g, b;
51 for(y=0; y < img.height(); y+=3){ 51 for(y=0; y < img.height(); y+=3){
52 unsigned int *data = (unsigned int *) img.scanLine(y); 52 unsigned int *data = (unsigned int *) img.scanLine(y);
53 for(x=0; x < img.width(); ++x){ 53 for(x=0; x < img.width(); ++x){
54 r = qRed(data[x]); 54 r = qRed(data[x]);
55 g = qGreen(data[x]); 55 g = qGreen(data[x]);
56 b = qBlue(data[x]); 56 b = qBlue(data[x]);
57 if(r-10) 57 if(r-10)
58 r-=10; 58 r-=10;
59 if(g-10) 59 if(g-10)
60 g-=10; 60 g-=10;
61 if(b-10) 61 if(b-10)
62 b-=10; 62 b-=10;
63 data[x] = qRgb(r, g, b); 63 data[x] = qRgb(r, g, b);
64 } 64 }
65 } 65 }
66 pix.convertFromImage(img); 66 pix.convertFromImage(img);
67} 67}
68 68
69TransMenuHandler::TransMenuHandler(QObject *parent) 69TransMenuHandler::TransMenuHandler(QObject *parent)
70 : QObject(parent) 70 : QObject(parent)
71{ 71{
72 pixDict.setAutoDelete(true); 72 pixDict.setAutoDelete(true);
73 reloadSettings(); 73 reloadSettings();
74} 74}
75 75
76void TransMenuHandler::reloadSettings() 76void TransMenuHandler::reloadSettings()
77{ 77{
78 pixDict.clear(); 78 pixDict.clear();
79 79
80 Config config ( "qpe" ); 80 Config config ( "qpe" );
81 config. setGroup ( "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
95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
96{ 96{
97 QWidget *p = (QWidget *)obj; 97 QWidget *p = (QWidget *)obj;
98 98
99 if(ev->type() == QEvent::Show){ 99 if(ev->type() == QEvent::Show){
100 if(type == TransStippleBg || type == TransStippleBtn || 100 if(type == TransStippleBg || type == TransStippleBtn ||
101 type == Custom){ 101 type == Custom){
102 QApplication::syncX(); 102 QApplication::syncX();
103 QPixmap *pix = new QPixmap; 103 QPixmap *pix = new QPixmap;
104 if(p->testWFlags(Qt::WType_Popup)){ 104 if(p->testWFlags(Qt::WType_Popup)){
105 QRect r(p->x(), p->y(), p->width(), p->height()); 105 QRect r(p->x(), p->y(), p->width(), p->height());
106 QRect deskR = QApplication::desktop()->rect(); 106 QRect deskR = QApplication::desktop()->rect();
107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
108 r.setBottom(deskR.bottom()); 108 r.setBottom(deskR.bottom());
109 r.setRight(deskR.right()); 109 r.setRight(deskR.right());
110 } 110 }
111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
112 r.width(), r.height()); 112 r.width(), r.height());
113 } 113 }
114 else{ // tear off menu 114 else{ // tear off menu
115 pix->resize(p->width(), p->height()); 115 pix->resize(p->width(), p->height());
116 pix->fill(Qt::black.rgb()); 116 pix->fill(Qt::black.rgb());
117 } 117 }
118 if(type == TransStippleBg){ 118 if(type == TransStippleBg){
119 stripePixmap(*pix, p->colorGroup().background()); 119 stripePixmap(*pix, p->colorGroup().background());
120 } 120 }
121 else if(type == TransStippleBtn){ 121 else if(type == TransStippleBtn){
122 stripePixmap(*pix, p->colorGroup().button()); 122 stripePixmap(*pix, p->colorGroup().button());
123 } 123 }
124 else{ 124 else{
125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
126 } 126 }
127 127
128 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
167LiquidStyle::LiquidStyle() 167LiquidStyle::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
210LiquidStyle::~LiquidStyle() 210LiquidStyle::~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
234void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 234void 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
326void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, 326void 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
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 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt embedded release warn_on 2CONFIG = qt embedded release warn_on
3SOURCES = liquid.cpp \ 3SOURCES = 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
9HEADERS = liquid.h \ 8HEADERS = 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
15LIBS += -lqpe -lopie 13LIBS += -lqpe -lopie
16INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
17DESTDIR = $(OPIEDIR)/plugins/styles 15DESTDIR = $(OPIEDIR)/plugins/styles
18TARGET = liquid 16TARGET = liquid
19VERSION = 1.0.0 17VERSION = 1.0.0
20 18
21TRANSLATIONS = ../../../i18n/de/libliquid.ts \ 19TRANSLATIONS = ../../../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
41static 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
58LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) 41LiquidSettings::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
153void LiquidSettings::changeType ( int t ) 128void 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
167void LiquidSettings::changeShadow ( bool b ) 142void LiquidSettings::changeShadow ( bool b )
168{ 143{
169 m_shadow = b; 144 m_shadow = b;
170} 145}
171 146
172void LiquidSettings::changeDeco ( bool b )
173{
174 m_deco = b;
175}
176
177void LiquidSettings::changeFlat ( bool b ) 147void LiquidSettings::changeFlat ( bool b )
178{ 148{
179 m_flat = b; 149 m_flat = b;
180} 150}
181 151
182 152
183bool LiquidSettings::writeConfig ( ) 153bool 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
7class QLabel; 7class QLabel;
8class OColorButton; 8class OColorButton;
9class QSlider; 9class QSlider;
10 10
11class LiquidSettings : public QWidget { 11class LiquidSettings : public QWidget {
12 Q_OBJECT 12 Q_OBJECT
13 13
14public: 14public:
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
17public slots: 17public 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
25private: 24private:
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
7LiquidInterface::LiquidInterface ( ) : ref ( 0 ) 9LiquidInterface::LiquidInterface ( ) : ref ( 0 )
8{ 10{
11 m_widget = 0;
9} 12}
10 13
11LiquidInterface::~LiquidInterface ( ) 14LiquidInterface::~LiquidInterface ( )
12{ 15{
13} 16}
14 17
15QStyle *LiquidInterface::create ( ) 18QStyle *LiquidInterface::style ( )
16{ 19{
17 return new LiquidStyle ( ); 20 return new LiquidStyle ( );
18} 21}
19 22
20QString LiquidInterface::name ( ) 23QString LiquidInterface::name ( ) const
21{
22 return QObject::tr( "Liquid", "name" );
23}
24
25QString LiquidInterface::description ( )
26{
27 return QObject::tr( "High Performance Liquid style by Mosfet", "description" );
28}
29
30QCString LiquidInterface::key ( )
31{ 24{
32 return QCString ( "liquid" ); 25 return qApp-> translate ( "Styles", "Liquid" );
33} 26}
34 27
35unsigned int LiquidInterface::version ( ) 28QString 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
40QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 33bool 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
62Q_EXPORT_INTERFACE() 38QWidget *LiquidInterface::create ( QWidget *parent, const char *name )
63{
64 Q_CREATE_INSTANCE( LiquidInterface )
65}
66
67
68LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 )
69{
70 m_widget = 0;
71}
72
73LiquidSettingsInterface::~LiquidSettingsInterface ( )
74{
75}
76
77QWidget *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
84bool LiquidSettingsInterface::accept ( ) 45bool 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
92void LiquidSettingsInterface::reject ( ) 53void LiquidInterface::reject ( )
93{ 54{
94} 55}
95 56
96QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 57
58QRESULT 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
75Q_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
113extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } 84extern "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
6class LiquidSettings; 6class LiquidSettings;
7 7
8class LiquidInterface : public StyleInterface { 8class LiquidInterface : public StyleExtendedInterface {
9public: 9public:
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
24private:
25 ulong ref;
26};
27 19
28class LiquidSettingsInterface : public StyleSettingsInterface { 20 virtual QString description ( ) const;
29public: 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
41private: 29private:
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
5MetalInterface::MetalInterface ( ) : ref ( 0 ) 7MetalInterface::MetalInterface ( ) : ref ( 0 )
6{ 8{
7} 9}
8 10
9MetalInterface::~MetalInterface ( ) 11MetalInterface::~MetalInterface ( )
10{ 12{
11} 13}
12 14
13QStyle *MetalInterface::create ( ) 15QStyle *MetalInterface::style ( )
14{ 16{
15 return new MetalStyle ( ); 17 return new MetalStyle ( );
16} 18}
17 19
18QString MetalInterface::name ( ) 20QString MetalInterface::name ( ) const
19{ 21{
20 return QObject::tr( "Metal", "name" ); 22 return qApp-> translate ( "Styles", "Metal" );
21} 23}
22 24
23QString MetalInterface::description ( )
24{
25 return QObject::tr( "Metal style", "description" );
26}
27
28QCString MetalInterface::key ( )
29{
30 return QCString ( "metal" );
31}
32
33unsigned int MetalInterface::version ( )
34{
35 return 100; // 1.0.0 (\d+.\d.\d)
36}
37 25
38QRESULT MetalInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 26QRESULT 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
53Q_EXPORT_INTERFACE() 41Q_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
7class MetalInterface : public StyleInterface { 7class MetalInterface : public StyleInterface {
8public: 8public:
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
23private: 18private:
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
7ThemeInterface::ThemeInterface ( ) : ref ( 0 ) 9ThemeInterface::ThemeInterface ( ) : ref ( 0 )
8{ 10{
11 m_widget = 0;
9} 12}
10 13
11ThemeInterface::~ThemeInterface ( ) 14ThemeInterface::~ThemeInterface ( )
12{ 15{
13} 16}
14 17
15QStyle *ThemeInterface::create ( ) 18QStyle *ThemeInterface::style ( )
16{ 19{
17 return new OThemeStyle ( "" ); 20 return new OThemeStyle ( "" );
18} 21}
19 22
20QString ThemeInterface::name ( ) 23QString ThemeInterface::name ( ) const
21{
22 return QObject::tr( "Themed style", "name" );
23}
24
25QString ThemeInterface::description ( )
26{
27 return QObject::tr( "KDE2 theme compatible style engine", "description" );
28}
29
30QCString ThemeInterface::key ( )
31{
32 return QCString ( "theme" );
33}
34
35unsigned 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
40QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 28QString 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
62Q_EXPORT_INTERFACE() 33bool ThemeInterface::hasSettings ( ) const
63{ 34{
64 Q_CREATE_INSTANCE( ThemeInterface ) 35 return true;
65} 36}
66 37
67 38QWidget *ThemeInterface::create ( QWidget *parent, const char *name )
68ThemeSettingsInterface::ThemeSettingsInterface ( ) : ref ( 0 )
69{
70 m_widget = 0;
71}
72
73ThemeSettingsInterface::~ThemeSettingsInterface ( )
74{
75}
76
77QWidget *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
84bool ThemeSettingsInterface::accept ( ) 45bool 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
92void ThemeSettingsInterface::reject ( ) 53void ThemeInterface::reject ( )
93{ 54{
94} 55}
95 56
96QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 57
58QRESULT 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
75Q_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
6class ThemeSettings; 6class ThemeSettings;
7 7
8class ThemeInterface : public StyleInterface { 8class ThemeInterface : public StyleExtendedInterface {
9public: 9public:
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
24private:
25 ulong ref;
26};
27
28class ThemeSettingsInterface : public StyleSettingsInterface {
29public:
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
41private: 28private:
42 ThemeSettings *m_widget; 29 ThemeSettings *m_widget;
43 ulong ref; 30 ulong ref;
44}; 31};
45 32
46#endif 33#endif