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