summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--apps/Settings/Liquid.desktop7
-rw-r--r--noncore/styles/liquid/liquid.cpp57
-rw-r--r--noncore/styles/liquid/opie-liquid.control2
-rw-r--r--noncore/styles/liquid/settings/liquidset.cpp199
-rw-r--r--noncore/styles/liquid/settings/liquidset.h39
-rw-r--r--noncore/styles/liquid/settings/main.cpp34
-rw-r--r--noncore/styles/liquid/settings/settings.pro24
-rw-r--r--pics/liquid/Liquid.pngbin0 -> 2771 bytes
8 files changed, 357 insertions, 5 deletions
diff --git a/apps/Settings/Liquid.desktop b/apps/Settings/Liquid.desktop
new file mode 100644
index 0000000..8a1727f
--- a/dev/null
+++ b/apps/Settings/Liquid.desktop
@@ -0,0 +1,7 @@
1[Desktop Entry]
2Type=Application
3Exec=liquid-settings
4Icon=liquid/Liquid
5Name=Liquid-Settings
6Name[de]=Liquid-Einstellungen
7
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 5f014ad..4653639 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,256 +1,297 @@
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 <qapplication.h> 13#include <qapplication.h>
14#include <qpe/config.h> 14#include <qpe/config.h>
15#include "effects.h" 15#include "effects.h"
16#include <qpalette.h> 16#include <qpalette.h>
17#include <qbitmap.h> 17#include <qbitmap.h>
18#include <qtabbar.h> 18#include <qtabbar.h>
19#include <qpopupmenu.h> 19#include <qpopupmenu.h>
20#include <qobjectlist.h> 20#include <qobjectlist.h>
21#include <qimage.h> 21#include <qimage.h>
22#include <qtimer.h> 22#include <qtimer.h>
23#include <qpixmapcache.h> 23#include <qpixmapcache.h>
24#include <qradiobutton.h> 24#include <qradiobutton.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qdrawutil.h> 26#include <qdrawutil.h>
27#include <qwidgetlist.h> 27#include <qwidgetlist.h>
28#include <qtoolbutton.h> 28#include <qtoolbutton.h>
29#include <qheader.h> 29#include <qheader.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <qmenubar.h> 31#include <qmenubar.h>
32 32
33 33
34#include <stdio.h> 34#include <stdio.h>
35 35
36#include "htmlmasks.h" 36#include "htmlmasks.h"
37#include "embeddata.h" 37#include "embeddata.h"
38 38
39typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 39typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
40 QColorGroup &, bool, bool); 40 QColorGroup &, bool, bool);
41 41
42QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 42QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
43 43
44void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 44void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
45{ 45{
46 QImage img(pix.convertToImage()); 46 QImage img(pix.convertToImage());
47 QImageEffect::fade(img, 0.9, color); 47 QImageEffect::fade(img, 0.9, color);
48 int x, y; 48 int x, y;
49 int r, g, b; 49 int r, g, b;
50 for(y=0; y < img.height(); y+=3){ 50 for(y=0; y < img.height(); y+=3){
51 unsigned int *data = (unsigned int *) img.scanLine(y); 51 unsigned int *data = (unsigned int *) img.scanLine(y);
52 for(x=0; x < img.width(); ++x){ 52 for(x=0; x < img.width(); ++x){
53 r = qRed(data[x]); 53 r = qRed(data[x]);
54 g = qGreen(data[x]); 54 g = qGreen(data[x]);
55 b = qBlue(data[x]); 55 b = qBlue(data[x]);
56 if(r-10) 56 if(r-10)
57 r-=10; 57 r-=10;
58 if(g-10) 58 if(g-10)
59 g-=10; 59 g-=10;
60 if(b-10) 60 if(b-10)
61 b-=10; 61 b-=10;
62 data[x] = qRgb(r, g, b); 62 data[x] = qRgb(r, g, b);
63 } 63 }
64 } 64 }
65 pix.convertFromImage(img); 65 pix.convertFromImage(img);
66} 66}
67 67
68TransMenuHandler::TransMenuHandler(QObject *parent) 68TransMenuHandler::TransMenuHandler(QObject *parent)
69 : QObject(parent) 69 : QObject(parent)
70{ 70{
71 pixDict.setAutoDelete(true); 71 pixDict.setAutoDelete(true);
72 reloadSettings(); 72 reloadSettings();
73} 73}
74 74
75void TransMenuHandler::reloadSettings() 75void TransMenuHandler::reloadSettings()
76{ 76{
77 pixDict.clear(); 77 pixDict.clear();
78 78
79 Config config ( "qpe" ); 79 Config config ( "qpe" );
80 config. setGroup ( "MosfetMenus" ); 80 config. setGroup ( "MosfetMenus" );
81 81
82 type = config. readNumEntry("Type", TransStippleBg); 82 type = config. readNumEntry("Type", TransStippleBg);
83 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 83 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
84 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 84 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
85 opacity = config. readNumEntry("Opacity", 10); 85 opacity = config. readNumEntry("Opacity", 10);
86 if ( opacity < -20 )
87 opacity = 20;
88 else if ( opacity > 20 )
89 opacity = 20;
90
86 shadowText = config. readBoolEntry("ShadowText", true); 91 shadowText = config. readBoolEntry("ShadowText", true);
87} 92}
88 93
89bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 94bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
90{ 95{
91 QPopupMenu *p = (QPopupMenu *)obj; 96 QWidget *p = (QWidget *)obj;
92 97
93 if(ev->type() == QEvent::Show){ 98 if(ev->type() == QEvent::Show){
94 if(type == TransStippleBg || type == TransStippleBtn || 99 if(type == TransStippleBg || type == TransStippleBtn ||
95 type == Custom){ 100 type == Custom){
96 QApplication::syncX(); 101 QApplication::syncX();
97 QPixmap *pix = new QPixmap; 102 QPixmap *pix = new QPixmap;
98 if(p->testWFlags(Qt::WType_Popup)){ 103 if(p->testWFlags(Qt::WType_Popup)){
99 QRect r(p->x(), p->y(), p->width(), p->height()); 104 QRect r(p->x(), p->y(), p->width(), p->height());
100 QRect deskR = QApplication::desktop()->rect(); 105 QRect deskR = QApplication::desktop()->rect();
101 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 106 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
102 r.setBottom(deskR.bottom()); 107 r.setBottom(deskR.bottom());
103 r.setRight(deskR.right()); 108 r.setRight(deskR.right());
104 } 109 }
105 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 110 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
106 r.width(), r.height()); 111 r.width(), r.height());
107 } 112 }
108 else{ // tear off menu 113 else{ // tear off menu
109 pix->resize(p->width(), p->height()); 114 pix->resize(p->width(), p->height());
110 pix->fill(Qt::black.rgb()); 115 pix->fill(Qt::black.rgb());
111 } 116 }
112 if(type == TransStippleBg){ 117 if(type == TransStippleBg){
113 stripePixmap(*pix, p->colorGroup().background()); 118 stripePixmap(*pix, p->colorGroup().background());
114 } 119 }
115 else if(type == TransStippleBtn){ 120 else if(type == TransStippleBtn){
116 stripePixmap(*pix, p->colorGroup().button()); 121 stripePixmap(*pix, p->colorGroup().button());
117 } 122 }
118 else{ 123 else{
119 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 124 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
120 } 125 }
121 pixDict.insert(p->winId(), pix); 126
127 if (p->inherits("QPopupMenu"))
128 pixDict.insert(p->winId(), pix);
129 else {
130 p->setBackgroundPixmap(*pix);
131
132 QObjectList *ol = p-> queryList("QWidget");
133 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
134 QWidget *wid = (QWidget *) it.current ( );
135
136 wid-> setBackgroundPixmap(*pix);
137 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
138 }
139 delete ol;
140 }
122 } 141 }
123 } 142 }
124 else if(ev->type() == QEvent::Hide){ 143 else if(ev->type() == QEvent::Hide){
125 if(type == TransStippleBg || type == TransStippleBtn || 144 if(type == TransStippleBg || type == TransStippleBtn ||
126 type == Custom){ 145 type == Custom){
127// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 146// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
128 pixDict.remove(p->winId()); 147
148 if (p->inherits("QPopupMenu"))
149 pixDict.remove(p->winId());
150 else {
151 p->setBackgroundMode(QWidget::PaletteBackground);
152
153 QObjectList *ol = p-> queryList("QWidget");
154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
155 QWidget *wid = (QWidget *) it.current ( );
156
157 wid-> setBackgroundMode( QWidget::PaletteBackground );
158 }
159 delete ol;
160 }
161 }
162 }
163 else if(ev->type() == QEvent::Paint){
164 if(type == TransStippleBg || type == TransStippleBtn ||
165 type == Custom){
166// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
167
168 if (!p->inherits("QPopupMenu"))
169 p->erase();
129 } 170 }
130 } 171 }
131 return(false); 172 return(false);
132} 173}
133 174
134 175
135LiquidStyle::LiquidStyle() 176LiquidStyle::LiquidStyle()
136 :QWindowsStyle() 177 :QWindowsStyle()
137{ 178{
138 setName ( "LiquidStyle" ); 179 setName ( "LiquidStyle" );
139 180
140 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 181 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
141 btnMaskBmp.setMask(btnMaskBmp); 182 btnMaskBmp.setMask(btnMaskBmp);
142 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 183 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
143 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 184 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
144 headerHoverID = -1; 185 headerHoverID = -1;
145 highlightWidget = NULL; 186 highlightWidget = NULL;
146 setButtonDefaultIndicatorWidth(0); 187 setButtonDefaultIndicatorWidth(0);
147 btnDict.setAutoDelete(true); 188 btnDict.setAutoDelete(true);
148 bevelFillDict.setAutoDelete(true); 189 bevelFillDict.setAutoDelete(true);
149 smallBevelFillDict.setAutoDelete(true); 190 smallBevelFillDict.setAutoDelete(true);
150 customBtnColorList.setAutoDelete(true); 191 customBtnColorList.setAutoDelete(true);
151 customBtnIconList.setAutoDelete(true); 192 customBtnIconList.setAutoDelete(true);
152 customBtnLabelList.setAutoDelete(true); 193 customBtnLabelList.setAutoDelete(true);
153 194
154 rMatrix.rotate(270.0); 195 rMatrix.rotate(270.0);
155 highcolor = QPixmap::defaultDepth() > 8; 196 highcolor = QPixmap::defaultDepth() > 8;
156 btnBorderPix = new QPixmap; 197 btnBorderPix = new QPixmap;
157 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 198 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
158 btnBlendPix = new QPixmap; 199 btnBlendPix = new QPixmap;
159 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 200 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
160 bevelFillPix = new QPixmap; 201 bevelFillPix = new QPixmap;
161 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 202 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
162 smallBevelFillPix = new QPixmap; 203 smallBevelFillPix = new QPixmap;
163 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 204 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
164 // new stuff 205 // new stuff
165 vsbSliderFillPix = menuPix = NULL; 206 vsbSliderFillPix = menuPix = NULL;
166 menuHandler = new TransMenuHandler(this); 207 menuHandler = new TransMenuHandler(this);
167 setScrollBarExtent(15, 15); 208 setScrollBarExtent(15, 15);
168 int i; 209 int i;
169 for(i=0; i < BITMAP_ITEMS; ++i){ 210 for(i=0; i < BITMAP_ITEMS; ++i){
170 pixmaps[i] = NULL; 211 pixmaps[i] = NULL;
171 } 212 }
172 oldSliderThickness = sliderThickness(); 213 oldSliderThickness = sliderThickness();
173 setSliderThickness(11); 214 setSliderThickness(11);
174} 215}
175 216
176LiquidStyle::~LiquidStyle() 217LiquidStyle::~LiquidStyle()
177{ 218{
178 if(btnBorderPix) 219 if(btnBorderPix)
179 delete btnBorderPix; 220 delete btnBorderPix;
180 if(btnBlendPix) 221 if(btnBlendPix)
181 delete btnBlendPix; 222 delete btnBlendPix;
182 if(bevelFillPix) 223 if(bevelFillPix)
183 delete bevelFillPix; 224 delete bevelFillPix;
184 if(smallBevelFillPix) 225 if(smallBevelFillPix)
185 delete smallBevelFillPix; 226 delete smallBevelFillPix;
186 if(vsbSliderFillPix) 227 if(vsbSliderFillPix)
187 delete vsbSliderFillPix; 228 delete vsbSliderFillPix;
188 if(menuPix) 229 if(menuPix)
189 delete menuPix; 230 delete menuPix;
190 231
191 setScrollBarExtent(16, 16); 232 setScrollBarExtent(16, 16);
192 setSliderThickness(oldSliderThickness); 233 setSliderThickness(oldSliderThickness);
193 int i; 234 int i;
194 for(i=0; i < BITMAP_ITEMS; ++i){ 235 for(i=0; i < BITMAP_ITEMS; ++i){
195 if(pixmaps[i]) 236 if(pixmaps[i])
196 delete pixmaps[i]; 237 delete pixmaps[i];
197 } 238 }
198} 239}
199 240
200void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 241void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
201 const QColor &c, const QColor &bg) 242 const QColor &c, const QColor &bg)
202{ 243{
203 244
204 QPen oldPen = p->pen(); // headers need this 245 QPen oldPen = p->pen(); // headers need this
205 int x2 = x+w-1; 246 int x2 = x+w-1;
206 int y2 = y+h-1; 247 int y2 = y+h-1;
207 // outer dark rect 248 // outer dark rect
208 p->setPen(c.dark(130)); 249 p->setPen(c.dark(130));
209 p->drawLine(x, y+2, x, y2-2); // l 250 p->drawLine(x, y+2, x, y2-2); // l
210 p->drawLine(x2, y+2, x2, y2-2); // r 251 p->drawLine(x2, y+2, x2, y2-2); // r
211 p->drawLine(x+2, y, x2-2, y); // t 252 p->drawLine(x+2, y, x2-2, y); // t
212 p->drawLine(x+2, y2, x2-2, y2); // b 253 p->drawLine(x+2, y2, x2-2, y2); // b
213 p->drawPoint(x+1, y+1); // tl 254 p->drawPoint(x+1, y+1); // tl
214 p->drawPoint(x2-1, y+1); // tr 255 p->drawPoint(x2-1, y+1); // tr
215 p->drawPoint(x+1, y2-1); // bl 256 p->drawPoint(x+1, y2-1); // bl
216 p->drawPoint(x2-1, y2-1); // br 257 p->drawPoint(x2-1, y2-1); // br
217 258
218 // inner top light lines 259 // inner top light lines
219 p->setPen(c.light(105)); 260 p->setPen(c.light(105));
220 p->drawLine(x+2, y+1, x2-2, y+1); 261 p->drawLine(x+2, y+1, x2-2, y+1);
221 p->drawLine(x+1, y+2, x2-1, y+2); 262 p->drawLine(x+1, y+2, x2-1, y+2);
222 p->drawLine(x+1, y+3, x+2, y+3); 263 p->drawLine(x+1, y+3, x+2, y+3);
223 p->drawLine(x2-2, y+3, x2-1, y+3); 264 p->drawLine(x2-2, y+3, x2-1, y+3);
224 p->drawPoint(x+1, y+4); 265 p->drawPoint(x+1, y+4);
225 p->drawPoint(x2-1, y+4); 266 p->drawPoint(x2-1, y+4);
226 267
227 // inner bottom light lines 268 // inner bottom light lines
228 p->setPen(c.light(110)); 269 p->setPen(c.light(110));
229 p->drawLine(x+2, y2-1, x2-2, y2-1); 270 p->drawLine(x+2, y2-1, x2-2, y2-1);
230 p->drawLine(x+1, y2-2, x2-1, y2-2); 271 p->drawLine(x+1, y2-2, x2-1, y2-2);
231 p->drawLine(x+1, y2-3, x+2, y2-3); 272 p->drawLine(x+1, y2-3, x+2, y2-3);
232 p->drawLine(x2-2, y2-3, x2-1, y2-3); 273 p->drawLine(x2-2, y2-3, x2-1, y2-3);
233 p->drawPoint(x+1, y2-4); 274 p->drawPoint(x+1, y2-4);
234 p->drawPoint(x2-1, y2-4); 275 p->drawPoint(x2-1, y2-4);
235 276
236 // inner left mid lines 277 // inner left mid lines
237 //p->setPen(c.light(105)); 278 //p->setPen(c.light(105));
238 p->setPen(c); 279 p->setPen(c);
239 p->drawLine(x+1, y+5, x+1, y2-5); 280 p->drawLine(x+1, y+5, x+1, y2-5);
240 p->drawLine(x+2, y+4, x+2, y2-4); 281 p->drawLine(x+2, y+4, x+2, y2-4);
241 282
242 // inner right mid lines 283 // inner right mid lines
243 p->drawLine(x2-1, y+5, x2-1, y2-5); 284 p->drawLine(x2-1, y+5, x2-1, y2-5);
244 p->drawLine(x2-2, y+4, x2-2, y2-4); 285 p->drawLine(x2-2, y+4, x2-2, y2-4);
245 286
246 // fill 287 // fill
247 QPixmap *pix; 288 QPixmap *pix;
248 if(h >= 32){ 289 if(h >= 32){
249 pix = bevelFillDict.find(c.rgb()); 290 pix = bevelFillDict.find(c.rgb());
250 if(!pix){ 291 if(!pix){
251 int h, s, v; 292 int h, s, v;
252 c.hsv(&h, &s, &v); 293 c.hsv(&h, &s, &v);
253 pix = new QPixmap(*bevelFillPix); 294 pix = new QPixmap(*bevelFillPix);
254 adjustHSV(*pix, h, s, v); 295 adjustHSV(*pix, h, s, v);
255 bevelFillDict.insert(c.rgb(), pix); 296 bevelFillDict.insert(c.rgb(), pix);
256 } 297 }
@@ -671,346 +712,354 @@ void LiquidStyle::polish(QPalette &appPal)
671 712
672 loadCustomButtons(); 713 loadCustomButtons();
673 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 714 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
674 btnDict.clear(); 715 btnDict.clear();
675 btnBorderDict.clear(); 716 btnBorderDict.clear();
676 bevelFillDict.clear(); 717 bevelFillDict.clear();
677 smallBevelFillDict.clear(); 718 smallBevelFillDict.clear();
678 719
679 Config config ( "qpe" ); 720 Config config ( "qpe" );
680 QPalette pal = QApplication::palette(); 721 QPalette pal = QApplication::palette();
681 722
682 // button color stuff 723 // button color stuff
683 config. setGroup ( "Appearance" ); 724 config. setGroup ( "Appearance" );
684 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 725 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
685 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { 726 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) {
686 // force button color to be different from background 727 // force button color to be different from background
687 QBrush btnBrush(QColor(200, 202, 228)); 728 QBrush btnBrush(QColor(200, 202, 228));
688 appPal.setBrush(QColorGroup::Button, btnBrush); 729 appPal.setBrush(QColorGroup::Button, btnBrush);
689 } 730 }
690 c.hsv(&btnH, &btnS, &btnV); 731 c.hsv(&btnH, &btnS, &btnV);
691 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 732 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
692 733
693 // menu pixmap 734 // menu pixmap
694 if(!menuPix){ 735 if(!menuPix){
695 menuPix = new QPixmap; 736 menuPix = new QPixmap;
696 menuPix->resize(64, 64); 737 menuPix->resize(64, 64);
697 } 738 }
698 QPainter painter; 739 QPainter painter;
699 menuPix->fill(c.rgb()); 740 menuPix->fill(c.rgb());
700 painter.begin(menuPix); 741 painter.begin(menuPix);
701 painter.setPen(c.dark(105)); 742 painter.setPen(c.dark(105));
702 for(i=0; i < 63; i+=4){ 743 for(i=0; i < 63; i+=4){
703 painter.drawLine(0, i, 63, i); 744 painter.drawLine(0, i, 63, i);
704 painter.drawLine(0, i+1, 63, i+1); 745 painter.drawLine(0, i+1, 63, i+1);
705 }; 746 };
706 painter.end(); 747 painter.end();
707 menuBrush.setColor(c); 748 menuBrush.setColor(c);
708 menuBrush.setPixmap(*menuPix); 749 menuBrush.setPixmap(*menuPix);
709 750
710 // pager brush 751 // pager brush
711 c = c.dark(120); 752 c = c.dark(120);
712 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 753 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
713 if(!pix){ 754 if(!pix){
714 int h, s, v; 755 int h, s, v;
715 c.hsv(&h, &s, &v); 756 c.hsv(&h, &s, &v);
716 pix = new QPixmap(*smallBevelFillPix); 757 pix = new QPixmap(*smallBevelFillPix);
717 adjustHSV(*pix, h, s, v); 758 adjustHSV(*pix, h, s, v);
718 smallBevelFillDict.insert(c.rgb(), pix); 759 smallBevelFillDict.insert(c.rgb(), pix);
719 } 760 }
720 pagerHoverBrush.setColor(c); 761 pagerHoverBrush.setColor(c);
721 pagerHoverBrush.setPixmap(*pix); 762 pagerHoverBrush.setPixmap(*pix);
722 763
723 c = c.dark(120); 764 c = c.dark(120);
724 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 765 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
725 if(!pix){ 766 if(!pix){
726 int h, s, v; 767 int h, s, v;
727 c.hsv(&h, &s, &v); 768 c.hsv(&h, &s, &v);
728 pix = new QPixmap(*smallBevelFillPix); 769 pix = new QPixmap(*smallBevelFillPix);
729 adjustHSV(*pix, h, s, v); 770 adjustHSV(*pix, h, s, v);
730 smallBevelFillDict.insert(c.rgb(), pix); 771 smallBevelFillDict.insert(c.rgb(), pix);
731 } 772 }
732 pagerBrush.setColor(c); 773 pagerBrush.setColor(c);
733 pagerBrush.setPixmap(*pix); 774 pagerBrush.setPixmap(*pix);
734 775
735 // background color stuff 776 // background color stuff
736 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); 777 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));
737 c.hsv(&bH, &bS, &bV); 778 c.hsv(&bH, &bS, &bV);
738 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 779 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
739 780
740 // FIXME? 781 // FIXME?
741 if(vsbSliderFillPix) 782 if(vsbSliderFillPix)
742 delete vsbSliderFillPix; 783 delete vsbSliderFillPix;
743 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 784 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
744 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 785 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
745 786
746 // background brush 787 // background brush
747 QPixmap wallPaper(32, 32); 788 QPixmap wallPaper(32, 32);
748 wallPaper.fill(c.rgb()); 789 wallPaper.fill(c.rgb());
749 painter.begin(&wallPaper); 790 painter.begin(&wallPaper);
750 for(i=0; i < 32; i+=4){ 791 for(i=0; i < 32; i+=4){
751 painter.setPen(c.dark(105)); 792 painter.setPen(c.dark(105));
752 painter.drawLine(0, i, 32, i); 793 painter.drawLine(0, i, 32, i);
753 painter.setPen(c.dark(103)); 794 painter.setPen(c.dark(103));
754 painter.drawLine(0, i+1, 32, i+1); 795 painter.drawLine(0, i+1, 32, i+1);
755 }; 796 };
756 painter.end(); 797 painter.end();
757 bgBrush.setColor(c); 798 bgBrush.setColor(c);
758 bgBrush.setPixmap(wallPaper); 799 bgBrush.setPixmap(wallPaper);
759 appPal.setBrush(QColorGroup::Background, bgBrush); 800 appPal.setBrush(QColorGroup::Background, bgBrush);
760 801
761 // lineedits 802 // lineedits
762 c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); 803 c = QColor ( config. readEntry("Base", ( Qt::white). name ( )));
763 QPixmap basePix; 804 QPixmap basePix;
764 basePix.resize(32, 32); 805 basePix.resize(32, 32);
765 basePix.fill(c.rgb()); 806 basePix.fill(c.rgb());
766 painter.begin(&basePix); 807 painter.begin(&basePix);
767 painter.setPen(c.dark(105)); 808 painter.setPen(c.dark(105));
768 for(i=0; i < 32; i+=4){ 809 for(i=0; i < 32; i+=4){
769 painter.drawLine(0, i, 32, i); 810 painter.drawLine(0, i, 32, i);
770 painter.drawLine(0, i+1, 32, i+1); 811 painter.drawLine(0, i+1, 32, i+1);
771 }; 812 };
772 painter.end(); 813 painter.end();
773 baseBrush.setColor(c); 814 baseBrush.setColor(c);
774 baseBrush.setPixmap(basePix); 815 baseBrush.setPixmap(basePix);
775 it.toFirst(); 816 it.toFirst();
776 while ((w=it.current()) != 0 ){ 817 while ((w=it.current()) != 0 ){
777 ++it; 818 ++it;
778 if(w->inherits("QLineEdit")){ 819 if(w->inherits("QLineEdit")){
779 QPalette pal = w->palette(); 820 QPalette pal = w->palette();
780 pal.setBrush(QColorGroup::Base, baseBrush); 821 pal.setBrush(QColorGroup::Base, baseBrush);
781 w->setPalette(pal); 822 w->setPalette(pal);
782 } 823 }
783 else if(w->inherits("QPushButton")){ 824 else if(w->inherits("QPushButton")){
784 applyCustomAttributes((QPushButton *)w); 825 applyCustomAttributes((QPushButton *)w);
785 } 826 }
786 } 827 }
787 828
788} 829}
789 830
790void LiquidStyle::polish(QWidget *w) 831void LiquidStyle::polish(QWidget *w)
791{ 832{
792 if(w->inherits("QMenuBar")){ 833 if(w->inherits("QMenuBar")){
793 //((QFrame*)w)->setLineWidth(0); 834 //((QFrame*)w)->setLineWidth(0);
794 w->setBackgroundMode(QWidget::PaletteBackground); 835 w->setBackgroundMode(QWidget::PaletteBackground);
795 return; 836 return;
796 } 837 }
797 if(w->inherits("QPopupMenu")) 838 if(w->inherits("QPopupMenu"))
798 w->setBackgroundMode(QWidget::NoBackground); 839 w->setBackgroundMode(QWidget::NoBackground);
799 840 else if(w-> testWFlags(Qt::WType_Popup)) {
841 printf("install popup: %s\n", w-> className ( ));
842 w->installEventFilter(menuHandler);
843 }
844
800 if(w->isTopLevel()){ 845 if(w->isTopLevel()){
801 return; 846 return;
802 } 847 }
848
803 849
804 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 850 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
805 851
806 if(w->inherits("QComboBox") || 852 if(w->inherits("QComboBox") ||
807 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 853 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
808 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 854 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
809 w->installEventFilter(this); 855 w->installEventFilter(this);
810 } 856 }
811 if(w->inherits("QLineEdit")){ 857 if(w->inherits("QLineEdit")){
812 QPalette pal = w->palette(); 858 QPalette pal = w->palette();
813 pal.setBrush(QColorGroup::Base, baseBrush); 859 pal.setBrush(QColorGroup::Base, baseBrush);
814 w->setPalette(pal); 860 w->setPalette(pal);
815 } 861 }
816 if(w->inherits("QPushButton")){ 862 if(w->inherits("QPushButton")){
817 applyCustomAttributes((QPushButton *)w); 863 applyCustomAttributes((QPushButton *)w);
818 w->installEventFilter(this); 864 w->installEventFilter(this);
819 } 865 }
820 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 866 if(w->inherits("QButton") || w-> inherits("QComboBox")){
821 w-> setBackgroundMode ( QWidget::PaletteBackground ); 867 w-> setBackgroundMode ( QWidget::PaletteBackground );
822 } 868 }
823 869
824 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 870 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
825 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 871 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
826 bool isViewportChild = w->parent() && 872 bool isViewportChild = w->parent() &&
827 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 873 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
828 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 874 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
829 875
830 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 876 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
831 w->setBackgroundMode(QWidget::X11ParentRelative); 877 w->setBackgroundMode(QWidget::X11ParentRelative);
832 return; 878 return;
833 } 879 }
834 if(isViewportChild){ 880 if(isViewportChild){
835 if(w->inherits("QButton") || w->inherits("QComboBox")){ 881 if(w->inherits("QButton") || w->inherits("QComboBox")){
836 if(w->parent()){ // heh, only way to test for KHTML children ;-) 882 if(w->parent()){ // heh, only way to test for KHTML children ;-)
837 if(w->parent()->parent()){ 883 if(w->parent()->parent()){
838 if(w->parent()->parent()->parent() && 884 if(w->parent()->parent()->parent() &&
839 w->parent()->parent()->parent()->inherits("KHTMLView")){ 885 w->parent()->parent()->parent()->inherits("KHTMLView")){
840 w->setAutoMask(true); 886 w->setAutoMask(true);
841 w->setBackgroundMode(QWidget::NoBackground); 887 w->setBackgroundMode(QWidget::NoBackground);
842 } 888 }
843 } 889 }
844 } 890 }
845 return; 891 return;
846 } 892 }
847 } 893 }
848 if(w->inherits("QHeader")){ 894 if(w->inherits("QHeader")){
849 w->setMouseTracking(true); 895 w->setMouseTracking(true);
850 w->installEventFilter(this); 896 w->installEventFilter(this);
851 } 897 }
852 if(w-> inherits("QToolButton")) { 898 if(w-> inherits("QToolButton")) {
853 ((QToolButton*)w)->setAutoRaise (false); 899 ((QToolButton*)w)->setAutoRaise (false);
854 } 900 }
855 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 901 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
856 return; 902 return;
857 } 903 }
858 904
859 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 905 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
860 palette().active().brush(QColorGroup::Background).pixmap()){ 906 palette().active().brush(QColorGroup::Background).pixmap()){
861 qWarning("No parent pixmap for child widget %s", w->className()); 907 qWarning("No parent pixmap for child widget %s", w->className());
862 return; 908 return;
863 } 909 }
864 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 910 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
865 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 911 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
866 if(w->backgroundMode() == QWidget::PaletteBackground || 912 if(w->backgroundMode() == QWidget::PaletteBackground ||
867 w->backgroundMode() == QWidget::PaletteButton){ 913 w->backgroundMode() == QWidget::PaletteButton){
868 w->setBackgroundMode(QWidget::X11ParentRelative); 914 w->setBackgroundMode(QWidget::X11ParentRelative);
869 } 915 }
870 } 916 }
871 if(w->inherits("QToolBar")){ 917 if(w->inherits("QToolBar")){
872 w->installEventFilter(this); 918 w->installEventFilter(this);
873 w->setBackgroundMode(QWidget::PaletteBackground); 919 w->setBackgroundMode(QWidget::PaletteBackground);
874 return; 920 return;
875 } 921 }
876 922
877} 923}
878 924
879void LiquidStyle::unPolish(QWidget *w) 925void LiquidStyle::unPolish(QWidget *w)
880{ 926{
881 if(w->inherits("QMenuBar")){ 927 if(w->inherits("QMenuBar")){
882 ((QFrame *)w)->setLineWidth(1); 928 ((QFrame *)w)->setLineWidth(1);
883 w->setBackgroundMode(QWidget::PaletteBackground); 929 w->setBackgroundMode(QWidget::PaletteBackground);
884 return; 930 return;
885 } 931 }
886 932
887 if(w->inherits("QPopupMenu")) 933 if(w->inherits("QPopupMenu"))
888 w->setBackgroundMode(QWidget::PaletteButton); 934 w->setBackgroundMode(QWidget::PaletteButton);
935 else if(w-> testWFlags(Qt::WType_Popup)) {
936 w->removeEventFilter(menuHandler);
937 }
889 938
890 if(w->isTopLevel()) 939 if(w->isTopLevel())
891 return; 940 return;
892 941
893 // for viewport children, don't just check for NoBackground.... 942 // for viewport children, don't just check for NoBackground....
894 bool isViewportChild = w->parent() && 943 bool isViewportChild = w->parent() &&
895 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 944 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
896 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 945 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
897 946
898 w->setPalette(QApplication::palette()); 947 w->setPalette(QApplication::palette());
899 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 948 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
900 if(w->inherits("QPushButton")) 949 if(w->inherits("QPushButton"))
901 w->setBackgroundMode(QWidget::PaletteButton); 950 w->setBackgroundMode(QWidget::PaletteButton);
902 else 951 else
903 w->setBackgroundMode(QWidget::PaletteBackground); 952 w->setBackgroundMode(QWidget::PaletteBackground);
904 } 953 }
905 954
906 if(isViewportChild) 955 if(isViewportChild)
907 w->setAutoMask(false); 956 w->setAutoMask(false);
908 957
909 if(w->inherits("QPushButton")){ 958 if(w->inherits("QPushButton")){
910 unapplyCustomAttributes((QPushButton *)w); 959 unapplyCustomAttributes((QPushButton *)w);
911 w->removeEventFilter(this); 960 w->removeEventFilter(this);
912 } 961 }
913/* 962/*
914 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 963 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
915 w-> setBackgroundMode ( PaletteBackground ); 964 w-> setBackgroundMode ( PaletteBackground );
916 } 965 }
917*/ 966*/
918 if(w->inherits("QComboBox") || 967 if(w->inherits("QComboBox") ||
919 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 968 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
920 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 969 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
921 w->removeEventFilter(this); 970 w->removeEventFilter(this);
922 } 971 }
923 if(w->inherits("QButton") || w->inherits("QComboBox")){ 972 if(w->inherits("QButton") || w->inherits("QComboBox")){
924 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 973 if(w->parent() && w->parent()->inherits("KHTMLPart")){
925 w->setAutoMask(false); 974 w->setAutoMask(false);
926 } 975 }
927 } 976 }
928 if(w->inherits("QToolBar")){ 977 if(w->inherits("QToolBar")){
929 w->removeEventFilter(this); 978 w->removeEventFilter(this);
930 w->setBackgroundMode(QWidget::PaletteBackground); 979 w->setBackgroundMode(QWidget::PaletteBackground);
931 return; 980 return;
932 } 981 }
933 if(w->inherits("QHeader")){ 982 if(w->inherits("QHeader")){
934 w->setMouseTracking(false); 983 w->setMouseTracking(false);
935 w->removeEventFilter(this); 984 w->removeEventFilter(this);
936 } 985 }
937} 986}
938 987
939void LiquidStyle::polish(QApplication *app) 988void LiquidStyle::polish(QApplication *app)
940{ 989{
941 990
942 QWindowsStyle::polish(app); 991 QWindowsStyle::polish(app);
943 menuAni = app->isEffectEnabled(UI_AnimateMenu); 992 menuAni = app->isEffectEnabled(UI_AnimateMenu);
944 menuFade = app->isEffectEnabled(UI_FadeMenu); 993 menuFade = app->isEffectEnabled(UI_FadeMenu);
945 if(menuAni) 994 if(menuAni)
946 app->setEffectEnabled(UI_AnimateMenu, false); 995 app->setEffectEnabled(UI_AnimateMenu, false);
947 if(menuFade) 996 if(menuFade)
948 app->setEffectEnabled(UI_FadeMenu, false); 997 app->setEffectEnabled(UI_FadeMenu, false);
949 998
950 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 999 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
951} 1000}
952 1001
953void LiquidStyle::unPolish(QApplication *app) 1002void LiquidStyle::unPolish(QApplication *app)
954{ 1003{
955 QWindowsStyle::unPolish(app); 1004 QWindowsStyle::unPolish(app);
956 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1005 app->setEffectEnabled(UI_AnimateMenu, menuAni);
957 app->setEffectEnabled(UI_FadeMenu, menuFade); 1006 app->setEffectEnabled(UI_FadeMenu, menuFade);
958 1007
959 qt_set_draw_menu_bar_impl ( 0 ); 1008 qt_set_draw_menu_bar_impl ( 0 );
960} 1009}
961 1010
962/* 1011/*
963 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1012 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
964 * force everything to erase and repaint on resize. This is going away, I'm 1013 * force everything to erase and repaint on resize. This is going away, I'm
965 * trying to get shaped widgets to work right without masking. QPushButton, 1014 * trying to get shaped widgets to work right without masking. QPushButton,
966 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1015 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
967 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1016 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
968 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1017 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
969 * caches them in QPixmapCache, which is bad for doing things like hover 1018 * caches them in QPixmapCache, which is bad for doing things like hover
970 * because the style methods aren't called in paintEvents if everything 1019 * because the style methods aren't called in paintEvents if everything
971 * is cached. We use our own Paint event handler instead. Taskbuttons and 1020 * is cached. We use our own Paint event handler instead. Taskbuttons and
972 * pager buttons draw into a pixmap buffer, so we handle those with palette 1021 * pager buttons draw into a pixmap buffer, so we handle those with palette
973 * modifications. For QHeader, different header items are actually one widget 1022 * modifications. For QHeader, different header items are actually one widget
974 * that draws multiple items, so we need to check which ID is hightlighted 1023 * that draws multiple items, so we need to check which ID is hightlighted
975 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1024 * and draw it. Finally, we also check enter and leave events for QLineEdit,
976 * since if it's inside a combobox we want to highlight the combobox during 1025 * since if it's inside a combobox we want to highlight the combobox during
977 * hovering in the edit. 1026 * hovering in the edit.
978 */ 1027 */
979bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1028bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
980{ 1029{
981 if(obj->inherits("QToolBar")){ 1030 if(obj->inherits("QToolBar")){
982 if(ev->type() == QEvent::Resize){ 1031 if(ev->type() == QEvent::Resize){
983 const QObjectList *tbChildList = obj->children(); 1032 const QObjectList *tbChildList = obj->children();
984 QObjectListIt it(*tbChildList); 1033 QObjectListIt it(*tbChildList);
985 QObject *child; 1034 QObject *child;
986 while((child = it.current()) != NULL){ 1035 while((child = it.current()) != NULL){
987 ++it; 1036 ++it;
988 if(child->isWidgetType()) 1037 if(child->isWidgetType())
989 ((QWidget *)child)->repaint(true); 1038 ((QWidget *)child)->repaint(true);
990 } 1039 }
991 1040
992 } 1041 }
993 } 1042 }
994 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ 1043 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){
995 QWidget *btn = (QWidget *)obj; 1044 QWidget *btn = (QWidget *)obj;
996 if(ev->type() == QEvent::Enter){ 1045 if(ev->type() == QEvent::Enter){
997 if(btn->isEnabled()){ 1046 if(btn->isEnabled()){
998 highlightWidget = btn; 1047 highlightWidget = btn;
999 btn->repaint(false); 1048 btn->repaint(false);
1000 } 1049 }
1001 } 1050 }
1002 else if(ev->type() == QEvent::Leave){ 1051 else if(ev->type() == QEvent::Leave){
1003 if(btn == highlightWidget){ 1052 if(btn == highlightWidget){
1004 highlightWidget = NULL; 1053 highlightWidget = NULL;
1005 btn->repaint(false); 1054 btn->repaint(false);
1006 } 1055 }
1007 } 1056 }
1008 } 1057 }
1009 else if(obj->inherits("QToolButton")){ 1058 else if(obj->inherits("QToolButton")){
1010 QToolButton *btn = (QToolButton *)btn; 1059 QToolButton *btn = (QToolButton *)btn;
1011 if(!btn->autoRaise()){ 1060 if(!btn->autoRaise()){
1012 if(btn->isEnabled()){ 1061 if(btn->isEnabled()){
1013 highlightWidget = btn; 1062 highlightWidget = btn;
1014 btn->repaint(false); 1063 btn->repaint(false);
1015 } 1064 }
1016 } 1065 }
diff --git a/noncore/styles/liquid/opie-liquid.control b/noncore/styles/liquid/opie-liquid.control
index 7b6ae71..6311dee 100644
--- a/noncore/styles/liquid/opie-liquid.control
+++ b/noncore/styles/liquid/opie-liquid.control
@@ -1,10 +1,10 @@
1Files: plugins/styles/libliquid.so* 1Files: plugins/styles/libliquid.so* bin/liquid-settings apps/Settings/Liquid.desktop pics/liquid/Liquid.png
2Priority: optional 2Priority: optional
3Section: opie/system 3Section: opie/system
4Maintainer: Robert Griebl <sandman@handhelds.org> 4Maintainer: Robert Griebl <sandman@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION.1 6Version: $QPE_VERSION-$SUB_VERSION.1
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: Liquid style by Mosfet. 8Description: Liquid style by Mosfet.
9 Mosfet's well known Liquid GUI style from KDE, 9 Mosfet's well known Liquid GUI style from KDE,
10ported to OPIE. 10ported to OPIE.
diff --git a/noncore/styles/liquid/settings/liquidset.cpp b/noncore/styles/liquid/settings/liquidset.cpp
new file mode 100644
index 0000000..0ef5dbe
--- a/dev/null
+++ b/noncore/styles/liquid/settings/liquidset.cpp
@@ -0,0 +1,199 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22
23#include "liquidset.h"
24#include "../liquid.h"
25
26#include <qpe/qpeapplication.h>
27#include <qpe/global.h>
28
29#include <qslider.h>
30#include <qtoolbutton.h>
31#include <qbuttongroup.h>
32#include <qradiobutton.h>
33#include <qcheckbox.h>
34#include <qlabel.h>
35#include <qlayout.h>
36#include <qpalette.h>
37
38#include <qpe/config.h>
39
40#include <opie/colorpopupmenu.h>
41
42
43static void changeButtonColor ( QWidget *btn, const QColor &col )
44{
45 QPalette pal = btn-> palette ( );
46
47 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
48 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col );
49 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col );
50
51 btn-> setPalette ( pal );
52}
53
54
55LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl )
56 : QDialog ( parent, name, fl )
57{
58 setCaption ( tr( "Liquid Style" ) );
59
60 Config config ( "qpe" );
61 config. setGroup ( "MosfetMenus" );
62
63 m_type = config. readNumEntry ( "Type", TransStippleBg );
64 m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( )));
65 m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( )));
66 int opacity = config. readNumEntry ( "Opacity", 10 );
67 m_shadow = config. readBoolEntry ( "ShadowText", true );
68
69 QVBoxLayout *vbox = new QVBoxLayout ( this );
70 vbox-> setSpacing ( 3 );
71 vbox-> setMargin ( 6 );
72
73 QButtonGroup *btngrp = new QButtonGroup ( this );
74 btngrp-> hide ( );
75
76 QRadioButton *rad;
77
78 rad = new QRadioButton ( tr( "No translucency" ), this );
79 btngrp-> insert ( rad, None );
80 vbox-> addWidget ( rad );
81
82 rad = new QRadioButton ( tr( "Stippled, background color" ), this );
83 btngrp-> insert ( rad, StippledBg );
84 vbox-> addWidget ( rad );
85
86 rad = new QRadioButton ( tr( "Stippled, button color" ), this );
87 btngrp-> insert ( rad, StippledBtn );
88 vbox-> addWidget ( rad );
89
90 rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this );
91 btngrp-> insert ( rad, TransStippleBg );
92 vbox-> addWidget ( rad );
93
94 rad = new QRadioButton ( tr( "Translucent stippled, button color" ), this );
95 btngrp-> insert ( rad, TransStippleBtn );
96 vbox-> addWidget ( rad );
97
98 rad = new QRadioButton ( tr( "Custom translucency" ), this );
99 btngrp-> insert ( rad, Custom );
100 vbox-> addWidget ( rad );
101
102 btngrp-> setExclusive ( true );
103 btngrp-> setButton ( m_type );
104
105 QGridLayout *grid = new QGridLayout ( vbox );
106 grid-> addColSpacing ( 0, 16 );
107 grid-> addColSpacing ( 3, 8 );
108
109 grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 );
110 grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 );
111 grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 );
112
113 m_menubtn = new QToolButton ( this );
114 grid-> addWidget ( m_menubtn, 0, 2 );
115
116 QPopupMenu *popup;
117
118 popup = new ColorPopupMenu ( m_menucol, this );
119 m_menubtn-> setPopup ( popup );
120 m_menubtn-> setPopupDelay ( 0 );
121 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & )));
122 changeMenuColor ( m_menucol );
123
124 m_textbtn = new QToolButton ( this );
125 grid-> addWidget ( m_textbtn, 0, 5 );
126
127 popup = new ColorPopupMenu ( m_textcol, this );
128 m_textbtn-> setPopup ( popup );
129 m_textbtn-> setPopupDelay ( 0 );
130 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & )));
131 changeTextColor ( m_textcol );
132
133 m_opacsld = new QSlider ( Horizontal, this );
134 m_opacsld-> setRange ( -20, 20 );
135 m_opacsld-> setValue ( opacity );
136 m_opacsld-> setTickmarks ( QSlider::Below );
137 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 );
138
139 vbox-> addSpacing ( 4 );
140
141 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed text" ), this );
142 shadow-> setChecked ( m_shadow );
143 vbox-> addWidget ( shadow );
144
145 vbox-> addStretch ( 10 );
146
147 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) );
148 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) );
149}
150
151void LiquidSet::changeType ( int t )
152{
153 bool custom = ( t == Custom );
154
155 m_menulbl-> setEnabled ( custom );
156 m_textlbl-> setEnabled ( custom );
157 m_opaclbl-> setEnabled ( custom );
158 m_menubtn-> setEnabled ( custom );
159 m_textbtn-> setEnabled ( custom );
160 m_opacsld-> setEnabled ( custom );
161
162 m_type = t;
163}
164
165void LiquidSet::changeMenuColor ( const QColor &col )
166{
167 m_menubtn-> setPalette ( col );
168 m_menucol = col;
169}
170
171void LiquidSet::changeTextColor ( const QColor &col )
172{
173 m_textbtn-> setPalette ( col );
174 m_textcol = col;
175}
176
177void LiquidSet::changeShadow ( bool b )
178{
179 m_shadow = b;
180}
181
182
183void LiquidSet::accept ( )
184{
185 Config config ( "qpe" );
186 config. setGroup ( "MosfetMenus" );
187
188 config. writeEntry ( "Type", m_type );
189 config. writeEntry ( "Color", m_menucol. name ( ));
190 config. writeEntry ( "TextColor", m_textcol. name ( ));
191 config. writeEntry ( "Opacity", m_opacsld-> value ( ));
192 config. writeEntry ( "ShadowText", m_shadow );
193 config. write ( );
194
195 Global::applyStyle ( );
196
197 QDialog::accept ( );
198}
199
diff --git a/noncore/styles/liquid/settings/liquidset.h b/noncore/styles/liquid/settings/liquidset.h
new file mode 100644
index 0000000..944b1ec
--- a/dev/null
+++ b/noncore/styles/liquid/settings/liquidset.h
@@ -0,0 +1,39 @@
1#ifndef __OPIE_LIQUID_SET_H__
2#define __OPIE_LIQUID_SET_H__
3
4#include <qdialog.h>
5#include <qcolor.h>
6
7class QLabel;
8class QToolButton;
9class QSlider;
10
11class LiquidSet : public QDialog {
12 Q_OBJECT
13
14public:
15 LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
16
17public slots:
18 void changeType ( int t );
19 void changeMenuColor ( const QColor &col );
20 void changeTextColor ( const QColor &col );
21 void changeShadow ( bool b );
22
23protected:
24 virtual void accept ( );
25
26private:
27 QColor m_menucol;
28 QColor m_textcol;
29 int m_type;
30 bool m_shadow;
31
32 QSlider * m_opacsld;
33 QLabel * m_menulbl;
34 QLabel * m_textlbl;
35 QLabel * m_opaclbl;
36 QToolButton *m_menubtn;
37 QToolButton *m_textbtn;
38};
39#endif
diff --git a/noncore/styles/liquid/settings/main.cpp b/noncore/styles/liquid/settings/main.cpp
new file mode 100644
index 0000000..fd69007
--- a/dev/null
+++ b/noncore/styles/liquid/settings/main.cpp
@@ -0,0 +1,34 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "liquidset.h"
22
23#include <qpe/qpeapplication.h>
24
25
26int main ( int argc, char** argv )
27{
28 QPEApplication a ( argc, argv );
29
30 LiquidSet dlg;
31 a. showMainWidget ( &dlg );
32
33 return a. exec ( );
34}
diff --git a/noncore/styles/liquid/settings/settings.pro b/noncore/styles/liquid/settings/settings.pro
new file mode 100644
index 0000000..b385d92
--- a/dev/null
+++ b/noncore/styles/liquid/settings/settings.pro
@@ -0,0 +1,24 @@
1 TEMPLATE= app
2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = liquidset.h
5 SOURCES = liquidset.cpp main.cpp
6INCLUDEPATH += $(OPIEDIR)/include
7 DEPENDPATH+= ../$(OPIEDIR)/include
8LIBS += -lqpe -lopie
9 TARGET = liquid-settings
10
11TRANSLATIONS = ../../../i18n/de/liquid-settings.ts \
12 ../../../i18n/en/liquid-settings.ts \
13 ../../../i18n/es/liquid-settings.ts \
14 ../../../i18n/fr/liquid-settings.ts \
15 ../../../i18n/hu/liquid-settings.ts \
16 ../../../i18n/ja/liquid-settings.ts \
17 ../../../i18n/ko/liquid-settings.ts \
18 ../../../i18n/no/liquid-settings.ts \
19 ../../../i18n/pl/liquid-settings.ts \
20 ../../../i18n/pt/liquid-settings.ts \
21 ../../../i18n/pt_BR/liquid-settings.ts \
22 ../../../i18n/sl/liquid-settings.ts \
23 ../../../i18n/zh_CN/liquid-settings.ts \
24 ../../../i18n/zh_TW/liquid-settings.ts
diff --git a/pics/liquid/Liquid.png b/pics/liquid/Liquid.png
new file mode 100644
index 0000000..67647d0
--- a/dev/null
+++ b/pics/liquid/Liquid.png
Binary files differ