summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid
authormickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
committer mickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
commit16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff)
tree0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/styles/liquid
parent8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff)
downloadopie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/styles/liquid') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/config.in2
-rw-r--r--noncore/styles/liquid/liquid.cpp27
-rw-r--r--noncore/styles/liquid/liquid.pro6
3 files changed, 20 insertions, 15 deletions
diff --git a/noncore/styles/liquid/config.in b/noncore/styles/liquid/config.in
index 23f8637..cffdb39 100644
--- a/noncore/styles/liquid/config.in
+++ b/noncore/styles/liquid/config.in
@@ -1,4 +1,4 @@
1 config LIQUID 1 config LIQUID
2 boolean "opie-liquid (Mosfet's well known Liquid GUI style from KDE)" 2 boolean "opie-liquid (Mosfet's well known Liquid GUI style from KDE)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBQTAUX 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBQTAUX && LIBOPIE2CORE
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index bac882c..51814e7 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,92 +1,97 @@
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// (c) 2002 Robert 'sandman' Griebl 6// (c) 2002 Robert 'sandman' Griebl
7// 7//
8 8
9 9
10#ifndef INCLUDE_MENUITEM_DEF 10#ifndef INCLUDE_MENUITEM_DEF
11#define INCLUDE_MENUITEM_DEF 11#define INCLUDE_MENUITEM_DEF
12#endif 12#endif
13 13
14#include <qmenudata.h>
15#include "liquid.h" 14#include "liquid.h"
16//#include "liquiddeco.h" 15#include "effects.h"
17#include <qapplication.h> 16#include "htmlmasks.h"
17#include "embeddata.h"
18
19/* OPIE */
20#include <opie2/odebug.h>
18#include <qpe/config.h> 21#include <qpe/config.h>
19#include "effects.h" 22using namespace Opie::Core;
23
24/* QT */
25#include <qmenudata.h>
26#include <qapplication.h>
20#include <qpalette.h> 27#include <qpalette.h>
21#include <qbitmap.h> 28#include <qbitmap.h>
22#include <qtabbar.h> 29#include <qtabbar.h>
23#include <qpopupmenu.h> 30#include <qpopupmenu.h>
24#include <qobjectlist.h> 31#include <qobjectlist.h>
25#include <qimage.h> 32#include <qimage.h>
26#include <qtimer.h> 33#include <qtimer.h>
27#include <qpixmapcache.h> 34#include <qpixmapcache.h>
28#include <qradiobutton.h> 35#include <qradiobutton.h>
29#include <qcombobox.h> 36#include <qcombobox.h>
30#include <qdrawutil.h> 37#include <qdrawutil.h>
31#include <qwidgetlist.h> 38#include <qwidgetlist.h>
32#include <qtoolbutton.h> 39#include <qtoolbutton.h>
33#include <qheader.h> 40#include <qheader.h>
34#include <unistd.h>
35#include <qmenubar.h> 41#include <qmenubar.h>
36#include <qprogressbar.h> 42#include <qprogressbar.h>
37#include <qlineedit.h> 43#include <qlineedit.h>
38#include <qlistbox.h> 44#include <qlistbox.h>
39 45
46/* STD */
47#include <unistd.h>
40#include <stdio.h> 48#include <stdio.h>
41 49
42#include "htmlmasks.h"
43#include "embeddata.h"
44
45 50
46typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 51typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
47 QColorGroup &, bool, bool); 52 QColorGroup &, bool, bool);
48 53
49QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 54QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
50 55
51void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 56void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
52{ 57{
53 QImage img(pix.convertToImage()); 58 QImage img(pix.convertToImage());
54 QImageEffect::fade(img, 0.9, color); 59 QImageEffect::fade(img, 0.9, color);
55 int x, y; 60 int x, y;
56 int r, g, b; 61 int r, g, b;
57 for(y=0; y < img.height(); y+=3){ 62 for(y=0; y < img.height(); y+=3){
58 unsigned int *data = (unsigned int *) img.scanLine(y); 63 unsigned int *data = (unsigned int *) img.scanLine(y);
59 for(x=0; x < img.width(); ++x){ 64 for(x=0; x < img.width(); ++x){
60 r = qRed(data[x]); 65 r = qRed(data[x]);
61 g = qGreen(data[x]); 66 g = qGreen(data[x]);
62 b = qBlue(data[x]); 67 b = qBlue(data[x]);
63 if(r-10) 68 if(r-10)
64 r-=10; 69 r-=10;
65 if(g-10) 70 if(g-10)
66 g-=10; 71 g-=10;
67 if(b-10) 72 if(b-10)
68 b-=10; 73 b-=10;
69 data[x] = qRgb(r, g, b); 74 data[x] = qRgb(r, g, b);
70 } 75 }
71 } 76 }
72 pix.convertFromImage(img); 77 pix.convertFromImage(img);
73} 78}
74 79
75TransMenuHandler::TransMenuHandler(QObject *parent) 80TransMenuHandler::TransMenuHandler(QObject *parent)
76 : QObject(parent) 81 : QObject(parent)
77{ 82{
78 pixDict.setAutoDelete(true); 83 pixDict.setAutoDelete(true);
79 reloadSettings(); 84 reloadSettings();
80} 85}
81 86
82void TransMenuHandler::reloadSettings() 87void TransMenuHandler::reloadSettings()
83{ 88{
84 pixDict.clear(); 89 pixDict.clear();
85 90
86 Config config ( "qpe" ); 91 Config config ( "qpe" );
87 config. setGroup ( "Liquid-Style" ); 92 config. setGroup ( "Liquid-Style" );
88 93
89 type = config. readNumEntry("Type", TransStippleBg); 94 type = config. readNumEntry("Type", TransStippleBg);
90 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 95 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
91 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 96 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
92 opacity = config. readNumEntry("Opacity", 10); 97 opacity = config. readNumEntry("Opacity", 10);
@@ -104,97 +109,97 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
104 109
105 if(ev->type() == QEvent::Show){ 110 if(ev->type() == QEvent::Show){
106 if(type == TransStippleBg || type == TransStippleBtn || 111 if(type == TransStippleBg || type == TransStippleBtn ||
107 type == Custom){ 112 type == Custom){
108 QApplication::syncX(); 113 QApplication::syncX();
109 QPixmap *pix = new QPixmap; 114 QPixmap *pix = new QPixmap;
110 if(p->testWFlags(Qt::WType_Popup)){ 115 if(p->testWFlags(Qt::WType_Popup)){
111 QRect r(p->x(), p->y(), p->width(), p->height()); 116 QRect r(p->x(), p->y(), p->width(), p->height());
112 QRect deskR = QApplication::desktop()->rect(); 117 QRect deskR = QApplication::desktop()->rect();
113 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 118 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
114 r.setBottom(deskR.bottom()); 119 r.setBottom(deskR.bottom());
115 r.setRight(deskR.right()); 120 r.setRight(deskR.right());
116 } 121 }
117 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 122 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
118 r.width(), r.height()); 123 r.width(), r.height());
119 } 124 }
120 else{ // tear off menu 125 else{ // tear off menu
121 pix->resize(p->width(), p->height()); 126 pix->resize(p->width(), p->height());
122 pix->fill(Qt::black.rgb()); 127 pix->fill(Qt::black.rgb());
123 } 128 }
124 if(type == TransStippleBg){ 129 if(type == TransStippleBg){
125 stripePixmap(*pix, p->colorGroup().background()); 130 stripePixmap(*pix, p->colorGroup().background());
126 } 131 }
127 else if(type == TransStippleBtn){ 132 else if(type == TransStippleBtn){
128 stripePixmap(*pix, p->colorGroup().button()); 133 stripePixmap(*pix, p->colorGroup().button());
129 } 134 }
130 else{ 135 else{
131 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 136 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
132 } 137 }
133 138
134 pixDict.insert(p->winId(), pix); 139 pixDict.insert(p->winId(), pix);
135 140
136 if ( !p->inherits("QPopupMenu")) 141 if ( !p->inherits("QPopupMenu"))
137 p->setBackgroundPixmap(*pix); 142 p->setBackgroundPixmap(*pix);
138 143
139 QObjectList *ol = p-> queryList("QWidget"); 144 QObjectList *ol = p-> queryList("QWidget");
140 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 145 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
141 QWidget *wid = (QWidget *) it.current ( ); 146 QWidget *wid = (QWidget *) it.current ( );
142 147
143 wid-> setBackgroundPixmap(*pix); 148 wid-> setBackgroundPixmap(*pix);
144 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 149 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
145 } 150 }
146 delete ol; 151 delete ol;
147 } 152 }
148 } 153 }
149 else if(ev->type() == QEvent::Hide){ 154 else if(ev->type() == QEvent::Hide){
150 if(type == TransStippleBg || type == TransStippleBtn || 155 if(type == TransStippleBg || type == TransStippleBtn ||
151 type == Custom){ 156 type == Custom){
152// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 157// owarn << "Deleting menu pixmap, width " << pixDict.find(p->winId())->width() << "" << oendl;
153 158
154 pixDict.remove(p->winId()); 159 pixDict.remove(p->winId());
155 if ( !p->inherits("QPopupMenu")) 160 if ( !p->inherits("QPopupMenu"))
156 p->setBackgroundMode(QWidget::PaletteBackground); 161 p->setBackgroundMode(QWidget::PaletteBackground);
157 162
158 QObjectList *ol = p-> queryList("QWidget"); 163 QObjectList *ol = p-> queryList("QWidget");
159 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 164 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
160 QWidget *wid = (QWidget *) it.current ( ); 165 QWidget *wid = (QWidget *) it.current ( );
161 166
162 wid-> setBackgroundMode( QWidget::PaletteBackground ); 167 wid-> setBackgroundMode( QWidget::PaletteBackground );
163 } 168 }
164 delete ol; 169 delete ol;
165 } 170 }
166 } 171 }
167 return(false); 172 return(false);
168} 173}
169 174
170 175
171 176
172 177
173LiquidStyle::LiquidStyle() 178LiquidStyle::LiquidStyle()
174 :QWindowsStyle() 179 :QWindowsStyle()
175{ 180{
176 setName ( "LiquidStyle" ); 181 setName ( "LiquidStyle" );
177 182
178 flatTBButtons = false; 183 flatTBButtons = false;
179 currentHeader = 0; 184 currentHeader = 0;
180 185
181 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 186 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
182 btnMaskBmp.setMask(btnMaskBmp); 187 btnMaskBmp.setMask(btnMaskBmp);
183 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 188 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
184 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 189 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
185 headerHoverID = -1; 190 headerHoverID = -1;
186 highlightWidget = NULL; 191 highlightWidget = NULL;
187 setButtonDefaultIndicatorWidth(0); 192 setButtonDefaultIndicatorWidth(0);
188 btnDict.setAutoDelete(true); 193 btnDict.setAutoDelete(true);
189 bevelFillDict.setAutoDelete(true); 194 bevelFillDict.setAutoDelete(true);
190 smallBevelFillDict.setAutoDelete(true); 195 smallBevelFillDict.setAutoDelete(true);
191 196
192 rMatrix.rotate(270.0); 197 rMatrix.rotate(270.0);
193 btnBorderPix = new QPixmap; 198 btnBorderPix = new QPixmap;
194 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 199 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
195 btnBlendPix = new QPixmap; 200 btnBlendPix = new QPixmap;
196 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 201 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
197 bevelFillPix = new QPixmap; 202 bevelFillPix = new QPixmap;
198 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 203 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
199 smallBevelFillPix = new QPixmap; 204 smallBevelFillPix = new QPixmap;
200 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 205 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
@@ -449,97 +454,97 @@ void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
449 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 454 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
450 // right 455 // right
451 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 456 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
452 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); 457 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20);
453 tilePix.setMask(blendMask); 458 tilePix.setMask(blendMask);
454 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 459 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
455 460
456 p.end(); 461 p.end();
457 462
458 // do the button mask - we don't automask buttons 463 // do the button mask - we don't automask buttons
459 QBitmap btnMask(w, h); 464 QBitmap btnMask(w, h);
460 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 465 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
461 p.begin(&btnMask); 466 p.begin(&btnMask);
462 p.fillRect(0, 0, w, h, Qt::color0); 467 p.fillRect(0, 0, w, h, Qt::color0);
463 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 468 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
464 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 469 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
465 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 470 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
466 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 471 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
467 // fills 472 // fills
468 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 473 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
469 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 474 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
470 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 475 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
471 p.end(); 476 p.end();
472 tmpPix.setMask(btnMask); 477 tmpPix.setMask(btnMask);
473 /*if(autoDefault){ 478 /*if(autoDefault){
474 if(supportPushDown && pushedDown){ 479 if(supportPushDown && pushedDown){
475 painter->drawPixmap(x+3, y+3, tmpPix); 480 painter->drawPixmap(x+3, y+3, tmpPix);
476 } 481 }
477 else{ 482 else{
478 painter->drawPixmap(x+2, y+2, tmpPix); 483 painter->drawPixmap(x+2, y+2, tmpPix);
479 } 484 }
480 } 485 }
481 else */if(supportPushDown && pushedDown) 486 else */if(supportPushDown && pushedDown)
482 painter->drawPixmap(x+1, y+1, tmpPix); 487 painter->drawPixmap(x+1, y+1, tmpPix);
483 else 488 else
484 painter->drawPixmap(x, y, tmpPix); 489 painter->drawPixmap(x, y, tmpPix);
485 490
486 491
487 492
488} 493}
489 494
490 495
491QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, 496QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
492 bool blend) 497 bool blend)
493{ 498{
494 QImage img(qembed_findImage(label)); 499 QImage img(qembed_findImage(label));
495 img.detach(); 500 img.detach();
496 if(img.isNull()){ // shouldn't happen, been tested 501 if(img.isNull()){ // shouldn't happen, been tested
497 qWarning("Invalid embedded label %s", label); 502 owarn << "Invalid embedded label " << label << "" << oendl;
498 return(NULL); 503 return(NULL);
499 } 504 }
500 if(img.depth() != 32) 505 if(img.depth() != 32)
501 img = img.convertDepth(32); 506 img = img.convertDepth(32);
502 unsigned int *data = (unsigned int *)img.bits(); 507 unsigned int *data = (unsigned int *)img.bits();
503 int total = img.width()*img.height(); 508 int total = img.width()*img.height();
504 int current; 509 int current;
505 QColor c; 510 QColor c;
506 int oldH, oldS, oldV; 511 int oldH, oldS, oldV;
507 int alpha; 512 int alpha;
508 if(v < 235) 513 if(v < 235)
509 v += 20; 514 v += 20;
510 else 515 else
511 v = 255; 516 v = 255;
512 float intensity = v/255.0; 517 float intensity = v/255.0;
513 518
514 for(current=0; current<total; ++current){ 519 for(current=0; current<total; ++current){
515 alpha = qAlpha(data[current]); 520 alpha = qAlpha(data[current]);
516 c.setRgb(data[current]); 521 c.setRgb(data[current]);
517 c.hsv(&oldH, &oldS, &oldV); 522 c.hsv(&oldH, &oldS, &oldV);
518 oldV = (int)(oldV*intensity); 523 oldV = (int)(oldV*intensity);
519 c.setHsv(h, s, oldV); 524 c.setHsv(h, s, oldV);
520 if(blend && alpha != 255 && alpha != 0){ 525 if(blend && alpha != 255 && alpha != 0){
521 float srcPercent = ((float)alpha)/255.0; 526 float srcPercent = ((float)alpha)/255.0;
522 float destPercent = 1.0-srcPercent; 527 float destPercent = 1.0-srcPercent;
523 oldH = (int)((srcPercent*h) + (destPercent*bH)); 528 oldH = (int)((srcPercent*h) + (destPercent*bH));
524 oldS = (int)((srcPercent*s) + (destPercent*bS)); 529 oldS = (int)((srcPercent*s) + (destPercent*bS));
525 oldV = (int)((srcPercent*oldV) + (destPercent*bV)); 530 oldV = (int)((srcPercent*oldV) + (destPercent*bV));
526 c.setHsv(oldH, oldS, oldV); 531 c.setHsv(oldH, oldS, oldV);
527 alpha = 255; 532 alpha = 255;
528 } 533 }
529 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); 534 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha);
530 } 535 }
531 QPixmap *pix = new QPixmap; 536 QPixmap *pix = new QPixmap;
532 pix->convertFromImage(img); 537 pix->convertFromImage(img);
533 return(pix); 538 return(pix);
534} 539}
535 540
536 541
537 542
538 543
539QPixmap* LiquidStyle::getPixmap(BitmapData item) 544QPixmap* LiquidStyle::getPixmap(BitmapData item)
540{ 545{
541 546
542 if(pixmaps[item]) 547 if(pixmaps[item])
543 return(pixmaps[item]); 548 return(pixmaps[item]);
544 549
545 switch(item){ 550 switch(item){
@@ -815,97 +820,97 @@ void LiquidStyle::polish(QWidget *w)
815 w->setBackgroundOrigin ( QWidget::ParentOrigin); 820 w->setBackgroundOrigin ( QWidget::ParentOrigin);
816 } 821 }
817 822
818 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 823 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
819 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 824 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
820 bool isViewportChild = w->parent() && 825 bool isViewportChild = w->parent() &&
821 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 826 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
822 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 827 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
823 828
824 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 829 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
825 w->setBackgroundMode(QWidget::X11ParentRelative); 830 w->setBackgroundMode(QWidget::X11ParentRelative);
826 return; 831 return;
827 } 832 }
828 if(isViewportChild){ 833 if(isViewportChild){
829 if(w->inherits("QButton") || w->inherits("QComboBox")){ 834 if(w->inherits("QButton") || w->inherits("QComboBox")){
830 if(w->parent()){ // heh, only way to test for KHTML children ;-) 835 if(w->parent()){ // heh, only way to test for KHTML children ;-)
831 if(w->parent()->parent()){ 836 if(w->parent()->parent()){
832 if(w->parent()->parent()->parent() && 837 if(w->parent()->parent()->parent() &&
833 w->parent()->parent()->parent()->inherits("KHTMLView")){ 838 w->parent()->parent()->parent()->inherits("KHTMLView")){
834 w->setAutoMask(true); 839 w->setAutoMask(true);
835 w->setBackgroundMode(QWidget::NoBackground); 840 w->setBackgroundMode(QWidget::NoBackground);
836 } 841 }
837 } 842 }
838 } 843 }
839 return; 844 return;
840 } 845 }
841 } 846 }
842 if(w->inherits("QHeader")){ 847 if(w->inherits("QHeader")){
843 w->setMouseTracking(true); 848 w->setMouseTracking(true);
844 w->installEventFilter(this); 849 w->installEventFilter(this);
845 } 850 }
846 if(w-> inherits("QToolButton")) { 851 if(w-> inherits("QToolButton")) {
847 if (w->parent()->inherits("QToolBar")) { 852 if (w->parent()->inherits("QToolBar")) {
848 ((QToolButton*)w)->setAutoRaise (flatTBButtons); 853 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
849 if ( flatTBButtons ) 854 if ( flatTBButtons )
850 w->setBackgroundOrigin(QWidget::ParentOrigin); 855 w->setBackgroundOrigin(QWidget::ParentOrigin);
851 } 856 }
852 w-> installEventFilter ( this ); 857 w-> installEventFilter ( this );
853 } 858 }
854 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 859 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
855 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 860 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
856 } 861 }
857 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 862 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
858 return; 863 return;
859 } 864 }
860 865
861 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 866 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
862 palette().active().brush(QColorGroup::Background).pixmap()){ 867 palette().active().brush(QColorGroup::Background).pixmap()){
863 qWarning("No parent pixmap for child widget %s", w->className()); 868 owarn << "No parent pixmap for child widget " << w->className() << "" << oendl;
864 return; 869 return;
865 } 870 }
866 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 871 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
867 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 872 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
868 if(w->backgroundMode() == QWidget::PaletteBackground || 873 if(w->backgroundMode() == QWidget::PaletteBackground ||
869 w->backgroundMode() == QWidget::PaletteButton){ 874 w->backgroundMode() == QWidget::PaletteButton){
870 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 875 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
871 w->setBackgroundOrigin(QWidget::ParentOrigin); 876 w->setBackgroundOrigin(QWidget::ParentOrigin);
872 // w->setBackgroundMode(QWidget::NoBackground); 877 // w->setBackgroundMode(QWidget::NoBackground);
873 } 878 }
874 } 879 }
875 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 880 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
876 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 881 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
877 else if ( w-> inherits("QFrame") ) 882 else if ( w-> inherits("QFrame") )
878 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 883 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
879 884
880 if ( w->parentWidget()->inherits ( "QWidgetStack" )) { 885 if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
881 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 886 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
882 } 887 }
883} 888}
884 889
885void LiquidStyle::unPolish(QWidget *w) 890void LiquidStyle::unPolish(QWidget *w)
886{ 891{
887 if(w->inherits("QMenuBar")){ 892 if(w->inherits("QMenuBar")){
888 ((QFrame *)w)->setLineWidth(1); 893 ((QFrame *)w)->setLineWidth(1);
889 w->setBackgroundMode(QWidget::PaletteBackground); 894 w->setBackgroundMode(QWidget::PaletteBackground);
890 return; 895 return;
891 } 896 }
892 897
893 if(w->inherits("QPopupMenu")) 898 if(w->inherits("QPopupMenu"))
894 w->setBackgroundMode(QWidget::PaletteButton); 899 w->setBackgroundMode(QWidget::PaletteButton);
895 else if(w-> testWFlags(Qt::WType_Popup) && 900 else if(w-> testWFlags(Qt::WType_Popup) &&
896 !w->inherits("QListBox") && 901 !w->inherits("QListBox") &&
897 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 902 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
898 w->removeEventFilter(menuHandler); 903 w->removeEventFilter(menuHandler);
899 } 904 }
900 905
901 if(w->isTopLevel()) 906 if(w->isTopLevel())
902 return; 907 return;
903 908
904 // for viewport children, don't just check for NoBackground.... 909 // for viewport children, don't just check for NoBackground....
905 bool isViewportChild = w->parent() && 910 bool isViewportChild = w->parent() &&
906 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 911 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
907 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 912 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
908 913
909 w->unsetPalette(); 914 w->unsetPalette();
910 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 915 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
911 if(w->inherits("QPushButton")) 916 if(w->inherits("QPushButton"))
diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro
index 7fe2829..767007f 100644
--- a/noncore/styles/liquid/liquid.pro
+++ b/noncore/styles/liquid/liquid.pro
@@ -1,19 +1,19 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt plugin embedded warn_on 2CONFIG = qt plugin embedded warn_on
3SOURCES = liquid.cpp \ 3SOURCES = liquid.cpp \
4 effects.cpp \ 4 effects.cpp \
5 liquidset.cpp \ 5 liquidset.cpp \
6 plugin.cpp 6 plugin.cpp
7 7
8HEADERS = liquid.h \ 8HEADERS = liquid.h \
9 effects.h \ 9 effects.h \
10 liquidset.h \ 10 liquidset.h \
11 plugin.h 11 plugin.h
12 12
13LIBS += -lqpe -lqtaux2 13LIBS += -lqpe -lqtaux2 -lopiecore2
14INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
15DESTDIR = $(OPIEDIR)/plugins/styles 15DESTDIR = $(OPIEDIR)/plugins/styles
16TARGET = liquid 16TARGET = liquid
17VERSION = 1.0.0 17VERSION = 1.0.1
18 18
19include ( $(OPIEDIR)/include.pro ) 19include ( $(OPIEDIR)/include.pro )