Diffstat (limited to 'noncore/styles/liquid/opie-liquid.diff') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 1114 |
1 files changed, 1114 insertions, 0 deletions
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff new file mode 100644 index 0000000..f902cb8 --- a/dev/null +++ b/noncore/styles/liquid/opie-liquid.diff | |||
@@ -0,0 +1,1114 @@ | |||
1 | This is a patch to mosfet's liquid 0.7. | ||
2 | Features: | ||
3 | - Qt-only | ||
4 | - works with Qt/E on QPE/OPIE | ||
5 | |||
6 | --- -Mon Jun 24 19:05:49 2002 | ||
7 | +++ liquid.hFri Jun 21 14:48:21 2002 | ||
8 | @@ -2,7 +2,7 @@ | ||
9 | #define LIQUID_STYLE_H | ||
10 | |||
11 | |||
12 | -#include <kstyle.h> | ||
13 | +#include <qwindowsstyle.h> | ||
14 | #include <qpainter.h> | ||
15 | #include <qdrawutil.h> | ||
16 | #include <qpalette.h> | ||
17 | @@ -20,7 +20,7 @@ | ||
18 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. | ||
19 | */ | ||
20 | |||
21 | -class KPixmap; | ||
22 | +class QPixmap; | ||
23 | |||
24 | #define BITMAP_ITEMS 41 | ||
25 | #define LIQUID_MENU_CHANGE 667 | ||
26 | @@ -50,24 +50,22 @@ | ||
27 | ~TransMenuHandler(){;} | ||
28 | void reloadSettings(); | ||
29 | int transType(){return(type);} | ||
30 | - KPixmap *pixmap(WId id){return(pixDict.find(id));} | ||
31 | + QPixmap *pixmap(WId id){return(pixDict.find(id));} | ||
32 | const QColor& textColor(){return(fgColor);} | ||
33 | const QColor& bgColor(){return(color);} | ||
34 | bool useShadowText(){return(shadowText);} | ||
35 | -protected slots: | ||
36 | - void slotKIPCMessage(int id, int arg); | ||
37 | protected: | ||
38 | bool eventFilter(QObject *obj, QEvent *ev); | ||
39 | - void stripePixmap(KPixmap &pix, const QColor &color); | ||
40 | + void stripePixmap(QPixmap &pix, const QColor &color); | ||
41 | |||
42 | QColor color, fgColor; | ||
43 | int opacity; | ||
44 | int type; | ||
45 | bool shadowText; | ||
46 | - QIntDict<KPixmap>pixDict; | ||
47 | + QIntDict<QPixmap>pixDict; | ||
48 | }; | ||
49 | |||
50 | -class LiquidStyle : public KStyle | ||
51 | +class LiquidStyle : public QWindowsStyle | ||
52 | { | ||
53 | friend class TransMenuHandler; | ||
54 | public: | ||
55 | @@ -121,33 +119,14 @@ | ||
56 | bool tickAbove, bool tickBelow); | ||
57 | void drawSliderMask(QPainter *p, int x, int y, int w, int h, | ||
58 | Orientation orient, bool, bool); | ||
59 | - void drawKToolBar(QPainter *p, int x, int y, int w, int h, | ||
60 | - const QColorGroup &g, KToolBarPos type, | ||
61 | - QBrush *fill=NULL); | ||
62 | - void drawKBarHandle(QPainter *p, int x, int y, int w, int h, | ||
63 | - const QColorGroup &g, | ||
64 | - KToolBarPos type, QBrush *fill=NULL); | ||
65 | - void drawKMenuBar(QPainter *p, int x, int y, int w, int h, | ||
66 | - const QColorGroup &g, bool macMode, | ||
67 | - QBrush *fill=NULL); | ||
68 | - void drawKToolBarButton(QPainter *p, int x, int y, int w, int h, | ||
69 | - const QColorGroup &g, bool sunken=false, | ||
70 | - bool raised = true, bool enabled = true, | ||
71 | - bool popup = false, | ||
72 | - KToolButtonType icontext = Icon, | ||
73 | - const QString& btext=QString::null, | ||
74 | - const QPixmap *icon=NULL, | ||
75 | - QFont *font=NULL, QWidget *btn=NULL); | ||
76 | - void drawKMenuItem(QPainter *p, int x, int y, int w, int h, | ||
77 | - const QColorGroup &g, bool active, | ||
78 | - QMenuItem *item, QBrush *fill=NULL); | ||
79 | +void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | ||
80 | + QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); | ||
81 | + | ||
82 | void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, | ||
83 | int tab, QMenuItem *mi, const QPalette &pal, | ||
84 | bool act, bool enabled, int x, int y, int w, | ||
85 | int h); | ||
86 | int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); | ||
87 | - void drawKProgressBlock(QPainter *p, int x, int y, int w, int h, | ||
88 | - const QColorGroup &g, QBrush *fill); | ||
89 | void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, | ||
90 | const QColor *pen, bool atBorder); | ||
91 | int defaultFrameWidth() const {return(2);} | ||
92 | @@ -167,12 +146,6 @@ | ||
93 | void drawToolButton(QPainter *p, int x, int y, int w, | ||
94 | int h, const QColorGroup &g, | ||
95 | bool sunken, const QBrush *fill); | ||
96 | - void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, | ||
97 | - const QColorGroup &g, QBrush *); | ||
98 | - void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, | ||
99 | - const QColorGroup &g, | ||
100 | - const QString &title, bool active, | ||
101 | - QPixmap *icon, QBrush *fill); | ||
102 | // for repainting toolbuttons when the toolbar is resized | ||
103 | bool eventFilter(QObject *obj, QEvent *ev); | ||
104 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, | ||
105 | --- -Mon Jun 24 19:05:49 2002 | ||
106 | +++ liquid.cppFri Jun 21 22:02:55 2002 | ||
107 | @@ -10,12 +10,9 @@ | ||
108 | |||
109 | #include <qmenudata.h> | ||
110 | #include "liquid.h" | ||
111 | -#include <kapp.h> | ||
112 | -#include <kglobal.h> | ||
113 | -#include <kconfig.h> | ||
114 | -#include <kdrawutil.h> | ||
115 | -#include <kglobalsettings.h> | ||
116 | -#include <kpixmapeffect.h> | ||
117 | +#include <qapplication.h> | ||
118 | +#include <qpe/config.h> | ||
119 | +#include "effects.h" | ||
120 | #include <qpalette.h> | ||
121 | #include <qbitmap.h> | ||
122 | #include <qtabbar.h> | ||
123 | @@ -25,28 +22,29 @@ | ||
124 | #include <qtimer.h> | ||
125 | #include <qpixmapcache.h> | ||
126 | #include <qradiobutton.h> | ||
127 | -#include <kimageeffect.h> | ||
128 | -#include <ktoolbar.h> | ||
129 | +#include <qcombobox.h> | ||
130 | #include <qdrawutil.h> | ||
131 | #include <qwidgetlist.h> | ||
132 | #include <qtoolbutton.h> | ||
133 | #include <qheader.h> | ||
134 | #include <unistd.h> | ||
135 | -#include <klocale.h> | ||
136 | -#include <kiconloader.h> | ||
137 | -#include <kmenubar.h> | ||
138 | -#include <kipc.h> | ||
139 | +#include <qmenubar.h> | ||
140 | |||
141 | -#include <X11/X.h> | ||
142 | -#include <X11/Xlib.h> | ||
143 | + | ||
144 | +#include <stdio.h> | ||
145 | |||
146 | #include "htmlmasks.h" | ||
147 | #include "embeddata.h" | ||
148 | |||
149 | -void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) | ||
150 | +typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, | ||
151 | + QColorGroup &, bool, bool); | ||
152 | + | ||
153 | +QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); | ||
154 | + | ||
155 | +void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) | ||
156 | { | ||
157 | QImage img(pix.convertToImage()); | ||
158 | - KImageEffect::fade(img, 0.9, color); | ||
159 | + QImageEffect::fade(img, 0.9, color); | ||
160 | int x, y; | ||
161 | int r, g, b; | ||
162 | for(y=0; y < img.height(); y+=3){ | ||
163 | @@ -71,24 +69,21 @@ | ||
164 | : QObject(parent) | ||
165 | { | ||
166 | pixDict.setAutoDelete(true); | ||
167 | - connect(kapp, SIGNAL(kipcMessage(int, int)), this, | ||
168 | - SLOT(slotKIPCMessage(int, int))); | ||
169 | reloadSettings(); | ||
170 | } | ||
171 | |||
172 | void TransMenuHandler::reloadSettings() | ||
173 | { | ||
174 | pixDict.clear(); | ||
175 | - KConfig *config = KGlobal::config(); | ||
176 | - config->setGroup("MosfetMenus"); | ||
177 | |||
178 | - type = config->readNumEntry("Type", TransStippleBg); | ||
179 | - color = config->readColorEntry("Color", | ||
180 | - &QApplication::palette().active().button()); | ||
181 | - fgColor = config->readColorEntry("TextColor", | ||
182 | - &QApplication::palette().active().text()); | ||
183 | - opacity = config->readNumEntry("Opacity", 10); | ||
184 | - shadowText = config->readBoolEntry("ShadowText", true); | ||
185 | + Config config ( "qpe" ); | ||
186 | + config. setGroup ( "MosfetMenus" ); | ||
187 | + | ||
188 | + type = config. readNumEntry("Type", TransStippleBg); | ||
189 | + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); | ||
190 | + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); | ||
191 | + opacity = config. readNumEntry("Opacity", 10); | ||
192 | + shadowText = config. readBoolEntry("ShadowText", true); | ||
193 | } | ||
194 | |||
195 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | ||
196 | @@ -99,7 +94,7 @@ | ||
197 | if(type == TransStippleBg || type == TransStippleBtn || | ||
198 | type == Custom){ | ||
199 | QApplication::syncX(); | ||
200 | - KPixmap *pix = new KPixmap; | ||
201 | + QPixmap *pix = new QPixmap; | ||
202 | if(p->testWFlags(Qt::WType_Popup)){ | ||
203 | QRect r(p->x(), p->y(), p->width(), p->height()); | ||
204 | QRect deskR = QApplication::desktop()->rect(); | ||
205 | @@ -107,7 +102,7 @@ | ||
206 | r.setBottom(deskR.bottom()); | ||
207 | r.setRight(deskR.right()); | ||
208 | } | ||
209 | - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), | ||
210 | + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), | ||
211 | r.width(), r.height()); | ||
212 | } | ||
213 | else{ // tear off menu | ||
214 | @@ -121,7 +116,7 @@ | ||
215 | stripePixmap(*pix, p->colorGroup().button()); | ||
216 | } | ||
217 | else{ | ||
218 | - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | ||
219 | + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | ||
220 | } | ||
221 | pixDict.insert(p->winId(), pix); | ||
222 | } | ||
223 | @@ -129,74 +124,19 @@ | ||
224 | else if(ev->type() == QEvent::Hide){ | ||
225 | if(type == TransStippleBg || type == TransStippleBtn || | ||
226 | type == Custom){ | ||
227 | - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | ||
228 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | ||
229 | pixDict.remove(p->winId()); | ||
230 | } | ||
231 | } | ||
232 | return(false); | ||
233 | } | ||
234 | |||
235 | -void TransMenuHandler::slotKIPCMessage(int id, int) | ||
236 | -{ | ||
237 | - if(id == LIQUID_MENU_CHANGE){ | ||
238 | - bool oldShadow = shadowText; | ||
239 | - | ||
240 | - KConfig *config = KGlobal::config(); | ||
241 | - config->reparseConfiguration(); // in case KControl changed values | ||
242 | - | ||
243 | - // Make sure no popupmenus are shown. There shouldn't be any because | ||
244 | - // the user just clicked "Apply", but there can be tear offs ;-) | ||
245 | - // We just close them so the pixmaps are deleted and regenerated. | ||
246 | - QWidgetList *list = QApplication::topLevelWidgets(); | ||
247 | - QWidgetListIt it( *list ); | ||
248 | - QWidget *w; | ||
249 | - while ((w=it.current()) != 0 ){ | ||
250 | - ++it; | ||
251 | - if(w->inherits("QPopupMenu")){ | ||
252 | - w->close(); | ||
253 | - } | ||
254 | - } | ||
255 | - | ||
256 | - reloadSettings(); | ||
257 | - | ||
258 | - // Now repaint menubar if needed | ||
259 | - if(shadowText != oldShadow){ | ||
260 | - it.toFirst(); | ||
261 | - while ((w=it.current()) != 0 ){ | ||
262 | - ++it; | ||
263 | - if(w->inherits("QMenuBar")){ | ||
264 | - w->repaint(); | ||
265 | - } | ||
266 | - } | ||
267 | - } | ||
268 | - } | ||
269 | - else if(id == MOSFET_BUTTON_CHANGE){ | ||
270 | - qWarning("In mosfet button change"); | ||
271 | - // really, this should be in LiquidStyle, but what the hell? ;-) | ||
272 | - QWidgetList *list = QApplication::allWidgets(); | ||
273 | - QWidgetListIt it( *list ); | ||
274 | - QWidget *w; | ||
275 | - while ((w=it.current()) != 0 ){ | ||
276 | - ++it; | ||
277 | - if(w->inherits("QPushButton")){ | ||
278 | - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); | ||
279 | - } | ||
280 | - } | ||
281 | - ((LiquidStyle*)parent())->loadCustomButtons(); | ||
282 | - it.toFirst(); | ||
283 | - while ((w=it.current()) != 0 ){ | ||
284 | - ++it; | ||
285 | - if(w->inherits("QPushButton")){ | ||
286 | - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); | ||
287 | - } | ||
288 | - } | ||
289 | - | ||
290 | - } | ||
291 | -} | ||
292 | |||
293 | LiquidStyle::LiquidStyle() | ||
294 | - :KStyle() | ||
295 | + :QWindowsStyle() | ||
296 | { | ||
297 | + setName ( "LiquidStyle" ); | ||
298 | + | ||
299 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | ||
300 | btnMaskBmp.setMask(btnMaskBmp); | ||
301 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | ||
302 | @@ -730,20 +670,19 @@ | ||
303 | } | ||
304 | |||
305 | loadCustomButtons(); | ||
306 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; | ||
307 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | ||
308 | btnDict.clear(); | ||
309 | btnBorderDict.clear(); | ||
310 | bevelFillDict.clear(); | ||
311 | smallBevelFillDict.clear(); | ||
312 | |||
313 | - KConfig *config = KGlobal::config(); | ||
314 | - QString oldGrp = config->group(); | ||
315 | + Config config ( "qpe" ); | ||
316 | QPalette pal = QApplication::palette(); | ||
317 | |||
318 | // button color stuff | ||
319 | - config->setGroup("General"); | ||
320 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); | ||
321 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ | ||
322 | + config. setGroup ( "Appearance" ); | ||
323 | + QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | ||
324 | + if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { | ||
325 | // force button color to be different from background | ||
326 | QBrush btnBrush(QColor(200, 202, 228)); | ||
327 | appPal.setBrush(QColorGroup::Button, btnBrush); | ||
328 | @@ -794,15 +733,7 @@ | ||
329 | pagerBrush.setPixmap(*pix); | ||
330 | |||
331 | // background color stuff | ||
332 | - c = config->readColorEntry("background", &Qt::lightGray); | ||
333 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0){ | ||
334 | - appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); | ||
335 | - appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); | ||
336 | - appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); | ||
337 | - appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); | ||
338 | - menuBrush.setColor(c); // hack - used for kicker applets | ||
339 | - appPal.setBrush(QColorGroup::Background, menuBrush); | ||
340 | - } | ||
341 | + c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); | ||
342 | c.hsv(&bH, &bS, &bV); | ||
343 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | ||
344 | |||
345 | @@ -825,13 +756,10 @@ | ||
346 | painter.end(); | ||
347 | bgBrush.setColor(c); | ||
348 | bgBrush.setPixmap(wallPaper); | ||
349 | - if(qstrcmp(kapp->argv()[0], "kicker") != 0 && | ||
350 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ | ||
351 | appPal.setBrush(QColorGroup::Background, bgBrush); | ||
352 | - } | ||
353 | |||
354 | // lineedits | ||
355 | - c = config->readColorEntry("windowBackground", &Qt::white); | ||
356 | + c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); | ||
357 | QPixmap basePix; | ||
358 | basePix.resize(32, 32); | ||
359 | basePix.fill(c.rgb()); | ||
360 | @@ -857,51 +785,27 @@ | ||
361 | } | ||
362 | } | ||
363 | |||
364 | - config->setGroup(oldGrp); | ||
365 | } | ||
366 | |||
367 | void LiquidStyle::polish(QWidget *w) | ||
368 | { | ||
369 | if(w->inherits("QMenuBar")){ | ||
370 | - ((QFrame*)w)->setLineWidth(0); | ||
371 | - w->setBackgroundMode(QWidget::NoBackground); | ||
372 | + //((QFrame*)w)->setLineWidth(0); | ||
373 | + w->setBackgroundMode(QWidget::PaletteBackground); | ||
374 | return; | ||
375 | } | ||
376 | if(w->inherits("QPopupMenu")) | ||
377 | w->setBackgroundMode(QWidget::NoBackground); | ||
378 | |||
379 | if(w->isTopLevel()){ | ||
380 | - if(!w->inherits("QPopupMenu") && | ||
381 | - qstrcmp(kapp->argv()[0], "kicker") == 0){ | ||
382 | - qWarning("Got panel toplevel %s", w->className()); | ||
383 | - // force extensions and child panels to use proper palette. | ||
384 | - if(w->inherits("Panel")){ | ||
385 | - qWarning("Setting panel palette"); | ||
386 | - w->setPalette(kapp->palette()); | ||
387 | - } | ||
388 | - else{ | ||
389 | - // reset palette for everything else | ||
390 | - QPalette pal = kapp->palette(); | ||
391 | - pal.setBrush(QColorGroup::Background, bgBrush); | ||
392 | - pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); | ||
393 | - pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); | ||
394 | - pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); | ||
395 | - pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); | ||
396 | - w->setPalette(pal); | ||
397 | - } | ||
398 | - } | ||
399 | return; | ||
400 | } | ||
401 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0 && | ||
402 | - w->inherits("KPanelExtension")){ // FIXME - doesn't work | ||
403 | - w->setPalette(kapp->palette()); | ||
404 | - } | ||
405 | + | ||
406 | + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | ||
407 | |||
408 | if(w->inherits("QComboBox") || | ||
409 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | ||
410 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | ||
411 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | ||
412 | - w->inherits("TaskContainer")){ | ||
413 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | ||
414 | w->installEventFilter(this); | ||
415 | } | ||
416 | if(w->inherits("QLineEdit")){ | ||
417 | @@ -913,6 +817,9 @@ | ||
418 | applyCustomAttributes((QPushButton *)w); | ||
419 | w->installEventFilter(this); | ||
420 | } | ||
421 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ | ||
422 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); | ||
423 | + } | ||
424 | |||
425 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | ||
426 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | ||
427 | @@ -942,11 +849,12 @@ | ||
428 | w->setMouseTracking(true); | ||
429 | w->installEventFilter(this); | ||
430 | } | ||
431 | + if(w-> inherits("QToolButton")) { | ||
432 | + ((QToolButton*)w)->setAutoRaise (false); | ||
433 | + } | ||
434 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | ||
435 | return; | ||
436 | } | ||
437 | - if(w->inherits("PanelButtonBase")) | ||
438 | - return; | ||
439 | |||
440 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | ||
441 | palette().active().brush(QColorGroup::Background).pixmap()){ | ||
442 | @@ -954,17 +862,18 @@ | ||
443 | return; | ||
444 | } | ||
445 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | ||
446 | - !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ | ||
447 | + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | ||
448 | if(w->backgroundMode() == QWidget::PaletteBackground || | ||
449 | w->backgroundMode() == QWidget::PaletteButton){ | ||
450 | w->setBackgroundMode(QWidget::X11ParentRelative); | ||
451 | } | ||
452 | } | ||
453 | - if(w->inherits("KToolBar")){ | ||
454 | + if(w->inherits("QToolBar")){ | ||
455 | w->installEventFilter(this); | ||
456 | - //w->setBackgroundMode(QWidget::NoBackground); | ||
457 | + w->setBackgroundMode(QWidget::PaletteBackground); | ||
458 | return; | ||
459 | } | ||
460 | + | ||
461 | } | ||
462 | |||
463 | void LiquidStyle::unPolish(QWidget *w) | ||
464 | @@ -1001,12 +910,14 @@ | ||
465 | unapplyCustomAttributes((QPushButton *)w); | ||
466 | w->removeEventFilter(this); | ||
467 | } | ||
468 | - | ||
469 | +/* | ||
470 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | ||
471 | + w-> setBackgroundMode ( PaletteBackground ); | ||
472 | + } | ||
473 | +*/ | ||
474 | if(w->inherits("QComboBox") || | ||
475 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | ||
476 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | ||
477 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | ||
478 | - w->inherits("TaskContainer")){ | ||
479 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | ||
480 | w->removeEventFilter(this); | ||
481 | } | ||
482 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | ||
483 | @@ -1014,9 +925,9 @@ | ||
484 | w->setAutoMask(false); | ||
485 | } | ||
486 | } | ||
487 | - if(w->inherits("KToolBar")){ | ||
488 | + if(w->inherits("QToolBar")){ | ||
489 | w->removeEventFilter(this); | ||
490 | - //w->setBackgroundMode(QWidget::PaletteBackground); | ||
491 | + w->setBackgroundMode(QWidget::PaletteBackground); | ||
492 | return; | ||
493 | } | ||
494 | if(w->inherits("QHeader")){ | ||
495 | @@ -1028,20 +939,24 @@ | ||
496 | void LiquidStyle::polish(QApplication *app) | ||
497 | { | ||
498 | |||
499 | - KStyle::polish(app); | ||
500 | + QWindowsStyle::polish(app); | ||
501 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | ||
502 | menuFade = app->isEffectEnabled(UI_FadeMenu); | ||
503 | if(menuAni) | ||
504 | app->setEffectEnabled(UI_AnimateMenu, false); | ||
505 | if(menuFade) | ||
506 | app->setEffectEnabled(UI_FadeMenu, false); | ||
507 | + | ||
508 | + qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | ||
509 | } | ||
510 | |||
511 | void LiquidStyle::unPolish(QApplication *app) | ||
512 | { | ||
513 | - KStyle::unPolish(app); | ||
514 | + QWindowsStyle::unPolish(app); | ||
515 | app->setEffectEnabled(UI_AnimateMenu, menuAni); | ||
516 | app->setEffectEnabled(UI_FadeMenu, menuFade); | ||
517 | + | ||
518 | + qt_set_draw_menu_bar_impl ( 0 ); | ||
519 | } | ||
520 | |||
521 | /* | ||
522 | @@ -1063,7 +978,7 @@ | ||
523 | */ | ||
524 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | ||
525 | { | ||
526 | - if(obj->inherits("KToolBar")){ | ||
527 | + if(obj->inherits("QToolBar")){ | ||
528 | if(ev->type() == QEvent::Resize){ | ||
529 | const QObjectList *tbChildList = obj->children(); | ||
530 | QObjectListIt it(*tbChildList); | ||
531 | @@ -1076,35 +991,7 @@ | ||
532 | |||
533 | } | ||
534 | } | ||
535 | - else if(obj->inherits("KMiniPagerButton")){ | ||
536 | - QButton *btn = (QButton *)obj; | ||
537 | - if(ev->type() == QEvent::Paint){ | ||
538 | - if(!(btn->isOn() || btn->isDown())){ | ||
539 | - QPalette pal = btn->palette(); | ||
540 | - pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? | ||
541 | - pagerHoverBrush : pagerBrush); | ||
542 | - btn->setPalette(pal); | ||
543 | - } | ||
544 | - else{ | ||
545 | - QPalette pal = btn->palette(); | ||
546 | - pal.setBrush(QColorGroup::Dark, | ||
547 | - QApplication::palette().active().brush(QColorGroup::Dark)); | ||
548 | - btn->setPalette(pal); | ||
549 | - | ||
550 | - } | ||
551 | - } | ||
552 | - else if(ev->type() == QEvent::Enter){ | ||
553 | - highlightWidget = btn; | ||
554 | - btn->repaint(false); | ||
555 | - } | ||
556 | - else if(ev->type() == QEvent::Leave){ | ||
557 | - highlightWidget = NULL; | ||
558 | - btn->repaint(false); | ||
559 | - } | ||
560 | - | ||
561 | - } | ||
562 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || | ||
563 | - obj->isA("AppletHandle")){ | ||
564 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | ||
565 | QWidget *btn = (QWidget *)obj; | ||
566 | if(ev->type() == QEvent::Enter){ | ||
567 | if(btn->isEnabled()){ | ||
568 | @@ -1119,20 +1006,7 @@ | ||
569 | } | ||
570 | } | ||
571 | } | ||
572 | - else if(obj->inherits("TaskContainer")){ | ||
573 | - QButton *btn = (QButton *)obj; | ||
574 | - QPalette pal = btn->palette(); | ||
575 | - if(ev->type() == QEvent::Enter){ | ||
576 | - pal.setColor(QColorGroup::Background, pal.active().button().light(110)); | ||
577 | - btn->setPalette(pal); | ||
578 | - } | ||
579 | - else if(ev->type() == QEvent::Leave){ | ||
580 | - pal.setColor(QColorGroup::Background, | ||
581 | - QApplication::palette().active().background()); | ||
582 | - btn->setPalette(pal); | ||
583 | - } | ||
584 | - } | ||
585 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ | ||
586 | + else if(obj->inherits("QToolButton")){ | ||
587 | QToolButton *btn = (QToolButton *)btn; | ||
588 | if(!btn->autoRaise()){ | ||
589 | if(btn->isEnabled()){ | ||
590 | @@ -1340,11 +1214,6 @@ | ||
591 | QColorGroup g = btn->colorGroup(); | ||
592 | |||
593 | |||
594 | - QColor testColor; | ||
595 | - if(btn->parent() && btn->parent()->isWidgetType()){ | ||
596 | - testColor = p->backgroundColor(); // remove me | ||
597 | - } | ||
598 | - | ||
599 | //int dw = buttonDefaultIndicatorWidth(); | ||
600 | if(btn->hasFocus() || btn->isDefault()){ | ||
601 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); | ||
602 | @@ -2065,203 +1934,24 @@ | ||
603 | p->drawLineSegments(a); | ||
604 | } | ||
605 | |||
606 | -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, | ||
607 | - const QColorGroup &g, KToolBarPos, | ||
608 | - QBrush *) | ||
609 | -{ | ||
610 | - p->setPen(g.button().dark(120)); | ||
611 | - int x2 = x+w-1; | ||
612 | - int y2 = y+h-1; | ||
613 | - p->drawLine(x+1, y, x2-1, y); | ||
614 | - p->drawLine(x+1, y2, x2-1, y2); | ||
615 | - p->drawLine(x, y+1, x, y2-1); | ||
616 | - p->drawLine(x2, y+1, x2, y2-1); | ||
617 | - | ||
618 | - p->setPen(g.background()); | ||
619 | - p->drawPoint(x, y); | ||
620 | - p->drawPoint(x2, y); | ||
621 | - p->drawPoint(x, y2); | ||
622 | - p->drawPoint(x2, y2); | ||
623 | - | ||
624 | - | ||
625 | - | ||
626 | - // p->drawRect(x, y, w, h); | ||
627 | - QPixmap *pix = bevelFillDict.find(g.button().rgb()); | ||
628 | - if(!pix){ | ||
629 | - int h, s, v; | ||
630 | - g.button().hsv(&h, &s, &v); | ||
631 | - pix = new QPixmap(*bevelFillPix); | ||
632 | - adjustHSV(*pix, h, s, v); | ||
633 | - bevelFillDict.insert(g.button().rgb(), pix); | ||
634 | - } | ||
635 | - | ||
636 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); | ||
637 | -} | ||
638 | - | ||
639 | -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, | ||
640 | - const QColorGroup &g, bool mac, QBrush *) | ||
641 | -{ | ||
642 | - if(p->device() && p->device()->devType() == QInternal::Widget && | ||
643 | - ((KMenuBar *)p->device())->isTopLevelMenu()){ | ||
644 | - p->setPen(Qt::black); | ||
645 | - p->drawRect(x, y, w, h); | ||
646 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); | ||
647 | - // left | ||
648 | - p->drawLine(x+1, y+1, x+1, y+5); | ||
649 | - p->drawLine(x+2, y+1, x+2, y+3); | ||
650 | - p->drawLine(x+3, y+1, x+3, y+2); | ||
651 | - p->drawLine(x+4, y+1, x+6, y+1); | ||
652 | - // right | ||
653 | - int x2 = x+w-1; | ||
654 | - p->drawLine(x2-1, y+1, x2-1, y+5); | ||
655 | - p->drawLine(x2-2, y+1, x2-2, y+3); | ||
656 | - p->drawLine(x2-3, y+1, x2-3, y+2); | ||
657 | - p->drawLine(x2-4, y+1, x2-6, y+1); | ||
658 | - } | ||
659 | - else{ | ||
660 | - qDrawShadePanel(p, x, y, w, h, g, false, 1, | ||
661 | - &g.brush(QColorGroup::Background)); | ||
662 | - } | ||
663 | |||
664 | -} | ||
665 | - | ||
666 | -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, | ||
667 | - const QColorGroup &g, KToolBarPos, QBrush *) | ||
668 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | ||
669 | + QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) | ||
670 | { | ||
671 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | ||
672 | -} | ||
673 | + x -= 2; // Bug in Qt/E | ||
674 | + y -= 2; | ||
675 | + w += 2; | ||
676 | + h += 2; | ||
677 | |||
678 | -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, | ||
679 | - const QColorGroup &g, bool sunken, | ||
680 | - bool raised, bool enabled, bool popup, | ||
681 | - KToolButtonType icontext, | ||
682 | - const QString& btext, const QPixmap *pixmap, | ||
683 | - QFont *font, QWidget *btn) | ||
684 | -{ | ||
685 | - int dx, dy; | ||
686 | - | ||
687 | - QFontMetrics fm(*font); | ||
688 | - | ||
689 | - QToolBar* toolbar = 0; | ||
690 | - if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) | ||
691 | - toolbar = static_cast<QToolBar*>(btn->parent()); | ||
692 | - | ||
693 | - --w, --h; | ||
694 | - if(sunken) | ||
695 | - ++x, ++y; | ||
696 | + p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); | ||
697 | |||
698 | - QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : | ||
699 | - g.background()); | ||
700 | - drawClearBevel(p, x, y, w, h, btnColor, g.background()); | ||
701 | - | ||
702 | - p->setPen(g.text()); | ||
703 | - | ||
704 | - if (icontext == Icon){ // icon only | ||
705 | - if (pixmap){ | ||
706 | - dx = ( w - pixmap->width() ) / 2; | ||
707 | - dy = ( h - pixmap->height() ) / 2; | ||
708 | - if ( sunken ) | ||
709 | - { | ||
710 | - ++dx; | ||
711 | - ++dy; | ||
712 | - } | ||
713 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | ||
714 | - } | ||
715 | - } | ||
716 | - else if (icontext == IconTextRight){ // icon and text (if any) | ||
717 | - if (pixmap){ | ||
718 | - dx = 4; | ||
719 | - dy = ( h - pixmap->height() ) / 2; | ||
720 | - if ( sunken ){ | ||
721 | - ++dx; | ||
722 | - ++dy; | ||
723 | - } | ||
724 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | ||
725 | - } | ||
726 | - if (!btext.isNull()){ | ||
727 | - int tf = AlignVCenter|AlignLeft; | ||
728 | - if (pixmap) | ||
729 | - dx= 4 + pixmap->width() + 2; | ||
730 | - else | ||
731 | - dx= 4; | ||
732 | - dy = 0; | ||
733 | - if ( sunken ){ | ||
734 | - ++dx; | ||
735 | - ++dy; | ||
736 | - } | ||
737 | - if (font) | ||
738 | - p->setFont(*font); | ||
739 | - if(raised) | ||
740 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | ||
741 | - p->drawText(x+dx, y+dy, w-dx, h, tf, btext); | ||
742 | - } | ||
743 | - } | ||
744 | - else if (icontext == Text){ // only text, even if there is a icon | ||
745 | - if (!btext.isNull()){ | ||
746 | - int tf = AlignVCenter|AlignLeft; | ||
747 | - if (!enabled) | ||
748 | - p->setPen(g.dark()); | ||
749 | - dx= (w - fm.width(btext)) / 2; | ||
750 | - dy= (h - fm.lineSpacing()) / 2; | ||
751 | - if ( sunken ){ | ||
752 | - ++dx; | ||
753 | - ++dy; | ||
754 | - } | ||
755 | - if (font) | ||
756 | - p->setFont(*font); | ||
757 | - if(raised) | ||
758 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | ||
759 | - p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); | ||
760 | - } | ||
761 | - } | ||
762 | - else if (icontext == IconTextBottom){ | ||
763 | - if (pixmap){ | ||
764 | - dx = (w - pixmap->width()) / 2; | ||
765 | - dy = (h - fm.lineSpacing() - pixmap->height()) / 2; | ||
766 | - if ( sunken ){ | ||
767 | - ++dx; | ||
768 | - ++dy; | ||
769 | - } | ||
770 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | ||
771 | - } | ||
772 | - if (!btext.isNull()){ | ||
773 | - int tf = AlignBottom|AlignHCenter; | ||
774 | - dy= pixmap->height(); | ||
775 | - dx = 2; | ||
776 | - if ( sunken ){ | ||
777 | - ++dx; | ||
778 | - ++dy; | ||
779 | - } | ||
780 | - if (font) | ||
781 | - p->setFont(*font); | ||
782 | - if(raised) | ||
783 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | ||
784 | - p->drawText(x, y, w, h-3, tf, btext); | ||
785 | - } | ||
786 | - } | ||
787 | - if (popup){ | ||
788 | - if (enabled) | ||
789 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, | ||
790 | - g, true); | ||
791 | - else | ||
792 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, | ||
793 | - 0, 0, g, false); | ||
794 | - } | ||
795 | -} | ||
796 | - | ||
797 | - | ||
798 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, | ||
799 | - const QColorGroup &g, bool active, QMenuItem *mi, | ||
800 | - QBrush *) | ||
801 | -{ | ||
802 | - if ( p->font() == KGlobalSettings::generalFont() ) | ||
803 | - p->setFont( KGlobalSettings::menuFont() ); | ||
804 | + w -= 2; | ||
805 | |||
806 | if(menuHandler->useShadowText()){ | ||
807 | QColor shadow; | ||
808 | if(p->device() && p->device()->devType() == QInternal::Widget && | ||
809 | - ((QWidget *)p->device())->inherits("KMenuBar")){ | ||
810 | - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | ||
811 | + ((QWidget *)p->device())->inherits("QMenuBar")){ | ||
812 | + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | ||
813 | g.background().dark(130); | ||
814 | } | ||
815 | else | ||
816 | @@ -2336,8 +2026,6 @@ | ||
817 | |||
818 | maxpmw = QMAX( maxpmw, 20 ); | ||
819 | |||
820 | - if ( p->font() == KGlobalSettings::generalFont() ) | ||
821 | - p->setFont( KGlobalSettings::menuFont() ); | ||
822 | |||
823 | bool dis = !enabled; | ||
824 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); | ||
825 | @@ -2363,7 +2051,7 @@ | ||
826 | p->fillRect(x, y, w, h, menuBrush); | ||
827 | } | ||
828 | else{ | ||
829 | - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | ||
830 | + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | ||
831 | if(pix) | ||
832 | p->drawPixmap(x, y, *pix, x, y, w, h); | ||
833 | } | ||
834 | @@ -2508,25 +2196,6 @@ | ||
835 | return h; | ||
836 | } | ||
837 | |||
838 | -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, | ||
839 | - const QColorGroup &g, QBrush *fill) | ||
840 | -{ | ||
841 | - p->setPen(g.button().dark(130)); | ||
842 | - p->drawRect(x, y, w, h); | ||
843 | - p->setPen(g.button().light(120)); | ||
844 | - p->drawRect(x+1, y+1, w-2, h-2); | ||
845 | - if(w >= 4 && h >= 4){ | ||
846 | - QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); | ||
847 | - if(!pix){ | ||
848 | - int h, s, v; | ||
849 | - g.button().dark(120).hsv(&h, &s, &v); | ||
850 | - pix = new QPixmap(*bevelFillPix); | ||
851 | - adjustHSV(*pix, h, s, v); | ||
852 | - bevelFillDict.insert(g.button().dark(120).rgb(), pix); | ||
853 | - } | ||
854 | - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | ||
855 | - } | ||
856 | -} | ||
857 | |||
858 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | ||
859 | const QColorGroup &g, const QColor *c, | ||
860 | @@ -2540,25 +2209,25 @@ | ||
861 | return; | ||
862 | } | ||
863 | else{ | ||
864 | - KStyle::drawFocusRect(p, r, g, c, atBorder); | ||
865 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); | ||
866 | } | ||
867 | } | ||
868 | else | ||
869 | - KStyle::drawFocusRect(p, r, g, c, atBorder); | ||
870 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); | ||
871 | |||
872 | } | ||
873 | |||
874 | void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) | ||
875 | { | ||
876 | mnu->installEventFilter(menuHandler); | ||
877 | - KStyle::polishPopupMenu(mnu); | ||
878 | + QWindowsStyle::polishPopupMenu(mnu); | ||
879 | } | ||
880 | |||
881 | void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, | ||
882 | bool selected) | ||
883 | { | ||
884 | if(tabBar->shape() != QTabBar::RoundedAbove){ | ||
885 | - KStyle::drawTab(p, tabBar, tab, selected); | ||
886 | + QWindowsStyle::drawTab(p, tabBar, tab, selected); | ||
887 | return; | ||
888 | } | ||
889 | QPixmap tilePix; | ||
890 | @@ -2671,7 +2340,7 @@ | ||
891 | vFrame = 8; // was 10 | ||
892 | } | ||
893 | else | ||
894 | - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | ||
895 | + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | ||
896 | } | ||
897 | |||
898 | |||
899 | @@ -2699,7 +2368,7 @@ | ||
900 | p->drawLine(x+1, y+1, x+1, y2-1); | ||
901 | } | ||
902 | else if(lineWidth != 2 || !sunken) | ||
903 | - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | ||
904 | + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | ||
905 | else{ | ||
906 | QPen oldPen = p->pen(); | ||
907 | int x2 = x+w-1; | ||
908 | @@ -2726,105 +2395,6 @@ | ||
909 | } | ||
910 | } | ||
911 | |||
912 | -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, | ||
913 | - const QColorGroup &g, QBrush *) | ||
914 | -{ | ||
915 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | ||
916 | - drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? | ||
917 | - g.button().light(120) : g.button(), g.button()); | ||
918 | - /* | ||
919 | - if(h > w){ | ||
920 | - int y2 = y+h-1; | ||
921 | - | ||
922 | - p->setPen(g.light()); | ||
923 | - | ||
924 | - p->drawLine(x+1, y+2, x+1, y2-2); | ||
925 | - p->drawLine(x+4, y+2, x+4, y2-2); | ||
926 | - | ||
927 | - p->setPen(g.dark()); | ||
928 | - p->drawLine(x+2, y+2, x+2, y2-2); | ||
929 | - p->drawLine(x+5, y+2, x+5, y2-2); | ||
930 | - | ||
931 | - } | ||
932 | - else{ | ||
933 | - int x2 = x+w-1; | ||
934 | - | ||
935 | - p->setPen(g.light()); | ||
936 | - | ||
937 | - p->drawLine(x+2, y+1, x2-2, y+1); | ||
938 | - p->drawLine(x+2, y+4, x2-2, y+4); | ||
939 | - | ||
940 | - p->setPen(g.dark()); | ||
941 | - p->drawLine(x+2, y+2, x2-2, y+2); | ||
942 | - p->drawLine(x+2, y+5, x2-2, y+5); | ||
943 | - }*/ | ||
944 | - | ||
945 | -} | ||
946 | - | ||
947 | -void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, | ||
948 | - const QColorGroup &g, | ||
949 | - const QString &text, bool sunken, | ||
950 | - QPixmap *pixmap, QBrush *) | ||
951 | -{ | ||
952 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); | ||
953 | - drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); | ||
954 | - p->setPen(g.buttonText()); // Kicker doesn't set this ;-) | ||
955 | - | ||
956 | - if(text.isNull() && !pixmap) | ||
957 | - return; | ||
958 | - | ||
959 | - const int pxWidth = 20; | ||
960 | - int textPos = pxWidth; | ||
961 | - QRect br(buttonRect(x, y, w, h)); | ||
962 | - | ||
963 | - if (sunken) | ||
964 | - p->translate(1,1); | ||
965 | - | ||
966 | - if ( pixmap && !pixmap->isNull() ) { | ||
967 | - int dx = ( pxWidth - pixmap->width() ) / 2; | ||
968 | - int dy = ( h - pixmap->height() ) / 2; | ||
969 | - p->drawPixmap( br.x()+dx, dy, *pixmap ); | ||
970 | - } | ||
971 | - | ||
972 | - QString s = text; | ||
973 | - static const QString &modStr = KGlobal::staticQString( | ||
974 | - QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); | ||
975 | - | ||
976 | - int modStrPos = s.find(modStr); | ||
977 | - | ||
978 | - if (-1 != modStrPos) { | ||
979 | - | ||
980 | - // +1 because we include a space after the closing brace. | ||
981 | - s.remove(modStrPos, modStr.length()+1); | ||
982 | - | ||
983 | - QPixmap modPixmap = SmallIcon("modified"); | ||
984 | - | ||
985 | - int dx = (pxWidth - modPixmap.width()) / 2; | ||
986 | - int dy = (h - modPixmap.height()) / 2; | ||
987 | - | ||
988 | - p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); | ||
989 | - | ||
990 | - textPos += pxWidth; | ||
991 | - } | ||
992 | - | ||
993 | - if (!s.isEmpty()){ | ||
994 | - if (p->fontMetrics().width(s) > br.width() - textPos) { | ||
995 | - | ||
996 | - int maxLen = br.width() - textPos - p->fontMetrics().width("..."); | ||
997 | - | ||
998 | - while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) | ||
999 | - s.truncate(s.length() - 1); | ||
1000 | - | ||
1001 | - s.append("..."); | ||
1002 | - } | ||
1003 | - | ||
1004 | - p->setPen(g.buttonText()); | ||
1005 | - | ||
1006 | - p->drawText(br.x()+ textPos, -1, w-textPos, h, | ||
1007 | - AlignLeft|AlignVCenter, s); | ||
1008 | - } | ||
1009 | - | ||
1010 | -} | ||
1011 | |||
1012 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) | ||
1013 | { | ||
1014 | @@ -2998,22 +2568,22 @@ | ||
1015 | customBtnIconList.clear(); | ||
1016 | customBtnLabelList.clear(); | ||
1017 | |||
1018 | - KConfig *config = KGlobal::config(); | ||
1019 | - QString oldGrp = config->group(); | ||
1020 | - config->setGroup("MosfetButtons"); | ||
1021 | +// KConfig *config = KGlobal::config(); | ||
1022 | +// QString oldGrp = config->group(); | ||
1023 | +// config->setGroup("MosfetButtons"); | ||
1024 | |||
1025 | QStrList iconList, colorList; //temp, we store QPixmaps and QColors | ||
1026 | iconList.setAutoDelete(true); | ||
1027 | colorList.setAutoDelete(true); | ||
1028 | - config->readListEntry("Labels", customBtnLabelList); | ||
1029 | - config->readListEntry("Icons", iconList); | ||
1030 | - config->readListEntry("Colors", colorList); | ||
1031 | +// config->readListEntry("Labels", customBtnLabelList); | ||
1032 | +// config->readListEntry("Icons", iconList); | ||
1033 | +// config->readListEntry("Colors", colorList); | ||
1034 | |||
1035 | const char *labelStr = customBtnLabelList.first(); | ||
1036 | const char *colorStr = colorList.first(); | ||
1037 | const char *iconStr = iconList.first(); | ||
1038 | |||
1039 | - KIconLoader *ldr = KGlobal::iconLoader(); | ||
1040 | +// KIconLoader *ldr = KGlobal::iconLoader(); | ||
1041 | while(labelStr != NULL){ | ||
1042 | QColor *c = new QColor; | ||
1043 | c->setNamedColor(QString(colorStr)); | ||
1044 | @@ -3022,7 +2592,7 @@ | ||
1045 | QString tmpStr(iconStr); | ||
1046 | if(!tmpStr.isEmpty()){ | ||
1047 | QPixmap *pixmap = | ||
1048 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); | ||
1049 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); | ||
1050 | if(pixmap->isNull()){ | ||
1051 | delete pixmap; | ||
1052 | customBtnIconList.append(NULL); | ||
1053 | @@ -3037,7 +2607,6 @@ | ||
1054 | colorStr = colorList.next(); | ||
1055 | iconStr = iconList.next(); | ||
1056 | } | ||
1057 | - config->setGroup(oldGrp); | ||
1058 | } | ||
1059 | |||
1060 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) | ||
1061 | @@ -3087,7 +2656,7 @@ | ||
1062 | } | ||
1063 | } | ||
1064 | |||
1065 | -#include "liquid.moc" | ||
1066 | +// #include "liquid.moc" | ||
1067 | |||
1068 | |||
1069 | |||
1070 | --- -Mon Jun 24 19:05:49 2002 | ||
1071 | +++ plugin.cppThu Jun 20 20:01:37 2002 | ||
1072 | @@ -1,29 +1,29 @@ | ||
1073 | #include "liquid.h" | ||
1074 | -#include <klocale.h> | ||
1075 | + | ||
1076 | |||
1077 | extern "C" { | ||
1078 | - KStyle* allocate(); | ||
1079 | - int minor_version(); | ||
1080 | - int major_version(); | ||
1081 | - const char *description(); | ||
1082 | + QStyle* allocate ( ); | ||
1083 | + int minor_version ( ); | ||
1084 | + int major_version ( ); | ||
1085 | + const char *description ( ); | ||
1086 | } | ||
1087 | |||
1088 | -KStyle* allocate() | ||
1089 | +QStyle* allocate ( ) | ||
1090 | { | ||
1091 | - return(new LiquidStyle); | ||
1092 | + return new LiquidStyle ( ); | ||
1093 | } | ||
1094 | |||
1095 | -int minor_version() | ||
1096 | +int minor_version ( ) | ||
1097 | { | ||
1098 | - return(0); | ||
1099 | + return 0; | ||
1100 | } | ||
1101 | |||
1102 | -int major_version() | ||
1103 | +int major_version ( ) | ||
1104 | { | ||
1105 | - return(1); | ||
1106 | + return 1; | ||
1107 | } | ||
1108 | |||
1109 | -const char *description() | ||
1110 | +const char *description ( ) | ||
1111 | { | ||
1112 | - return(i18n("High performance liquid plugin").utf8()); | ||
1113 | + return "High performance liquid plugin"; | ||
1114 | } | ||