author | sandman <sandman> | 2002-07-15 00:52:50 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-07-15 00:52:50 (UTC) |
commit | ecf2a873be3274bb30be0c659b7db6ef8a43be84 (patch) (unidiff) | |
tree | 5c80fb0863966fffd245f6ed44c6bf524c11842b /noncore/styles/liquid/opie-liquid.diff | |
parent | 4feeec8b5b41cfd3d13274411f515524f687da09 (diff) | |
download | opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.zip opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.tar.gz opie-ecf2a873be3274bb30be0c659b7db6ef8a43be84.tar.bz2 |
Added an option to make toolbar buttons flat
Diffstat (limited to 'noncore/styles/liquid/opie-liquid.diff') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 342 |
1 files changed, 261 insertions, 81 deletions
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff index bcbdc8d..7dfd868 100644 --- a/noncore/styles/liquid/opie-liquid.diff +++ b/noncore/styles/liquid/opie-liquid.diff | |||
@@ -1,13 +1,13 @@ | |||
1 | This is a patch to mosfet's liquid 0.7. | 1 | This is a patch to mosfet's liquid 0.7. |
2 | Features: | 2 | Features: |
3 | - Qt-only | 3 | - Qt-only |
4 | - works with Qt/E on QPE/OPIE | 4 | - works with Qt/E on QPE/OPIE |
5 | 5 | ||
6 | --- -Mon Jul 1 11:38:05 2002 | 6 | --- -Mon Jul 15 02:34:13 2002 |
7 | +++ liquid.hMon Jun 24 19:07:45 2002 | 7 | +++ liquid.hMon Jul 15 01:51:12 2002 |
8 | @@ -2,7 +2,7 @@ | 8 | @@ -2,7 +2,7 @@ |
9 | #define LIQUID_STYLE_H | 9 | #define LIQUID_STYLE_H |
10 | 10 | ||
11 | 11 | ||
12 | -#include <kstyle.h> | 12 | -#include <kstyle.h> |
13 | +#include <qwindowsstyle.h> | 13 | +#include <qwindowsstyle.h> |
@@ -99,14 +99,22 @@ Features: | |||
99 | - const QColorGroup &g, | 99 | - const QColorGroup &g, |
100 | - const QString &title, bool active, | 100 | - const QString &title, bool active, |
101 | - QPixmap *icon, QBrush *fill); | 101 | - QPixmap *icon, QBrush *fill); |
102 | // for repainting toolbuttons when the toolbar is resized | 102 | // for repainting toolbuttons when the toolbar is resized |
103 | bool eventFilter(QObject *obj, QEvent *ev); | 103 | bool eventFilter(QObject *obj, QEvent *ev); |
104 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, | 104 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, |
105 | --- -Mon Jul 1 11:38:05 2002 | 105 | @@ -204,6 +177,7 @@ |
106 | +++ liquid.cppMon Jul 1 03:45:28 2002 | 106 | QPixmap* getPixmap(BitmapData item); |
107 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); | ||
108 | private: | ||
109 | +bool flatTBButtons; | ||
110 | bool highcolor; | ||
111 | QColorGroup radioOnGrp; | ||
112 | QWidget *highlightWidget; | ||
113 | --- -Mon Jul 15 02:34:13 2002 | ||
114 | +++ liquid.cppMon Jul 15 02:31:59 2002 | ||
107 | @@ -10,12 +10,10 @@ | 115 | @@ -10,12 +10,10 @@ |
108 | 116 | ||
109 | #include <qmenudata.h> | 117 | #include <qmenudata.h> |
110 | #include "liquid.h" | 118 | #include "liquid.h" |
111 | -#include <kapp.h> | 119 | -#include <kapp.h> |
112 | -#include <kglobal.h> | 120 | -#include <kglobal.h> |
@@ -181,13 +189,13 @@ Features: | |||
181 | - &QApplication::palette().active().button()); | 189 | - &QApplication::palette().active().button()); |
182 | - fgColor = config->readColorEntry("TextColor", | 190 | - fgColor = config->readColorEntry("TextColor", |
183 | - &QApplication::palette().active().text()); | 191 | - &QApplication::palette().active().text()); |
184 | - opacity = config->readNumEntry("Opacity", 10); | 192 | - opacity = config->readNumEntry("Opacity", 10); |
185 | - shadowText = config->readBoolEntry("ShadowText", true); | 193 | - shadowText = config->readBoolEntry("ShadowText", true); |
186 | + Config config ( "qpe" ); | 194 | + Config config ( "qpe" ); |
187 | + config. setGroup ( "MosfetMenus" ); | 195 | + config. setGroup ( "Liquid-Style" ); |
188 | + | 196 | + |
189 | + type = config. readNumEntry("Type", TransStippleBg); | 197 | + type = config. readNumEntry("Type", TransStippleBg); |
190 | + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); | 198 | + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); |
191 | + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); | 199 | + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); |
192 | + opacity = config. readNumEntry("Opacity", 10); | 200 | + opacity = config. readNumEntry("Opacity", 10); |
193 | + if ( opacity < -20 ) | 201 | + if ( opacity < -20 ) |
@@ -218,23 +226,23 @@ Features: | |||
218 | } | 226 | } |
219 | - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), | 227 | - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), |
220 | + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), | 228 | + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), |
221 | r.width(), r.height()); | 229 | r.width(), r.height()); |
222 | } | 230 | } |
223 | else{ // tear off menu | 231 | else{ // tear off menu |
224 | @@ -121,82 +122,54 @@ | 232 | @@ -121,82 +122,55 @@ |
225 | stripePixmap(*pix, p->colorGroup().button()); | 233 | stripePixmap(*pix, p->colorGroup().button()); |
226 | } | 234 | } |
227 | else{ | 235 | else{ |
228 | - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 236 | - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
229 | + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 237 | + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
230 | } | 238 | } |
231 | + | 239 | + |
232 | + if (p->inherits("QPopupMenu")) | ||
233 | pixDict.insert(p->winId(), pix); | 240 | pixDict.insert(p->winId(), pix); |
234 | + else { | 241 | + |
242 | + if (!p->inherits("QPopupMenu")) { | ||
235 | + p->setBackgroundPixmap(*pix); | 243 | + p->setBackgroundPixmap(*pix); |
236 | + | 244 | + |
237 | + QObjectList *ol = p-> queryList("QWidget"); | 245 | + QObjectList *ol = p-> queryList("QWidget"); |
238 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 246 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
239 | + QWidget *wid = (QWidget *) it.current ( ); | 247 | + QWidget *wid = (QWidget *) it.current ( ); |
240 | + | 248 | + |
@@ -251,19 +259,19 @@ Features: | |||
251 | - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 259 | - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
252 | - pixDict.remove(p->winId()); | 260 | - pixDict.remove(p->winId()); |
253 | - } | 261 | - } |
254 | - } | 262 | - } |
255 | - return(false); | 263 | - return(false); |
256 | -} | 264 | -} |
257 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 265 | - |
258 | |||
259 | -void TransMenuHandler::slotKIPCMessage(int id, int) | 266 | -void TransMenuHandler::slotKIPCMessage(int id, int) |
260 | -{ | 267 | -{ |
261 | - if(id == LIQUID_MENU_CHANGE){ | 268 | - if(id == LIQUID_MENU_CHANGE){ |
262 | - bool oldShadow = shadowText; | 269 | - bool oldShadow = shadowText; |
263 | - | 270 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
271 | |||
264 | - KConfig *config = KGlobal::config(); | 272 | - KConfig *config = KGlobal::config(); |
265 | - config->reparseConfiguration(); // in case KControl changed values | 273 | - config->reparseConfiguration(); // in case KControl changed values |
266 | - | 274 | - |
267 | - // Make sure no popupmenus are shown. There shouldn't be any because | 275 | - // Make sure no popupmenus are shown. There shouldn't be any because |
268 | - // the user just clicked "Apply", but there can be tear offs ;-) | 276 | - // the user just clicked "Apply", but there can be tear offs ;-) |
269 | - // We just close them so the pixmaps are deleted and regenerated. | 277 | - // We just close them so the pixmaps are deleted and regenerated. |
@@ -273,15 +281,14 @@ Features: | |||
273 | - while ((w=it.current()) != 0 ){ | 281 | - while ((w=it.current()) != 0 ){ |
274 | - ++it; | 282 | - ++it; |
275 | - if(w->inherits("QPopupMenu")){ | 283 | - if(w->inherits("QPopupMenu")){ |
276 | - w->close(); | 284 | - w->close(); |
277 | - } | 285 | - } |
278 | - } | 286 | - } |
279 | + if (p->inherits("QPopupMenu")) | ||
280 | + pixDict.remove(p->winId()); | 287 | + pixDict.remove(p->winId()); |
281 | + else { | 288 | + if (!p->inherits("QPopupMenu")) { |
282 | + p->setBackgroundMode(QWidget::PaletteBackground); | 289 | + p->setBackgroundMode(QWidget::PaletteBackground); |
283 | 290 | ||
284 | - reloadSettings(); | 291 | - reloadSettings(); |
285 | + QObjectList *ol = p-> queryList("QWidget"); | 292 | + QObjectList *ol = p-> queryList("QWidget"); |
286 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 293 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
287 | + QWidget *wid = (QWidget *) it.current ( ); | 294 | + QWidget *wid = (QWidget *) it.current ( ); |
@@ -292,26 +299,26 @@ Features: | |||
292 | - while ((w=it.current()) != 0 ){ | 299 | - while ((w=it.current()) != 0 ){ |
293 | - ++it; | 300 | - ++it; |
294 | - if(w->inherits("QMenuBar")){ | 301 | - if(w->inherits("QMenuBar")){ |
295 | - w->repaint(); | 302 | - w->repaint(); |
296 | - } | 303 | - } |
297 | - } | 304 | - } |
298 | - } | 305 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); |
306 | } | ||
299 | - } | 307 | - } |
300 | - else if(id == MOSFET_BUTTON_CHANGE){ | 308 | - else if(id == MOSFET_BUTTON_CHANGE){ |
301 | - qWarning("In mosfet button change"); | 309 | - qWarning("In mosfet button change"); |
302 | - // really, this should be in LiquidStyle, but what the hell? ;-) | 310 | - // really, this should be in LiquidStyle, but what the hell? ;-) |
303 | - QWidgetList *list = QApplication::allWidgets(); | 311 | - QWidgetList *list = QApplication::allWidgets(); |
304 | - QWidgetListIt it( *list ); | 312 | - QWidgetListIt it( *list ); |
305 | - QWidget *w; | 313 | - QWidget *w; |
306 | - while ((w=it.current()) != 0 ){ | 314 | - while ((w=it.current()) != 0 ){ |
307 | - ++it; | 315 | - ++it; |
308 | - if(w->inherits("QPushButton")){ | 316 | - if(w->inherits("QPushButton")){ |
309 | - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); | 317 | - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); |
310 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); | 318 | - } |
311 | } | ||
312 | - } | 319 | - } |
313 | - ((LiquidStyle*)parent())->loadCustomButtons(); | 320 | - ((LiquidStyle*)parent())->loadCustomButtons(); |
314 | - it.toFirst(); | 321 | - it.toFirst(); |
315 | - while ((w=it.current()) != 0 ){ | 322 | - while ((w=it.current()) != 0 ){ |
316 | - ++it; | 323 | - ++it; |
317 | - if(w->inherits("QPushButton")){ | 324 | - if(w->inherits("QPushButton")){ |
@@ -328,16 +335,18 @@ Features: | |||
328 | LiquidStyle::LiquidStyle() | 335 | LiquidStyle::LiquidStyle() |
329 | - :KStyle() | 336 | - :KStyle() |
330 | + :QWindowsStyle() | 337 | + :QWindowsStyle() |
331 | { | 338 | { |
332 | + setName ( "LiquidStyle" ); | 339 | + setName ( "LiquidStyle" ); |
333 | + | 340 | + |
341 | +flatTBButtons = false; | ||
342 | + | ||
334 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 343 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
335 | btnMaskBmp.setMask(btnMaskBmp); | 344 | btnMaskBmp.setMask(btnMaskBmp); |
336 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 345 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
337 | @@ -730,20 +703,19 @@ | 346 | @@ -730,20 +704,26 @@ |
338 | } | 347 | } |
339 | 348 | ||
340 | loadCustomButtons(); | 349 | loadCustomButtons(); |
341 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; | 350 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; |
342 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | 351 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; |
343 | btnDict.clear(); | 352 | btnDict.clear(); |
@@ -345,25 +354,32 @@ Features: | |||
345 | bevelFillDict.clear(); | 354 | bevelFillDict.clear(); |
346 | smallBevelFillDict.clear(); | 355 | smallBevelFillDict.clear(); |
347 | 356 | ||
348 | - KConfig *config = KGlobal::config(); | 357 | - KConfig *config = KGlobal::config(); |
349 | - QString oldGrp = config->group(); | 358 | - QString oldGrp = config->group(); |
350 | + Config config ( "qpe" ); | 359 | + Config config ( "qpe" ); |
360 | + config. setGroup ( "Liquid-Style" ); | ||
361 | +int contrast = config. readNumEntry ( "StippleContrast", 5 ); | ||
362 | +if ( contrast < 0 ) | ||
363 | + contrast = 0; | ||
364 | +else if ( contrast > 10 ) | ||
365 | + contrast = 10; | ||
366 | + | ||
351 | QPalette pal = QApplication::palette(); | 367 | QPalette pal = QApplication::palette(); |
352 | 368 | ||
353 | // button color stuff | 369 | // button color stuff |
354 | - config->setGroup("General"); | 370 | - config->setGroup("General"); |
355 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); | 371 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); |
356 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ | 372 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ |
357 | + config. setGroup ( "Appearance" ); | 373 | + config. setGroup ( "Appearance" ); |
358 | + QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 374 | + QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); |
359 | + if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { | 375 | + if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { |
360 | // force button color to be different from background | 376 | // force button color to be different from background |
361 | QBrush btnBrush(QColor(200, 202, 228)); | 377 | QBrush btnBrush(QColor(200, 202, 228)); |
362 | appPal.setBrush(QColorGroup::Button, btnBrush); | 378 | appPal.setBrush(QColorGroup::Button, btnBrush); |
363 | @@ -794,15 +766,7 @@ | 379 | @@ -794,15 +774,7 @@ |
364 | pagerBrush.setPixmap(*pix); | 380 | pagerBrush.setPixmap(*pix); |
365 | 381 | ||
366 | // background color stuff | 382 | // background color stuff |
367 | - c = config->readColorEntry("background", &Qt::lightGray); | 383 | - c = config->readColorEntry("background", &Qt::lightGray); |
368 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0){ | 384 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0){ |
369 | - appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); | 385 | - appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); |
@@ -374,13 +390,23 @@ Features: | |||
374 | - appPal.setBrush(QColorGroup::Background, menuBrush); | 390 | - appPal.setBrush(QColorGroup::Background, menuBrush); |
375 | - } | 391 | - } |
376 | + c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); | 392 | + c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); |
377 | c.hsv(&bH, &bS, &bV); | 393 | c.hsv(&bH, &bS, &bV); |
378 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 394 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
379 | 395 | ||
380 | @@ -825,13 +789,10 @@ | 396 | @@ -817,21 +789,18 @@ |
397 | wallPaper.fill(c.rgb()); | ||
398 | painter.begin(&wallPaper); | ||
399 | for(i=0; i < 32; i+=4){ | ||
400 | - painter.setPen(c.dark(105)); | ||
401 | + painter.setPen(c.dark(100 + contrast)); | ||
402 | painter.drawLine(0, i, 32, i); | ||
403 | - painter.setPen(c.dark(103)); | ||
404 | + painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); | ||
405 | painter.drawLine(0, i+1, 32, i+1); | ||
406 | }; | ||
381 | painter.end(); | 407 | painter.end(); |
382 | bgBrush.setColor(c); | 408 | bgBrush.setColor(c); |
383 | bgBrush.setPixmap(wallPaper); | 409 | bgBrush.setPixmap(wallPaper); |
384 | - if(qstrcmp(kapp->argv()[0], "kicker") != 0 && | 410 | - if(qstrcmp(kapp->argv()[0], "kicker") != 0 && |
385 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ | 411 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ |
386 | appPal.setBrush(QColorGroup::Background, bgBrush); | 412 | appPal.setBrush(QColorGroup::Background, bgBrush); |
@@ -389,13 +415,13 @@ Features: | |||
389 | // lineedits | 415 | // lineedits |
390 | - c = config->readColorEntry("windowBackground", &Qt::white); | 416 | - c = config->readColorEntry("windowBackground", &Qt::white); |
391 | + c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); | 417 | + c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); |
392 | QPixmap basePix; | 418 | QPixmap basePix; |
393 | basePix.resize(32, 32); | 419 | basePix.resize(32, 32); |
394 | basePix.fill(c.rgb()); | 420 | basePix.fill(c.rgb()); |
395 | @@ -857,51 +818,31 @@ | 421 | @@ -857,51 +826,39 @@ |
396 | } | 422 | } |
397 | } | 423 | } |
398 | 424 | ||
399 | - config->setGroup(oldGrp); | 425 | - config->setGroup(oldGrp); |
400 | } | 426 | } |
401 | 427 | ||
@@ -403,12 +429,19 @@ Features: | |||
403 | { | 429 | { |
404 | if(w->inherits("QMenuBar")){ | 430 | if(w->inherits("QMenuBar")){ |
405 | - ((QFrame*)w)->setLineWidth(0); | 431 | - ((QFrame*)w)->setLineWidth(0); |
406 | - w->setBackgroundMode(QWidget::NoBackground); | 432 | - w->setBackgroundMode(QWidget::NoBackground); |
407 | + //((QFrame*)w)->setLineWidth(0); | 433 | + //((QFrame*)w)->setLineWidth(0); |
408 | + w->setBackgroundMode(QWidget::PaletteBackground); | 434 | + w->setBackgroundMode(QWidget::PaletteBackground); |
435 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
436 | + return; | ||
437 | + } | ||
438 | + if(w->inherits("QToolBar")){ | ||
439 | + w->installEventFilter(this); | ||
440 | + w->setBackgroundMode(QWidget::PaletteBackground); | ||
441 | + w->setBackgroundOrigin(QWidget::WidgetOrigin); | ||
409 | return; | 442 | return; |
410 | } | 443 | } |
411 | if(w->inherits("QPopupMenu")) | 444 | if(w->inherits("QPopupMenu")) |
412 | w->setBackgroundMode(QWidget::NoBackground); | 445 | w->setBackgroundMode(QWidget::NoBackground); |
413 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 446 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
414 | + w->installEventFilter(menuHandler); | 447 | + w->installEventFilter(menuHandler); |
@@ -439,81 +472,82 @@ Features: | |||
439 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0 && | 472 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0 && |
440 | - w->inherits("KPanelExtension")){ // FIXME - doesn't work | 473 | - w->inherits("KPanelExtension")){ // FIXME - doesn't work |
441 | - w->setPalette(kapp->palette()); | 474 | - w->setPalette(kapp->palette()); |
442 | - } | 475 | - } |
443 | + | 476 | + |
444 | + | 477 | + |
478 | + if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) | ||
445 | + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | 479 | + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); |
446 | 480 | ||
447 | if(w->inherits("QComboBox") || | 481 | if(w->inherits("QComboBox") || |
448 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 482 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
449 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | 483 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || |
450 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 484 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
451 | - w->inherits("TaskContainer")){ | 485 | - w->inherits("TaskContainer")){ |
452 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 486 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
453 | w->installEventFilter(this); | 487 | w->installEventFilter(this); |
454 | } | 488 | } |
455 | if(w->inherits("QLineEdit")){ | 489 | if(w->inherits("QLineEdit")){ |
456 | @@ -913,6 +854,9 @@ | 490 | @@ -913,6 +870,9 @@ |
457 | applyCustomAttributes((QPushButton *)w); | 491 | applyCustomAttributes((QPushButton *)w); |
458 | w->installEventFilter(this); | 492 | w->installEventFilter(this); |
459 | } | 493 | } |
460 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 494 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
461 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); | 495 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); |
462 | + } | 496 | + } |
463 | 497 | ||
464 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 498 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
465 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 499 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
466 | @@ -942,11 +886,12 @@ | 500 | @@ -942,11 +902,14 @@ |
467 | w->setMouseTracking(true); | 501 | w->setMouseTracking(true); |
468 | w->installEventFilter(this); | 502 | w->installEventFilter(this); |
469 | } | 503 | } |
470 | + if(w-> inherits("QToolButton")) { | 504 | + if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { |
471 | + ((QToolButton*)w)->setAutoRaise (false); | 505 | + ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
506 | + if ( flatTBButtons ) | ||
507 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
472 | + } | 508 | + } |
473 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 509 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
474 | return; | 510 | return; |
475 | } | 511 | } |
476 | - if(w->inherits("PanelButtonBase")) | 512 | - if(w->inherits("PanelButtonBase")) |
477 | - return; | 513 | - return; |
478 | 514 | ||
479 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 515 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
480 | palette().active().brush(QColorGroup::Background).pixmap()){ | 516 | palette().active().brush(QColorGroup::Background).pixmap()){ |
481 | @@ -954,17 +899,18 @@ | 517 | @@ -954,17 +917,13 @@ |
482 | return; | 518 | return; |
483 | } | 519 | } |
484 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 520 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
485 | - !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ | 521 | - !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ |
486 | + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 522 | + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
487 | if(w->backgroundMode() == QWidget::PaletteBackground || | 523 | if(w->backgroundMode() == QWidget::PaletteBackground || |
488 | w->backgroundMode() == QWidget::PaletteButton){ | 524 | w->backgroundMode() == QWidget::PaletteButton){ |
489 | w->setBackgroundMode(QWidget::X11ParentRelative); | 525 | w->setBackgroundMode(QWidget::X11ParentRelative); |
490 | } | 526 | } |
491 | } | 527 | } |
492 | - if(w->inherits("KToolBar")){ | 528 | - if(w->inherits("KToolBar")){ |
493 | + if(w->inherits("QToolBar")){ | 529 | - w->installEventFilter(this); |
494 | w->installEventFilter(this); | ||
495 | - //w->setBackgroundMode(QWidget::NoBackground); | 530 | - //w->setBackgroundMode(QWidget::NoBackground); |
496 | + w->setBackgroundMode(QWidget::PaletteBackground); | 531 | - return; |
497 | return; | 532 | - } |
498 | } | ||
499 | + | 533 | + |
500 | } | 534 | } |
501 | 535 | ||
502 | void LiquidStyle::unPolish(QWidget *w) | 536 | void LiquidStyle::unPolish(QWidget *w) |
503 | @@ -977,6 +923,9 @@ | 537 | @@ -977,6 +936,9 @@ |
504 | 538 | ||
505 | if(w->inherits("QPopupMenu")) | 539 | if(w->inherits("QPopupMenu")) |
506 | w->setBackgroundMode(QWidget::PaletteButton); | 540 | w->setBackgroundMode(QWidget::PaletteButton); |
507 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 541 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
508 | + w->removeEventFilter(menuHandler); | 542 | + w->removeEventFilter(menuHandler); |
509 | + } | 543 | + } |
510 | 544 | ||
511 | if(w->isTopLevel()) | 545 | if(w->isTopLevel()) |
512 | return; | 546 | return; |
513 | @@ -1001,12 +950,14 @@ | 547 | @@ -1001,12 +963,14 @@ |
514 | unapplyCustomAttributes((QPushButton *)w); | 548 | unapplyCustomAttributes((QPushButton *)w); |
515 | w->removeEventFilter(this); | 549 | w->removeEventFilter(this); |
516 | } | 550 | } |
517 | - | 551 | - |
518 | +/* | 552 | +/* |
519 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 553 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
@@ -526,25 +560,25 @@ Features: | |||
526 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 560 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
527 | - w->inherits("TaskContainer")){ | 561 | - w->inherits("TaskContainer")){ |
528 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 562 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
529 | w->removeEventFilter(this); | 563 | w->removeEventFilter(this); |
530 | } | 564 | } |
531 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 565 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
532 | @@ -1014,9 +965,9 @@ | 566 | @@ -1014,9 +978,9 @@ |
533 | w->setAutoMask(false); | 567 | w->setAutoMask(false); |
534 | } | 568 | } |
535 | } | 569 | } |
536 | - if(w->inherits("KToolBar")){ | 570 | - if(w->inherits("KToolBar")){ |
537 | + if(w->inherits("QToolBar")){ | 571 | + if(w->inherits("QToolBar")){ |
538 | w->removeEventFilter(this); | 572 | w->removeEventFilter(this); |
539 | - //w->setBackgroundMode(QWidget::PaletteBackground); | 573 | - //w->setBackgroundMode(QWidget::PaletteBackground); |
540 | + w->setBackgroundMode(QWidget::PaletteBackground); | 574 | + w->setBackgroundMode(QWidget::PaletteBackground); |
541 | return; | 575 | return; |
542 | } | 576 | } |
543 | if(w->inherits("QHeader")){ | 577 | if(w->inherits("QHeader")){ |
544 | @@ -1028,20 +979,28 @@ | 578 | @@ -1028,20 +992,34 @@ |
545 | void LiquidStyle::polish(QApplication *app) | 579 | void LiquidStyle::polish(QApplication *app) |
546 | { | 580 | { |
547 | 581 | ||
548 | - KStyle::polish(app); | 582 | - KStyle::polish(app); |
549 | + QWindowsStyle::polish(app); | 583 | + QWindowsStyle::polish(app); |
550 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | 584 | menuAni = app->isEffectEnabled(UI_AnimateMenu); |
@@ -553,13 +587,19 @@ Features: | |||
553 | app->setEffectEnabled(UI_AnimateMenu, false); | 587 | app->setEffectEnabled(UI_AnimateMenu, false); |
554 | if(menuFade) | 588 | if(menuFade) |
555 | app->setEffectEnabled(UI_FadeMenu, false); | 589 | app->setEffectEnabled(UI_FadeMenu, false); |
556 | + | 590 | + |
557 | + qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | 591 | + qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); |
558 | + | 592 | + |
593 | + Config config ( "qpe" ); | ||
594 | + config. setGroup ( "Liquid-Style" ); | ||
595 | + | ||
596 | + if ( config. readBoolEntry ( "WinDecoration", true )) | ||
559 | + QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | 597 | + QApplication::qwsSetDecoration ( new LiquidDecoration ( )); |
598 | + | ||
599 | +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); | ||
560 | } | 600 | } |
561 | 601 | ||
562 | void LiquidStyle::unPolish(QApplication *app) | 602 | void LiquidStyle::unPolish(QApplication *app) |
563 | { | 603 | { |
564 | - KStyle::unPolish(app); | 604 | - KStyle::unPolish(app); |
565 | + QWindowsStyle::unPolish(app); | 605 | + QWindowsStyle::unPolish(app); |
@@ -569,22 +609,22 @@ Features: | |||
569 | + qt_set_draw_menu_bar_impl ( 0 ); | 609 | + qt_set_draw_menu_bar_impl ( 0 ); |
570 | + | 610 | + |
571 | + QApplication::qwsSetDecoration ( new QPEDecoration ( )); | 611 | + QApplication::qwsSetDecoration ( new QPEDecoration ( )); |
572 | } | 612 | } |
573 | 613 | ||
574 | /* | 614 | /* |
575 | @@ -1063,7 +1022,7 @@ | 615 | @@ -1063,7 +1041,7 @@ |
576 | */ | 616 | */ |
577 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 617 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
578 | { | 618 | { |
579 | - if(obj->inherits("KToolBar")){ | 619 | - if(obj->inherits("KToolBar")){ |
580 | + if(obj->inherits("QToolBar")){ | 620 | + if(obj->inherits("QToolBar")){ |
581 | if(ev->type() == QEvent::Resize){ | 621 | if(ev->type() == QEvent::Resize){ |
582 | const QObjectList *tbChildList = obj->children(); | 622 | const QObjectList *tbChildList = obj->children(); |
583 | QObjectListIt it(*tbChildList); | 623 | QObjectListIt it(*tbChildList); |
584 | @@ -1076,35 +1035,7 @@ | 624 | @@ -1076,35 +1054,7 @@ |
585 | 625 | ||
586 | } | 626 | } |
587 | } | 627 | } |
588 | - else if(obj->inherits("KMiniPagerButton")){ | 628 | - else if(obj->inherits("KMiniPagerButton")){ |
589 | - QButton *btn = (QButton *)obj; | 629 | - QButton *btn = (QButton *)obj; |
590 | - if(ev->type() == QEvent::Paint){ | 630 | - if(ev->type() == QEvent::Paint){ |
@@ -615,13 +655,13 @@ Features: | |||
615 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || | 655 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || |
616 | - obj->isA("AppletHandle")){ | 656 | - obj->isA("AppletHandle")){ |
617 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 657 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ |
618 | QWidget *btn = (QWidget *)obj; | 658 | QWidget *btn = (QWidget *)obj; |
619 | if(ev->type() == QEvent::Enter){ | 659 | if(ev->type() == QEvent::Enter){ |
620 | if(btn->isEnabled()){ | 660 | if(btn->isEnabled()){ |
621 | @@ -1119,20 +1050,7 @@ | 661 | @@ -1119,20 +1069,7 @@ |
622 | } | 662 | } |
623 | } | 663 | } |
624 | } | 664 | } |
625 | - else if(obj->inherits("TaskContainer")){ | 665 | - else if(obj->inherits("TaskContainer")){ |
626 | - QButton *btn = (QButton *)obj; | 666 | - QButton *btn = (QButton *)obj; |
627 | - QPalette pal = btn->palette(); | 667 | - QPalette pal = btn->palette(); |
@@ -637,58 +677,111 @@ Features: | |||
637 | - } | 677 | - } |
638 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ | 678 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ |
639 | + else if(obj->inherits("QToolButton")){ | 679 | + else if(obj->inherits("QToolButton")){ |
640 | QToolButton *btn = (QToolButton *)btn; | 680 | QToolButton *btn = (QToolButton *)btn; |
641 | if(!btn->autoRaise()){ | 681 | if(!btn->autoRaise()){ |
642 | if(btn->isEnabled()){ | 682 | if(btn->isEnabled()){ |
643 | @@ -1340,11 +1258,6 @@ | 683 | @@ -1340,11 +1277,6 @@ |
644 | QColorGroup g = btn->colorGroup(); | 684 | QColorGroup g = btn->colorGroup(); |
645 | 685 | ||
646 | 686 | ||
647 | - QColor testColor; | 687 | - QColor testColor; |
648 | - if(btn->parent() && btn->parent()->isWidgetType()){ | 688 | - if(btn->parent() && btn->parent()->isWidgetType()){ |
649 | - testColor = p->backgroundColor(); // remove me | 689 | - testColor = p->backgroundColor(); // remove me |
650 | - } | 690 | - } |
651 | - | 691 | - |
652 | //int dw = buttonDefaultIndicatorWidth(); | 692 | //int dw = buttonDefaultIndicatorWidth(); |
653 | if(btn->hasFocus() || btn->isDefault()){ | 693 | if(btn->hasFocus() || btn->isDefault()){ |
654 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); | 694 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); |
655 | @@ -1914,8 +1827,8 @@ | 695 | @@ -1596,7 +1528,7 @@ |
696 | if(sbBuffer.size() != sb->size()) | ||
697 | sbBuffer.resize(sb->size()); | ||
698 | } | ||
699 | - subB.setRect( subX,subY,buttonDim,buttonDim ); | ||
700 | + subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); | ||
701 | addB.setRect( addX,addY,buttonDim,buttonDim ); | ||
702 | if(horiz) | ||
703 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); | ||
704 | @@ -1624,7 +1556,7 @@ | ||
705 | QPainter painter; | ||
706 | if(!horiz){ | ||
707 | painter.begin(&sbBuffer); | ||
708 | - QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); | ||
709 | + QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); | ||
710 | if(sliderR.height() >= 8){ | ||
711 | painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, | ||
712 | 13, 8); | ||
713 | @@ -1690,7 +1622,7 @@ | ||
714 | } | ||
715 | else{ | ||
716 | painter.begin(&sbBuffer); | ||
717 | - QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); | ||
718 | + QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); | ||
719 | if(sliderR.width() >= 8){ | ||
720 | painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, | ||
721 | 8, 13); | ||
722 | @@ -1761,10 +1693,10 @@ | ||
723 | addB.width()-8, addB.height()-8, g, !maxed); | ||
724 | } | ||
725 | if ( controls & SubLine ) { | ||
726 | - drawSBButton(p, subB, g, activeControl == SubLine); | ||
727 | - drawArrow( p, horiz ? LeftArrow : UpArrow, | ||
728 | - false, subB.x()+4, subB.y()+4, | ||
729 | - subB.width()-8, subB.height()-8, g, !maxed); | ||
730 | + // drawSBButton(p, subB, g, activeControl == SubLine); | ||
731 | + // drawArrow( p, horiz ? LeftArrow : UpArrow, | ||
732 | + // false, subB.x()+4, subB.y()+4, | ||
733 | + // subB.width()-8, subB.height()-8, g, !maxed); | ||
734 | drawSBButton(p, subHC, g, activeControl == SubLine); | ||
735 | drawArrow( p, horiz ? LeftArrow : UpArrow, | ||
736 | false, subHC.x()+4, subHC.y()+4, | ||
737 | @@ -1865,8 +1797,8 @@ | ||
738 | else | ||
739 | buttonDim = ( length - b*2 )/2 - 1; | ||
740 | |||
741 | - sliderMin = b + buttonDim; | ||
742 | - maxLength = length - b*2 - buttonDim*3; | ||
743 | + sliderMin = b + 0; // buttonDim; | ||
744 | + maxLength = length - b*2 - buttonDim*2; // 3; | ||
745 | |||
746 | if ( sb->maxValue() == sb->minValue() ) { | ||
747 | sliderLength = maxLength; | ||
748 | @@ -1914,8 +1846,8 @@ | ||
656 | return(QSize(16, 16)); | 749 | return(QSize(16, 16)); |
657 | } | 750 | } |
658 | 751 | ||
659 | -void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, | 752 | -void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, |
660 | - int h, const QColorGroup &g, bool on, | 753 | - int h, const QColorGroup &g, bool on, |
661 | +void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, | 754 | +void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, |
662 | + int /*h*/, const QColorGroup &/*g*/, bool on, | 755 | + int /*h*/, const QColorGroup &/*g*/, bool on, |
663 | bool down, bool) | 756 | bool down, bool) |
664 | { | 757 | { |
665 | bool isHover = highlightWidget == p->device(); | 758 | bool isHover = highlightWidget == p->device(); |
666 | @@ -1957,8 +1870,8 @@ | 759 | @@ -1957,8 +1889,8 @@ |
667 | return(QSize(20, 22)); | 760 | return(QSize(20, 22)); |
668 | } | 761 | } |
669 | 762 | ||
670 | -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, | 763 | -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, |
671 | - const QColorGroup &g, int state, bool down, bool) | 764 | - const QColorGroup &g, int state, bool down, bool) |
672 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 765 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
673 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) | 766 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) |
674 | { | 767 | { |
675 | bool isHover = highlightWidget == p->device(); | 768 | bool isHover = highlightWidget == p->device(); |
676 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget | 769 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget |
677 | @@ -1996,8 +1909,8 @@ | 770 | @@ -1996,8 +1928,8 @@ |
678 | } | 771 | } |
679 | } | 772 | } |
680 | 773 | ||
681 | -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, | 774 | -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, |
682 | - int state) | 775 | - int state) |
683 | +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 776 | +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
684 | + int /*state*/) | 777 | + int /*state*/) |
685 | { | 778 | { |
686 | // needed for some reason by KHtml, even tho it's all filled ;P | 779 | // needed for some reason by KHtml, even tho it's all filled ;P |
687 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); | 780 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); |
688 | @@ -2005,18 +1918,17 @@ | 781 | @@ -2005,18 +1937,17 @@ |
689 | } | 782 | } |
690 | 783 | ||
691 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, | 784 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, |
692 | - const QColorGroup &g, Orientation orient, | 785 | - const QColorGroup &g, Orientation orient, |
693 | + const QColorGroup &/*g*/, Orientation orient, | 786 | + const QColorGroup &/*g*/, Orientation orient, |
694 | bool, bool) | 787 | bool, bool) |
@@ -704,13 +797,13 @@ Features: | |||
704 | 797 | ||
705 | -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, | 798 | -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, |
706 | +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 799 | +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
707 | Orientation orient, bool, bool) | 800 | Orientation orient, bool, bool) |
708 | { | 801 | { |
709 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : | 802 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : |
710 | @@ -2065,203 +1977,24 @@ | 803 | @@ -2065,203 +1996,26 @@ |
711 | p->drawLineSegments(a); | 804 | p->drawLineSegments(a); |
712 | } | 805 | } |
713 | 806 | ||
714 | -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, | 807 | -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, |
715 | - const QColorGroup &g, KToolBarPos, | 808 | - const QColorGroup &g, KToolBarPos, |
716 | - QBrush *) | 809 | - QBrush *) |
@@ -775,17 +868,13 @@ Features: | |||
775 | - const QColorGroup &g, KToolBarPos, QBrush *) | 868 | - const QColorGroup &g, KToolBarPos, QBrush *) |
776 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 869 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
777 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | 870 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) |
778 | { | 871 | { |
779 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | 872 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); |
780 | -} | 873 | -} |
781 | + x -= 2; // Bug in Qt/E | 874 | - |
782 | + y -= 2; | ||
783 | + w += 2; | ||
784 | + h += 2; | ||
785 | |||
786 | -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, | 875 | -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, |
787 | - const QColorGroup &g, bool sunken, | 876 | - const QColorGroup &g, bool sunken, |
788 | - bool raised, bool enabled, bool popup, | 877 | - bool raised, bool enabled, bool popup, |
789 | - KToolButtonType icontext, | 878 | - KToolButtonType icontext, |
790 | - const QString& btext, const QPixmap *pixmap, | 879 | - const QString& btext, const QPixmap *pixmap, |
791 | - QFont *font, QWidget *btn) | 880 | - QFont *font, QWidget *btn) |
@@ -895,65 +984,71 @@ Features: | |||
895 | - if (enabled) | 984 | - if (enabled) |
896 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, | 985 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, |
897 | - g, true); | 986 | - g, true); |
898 | - else | 987 | - else |
899 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, | 988 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, |
900 | - 0, 0, g, false); | 989 | - 0, 0, g, false); |
990 | + if(active){ | ||
991 | + x -= 2; // Bug in Qt/E | ||
992 | + y -= 2; | ||
993 | + w += 2; | ||
994 | + h += 2; | ||
995 | } | ||
901 | - } | 996 | - } |
902 | -} | ||
903 | + p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); | ||
904 | |||
905 | - | 997 | - |
998 | |||
906 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, | 999 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, |
907 | - const QColorGroup &g, bool active, QMenuItem *mi, | 1000 | - const QColorGroup &g, bool active, QMenuItem *mi, |
908 | - QBrush *) | 1001 | - QBrush *) |
909 | -{ | 1002 | -{ |
910 | - if ( p->font() == KGlobalSettings::generalFont() ) | 1003 | - if ( p->font() == KGlobalSettings::generalFont() ) |
911 | - p->setFont( KGlobalSettings::menuFont() ); | 1004 | - p->setFont( KGlobalSettings::menuFont() ); |
912 | + w -= 2; | 1005 | + QWidget *parent = (QWidget *)p->device(); |
1006 | + p->setBrushOrigin(parent->pos()); | ||
1007 | + parent->erase(x, y, w, h); | ||
913 | 1008 | ||
914 | if(menuHandler->useShadowText()){ | 1009 | if(menuHandler->useShadowText()){ |
915 | QColor shadow; | 1010 | QColor shadow; |
916 | if(p->device() && p->device()->devType() == QInternal::Widget && | 1011 | if(p->device() && p->device()->devType() == QInternal::Widget && |
917 | - ((QWidget *)p->device())->inherits("KMenuBar")){ | 1012 | - ((QWidget *)p->device())->inherits("KMenuBar")){ |
918 | - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 1013 | - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
919 | + ((QWidget *)p->device())->inherits("QMenuBar")){ | 1014 | + ((QWidget *)p->device())->inherits("QMenuBar")){ |
920 | + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 1015 | + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
921 | g.background().dark(130); | 1016 | g.background().dark(130); |
922 | } | 1017 | } |
923 | else | 1018 | else |
924 | @@ -2300,8 +2033,8 @@ | 1019 | @@ -2300,8 +2054,8 @@ |
925 | } | 1020 | } |
926 | 1021 | ||
927 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 1022 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
928 | - const QColorGroup &g, int lineWidth, | 1023 | - const QColorGroup &g, int lineWidth, |
929 | - const QBrush * fill) | 1024 | - const QBrush * fill) |
930 | + const QColorGroup &g, int /*lineWidth*/, | 1025 | + const QColorGroup &g, int /*lineWidth*/, |
931 | + const QBrush * /*fill*/) | 1026 | + const QBrush * /*fill*/) |
932 | { | 1027 | { |
933 | QColor c; | 1028 | QColor c; |
934 | switch(menuHandler->transType()){ | 1029 | switch(menuHandler->transType()){ |
935 | @@ -2336,8 +2069,6 @@ | 1030 | @@ -2336,8 +2090,6 @@ |
936 | 1031 | ||
937 | maxpmw = QMAX( maxpmw, 20 ); | 1032 | maxpmw = QMAX( maxpmw, 20 ); |
938 | 1033 | ||
939 | - if ( p->font() == KGlobalSettings::generalFont() ) | 1034 | - if ( p->font() == KGlobalSettings::generalFont() ) |
940 | - p->setFont( KGlobalSettings::menuFont() ); | 1035 | - p->setFont( KGlobalSettings::menuFont() ); |
941 | 1036 | ||
942 | bool dis = !enabled; | 1037 | bool dis = !enabled; |
943 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); | 1038 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); |
944 | @@ -2363,7 +2094,7 @@ | 1039 | @@ -2363,7 +2115,7 @@ |
945 | p->fillRect(x, y, w, h, menuBrush); | 1040 | p->fillRect(x, y, w, h, menuBrush); |
946 | } | 1041 | } |
947 | else{ | 1042 | else{ |
948 | - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | 1043 | - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); |
949 | + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | 1044 | + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); |
950 | if(pix) | 1045 | if(pix) |
951 | p->drawPixmap(x, y, *pix, x, y, w, h); | 1046 | p->drawPixmap(x, y, *pix, x, y, w, h); |
952 | } | 1047 | } |
953 | @@ -2508,25 +2239,6 @@ | 1048 | @@ -2508,25 +2260,6 @@ |
954 | return h; | 1049 | return h; |
955 | } | 1050 | } |
956 | 1051 | ||
957 | -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, | 1052 | -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, |
958 | - const QColorGroup &g, QBrush *fill) | 1053 | - const QColorGroup &g, QBrush *fill) |
959 | -{ | 1054 | -{ |
@@ -973,13 +1068,13 @@ Features: | |||
973 | - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | 1068 | - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); |
974 | - } | 1069 | - } |
975 | -} | 1070 | -} |
976 | 1071 | ||
977 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | 1072 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, |
978 | const QColorGroup &g, const QColor *c, | 1073 | const QColorGroup &g, const QColor *c, |
979 | @@ -2540,25 +2252,25 @@ | 1074 | @@ -2540,25 +2273,25 @@ |
980 | return; | 1075 | return; |
981 | } | 1076 | } |
982 | else{ | 1077 | else{ |
983 | - KStyle::drawFocusRect(p, r, g, c, atBorder); | 1078 | - KStyle::drawFocusRect(p, r, g, c, atBorder); |
984 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); | 1079 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); |
985 | } | 1080 | } |
@@ -1003,31 +1098,31 @@ Features: | |||
1003 | if(tabBar->shape() != QTabBar::RoundedAbove){ | 1098 | if(tabBar->shape() != QTabBar::RoundedAbove){ |
1004 | - KStyle::drawTab(p, tabBar, tab, selected); | 1099 | - KStyle::drawTab(p, tabBar, tab, selected); |
1005 | + QWindowsStyle::drawTab(p, tabBar, tab, selected); | 1100 | + QWindowsStyle::drawTab(p, tabBar, tab, selected); |
1006 | return; | 1101 | return; |
1007 | } | 1102 | } |
1008 | QPixmap tilePix; | 1103 | QPixmap tilePix; |
1009 | @@ -2671,7 +2383,7 @@ | 1104 | @@ -2671,7 +2404,7 @@ |
1010 | vFrame = 8; // was 10 | 1105 | vFrame = 8; // was 10 |
1011 | } | 1106 | } |
1012 | else | 1107 | else |
1013 | - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | 1108 | - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); |
1014 | + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | 1109 | + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); |
1015 | } | 1110 | } |
1016 | 1111 | ||
1017 | 1112 | ||
1018 | @@ -2699,7 +2411,7 @@ | 1113 | @@ -2699,7 +2432,7 @@ |
1019 | p->drawLine(x+1, y+1, x+1, y2-1); | 1114 | p->drawLine(x+1, y+1, x+1, y2-1); |
1020 | } | 1115 | } |
1021 | else if(lineWidth != 2 || !sunken) | 1116 | else if(lineWidth != 2 || !sunken) |
1022 | - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | 1117 | - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); |
1023 | + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | 1118 | + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); |
1024 | else{ | 1119 | else{ |
1025 | QPen oldPen = p->pen(); | 1120 | QPen oldPen = p->pen(); |
1026 | int x2 = x+w-1; | 1121 | int x2 = x+w-1; |
1027 | @@ -2726,105 +2438,6 @@ | 1122 | @@ -2726,105 +2459,6 @@ |
1028 | } | 1123 | } |
1029 | } | 1124 | } |
1030 | 1125 | ||
1031 | -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, | 1126 | -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, |
1032 | - const QColorGroup &g, QBrush *) | 1127 | - const QColorGroup &g, QBrush *) |
1033 | -{ | 1128 | -{ |
@@ -1127,13 +1222,13 @@ Features: | |||
1127 | - } | 1222 | - } |
1128 | - | 1223 | - |
1129 | -} | 1224 | -} |
1130 | 1225 | ||
1131 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) | 1226 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) |
1132 | { | 1227 | { |
1133 | @@ -2998,22 +2611,22 @@ | 1228 | @@ -2998,22 +2632,22 @@ |
1134 | customBtnIconList.clear(); | 1229 | customBtnIconList.clear(); |
1135 | customBtnLabelList.clear(); | 1230 | customBtnLabelList.clear(); |
1136 | 1231 | ||
1137 | - KConfig *config = KGlobal::config(); | 1232 | - KConfig *config = KGlobal::config(); |
1138 | - QString oldGrp = config->group(); | 1233 | - QString oldGrp = config->group(); |
1139 | - config->setGroup("MosfetButtons"); | 1234 | - config->setGroup("MosfetButtons"); |
@@ -1157,77 +1252,162 @@ Features: | |||
1157 | 1252 | ||
1158 | - KIconLoader *ldr = KGlobal::iconLoader(); | 1253 | - KIconLoader *ldr = KGlobal::iconLoader(); |
1159 | +// KIconLoader *ldr = KGlobal::iconLoader(); | 1254 | +// KIconLoader *ldr = KGlobal::iconLoader(); |
1160 | while(labelStr != NULL){ | 1255 | while(labelStr != NULL){ |
1161 | QColor *c = new QColor; | 1256 | QColor *c = new QColor; |
1162 | c->setNamedColor(QString(colorStr)); | 1257 | c->setNamedColor(QString(colorStr)); |
1163 | @@ -3022,7 +2635,7 @@ | 1258 | @@ -3022,7 +2656,7 @@ |
1164 | QString tmpStr(iconStr); | 1259 | QString tmpStr(iconStr); |
1165 | if(!tmpStr.isEmpty()){ | 1260 | if(!tmpStr.isEmpty()){ |
1166 | QPixmap *pixmap = | 1261 | QPixmap *pixmap = |
1167 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); | 1262 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); |
1168 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); | 1263 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); |
1169 | if(pixmap->isNull()){ | 1264 | if(pixmap->isNull()){ |
1170 | delete pixmap; | 1265 | delete pixmap; |
1171 | customBtnIconList.append(NULL); | 1266 | customBtnIconList.append(NULL); |
1172 | @@ -3037,7 +2650,6 @@ | 1267 | @@ -3037,7 +2671,6 @@ |
1173 | colorStr = colorList.next(); | 1268 | colorStr = colorList.next(); |
1174 | iconStr = iconList.next(); | 1269 | iconStr = iconList.next(); |
1175 | } | 1270 | } |
1176 | - config->setGroup(oldGrp); | 1271 | - config->setGroup(oldGrp); |
1177 | } | 1272 | } |
1178 | 1273 | ||
1179 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) | 1274 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) |
1180 | @@ -3087,7 +2699,7 @@ | 1275 | @@ -3087,7 +2720,7 @@ |
1181 | } | 1276 | } |
1182 | } | 1277 | } |
1183 | 1278 | ||
1184 | -#include "liquid.moc" | 1279 | -#include "liquid.moc" |
1185 | +// #include "liquid.moc" | 1280 | +// #include "liquid.moc" |
1186 | 1281 | ||
1187 | 1282 | ||
1188 | 1283 | ||
1189 | --- -Mon Jul 1 11:38:05 2002 | 1284 | --- -Mon Jul 15 02:34:13 2002 |
1190 | +++ plugin.cppFri Jun 28 13:25:25 2002 | 1285 | +++ plugin.cppFri Jul 12 00:41:40 2002 |
1191 | @@ -1,29 +1,29 @@ | 1286 | @@ -1,29 +1,113 @@ |
1192 | #include "liquid.h" | 1287 | #include "liquid.h" |
1193 | -#include <klocale.h> | 1288 | -#include <klocale.h> |
1194 | + | 1289 | +#include "liquidset.h" |
1290 | +#include "plugin.h" | ||
1195 | 1291 | ||
1196 | extern "C" { | 1292 | -extern "C" { |
1197 | - KStyle* allocate(); | 1293 | - KStyle* allocate(); |
1198 | - int minor_version(); | 1294 | - int minor_version(); |
1199 | - int major_version(); | 1295 | - int major_version(); |
1200 | - const char *description(); | 1296 | - const char *description(); |
1201 | + QStyle* allocate ( ); | 1297 | + |
1202 | + int minor_version ( ); | 1298 | + |
1203 | + int major_version ( ); | 1299 | +LiquidInterface::LiquidInterface ( ) : ref ( 0 ) |
1204 | + const char *description ( ); | 1300 | +{ |
1301 | +} | ||
1302 | + | ||
1303 | +LiquidInterface::~LiquidInterface ( ) | ||
1304 | +{ | ||
1305 | +} | ||
1306 | + | ||
1307 | +QStyle *LiquidInterface::create ( ) | ||
1308 | +{ | ||
1309 | +return new LiquidStyle ( ); | ||
1310 | +} | ||
1311 | + | ||
1312 | +QString LiquidInterface::name ( ) | ||
1313 | +{ | ||
1314 | +return QObject::tr( "Liquid", "name" ); | ||
1205 | } | 1315 | } |
1206 | 1316 | ||
1207 | -KStyle* allocate() | 1317 | -KStyle* allocate() |
1208 | +QStyle* allocate ( ) | 1318 | +QString LiquidInterface::description ( ) |
1209 | { | 1319 | { |
1210 | - return(new LiquidStyle); | 1320 | - return(new LiquidStyle); |
1211 | + return new LiquidStyle ( ); | 1321 | +return QObject::tr( "High Performance Liquid style by Mosfet", "description" ); |
1212 | } | 1322 | } |
1213 | 1323 | ||
1214 | -int minor_version() | 1324 | -int minor_version() |
1215 | +int minor_version ( ) | 1325 | +QCString LiquidInterface::key ( ) |
1216 | { | 1326 | { |
1217 | - return(0); | 1327 | - return(0); |
1218 | + return 0; | 1328 | +return QCString ( "liquid" ); |
1219 | } | 1329 | } |
1220 | 1330 | ||
1221 | -int major_version() | 1331 | -int major_version() |
1222 | +int major_version ( ) | 1332 | +unsigned int LiquidInterface::version ( ) |
1223 | { | 1333 | { |
1224 | - return(1); | 1334 | - return(1); |
1225 | + return 1; | 1335 | +return 100; // 1.0.0 (\d+.\d.\d) |
1226 | } | 1336 | } |
1227 | 1337 | ||
1228 | -const char *description() | 1338 | -const char *description() |
1229 | +const char *description ( ) | 1339 | +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
1340 | +{ | ||
1341 | +static LiquidSettingsInterface *setiface = 0; | ||
1342 | + | ||
1343 | +*iface = 0; | ||
1344 | + | ||
1345 | +if ( uuid == IID_QUnknown ) | ||
1346 | + *iface = this; | ||
1347 | +else if ( uuid == IID_Style ) | ||
1348 | + *iface = this; | ||
1349 | +else if ( uuid == IID_StyleSettings ) { | ||
1350 | + if ( !setiface ) | ||
1351 | + setiface = new LiquidSettingsInterface ( ); | ||
1352 | + *iface = setiface; | ||
1353 | +} | ||
1354 | + | ||
1355 | +if ( *iface ) | ||
1356 | + (*iface)-> addRef ( ); | ||
1357 | + | ||
1358 | +return QS_OK; | ||
1359 | +} | ||
1360 | + | ||
1361 | +Q_EXPORT_INTERFACE() | ||
1362 | +{ | ||
1363 | +Q_CREATE_INSTANCE( LiquidInterface ) | ||
1364 | +} | ||
1365 | + | ||
1366 | + | ||
1367 | +LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) | ||
1230 | { | 1368 | { |
1231 | - return(i18n("High performance liquid plugin").utf8()); | 1369 | - return(i18n("High performance liquid plugin").utf8()); |
1232 | + return "High Performance Liquid"; | 1370 | +m_widget = 0; |
1233 | } | 1371 | } |
1372 | + | ||
1373 | +LiquidSettingsInterface::~LiquidSettingsInterface ( ) | ||
1374 | +{ | ||
1375 | +} | ||
1376 | + | ||
1377 | +QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) | ||
1378 | +{ | ||
1379 | +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); | ||
1380 | + | ||
1381 | +return m_widget; | ||
1382 | +} | ||
1383 | + | ||
1384 | +bool LiquidSettingsInterface::accept ( ) | ||
1385 | +{ | ||
1386 | +if ( !m_widget ) | ||
1387 | + return false; | ||
1388 | + | ||
1389 | +return m_widget-> writeConfig ( ); | ||
1390 | +} | ||
1391 | + | ||
1392 | +void LiquidSettingsInterface::reject ( ) | ||
1393 | +{ | ||
1394 | +} | ||
1395 | + | ||
1396 | +QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
1397 | +{ | ||
1398 | +*iface = 0; | ||
1399 | + | ||
1400 | + | ||
1401 | +if ( uuid == IID_QUnknown ) | ||
1402 | + *iface = this; | ||
1403 | +else if ( uuid == IID_StyleSettings ) | ||
1404 | + *iface = this; | ||
1405 | + | ||
1406 | +if ( *iface ) | ||
1407 | + (*iface)-> addRef ( ); | ||
1408 | + | ||
1409 | +return QS_OK; | ||
1410 | +} | ||
1411 | + | ||
1412 | +// Hack for Retail Z experiments | ||
1413 | +extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } | ||