summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-21 19:49:00 (UTC)
committer sandman <sandman>2002-11-21 19:49:00 (UTC)
commit440f1d4d439c83368a855355cdceda43660137f2 (patch) (unidiff)
tree1b7ffd5157d2c141b9f978d08e47699ea2d013ff
parent0b0ebb03a1fc0a316b52ce147d87fa89d3b5af16 (diff)
downloadopie-440f1d4d439c83368a855355cdceda43660137f2.zip
opie-440f1d4d439c83368a855355cdceda43660137f2.tar.gz
opie-440f1d4d439c83368a855355cdceda43660137f2.tar.bz2
- pixmaps in in menubars are now drawn (this is uncommon, but resulted in
blank icons in nethack for example) - small size optimization - updated the QPL diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/embeddata.h2
-rw-r--r--noncore/styles/liquid/liquid.cpp20
-rw-r--r--noncore/styles/liquid/opie-liquid.diff141
3 files changed, 112 insertions, 51 deletions
diff --git a/noncore/styles/liquid/embeddata.h b/noncore/styles/liquid/embeddata.h
index e4ccc27..5207fb1 100644
--- a/noncore/styles/liquid/embeddata.h
+++ b/noncore/styles/liquid/embeddata.h
@@ -964,25 +964,25 @@ static struct EmbedImage {
964 { 13, 28, 32, (const unsigned char*)sbslider_mid_data, 0, 0, TRUE, "sbslider_mid" }, 964 { 13, 28, 32, (const unsigned char*)sbslider_mid_data, 0, 0, TRUE, "sbslider_mid" },
965 { 13, 8, 32, (const unsigned char*)sbslider_top_data, 0, 0, TRUE, "sbslider_top" }, 965 { 13, 8, 32, (const unsigned char*)sbslider_top_data, 0, 0, TRUE, "sbslider_top" },
966 { 10, 11, 32, (const unsigned char*)sliderarrow_data, 0, 0, TRUE, "sliderarrow" }, 966 { 10, 11, 32, (const unsigned char*)sliderarrow_data, 0, 0, TRUE, "sliderarrow" },
967 { 85, 33, 32, (const unsigned char*)tab_data, 0, 0, TRUE, "tab" }, 967 { 85, 33, 32, (const unsigned char*)tab_data, 0, 0, TRUE, "tab" },
968}; 968};
969 969
970static int cmpEmbedImage(const void *a, const void *b) 970static int cmpEmbedImage(const void *a, const void *b)
971{ 971{
972 const EmbedImage* ea = (const EmbedImage*)a; 972 const EmbedImage* ea = (const EmbedImage*)a;
973 const EmbedImage* eb = (const EmbedImage*)b; 973 const EmbedImage* eb = (const EmbedImage*)b;
974 return strcmp(ea->name,eb->name); 974 return strcmp(ea->name,eb->name);
975} 975}
976inline const QImage& qembed_findImage(const char* name) 976static const QImage& qembed_findImage(const char* name)
977{ 977{
978 EmbedImage key; key.name = name; 978 EmbedImage key; key.name = name;
979 EmbedImage* r = (EmbedImage*)bsearch( &key, embed_image_vec, 979 EmbedImage* r = (EmbedImage*)bsearch( &key, embed_image_vec,
980 sizeof(embed_image_vec)/sizeof(EmbedImage), sizeof(EmbedImage), cmpEmbedImage ); 980 sizeof(embed_image_vec)/sizeof(EmbedImage), sizeof(EmbedImage), cmpEmbedImage );
981 QImage* img; 981 QImage* img;
982 if ( r ) { 982 if ( r ) {
983 img = new QImage((uchar*)r->data, 983 img = new QImage((uchar*)r->data,
984 r->width, 984 r->width,
985 r->height, 985 r->height,
986 r->depth, 986 r->depth,
987 (QRgb*)r->colorTable, 987 (QRgb*)r->colorTable,
988 r->numColors, 988 r->numColors,
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index ba732aa..c8f8d20 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1996,52 +1996,62 @@ void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1996 parent->erase(x, y, w, h); 1996 parent->erase(x, y, w, h);
1997 1997
1998 if(menuHandler->useShadowText()){ 1998 if(menuHandler->useShadowText()){
1999 QColor shadow; 1999 QColor shadow;
2000 if(p->device() && p->device()->devType() == QInternal::Widget && 2000 if(p->device() && p->device()->devType() == QInternal::Widget &&
2001 ((QWidget *)p->device())->inherits("QMenuBar")){ 2001 ((QWidget *)p->device())->inherits("QMenuBar")){
2002 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 2002 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
2003 g.background().dark(130); 2003 g.background().dark(130);
2004 } 2004 }
2005 else 2005 else
2006 shadow = g.background().dark(130); 2006 shadow = g.background().dark(130);
2007 2007
2008 QPixmap *dummy = 0;
2009
2010 if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) {
2011 dummy = new QPixmap ( mi-> pixmap ( )-> size ( ));
2012 QBitmap dummy_mask ( dummy-> size ( ));
2013 dummy_mask. fill ( color1 );
2014 dummy-> setMask ( dummy_mask );
2015 }
2016
2008 if(active){ 2017 if(active){
2009 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2018 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2010 QApplication::style().drawItem(p, x+1, y+1, w, h, 2019 QApplication::style().drawItem(p, x+1, y+1, w, h,
2011 AlignCenter|ShowPrefix|DontClip|SingleLine, 2020 AlignCenter|ShowPrefix|DontClip|SingleLine,
2012 g, mi->isEnabled(), NULL, mi->text(), 2021 g, mi->isEnabled(), dummy, mi->text(),
2013 -1, &shadow); 2022 -1, &shadow);
2014 QApplication::style().drawItem(p, x, y, w, h, 2023 QApplication::style().drawItem(p, x, y, w, h,
2015 AlignCenter|ShowPrefix|DontClip|SingleLine, 2024 AlignCenter|ShowPrefix|DontClip|SingleLine,
2016 g, mi->isEnabled(), NULL, mi->text(), 2025 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2017 -1, &g.text()); 2026 -1, &g.text());
2018 } 2027 }
2019 else{ 2028 else{
2020 QApplication::style().drawItem(p, x+1, y+1, w, h, 2029 QApplication::style().drawItem(p, x+1, y+1, w, h,
2021 AlignCenter|ShowPrefix|DontClip|SingleLine, 2030 AlignCenter|ShowPrefix|DontClip|SingleLine,
2022 g, mi->isEnabled(), NULL, mi->text(), 2031 g, mi->isEnabled(), dummy, mi->text(),
2023 -1, &shadow); 2032 -1, &shadow);
2024 QApplication::style().drawItem(p, x, y, w, h, 2033 QApplication::style().drawItem(p, x, y, w, h,
2025 AlignCenter|ShowPrefix|DontClip|SingleLine, 2034 AlignCenter|ShowPrefix|DontClip|SingleLine,
2026 g, mi->isEnabled(), NULL, mi->text(), 2035 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2027 -1, &g.text()); 2036 -1, &g.text());
2028 } 2037 }
2038 delete dummy;
2029 } 2039 }
2030 else{ 2040 else{
2031 if(active) 2041 if(active)
2032 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2042 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2033 QApplication::style().drawItem(p, x, y, w, h, 2043 QApplication::style().drawItem(p, x, y, w, h,
2034 AlignCenter|ShowPrefix|DontClip|SingleLine, 2044 AlignCenter|ShowPrefix|DontClip|SingleLine,
2035 g, mi->isEnabled(), NULL, mi->text(), 2045 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2036 -1, &g.text()); 2046 -1, &g.text());
2037 } 2047 }
2038} 2048}
2039 2049
2040void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 2050void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
2041 const QColorGroup &g, int /*lineWidth*/, 2051 const QColorGroup &g, int /*lineWidth*/,
2042 const QBrush * /*fill*/) 2052 const QBrush * /*fill*/)
2043{ 2053{
2044 QColor c; 2054 QColor c;
2045 switch(menuHandler->transType()){ 2055 switch(menuHandler->transType()){
2046 case None: 2056 case None:
2047 case StippledBg: 2057 case StippledBg:
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff
index 29ae6f3..d90433c 100644
--- a/noncore/styles/liquid/opie-liquid.diff
+++ b/noncore/styles/liquid/opie-liquid.diff
@@ -1,18 +1,18 @@
1This is a patch to mosfet's liquid 0.7. 1This is a patch to mosfet's liquid 0.7.
2Features: 2Features:
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 --- -2002-11-18 04:47:41.000000000 +0100 6 --- -2002-11-21 20:45:47.000000000 +0100
7 +++ liquid.h2002-11-18 03:32:40.000000000 +0100 7 +++ liquid.h2002-11-18 03:32:40.000000000 +0100
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.
@@ -132,26 +132,26 @@ Features:
132 132
133 QIntDict<QPixmap>btnDict; 133 QIntDict<QPixmap>btnDict;
134@@ -224,9 +187,6 @@ 134@@ -224,9 +187,6 @@
135 QIntDict<QPixmap>bevelFillDict; 135 QIntDict<QPixmap>bevelFillDict;
136 QIntDict<QPixmap>smallBevelFillDict; 136 QIntDict<QPixmap>smallBevelFillDict;
137 137
138- QList<QColor>customBtnColorList; 138- QList<QColor>customBtnColorList;
139- QList<QPixmap>customBtnIconList; 139- QList<QPixmap>customBtnIconList;
140- QStrList customBtnLabelList; 140- QStrList customBtnLabelList;
141 QPixmap *vsbSliderFillPix; 141 QPixmap *vsbSliderFillPix;
142 TransMenuHandler *menuHandler; 142 TransMenuHandler *menuHandler;
143 QPixmap *pixmaps[BITMAP_ITEMS]; 143 QPixmap *pixmaps[BITMAP_ITEMS];
144 --- -2002-11-18 04:47:41.000000000 +0100 144 --- -2002-11-21 20:45:47.000000000 +0100
145 +++ liquid.cpp2002-11-18 04:46:13.000000000 +0100 145 +++ liquid.cpp2002-11-21 20:27:48.000000000 +0100
146@@ -2,6 +2,9 @@ 146@@ -2,6 +2,9 @@
147 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 147 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
148 */ 148 */
149 149
150+// 150+//
151+// (c) 2002 Robert 'sandman' Griebl 151+// (c) 2002 Robert 'sandman' Griebl
152+// 152+//
153 153
154 154
155 #ifndef INCLUDE_MENUITEM_DEF 155 #ifndef INCLUDE_MENUITEM_DEF
156@@ -10,12 +13,10 @@ 156@@ -10,12 +13,10 @@
157 157
@@ -332,50 +332,50 @@ Features:
332- reloadSettings(); 332- reloadSettings();
333 + QObjectList *ol = p-> queryList("QWidget"); 333 + QObjectList *ol = p-> queryList("QWidget");
334 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 334 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
335 + QWidget *wid = (QWidget *) it.current ( ); 335 + QWidget *wid = (QWidget *) it.current ( );
336 336
337- // Now repaint menubar if needed 337- // Now repaint menubar if needed
338- if(shadowText != oldShadow){ 338- if(shadowText != oldShadow){
339- it.toFirst(); 339- it.toFirst();
340- while ((w=it.current()) != 0 ){ 340- while ((w=it.current()) != 0 ){
341- ++it; 341- ++it;
342- if(w->inherits("QMenuBar")){ 342- if(w->inherits("QMenuBar")){
343- w->repaint(); 343- w->repaint();
344- }
345- }
346 + wid-> setBackgroundMode( QWidget::PaletteBackground ); 344 + wid-> setBackgroundMode( QWidget::PaletteBackground );
345 }
346 + delete ol;
347 }
347 } 348 }
348- } 349- }
349- else if(id == MOSFET_BUTTON_CHANGE){ 350- else if(id == MOSFET_BUTTON_CHANGE){
350- qWarning("In mosfet button change"); 351- qWarning("In mosfet button change");
351- // really, this should be in LiquidStyle, but what the hell? ;-) 352- // really, this should be in LiquidStyle, but what the hell? ;-)
352- QWidgetList *list = QApplication::allWidgets(); 353- QWidgetList *list = QApplication::allWidgets();
353- QWidgetListIt it( *list ); 354- QWidgetListIt it( *list );
354- QWidget *w; 355- QWidget *w;
355- while ((w=it.current()) != 0 ){ 356- while ((w=it.current()) != 0 ){
356- ++it; 357- ++it;
357- if(w->inherits("QPushButton")){ 358- if(w->inherits("QPushButton")){
358- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); 359- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w);
359- } 360- }
360- } 361- }
361- ((LiquidStyle*)parent())->loadCustomButtons(); 362- ((LiquidStyle*)parent())->loadCustomButtons();
362- it.toFirst(); 363- it.toFirst();
363- while ((w=it.current()) != 0 ){ 364- while ((w=it.current()) != 0 ){
364- ++it; 365- ++it;
365- if(w->inherits("QPushButton")){ 366- if(w->inherits("QPushButton")){
366- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); 367- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w);
367 + delete ol; 368- }
368 } 369- }
369 }
370+ return(false); 370+ return(false);
371+} 371+}
372 372
373- } 373- }
374+ 374+
375+static int qt_version ( ) 375+static int qt_version ( )
376+{ 376+{
377 +const char *qver = qVersion ( ); 377 +const char *qver = qVersion ( );
378 +return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 378 +return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
379 } 379 }
380 380
381+ 381+
@@ -485,28 +485,28 @@ Features:
485+ 485+
486 +case CB: 486 +case CB:
487+ pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); 487+ pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/);
488 break; 488 break;
489 case CBHover: 489 case CBHover:
490- pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); 490- pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true);
491+ pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); 491+ pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/);
492 break; 492 break;
493- case HSlider: 493- case HSlider:
494- pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 494- pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
495+ case CBDown: 495+ case CBDown:
496+ pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); 496+ pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/);
497 break; 497+ break;
498+ case CBDownHover: 498+ case CBDownHover:
499+ pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); 499+ pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/);
500+ break; 500 break;
501+ 501+
502 case VSlider: 502 case VSlider:
503- pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 503- pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
504+ pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); 504+ pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true );
505 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 505 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
506 break; 506 break;
507- case RadioOff: 507- case RadioOff:
508- pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); 508- pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true);
509- break; 509- break;
510- case Tab: 510- case Tab:
511- pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); 511- pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true);
512- break; 512- break;
@@ -1563,25 +1563,25 @@ Features:
1563- p->fillRect(x, y, w, h, 1563- p->fillRect(x, y, w, h,
1564- QApplication::palette().active().brush(QColorGroup::Background)); 1564- QApplication::palette().active().brush(QColorGroup::Background));
1565+ parent->erase(x, y, w, h); 1565+ parent->erase(x, y, w, h);
1566 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1566 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1567 *getPixmap(VSlider)); 1567 *getPixmap(VSlider));
1568 } 1568 }
1569 1569
1570-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, 1570-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h,
1571+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1571+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1572 Orientation orient, bool, bool) 1572 Orientation orient, bool, bool)
1573 { 1573 {
1574 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1574 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1575@@ -2065,203 +1980,26 @@ 1575@@ -2065,243 +1980,76 @@
1576 p->drawLineSegments(a); 1576 p->drawLineSegments(a);
1577 } 1577 }
1578 1578
1579-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, 1579-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h,
1580- const QColorGroup &g, KToolBarPos, 1580- const QColorGroup &g, KToolBarPos,
1581- QBrush *) 1581- QBrush *)
1582-{ 1582-{
1583- p->setPen(g.button().dark(120)); 1583- p->setPen(g.button().dark(120));
1584- int x2 = x+w-1; 1584- int x2 = x+w-1;
1585- int y2 = y+h-1; 1585- int y2 = y+h-1;
1586- p->drawLine(x+1, y, x2-1, y); 1586- p->drawLine(x+1, y, x2-1, y);
1587- p->drawLine(x+1, y2, x2-1, y2); 1587- p->drawLine(x+1, y2, x2-1, y2);
@@ -1624,27 +1624,27 @@ Features:
1624- p->drawLine(x+4, y+1, x+6, y+1); 1624- p->drawLine(x+4, y+1, x+6, y+1);
1625- // right 1625- // right
1626- int x2 = x+w-1; 1626- int x2 = x+w-1;
1627- p->drawLine(x2-1, y+1, x2-1, y+5); 1627- p->drawLine(x2-1, y+1, x2-1, y+5);
1628- p->drawLine(x2-2, y+1, x2-2, y+3); 1628- p->drawLine(x2-2, y+1, x2-2, y+3);
1629- p->drawLine(x2-3, y+1, x2-3, y+2); 1629- p->drawLine(x2-3, y+1, x2-3, y+2);
1630- p->drawLine(x2-4, y+1, x2-6, y+1); 1630- p->drawLine(x2-4, y+1, x2-6, y+1);
1631- } 1631- }
1632- else{ 1632- else{
1633- qDrawShadePanel(p, x, y, w, h, g, false, 1, 1633- qDrawShadePanel(p, x, y, w, h, g, false, 1,
1634- &g.brush(QColorGroup::Background)); 1634- &g.brush(QColorGroup::Background));
1635- } 1635- }
1636-
1637-}
1638 1636
1637-}
1638-
1639-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, 1639-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h,
1640- const QColorGroup &g, KToolBarPos, QBrush *) 1640- const QColorGroup &g, KToolBarPos, QBrush *)
1641+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 1641+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1642+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 1642+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
1643 { 1643 {
1644- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1644- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
1645-} 1645-}
1646- 1646-
1647-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, 1647-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h,
1648- const QColorGroup &g, bool sunken, 1648- const QColorGroup &g, bool sunken,
1649- bool raised, bool enabled, bool popup, 1649- bool raised, bool enabled, bool popup,
1650- KToolButtonType icontext, 1650- KToolButtonType icontext,
@@ -1779,54 +1779,100 @@ Features:
1779+ parent->erase(x, y, w, h); 1779+ parent->erase(x, y, w, h);
1780 1780
1781 if(menuHandler->useShadowText()){ 1781 if(menuHandler->useShadowText()){
1782 QColor shadow; 1782 QColor shadow;
1783 if(p->device() && p->device()->devType() == QInternal::Widget && 1783 if(p->device() && p->device()->devType() == QInternal::Widget &&
1784- ((QWidget *)p->device())->inherits("KMenuBar")){ 1784- ((QWidget *)p->device())->inherits("KMenuBar")){
1785- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1785- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1786+ ((QWidget *)p->device())->inherits("QMenuBar")){ 1786+ ((QWidget *)p->device())->inherits("QMenuBar")){
1787+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1787+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1788 g.background().dark(130); 1788 g.background().dark(130);
1789 } 1789 }
1790 else 1790 else
1791@@ -2300,8 +2038,8 @@ 1791 shadow = g.background().dark(130);
1792
1793 + QPixmap *dummy = 0;
1794 +
1795 + if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) {
1796 + dummy = new QPixmap ( mi-> pixmap ( )-> size ( ));
1797 + QBitmap dummy_mask ( dummy-> size ( ));
1798 + dummy_mask. fill ( color1 );
1799 + dummy-> setMask ( dummy_mask );
1800 + }
1801+
1802 if(active){
1803 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
1804 QApplication::style().drawItem(p, x+1, y+1, w, h,
1805 AlignCenter|ShowPrefix|DontClip|SingleLine,
1806- g, mi->isEnabled(), NULL, mi->text(),
1807+ g, mi->isEnabled(), dummy, mi->text(),
1808 -1, &shadow);
1809 QApplication::style().drawItem(p, x, y, w, h,
1810 AlignCenter|ShowPrefix|DontClip|SingleLine,
1811- g, mi->isEnabled(), NULL, mi->text(),
1812+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1813 -1, &g.text());
1814 }
1815 else{
1816 QApplication::style().drawItem(p, x+1, y+1, w, h,
1817 AlignCenter|ShowPrefix|DontClip|SingleLine,
1818- g, mi->isEnabled(), NULL, mi->text(),
1819+ g, mi->isEnabled(), dummy, mi->text(),
1820 -1, &shadow);
1821 QApplication::style().drawItem(p, x, y, w, h,
1822 AlignCenter|ShowPrefix|DontClip|SingleLine,
1823- g, mi->isEnabled(), NULL, mi->text(),
1824+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1825 -1, &g.text());
1826 }
1827+ delete dummy;
1828 }
1829 else{
1830 if(active)
1831 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
1832 QApplication::style().drawItem(p, x, y, w, h,
1833 AlignCenter|ShowPrefix|DontClip|SingleLine,
1834- g, mi->isEnabled(), NULL, mi->text(),
1835+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1836 -1, &g.text());
1837 }
1792 } 1838 }
1793 1839
1794 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 1840 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
1795- const QColorGroup &g, int lineWidth, 1841- const QColorGroup &g, int lineWidth,
1796- const QBrush * fill) 1842- const QBrush * fill)
1797+ const QColorGroup &g, int /*lineWidth*/, 1843+ const QColorGroup &g, int /*lineWidth*/,
1798+ const QBrush * /*fill*/) 1844+ const QBrush * /*fill*/)
1799 { 1845 {
1800 QColor c; 1846 QColor c;
1801 switch(menuHandler->transType()){ 1847 switch(menuHandler->transType()){
1802@@ -2336,8 +2074,6 @@ 1848@@ -2336,8 +2084,6 @@
1803 1849
1804 maxpmw = QMAX( maxpmw, 20 ); 1850 maxpmw = QMAX( maxpmw, 20 );
1805 1851
1806- if ( p->font() == KGlobalSettings::generalFont() ) 1852- if ( p->font() == KGlobalSettings::generalFont() )
1807- p->setFont( KGlobalSettings::menuFont() ); 1853- p->setFont( KGlobalSettings::menuFont() );
1808 1854
1809 bool dis = !enabled; 1855 bool dis = !enabled;
1810 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 1856 QColorGroup itemg = dis ? pal.disabled() : pal.active();
1811@@ -2363,7 +2099,7 @@ 1857@@ -2363,7 +2109,7 @@
1812 p->fillRect(x, y, w, h, menuBrush); 1858 p->fillRect(x, y, w, h, menuBrush);
1813 } 1859 }
1814 else{ 1860 else{
1815- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1861- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1816+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1862+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1817 if(pix) 1863 if(pix)
1818 p->drawPixmap(x, y, *pix, x, y, w, h); 1864 p->drawPixmap(x, y, *pix, x, y, w, h);
1819 } 1865 }
1820@@ -2508,25 +2244,6 @@ 1866@@ -2508,25 +2254,6 @@
1821 return h; 1867 return h;
1822 } 1868 }
1823 1869
1824-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, 1870-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h,
1825- const QColorGroup &g, QBrush *fill) 1871- const QColorGroup &g, QBrush *fill)
1826-{ 1872-{
1827- p->setPen(g.button().dark(130)); 1873- p->setPen(g.button().dark(130));
1828- p->drawRect(x, y, w, h); 1874- p->drawRect(x, y, w, h);
1829- p->setPen(g.button().light(120)); 1875- p->setPen(g.button().light(120));
1830- p->drawRect(x+1, y+1, w-2, h-2); 1876- p->drawRect(x+1, y+1, w-2, h-2);
1831- if(w >= 4 && h >= 4){ 1877- if(w >= 4 && h >= 4){
1832- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1878- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
@@ -1834,25 +1880,25 @@ Features:
1834- int h, s, v; 1880- int h, s, v;
1835- g.button().dark(120).hsv(&h, &s, &v); 1881- g.button().dark(120).hsv(&h, &s, &v);
1836- pix = new QPixmap(*bevelFillPix); 1882- pix = new QPixmap(*bevelFillPix);
1837- adjustHSV(*pix, h, s, v); 1883- adjustHSV(*pix, h, s, v);
1838- bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1884- bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1839- } 1885- }
1840- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1886- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1841- } 1887- }
1842-} 1888-}
1843 1889
1844 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, 1890 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r,
1845 const QColorGroup &g, const QColor *c, 1891 const QColorGroup &g, const QColor *c,
1846@@ -2536,29 +2253,29 @@ 1892@@ -2536,29 +2263,29 @@
1847 if(p->device()->devType() == QInternal::Widget){ 1893 if(p->device()->devType() == QInternal::Widget){
1848 // if so does it use a special focus rectangle? 1894 // if so does it use a special focus rectangle?
1849 QWidget *w = (QWidget *)p->device(); 1895 QWidget *w = (QWidget *)p->device();
1850- if(w->inherits("QPushButton") || w->inherits("QSlider")){ 1896- if(w->inherits("QPushButton") || w->inherits("QSlider")){
1851+ if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ 1897+ if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){
1852 return; 1898 return;
1853 } 1899 }
1854 else{ 1900 else{
1855- KStyle::drawFocusRect(p, r, g, c, atBorder); 1901- KStyle::drawFocusRect(p, r, g, c, atBorder);
1856+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 1902+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
1857 } 1903 }
1858 } 1904 }
@@ -1869,43 +1915,43 @@ Features:
1869+ QWindowsStyle::polishPopupMenu(mnu); 1915+ QWindowsStyle::polishPopupMenu(mnu);
1870 } 1916 }
1871 1917
1872 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, 1918 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
1873 bool selected) 1919 bool selected)
1874 { 1920 {
1875 if(tabBar->shape() != QTabBar::RoundedAbove){ 1921 if(tabBar->shape() != QTabBar::RoundedAbove){
1876- KStyle::drawTab(p, tabBar, tab, selected); 1922- KStyle::drawTab(p, tabBar, tab, selected);
1877+ QWindowsStyle::drawTab(p, tabBar, tab, selected); 1923+ QWindowsStyle::drawTab(p, tabBar, tab, selected);
1878 return; 1924 return;
1879 } 1925 }
1880 QPixmap tilePix; 1926 QPixmap tilePix;
1881@@ -2671,7 +2388,7 @@ 1927@@ -2671,7 +2398,7 @@
1882 vFrame = 8; // was 10 1928 vFrame = 8; // was 10
1883 } 1929 }
1884 else 1930 else
1885- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1931- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1886+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1932+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1887 } 1933 }
1888 1934
1889 1935
1890@@ -2699,7 +2416,7 @@ 1936@@ -2699,7 +2426,7 @@
1891 p->drawLine(x+1, y+1, x+1, y2-1); 1937 p->drawLine(x+1, y+1, x+1, y2-1);
1892 } 1938 }
1893 else if(lineWidth != 2 || !sunken) 1939 else if(lineWidth != 2 || !sunken)
1894- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1940- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1895+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1941+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1896 else{ 1942 else{
1897 QPen oldPen = p->pen(); 1943 QPen oldPen = p->pen();
1898 int x2 = x+w-1; 1944 int x2 = x+w-1;
1899@@ -2726,105 +2443,6 @@ 1945@@ -2726,105 +2453,6 @@
1900 } 1946 }
1901 } 1947 }
1902 1948
1903-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, 1949-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h,
1904- const QColorGroup &g, QBrush *) 1950- const QColorGroup &g, QBrush *)
1905-{ 1951-{
1906- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1952- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
1907- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? 1953- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ?
1908- g.button().light(120) : g.button(), g.button()); 1954- g.button().light(120) : g.button(), g.button());
1909- /* 1955- /*
1910- if(h > w){ 1956- if(h > w){
1911- int y2 = y+h-1; 1957- int y2 = y+h-1;
@@ -1993,25 +2039,25 @@ Features:
1993- } 2039- }
1994- 2040-
1995- p->setPen(g.buttonText()); 2041- p->setPen(g.buttonText());
1996- 2042-
1997- p->drawText(br.x()+ textPos, -1, w-textPos, h, 2043- p->drawText(br.x()+ textPos, -1, w-textPos, h,
1998- AlignLeft|AlignVCenter, s); 2044- AlignLeft|AlignVCenter, s);
1999- } 2045- }
2000- 2046-
2001-} 2047-}
2002 2048
2003 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) 2049 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v)
2004 { 2050 {
2005@@ -2988,110 +2606,5 @@ 2051@@ -2988,110 +2616,5 @@
2006 } 2052 }
2007 } 2053 }
2008 2054
2009-// I'm debating if to use QValueList or QList here. I like QValueList better, 2055-// I'm debating if to use QValueList or QList here. I like QValueList better,
2010-// but QList handles pointers which is good for a lot of empty icons... 2056-// but QList handles pointers which is good for a lot of empty icons...
2011- 2057-
2012-void LiquidStyle::loadCustomButtons() 2058-void LiquidStyle::loadCustomButtons()
2013-{ 2059-{
2014- return; // TODO 2060- return; // TODO
2015- customBtnColorList.clear(); 2061- customBtnColorList.clear();
2016- customBtnIconList.clear(); 2062- customBtnIconList.clear();
2017- customBtnLabelList.clear(); 2063- customBtnLabelList.clear();
@@ -2104,87 +2150,87 @@ Features:
2104- } 2150- }
2105- } 2151- }
2106-} 2152-}
2107- 2153-
2108-#include "liquid.moc" 2154-#include "liquid.moc"
2109- 2155-
2110- 2156-
2111- 2157-
2112- 2158-
2113- 2159-
2114 2160
2115 /* vim: set noet sw=8 ts=8: */ 2161 /* vim: set noet sw=8 ts=8: */
2116 --- -2002-11-18 04:47:41.000000000 +0100 2162 --- -2002-11-21 20:45:47.000000000 +0100
2117 +++ plugin.cpp2002-11-18 03:54:56.000000000 +0100 2163 +++ plugin.cpp2002-11-18 18:11:41.000000000 +0100
2118@@ -1,29 +1,79 @@ 2164@@ -1,29 +1,84 @@
2119+#include <qapplication.h> 2165+#include <qapplication.h>
2120+ 2166+
2121 #include "liquid.h" 2167 #include "liquid.h"
2122-#include <klocale.h> 2168-#include <klocale.h>
2123+#include "liquidset.h" 2169+#include "liquidset.h"
2124+#include "plugin.h" 2170+#include "plugin.h"
2125+ 2171+
2126+ 2172+
2127+ 2173+
2128+LiquidInterface::LiquidInterface ( ) : ref ( 0 ) 2174+LiquidInterface::LiquidInterface ( ) : ref ( 0 )
2129+{ 2175+{
2130 +m_widget = 0; 2176 +m_widget = 0;
2131+} 2177+}
2178+
2179+LiquidInterface::~LiquidInterface ( )
2180+{
2181+}
2182+
2183+QStyle *LiquidInterface::style ( )
2184+{
2185 +return new LiquidStyle ( );
2186+}
2132 2187
2133-extern "C" { 2188-extern "C" {
2134- KStyle* allocate(); 2189- KStyle* allocate();
2135- int minor_version(); 2190- int minor_version();
2136- int major_version(); 2191- int major_version();
2137- const char *description(); 2192- const char *description();
2138+LiquidInterface::~LiquidInterface ( ) 2193+QString LiquidInterface::name ( ) const
2139+{ 2194+{
2195 +return qApp-> translate ( "Styles", "Liquid" );
2140 } 2196 }
2141 2197
2142-KStyle* allocate() 2198-KStyle* allocate()
2143+QStyle *LiquidInterface::style ( ) 2199+QString LiquidInterface::description ( ) const
2144 { 2200 {
2145- return(new LiquidStyle); 2201- return(new LiquidStyle);
2146 +return new LiquidStyle ( ); 2202 +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" );
2147 } 2203 }
2148 2204
2149-int minor_version() 2205-int minor_version()
2150+QString LiquidInterface::name ( ) const 2206+bool LiquidInterface::hasSettings ( ) const
2151 { 2207 {
2152- return(0); 2208- return(0);
2153 +return qApp-> translate ( "Styles", "Liquid" ); 2209 +return true;
2154 } 2210 }
2155 2211
2156-int major_version() 2212-int major_version()
2157+QString LiquidInterface::description ( ) const 2213+QWidget *LiquidInterface::create ( QWidget *parent, const char *name )
2158 { 2214 {
2159- return(1); 2215- return(1);
2160 +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); 2216 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" );
2217 +
2218 +return m_widget;
2161 } 2219 }
2162 2220
2163-const char *description() 2221-const char *description()
2164+bool LiquidInterface::hasSettings ( ) const 2222+bool LiquidInterface::accept ( )
2165 { 2223 {
2166- return(i18n("High performance liquid plugin").utf8()); 2224- return(i18n("High performance liquid plugin").utf8());
2167 +return true;
2168+}
2169+
2170+QWidget *LiquidInterface::create ( QWidget *parent, const char *name )
2171+{
2172 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" );
2173 +
2174 +return m_widget;
2175+}
2176+
2177+bool LiquidInterface::accept ( )
2178+{
2179 +if ( !m_widget ) 2225 +if ( !m_widget )
2180 + return false; 2226 + return false;
2181+ 2227+
2182 +return m_widget-> writeConfig ( ); 2228 +return m_widget-> writeConfig ( );
2183 } 2229 }
2184+ 2230+
2185+void LiquidInterface::reject ( ) 2231+void LiquidInterface::reject ( )
2186+{ 2232+{
2187+} 2233+}
2188+ 2234+
2189+ 2235+
2190+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 2236+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
@@ -2200,12 +2246,17 @@ Features:
2200 + 2246 +
2201 +if ( *iface ) 2247 +if ( *iface )
2202 + (*iface)-> addRef ( ); 2248 + (*iface)-> addRef ( );
2203 + 2249 +
2204 +return QS_OK; 2250 +return QS_OK;
2205+} 2251+}
2206+ 2252+
2207+Q_EXPORT_INTERFACE() 2253+Q_EXPORT_INTERFACE()
2208+{ 2254+{
2209 +Q_CREATE_INSTANCE( LiquidInterface ) 2255 +Q_CREATE_INSTANCE( LiquidInterface )
2210+} 2256+}
2211+ 2257+
2258+
2259+// For Sharp ROM
2260+
2261+extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } }
2262+extern "C" { void drawmenubaritem ( QStyle *sty, QPainter *p, int x, int y, int w, int h, QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) { return ((LiquidStyle *) sty )-> drawMenuBarItem ( p, x, y, w, h, mi, g, enabled, active ); } }