-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 14 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.cpp | 2 |
2 files changed, 3 insertions, 13 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 4653639..2b6eaa4 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -115,105 +115,96 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) pix->fill(Qt::black.rgb()); } if(type == TransStippleBg){ stripePixmap(*pix, p->colorGroup().background()); } else if(type == TransStippleBtn){ stripePixmap(*pix, p->colorGroup().button()); } else{ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); } if (p->inherits("QPopupMenu")) pixDict.insert(p->winId(), pix); else { p->setBackgroundPixmap(*pix); QObjectList *ol = p-> queryList("QWidget"); for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { QWidget *wid = (QWidget *) it.current ( ); wid-> setBackgroundPixmap(*pix); wid-> setBackgroundOrigin(QWidget::ParentOrigin); } delete ol; } } } else if(ev->type() == QEvent::Hide){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); if (p->inherits("QPopupMenu")) pixDict.remove(p->winId()); else { 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; } } } - else if(ev->type() == QEvent::Paint){ - if(type == TransStippleBg || type == TransStippleBtn || - type == Custom){ -// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); - - if (!p->inherits("QPopupMenu")) - p->erase(); - } - } return(false); } LiquidStyle::LiquidStyle() :QWindowsStyle() { setName ( "LiquidStyle" ); 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); customBtnColorList.setAutoDelete(true); customBtnIconList.setAutoDelete(true); customBtnLabelList.setAutoDelete(true); rMatrix.rotate(270.0); highcolor = QPixmap::defaultDepth() > 8; 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 vsbSliderFillPix = menuPix = NULL; menuHandler = new TransMenuHandler(this); setScrollBarExtent(15, 15); int i; for(i=0; i < BITMAP_ITEMS; ++i){ pixmaps[i] = NULL; } oldSliderThickness = sliderThickness(); setSliderThickness(11); } LiquidStyle::~LiquidStyle() { if(btnBorderPix) @@ -792,192 +783,191 @@ void LiquidStyle::polish(QPalette &appPal) painter.setPen(c.dark(105)); painter.drawLine(0, i, 32, i); painter.setPen(c.dark(103)); painter.drawLine(0, i+1, 32, i+1); }; painter.end(); bgBrush.setColor(c); bgBrush.setPixmap(wallPaper); appPal.setBrush(QColorGroup::Background, bgBrush); // lineedits c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); QPixmap basePix; basePix.resize(32, 32); basePix.fill(c.rgb()); painter.begin(&basePix); painter.setPen(c.dark(105)); for(i=0; i < 32; i+=4){ painter.drawLine(0, i, 32, i); painter.drawLine(0, i+1, 32, i+1); }; painter.end(); baseBrush.setColor(c); baseBrush.setPixmap(basePix); it.toFirst(); while ((w=it.current()) != 0 ){ ++it; if(w->inherits("QLineEdit")){ QPalette pal = w->palette(); pal.setBrush(QColorGroup::Base, baseBrush); w->setPalette(pal); } else if(w->inherits("QPushButton")){ applyCustomAttributes((QPushButton *)w); } } } void LiquidStyle::polish(QWidget *w) { if(w->inherits("QMenuBar")){ //((QFrame*)w)->setLineWidth(0); w->setBackgroundMode(QWidget::PaletteBackground); return; } if(w->inherits("QPopupMenu")) w->setBackgroundMode(QWidget::NoBackground); - else if(w-> testWFlags(Qt::WType_Popup)) { - printf("install popup: %s\n", w-> className ( )); + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { w->installEventFilter(menuHandler); } if(w->isTopLevel()){ return; } w-> setBackgroundOrigin ( QWidget::ParentOrigin ); if(w->inherits("QComboBox") || w->inherits("QLineEdit") || w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QScrollBar")) { w->installEventFilter(this); } if(w->inherits("QLineEdit")){ QPalette pal = w->palette(); pal.setBrush(QColorGroup::Base, baseBrush); w->setPalette(pal); } if(w->inherits("QPushButton")){ applyCustomAttributes((QPushButton *)w); w->installEventFilter(this); } if(w->inherits("QButton") || w-> inherits("QComboBox")){ w-> setBackgroundMode ( QWidget::PaletteBackground ); } bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || qstrcmp(w->name(), "qt_clipped_viewport") == 0; bool isViewportChild = w->parent() && ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ w->setBackgroundMode(QWidget::X11ParentRelative); return; } if(isViewportChild){ if(w->inherits("QButton") || w->inherits("QComboBox")){ if(w->parent()){ // heh, only way to test for KHTML children ;-) if(w->parent()->parent()){ if(w->parent()->parent()->parent() && w->parent()->parent()->parent()->inherits("KHTMLView")){ w->setAutoMask(true); w->setBackgroundMode(QWidget::NoBackground); } } } return; } } if(w->inherits("QHeader")){ w->setMouseTracking(true); w->installEventFilter(this); } if(w-> inherits("QToolButton")) { ((QToolButton*)w)->setAutoRaise (false); } if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ return; } if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> palette().active().brush(QColorGroup::Background).pixmap()){ qWarning("No parent pixmap for child widget %s", w->className()); return; } if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { if(w->backgroundMode() == QWidget::PaletteBackground || w->backgroundMode() == QWidget::PaletteButton){ w->setBackgroundMode(QWidget::X11ParentRelative); } } if(w->inherits("QToolBar")){ w->installEventFilter(this); w->setBackgroundMode(QWidget::PaletteBackground); return; } } void LiquidStyle::unPolish(QWidget *w) { if(w->inherits("QMenuBar")){ ((QFrame *)w)->setLineWidth(1); w->setBackgroundMode(QWidget::PaletteBackground); return; } if(w->inherits("QPopupMenu")) w->setBackgroundMode(QWidget::PaletteButton); - else if(w-> testWFlags(Qt::WType_Popup)) { + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { w->removeEventFilter(menuHandler); } if(w->isTopLevel()) return; // for viewport children, don't just check for NoBackground.... bool isViewportChild = w->parent() && ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); w->setPalette(QApplication::palette()); if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ if(w->inherits("QPushButton")) w->setBackgroundMode(QWidget::PaletteButton); else w->setBackgroundMode(QWidget::PaletteBackground); } if(isViewportChild) w->setAutoMask(false); if(w->inherits("QPushButton")){ unapplyCustomAttributes((QPushButton *)w); w->removeEventFilter(this); } /* if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ w-> setBackgroundMode ( PaletteBackground ); } */ if(w->inherits("QComboBox") || w->inherits("QLineEdit") || w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QScrollBar")) { w->removeEventFilter(this); } if(w->inherits("QButton") || w->inherits("QComboBox")){ if(w->parent() && w->parent()->inherits("KHTMLPart")){ w->setAutoMask(false); } } if(w->inherits("QToolBar")){ w->removeEventFilter(this); w->setBackgroundMode(QWidget::PaletteBackground); return; } if(w->inherits("QHeader")){ w->setMouseTracking(false); diff --git a/noncore/styles/liquid/plugin.cpp b/noncore/styles/liquid/plugin.cpp index fca7c06..d9aa8ef 100644 --- a/noncore/styles/liquid/plugin.cpp +++ b/noncore/styles/liquid/plugin.cpp @@ -1,29 +1,29 @@ #include "liquid.h" extern "C" { QStyle* allocate ( ); int minor_version ( ); int major_version ( ); const char *description ( ); } QStyle* allocate ( ) { return new LiquidStyle ( ); } int minor_version ( ) { return 0; } int major_version ( ) { return 1; } const char *description ( ) { - return "High performance liquid plugin"; + return "High Performance Liquid"; } |