summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/liquid.cpp
authorsandman <sandman>2002-09-21 01:31:23 (UTC)
committer sandman <sandman>2002-09-21 01:31:23 (UTC)
commit804a06520928973d706bf827209f8a7625010b7f (patch) (side-by-side diff)
tree06865733a58dbd033747ef6ceca9bd6c51f24455 /noncore/styles/liquid/liquid.cpp
parent6ae824e5c3a555d5129c68d387094d50276742f4 (diff)
downloadopie-804a06520928973d706bf827209f8a7625010b7f.zip
opie-804a06520928973d706bf827209f8a7625010b7f.tar.gz
opie-804a06520928973d706bf827209f8a7625010b7f.tar.bz2
- disable liquid win decoration - this has to be made a separate plugin
- liquid now uses the polished palette for color values (liquid did parse qpe.conf before -- the new Qt/e patch is needed for this to work) - updated QPL diff
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 22bf8af..0d9d259 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -676,25 +676,24 @@ QPixmap* LiquidStyle::getPixmap(BitmapData item)
case HSBSliderMidBg:
pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
*pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
break;
default:
break;
}
return(pixmaps[item]);
}
void LiquidStyle::polish(QPalette &appPal)
{
-
int i;
for(i=0; i < BITMAP_ITEMS; ++i){
if(pixmaps[i]){
delete pixmaps[i];
pixmaps[i] = NULL;
}
}
QWidgetList *list = QApplication::allWidgets();
QWidgetListIt it( *list );
QWidget *w;
while ((w=it.current()) != 0 ){
++it;
@@ -709,30 +708,33 @@ void LiquidStyle::polish(QPalette &appPal)
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();
+// QPalette pal = QApplication::palette();
// button color stuff
config. setGroup ( "Appearance" );
- QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
- if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) {
+ QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
+ appPal. color ( QPalette::Active, QColorGroup::Button );
+ if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )
+ //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
+ ) {
// 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);
}
@@ -765,25 +767,25 @@ void LiquidStyle::polish(QPalette &appPal)
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 = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));
+ c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ 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());
@@ -791,50 +793,49 @@ void LiquidStyle::polish(QPalette &appPal)
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);
// lineedits
- c = QColor ( config. readEntry("Base", ( Qt::white). name ( )));
+ c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base );
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);
w->setBackgroundOrigin(QWidget::ParentOrigin);
return;
}
if(w->inherits("QToolBar")){
w->installEventFilter(this);
@@ -939,25 +940,25 @@ void LiquidStyle::unPolish(QWidget *w)
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());
+ w->unsetPalette();
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);
@@ -996,39 +997,39 @@ void LiquidStyle::polish(QApplication *app)
menuAni = app->isEffectEnabled(UI_AnimateMenu);
menuFade = app->isEffectEnabled(UI_FadeMenu);
if(menuAni)
app->setEffectEnabled(UI_AnimateMenu, false);
if(menuFade)
app->setEffectEnabled(UI_FadeMenu, false);
qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
Config config ( "qpe" );
config. setGroup ( "Liquid-Style" );
- if ( config. readBoolEntry ( "WinDecoration", true ))
- QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
+// if ( config. readBoolEntry ( "WinDecoration", true ))
+// QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
}
void LiquidStyle::unPolish(QApplication *app)
{
QWindowsStyle::unPolish(app);
app->setEffectEnabled(UI_AnimateMenu, menuAni);
app->setEffectEnabled(UI_FadeMenu, menuFade);
qt_set_draw_menu_bar_impl ( 0 );
- QApplication::qwsSetDecoration ( new QPEDecoration ( ));
+// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
}
/*
* 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
* trying to get shaped widgets to work right without masking. QPushButton,
* QComboBox, and Panel applet handles capture mouse enter and leaves in order
* to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
* RadioButtons need to do this differently. Qt buffers these in pixmaps and
* caches them in QPixmapCache, which is bad for doing things like hover
* because the style methods aren't called in paintEvents if everything
* is cached. We use our own Paint event handler instead. Taskbuttons and