-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 4a65952..bac882c 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -147,61 +147,55 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) } } else if(ev->type() == QEvent::Hide){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); pixDict.remove(p->winId()); if ( !p->inherits("QPopupMenu")) p->setBackgroundMode(QWidget::PaletteBackground); QObjectList *ol = p-> queryList("QWidget"); for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); wid-> setBackgroundMode( QWidget::PaletteBackground ); } delete ol; } } return(false); } -static int qt_version ( ) -{ - const char *qver = qVersion ( ); - return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); -} LiquidStyle::LiquidStyle() :QWindowsStyle() { setName ( "LiquidStyle" ); - oldqte = ( qt_version ( ) < 234 ); flatTBButtons = false; currentHeader = 0; btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); btnMaskBmp.setMask(btnMaskBmp); htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); headerHoverID = -1; highlightWidget = NULL; setButtonDefaultIndicatorWidth(0); btnDict.setAutoDelete(true); bevelFillDict.setAutoDelete(true); smallBevelFillDict.setAutoDelete(true); rMatrix.rotate(270.0); btnBorderPix = new QPixmap; btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); btnBlendPix = new QPixmap; btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); bevelFillPix = new QPixmap; bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); smallBevelFillPix = new QPixmap; smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); // new stuff @@ -686,52 +680,50 @@ void LiquidStyle::polish(QPalette &appPal) for(i=0; i < BITMAP_ITEMS; ++i){ if(pixmaps[i]){ delete pixmaps[i]; pixmaps[i] = NULL; } } lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; btnDict.clear(); btnBorderDict.clear(); bevelFillDict.clear(); smallBevelFillDict.clear(); Config config ( "qpe" ); config. setGroup ( "Liquid-Style" ); int contrast = config. readNumEntry ( "StippleContrast", 5 ); if ( contrast < 0 ) contrast = 0; else if ( contrast > 10 ) contrast = 10; // QPalette pal = QApplication::palette(); // button color stuff config. setGroup ( "Appearance" ); - QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) - : appPal. color ( QPalette::Active, QColorGroup::Button ); - if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) - : appPal. color ( QPalette::Active, QColorGroup::Background ))) { + QColor c = appPal. color ( QPalette::Active, QColorGroup::Button ); + if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )) { // force button color to be different from background QBrush btnBrush(QColor(200, 202, 228)); appPal.setBrush(QColorGroup::Button, btnBrush); } c.hsv(&btnH, &btnS, &btnV); c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); // menu pixmap if(!menuPix){ menuPix = new QPixmap; menuPix->resize(64, 64); } QPainter painter; menuPix->fill(c.rgb()); painter.begin(menuPix); painter.setPen(c.dark(105)); for(i=0; i < 63; i+=4){ painter.drawLine(0, i, 63, i); painter.drawLine(0, i+1, 63, i+1); }; painter.end(); menuBrush.setColor(c); menuBrush.setPixmap(*menuPix); @@ -740,50 +732,49 @@ void LiquidStyle::polish(QPalette &appPal) QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) if(!pix){ int h, s, v; c.hsv(&h, &s, &v); pix = new QPixmap(*smallBevelFillPix); adjustHSV(*pix, h, s, v); smallBevelFillDict.insert(c.rgb(), pix); } // pagerHoverBrush.setColor(c); // pagerHoverBrush.setPixmap(*pix); c = c.dark(120); pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) if(!pix){ int h, s, v; c.hsv(&h, &s, &v); pix = new QPixmap(*smallBevelFillPix); adjustHSV(*pix, h, s, v); smallBevelFillDict.insert(c.rgb(), pix); } // pagerBrush.setColor(c); // pagerBrush.setPixmap(*pix); // background color stuff - c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) - : appPal. color ( QPalette::Active, QColorGroup::Background ); + c = appPal. color ( QPalette::Active, QColorGroup::Background ); c.hsv(&bH, &bS, &bV); c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); // FIXME? if(vsbSliderFillPix) delete vsbSliderFillPix; vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); adjustHSV(*vsbSliderFillPix, bH, bS, bV); // background brush QPixmap wallPaper(32, 32); wallPaper.fill(c.rgb()); painter.begin(&wallPaper); for(i=0; i < 32; i+=4){ painter.setPen(c.dark(100 + contrast)); painter.drawLine(0, i, 32, i); painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); painter.drawLine(0, i+1, 32, i+1); }; painter.end(); bgBrush.setColor(c); bgBrush.setPixmap(wallPaper); appPal.setBrush(QColorGroup::Background, bgBrush); |