author | sandman <sandman> | 2002-10-24 01:21:24 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-24 01:21:24 (UTC) |
commit | f09549e37fee6decd56168043209e8051b8757fb (patch) (side-by-side diff) | |
tree | cfcfc40bfca40df380489829ab5b88cff91d1fee | |
parent | 36e13db0a1d44abd5a160a34e4679b90d62826c7 (diff) | |
download | opie-f09549e37fee6decd56168043209e8051b8757fb.zip opie-f09549e37fee6decd56168043209e8051b8757fb.tar.gz opie-f09549e37fee6decd56168043209e8051b8757fb.tar.bz2 |
- "what's this" widget drop shadows are drawn correctly now
- updated the QPL diff
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 8 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 365 |
2 files changed, 225 insertions, 148 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index eb1ec6e..6812d16 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -845,3 +845,5 @@ void LiquidStyle::polish(QWidget *w) w->setBackgroundMode(QWidget::NoBackground); - else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { + else if(w-> testWFlags(Qt::WType_Popup) && + !w->inherits("QListBox") && + ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { w->installEventFilter(menuHandler); @@ -946,3 +948,5 @@ void LiquidStyle::unPolish(QWidget *w) w->setBackgroundMode(QWidget::PaletteButton); - else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { + else if(w-> testWFlags(Qt::WType_Popup) && + !w->inherits("QListBox") && + ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { w->removeEventFilter(menuHandler); diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff index 90ece90..f3531e5 100644 --- a/noncore/styles/liquid/opie-liquid.diff +++ b/noncore/styles/liquid/opie-liquid.diff @@ -5,4 +5,4 @@ Features: ---- - Sat Sep 21 05:31:47 2002 -+++ liquid.h Mon Jul 15 02:52:50 2002 +--- - 2002-10-24 03:19:30.000000000 +0200 ++++ liquid.h 2002-07-15 02:52:50.000000000 +0200 @@ -2,7 +2,7 @@ @@ -112,4 +112,4 @@ Features: QWidget *highlightWidget; ---- - Sat Sep 21 05:31:48 2002 -+++ liquid.cpp Sat Sep 21 05:18:54 2002 +--- - 2002-10-24 03:19:31.000000000 +0200 ++++ liquid.cpp 2002-10-24 03:18:15.000000000 +0200 @@ -10,12 +10,10 @@ @@ -124,3 +124,3 @@ Features: -#include <kpixmapeffect.h> -+#include "liquiddeco.h" ++//#include "liquiddeco.h" +#include <qapplication.h> @@ -148,2 +148,3 @@ Features: +#include <qmenubar.h> ++#include <qprogressbar.h> @@ -151,3 +152,2 @@ Features: -#include <X11/Xlib.h> -+ +#include <stdio.h> @@ -231,3 +231,3 @@ Features: else{ // tear off menu -@@ -121,82 +122,55 @@ +@@ -121,82 +122,53 @@ stripePixmap(*pix, p->colorGroup().button()); @@ -241,3 +241,3 @@ Features: + -+ if (!p->inherits("QPopupMenu")) { ++ if ( !p->inherits("QPopupMenu")) + p->setBackgroundPixmap(*pix); @@ -252,3 +252,2 @@ Features: + delete ol; -+ } } @@ -287,3 +286,3 @@ Features: + pixDict.remove(p->winId()); -+ if (!p->inherits("QPopupMenu")) { ++ if ( !p->inherits("QPopupMenu")) + p->setBackgroundMode(QWidget::PaletteBackground); @@ -302,6 +301,7 @@ Features: - w->repaint(); -- } -- } + wid-> setBackgroundMode( QWidget::PaletteBackground ); } ++ delete ol; + } + } - } @@ -325,7 +325,6 @@ Features: - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); -+ delete ol; - } - } +- } +- } - - } +- } + return(false); @@ -345,3 +344,3 @@ Features: htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); -@@ -711,7 +685,6 @@ +@@ -711,7 +683,6 @@ @@ -353,3 +352,3 @@ Features: if(pixmaps[i]){ -@@ -730,20 +703,29 @@ +@@ -730,20 +701,29 @@ } @@ -390,3 +389,3 @@ Features: appPal.setBrush(QColorGroup::Button, btnBrush); -@@ -794,15 +776,7 @@ +@@ -794,15 +774,7 @@ pagerBrush.setPixmap(*pix); @@ -407,3 +406,3 @@ Features: -@@ -817,21 +791,18 @@ +@@ -817,21 +789,18 @@ wallPaper.fill(c.rgb()); @@ -432,3 +431,3 @@ Features: basePix.fill(c.rgb()); -@@ -856,52 +827,39 @@ +@@ -856,52 +825,37 @@ applyCustomAttributes((QPushButton *)w); @@ -458,3 +457,5 @@ Features: w->setBackgroundMode(QWidget::NoBackground); -+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { ++ else if(w-> testWFlags(Qt::WType_Popup) && ++ !w->inherits("QListBox") && ++ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { + w->installEventFilter(menuHandler); @@ -488,8 +489,5 @@ Features: - } -+ -+ -+ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) -+ w-> setBackgroundOrigin ( QWidget::ParentOrigin ); - if(w->inherits("QComboBox") || +- if(w->inherits("QComboBox") || ++ if(w->inherits("QComboBox") || w->inherits("QProgressBar") || w->inherits("QLineEdit") || w->inherits("QRadioButton") || @@ -502,3 +500,3 @@ Features: if(w->inherits("QLineEdit")){ -@@ -913,6 +871,9 @@ +@@ -913,6 +867,10 @@ applyCustomAttributes((QPushButton *)w); @@ -508,2 +506,3 @@ Features: + w-> setBackgroundMode ( QWidget::PaletteBackground ); ++ w->setBackgroundOrigin ( QWidget::ParentOrigin); + } @@ -512,3 +511,3 @@ Features: qstrcmp(w->name(), "qt_clipped_viewport") == 0; -@@ -942,11 +903,14 @@ +@@ -942,11 +900,17 @@ w->setMouseTracking(true); @@ -521,2 +520,5 @@ Features: + } ++ if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { ++ ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); ++ } if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ @@ -529,3 +531,3 @@ Features: palette().active().brush(QColorGroup::Background).pixmap()){ -@@ -954,17 +918,13 @@ +@@ -954,16 +918,21 @@ return; @@ -537,3 +539,6 @@ Features: w->backgroundMode() == QWidget::PaletteButton){ - w->setBackgroundMode(QWidget::X11ParentRelative); +- w->setBackgroundMode(QWidget::X11ParentRelative); ++ w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); ++ w->setBackgroundOrigin(QWidget::ParentOrigin); ++// w->setBackgroundMode(QWidget::NoBackground); } @@ -544,8 +549,13 @@ Features: - return; -- } ++ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) ++ w-> setBackgroundOrigin ( QWidget::ParentOrigin ); ++ else if ( w-> inherits("QFrame") ) ++ w->setBackgroundOrigin ( QWidget::WidgetOrigin ); + ++ if ( w->parentWidget()->inherits ( "QWidgetStack" )) { ++ w->setBackgroundOrigin ( QWidget::WidgetOrigin ); + } } - void LiquidStyle::unPolish(QWidget *w) -@@ -977,6 +937,9 @@ +@@ -977,6 +946,11 @@ @@ -553,3 +563,5 @@ Features: w->setBackgroundMode(QWidget::PaletteButton); -+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { ++ else if(w-> testWFlags(Qt::WType_Popup) && ++ !w->inherits("QListBox") && ++ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { + w->removeEventFilter(menuHandler); @@ -559,3 +571,3 @@ Features: return; -@@ -986,7 +949,7 @@ +@@ -986,7 +960,7 @@ ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || @@ -568,3 +580,3 @@ Features: w->setBackgroundMode(QWidget::PaletteButton); -@@ -1001,12 +964,14 @@ +@@ -1001,12 +975,14 @@ unapplyCustomAttributes((QPushButton *)w); @@ -587,3 +599,3 @@ Features: if(w->inherits("QButton") || w->inherits("QComboBox")){ -@@ -1014,9 +979,9 @@ +@@ -1014,9 +990,9 @@ w->setAutoMask(false); @@ -599,3 +611,3 @@ Features: if(w->inherits("QHeader")){ -@@ -1028,20 +993,34 @@ +@@ -1028,22 +1004,98 @@ void LiquidStyle::polish(QApplication *app) @@ -635,4 +647,68 @@ Features: ++ ++/* !! HACK !! Beware ++ * ++ * TT forgot to make the QProgressBar widget styleable in Qt 2.x ++ * So the only way to customize the drawing, is to intercept the ++ * paint event - since we have to use protected functions, we need ++ * to derive a "hack" class from QProgressBar and do the painting ++ * in there. ++ * ++ * - sandman ++ */ ++ ++class HackProgressBar : public QProgressBar { ++public: ++ HackProgressBar ( ); ++ ++ void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) ++ { ++ QPainter p( this ); ++ ++ if ( !contentsRect().contains( event->rect() ) ) { ++ p.save(); ++ p.setClipRegion( event->region().intersect(frameRect()) ); ++ drawFrame( &p); ++ p.restore(); ++ } ++ if ( event->rect().intersects( contentsRect() )) { ++ p.setClipRegion( event->region().intersect( contentsRect() ) ); ++ ++ int x, y, w, h; ++ contentsRect ( ). rect ( &x, &y, &w, &h ); ++ ++ int prog = progress ( ); ++ int total = totalSteps ( ); ++ if ( prog < 0 ) ++ prog = 0; ++ if ( total <= 0 ) ++ total = 1; ++ int bw = w * prog / total; ++ if ( bw > w ) ++ bw = w; ++ ++ p.setPen(g.button().dark(130)); ++ p.drawRect(x, y, bw, h); ++ p.setPen(g.button().light(120)); ++ p.drawRect(x+1, y+1, bw-2, h-2); ++ ++ if(bw >= 4 && h >= 4 && pix) ++ p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); ++ ++ if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { ++ QString pstr; ++ pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); ++ p. setPen ( g.text());//g.highlightedText ( )); ++ p. drawText (x,y,w-1,h-1,AlignCenter,pstr); ++ } ++ } ++ } ++}; ++ ++ ++ /* -@@ -1063,7 +1042,7 @@ + * This is a fun method ;-) Here's an overview. KToolBar grabs resize to + * force everything to erase and repaint on resize. This is going away, I'm +@@ -1063,7 +1115,7 @@ */ @@ -645,3 +721,3 @@ Features: QObjectListIt it(*tbChildList); -@@ -1076,35 +1055,7 @@ +@@ -1076,35 +1128,7 @@ @@ -682,3 +758,3 @@ Features: if(btn->isEnabled()){ -@@ -1119,20 +1070,7 @@ +@@ -1119,20 +1143,7 @@ } @@ -704,3 +780,29 @@ Features: if(btn->isEnabled()){ -@@ -1340,11 +1278,6 @@ +@@ -1290,7 +1301,24 @@ + } + } + } +- return(false); ++ else if (obj-> inherits( "QProgressBar" )) { ++ if ( ev->type() == QEvent::Paint ) { ++ HackProgressBar *p = (HackProgressBar *) obj; ++ const QColorGroup &g = p-> colorGroup ( ); ++ ++ QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); ++ if(!pix){ ++ int h, s, v; ++ g.button().dark(120).hsv(&h, &s, &v); ++ pix = new QPixmap(*bevelFillPix); ++ adjustHSV(*pix, h, s, v); ++ bevelFillDict.insert(g.button().dark(120).rgb(), pix); ++ } ++ p-> paint ((QPaintEvent *) ev, g, pix ); ++ return true; ++ } ++ } ++ return false ; + } + + void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, +@@ -1340,11 +1368,6 @@ QColorGroup g = btn->colorGroup(); @@ -716,3 +818,3 @@ Features: QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); -@@ -1596,7 +1529,7 @@ +@@ -1596,7 +1619,7 @@ if(sbBuffer.size() != sb->size()) @@ -725,3 +827,3 @@ Features: subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); -@@ -1624,7 +1557,7 @@ +@@ -1624,7 +1647,7 @@ QPainter painter; @@ -734,3 +836,3 @@ Features: 13, 8); -@@ -1690,7 +1623,7 @@ +@@ -1690,7 +1713,7 @@ } @@ -743,3 +845,3 @@ Features: 8, 13); -@@ -1761,10 +1694,10 @@ +@@ -1761,10 +1784,10 @@ addB.width()-8, addB.height()-8, g, !maxed); @@ -758,3 +860,3 @@ Features: false, subHC.x()+4, subHC.y()+4, -@@ -1865,8 +1798,8 @@ +@@ -1865,8 +1888,8 @@ else @@ -769,3 +871,3 @@ Features: sliderLength = maxLength; -@@ -1914,8 +1847,8 @@ +@@ -1914,8 +1937,8 @@ return(QSize(16, 16)); @@ -780,3 +882,3 @@ Features: bool isHover = highlightWidget == p->device(); -@@ -1957,8 +1890,8 @@ +@@ -1957,8 +1980,8 @@ return(QSize(20, 22)); @@ -791,3 +893,3 @@ Features: bool isMasked = p->device() && p->device()->devType() == QInternal::Widget -@@ -1996,8 +1929,8 @@ +@@ -1996,8 +2019,8 @@ } @@ -802,3 +904,3 @@ Features: p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); -@@ -2005,18 +1938,17 @@ +@@ -2005,18 +2028,17 @@ } @@ -824,3 +926,3 @@ Features: p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : -@@ -2065,203 +1997,26 @@ +@@ -2065,203 +2087,26 @@ p->drawLineSegments(a); @@ -846,3 +948,3 @@ Features: - -- + - @@ -863,3 +965,5 @@ Features: - const QColorGroup &g, bool mac, QBrush *) --{ ++void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, ++ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) + { - if(p->device() && p->device()->devType() == QInternal::Widget && @@ -887,8 +991,6 @@ Features: -} - +- -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, KToolBarPos, QBrush *) -+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, -+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) - { +-{ - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); @@ -1040,3 +1142,3 @@ Features: else -@@ -2300,8 +2055,8 @@ +@@ -2300,8 +2145,8 @@ } @@ -1051,3 +1153,3 @@ Features: switch(menuHandler->transType()){ -@@ -2336,8 +2091,6 @@ +@@ -2336,8 +2181,6 @@ @@ -1060,3 +1162,3 @@ Features: QColorGroup itemg = dis ? pal.disabled() : pal.active(); -@@ -2363,7 +2116,7 @@ +@@ -2363,7 +2206,7 @@ p->fillRect(x, y, w, h, menuBrush); @@ -1069,3 +1171,3 @@ Features: } -@@ -2508,25 +2261,6 @@ +@@ -2508,25 +2351,6 @@ return h; @@ -1095,3 +1197,3 @@ Features: const QColorGroup &g, const QColor *c, -@@ -2540,25 +2274,25 @@ +@@ -2540,25 +2364,25 @@ return; @@ -1125,3 +1227,3 @@ Features: QPixmap tilePix; -@@ -2671,7 +2405,7 @@ +@@ -2671,7 +2495,7 @@ vFrame = 8; // was 10 @@ -1134,3 +1236,3 @@ Features: -@@ -2699,7 +2433,7 @@ +@@ -2699,7 +2523,7 @@ p->drawLine(x+1, y+1, x+1, y2-1); @@ -1143,3 +1245,3 @@ Features: int x2 = x+w-1; -@@ -2726,105 +2460,6 @@ +@@ -2726,105 +2550,6 @@ } @@ -1249,3 +1351,3 @@ Features: { -@@ -2998,22 +2633,22 @@ +@@ -2998,22 +2723,22 @@ customBtnIconList.clear(); @@ -1279,3 +1381,3 @@ Features: c->setNamedColor(QString(colorStr)); -@@ -3022,7 +2657,7 @@ +@@ -3022,7 +2747,7 @@ QString tmpStr(iconStr); @@ -1288,3 +1390,3 @@ Features: customBtnIconList.append(NULL); -@@ -3037,7 +2672,6 @@ +@@ -3037,7 +2762,6 @@ colorStr = colorList.next(); @@ -1296,3 +1398,3 @@ Features: void LiquidStyle::applyCustomAttributes(QPushButton *btn) -@@ -3087,7 +2721,7 @@ +@@ -3087,7 +2811,7 @@ } @@ -1305,5 +1407,7 @@ Features: ---- - Sat Sep 21 05:31:48 2002 -+++ plugin.cpp Mon Jul 8 02:42:56 2002 -@@ -1,29 +1,113 @@ +--- - 2002-10-24 03:19:31.000000000 +0200 ++++ plugin.cpp 2002-10-04 03:37:38.000000000 +0200 +@@ -1,29 +1,84 @@ ++#include <qapplication.h> ++ #include "liquid.h" @@ -1312,8 +1416,3 @@ Features: +#include "plugin.h" - --extern "C" { -- KStyle* allocate(); -- int minor_version(); -- int major_version(); -- const char *description(); ++ + @@ -1322,2 +1421,3 @@ Features: +{ ++ m_widget = 0; +} @@ -1328,3 +1428,3 @@ Features: + -+QStyle *LiquidInterface::create ( ) ++QStyle *LiquidInterface::style ( ) +{ @@ -1333,5 +1433,27 @@ Features: + -+QString LiquidInterface::name ( ) ++QString LiquidInterface::name ( ) const ++{ ++ return qApp-> translate ( "Styles", "Liquid" ); ++} ++ ++QString LiquidInterface::description ( ) const +{ -+ return QObject::tr( "Liquid", "name" ); ++ return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); ++} ++ ++bool LiquidInterface::hasSettings ( ) const ++{ ++ return true; ++} ++ ++QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) ++{ ++ m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); + +-extern "C" { +- KStyle* allocate(); +- int minor_version(); +- int major_version(); +- const char *description(); ++ return m_widget; } @@ -1339,6 +1461,9 @@ Features: -KStyle* allocate() -+QString LiquidInterface::description ( ) ++bool LiquidInterface::accept ( ) { - return(new LiquidStyle); -+ return QObject::tr( "High Performance Liquid style by Mosfet", "description" ); ++ if ( !m_widget ) ++ return false; ++ ++ return m_widget-> writeConfig ( ); } @@ -1346,6 +1471,5 @@ Features: -int minor_version() -+QCString LiquidInterface::key ( ) ++void LiquidInterface::reject ( ) { - return(0); -+ return QCString ( "liquid" ); } @@ -1353,13 +1477,6 @@ Features: -int major_version() -+unsigned int LiquidInterface::version ( ) ++ ++QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { - return(1); -+ return 100; // 1.0.0 (\d+.\d.\d) - } - --const char *description() -+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) -+{ -+ static LiquidSettingsInterface *setiface = 0; -+ + *iface = 0; @@ -1370,7 +1487,4 @@ Features: + *iface = this; -+ else if ( uuid == IID_StyleSettings ) { -+ if ( !setiface ) -+ setiface = new LiquidSettingsInterface ( ); -+ *iface = setiface; -+ } ++ else if ( uuid == IID_StyleExtended ) ++ *iface = this; + @@ -1380,54 +1494,13 @@ Features: + return QS_OK; -+} -+ + } + +-const char *description() +Q_EXPORT_INTERFACE() -+{ -+ Q_CREATE_INSTANCE( LiquidInterface ) -+} -+ -+ -+LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) { - return(i18n("High performance liquid plugin").utf8()); -+ m_widget = 0; ++ Q_CREATE_INSTANCE( LiquidInterface ) } + -+LiquidSettingsInterface::~LiquidSettingsInterface ( ) -+{ -+} -+ -+QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) -+{ -+ m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); -+ -+ return m_widget; -+} -+ -+bool LiquidSettingsInterface::accept ( ) -+{ -+ if ( !m_widget ) -+ return false; -+ -+ return m_widget-> writeConfig ( ); -+} -+ -+void LiquidSettingsInterface::reject ( ) -+{ -+} -+ -+QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) -+{ -+ *iface = 0; + + -+ if ( uuid == IID_QUnknown ) -+ *iface = this; -+ else if ( uuid == IID_StyleSettings ) -+ *iface = this; -+ -+ if ( *iface ) -+ (*iface)-> addRef ( ); -+ -+ return QS_OK; -+} + |