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) (unidiff)
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
@@ -682,13 +682,12 @@ QPixmap* LiquidStyle::getPixmap(BitmapData item)
682 } 682 }
683 return(pixmaps[item]); 683 return(pixmaps[item]);
684} 684}
685 685
686void LiquidStyle::polish(QPalette &appPal) 686void LiquidStyle::polish(QPalette &appPal)
687{ 687{
688
689 int i; 688 int i;
690 for(i=0; i < BITMAP_ITEMS; ++i){ 689 for(i=0; i < BITMAP_ITEMS; ++i){
691 if(pixmaps[i]){ 690 if(pixmaps[i]){
692 delete pixmaps[i]; 691 delete pixmaps[i];
693 pixmaps[i] = NULL; 692 pixmaps[i] = NULL;
694 } 693 }
@@ -715,18 +714,21 @@ void LiquidStyle::polish(QPalette &appPal)
715 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 714 int contrast = config. readNumEntry ( "StippleContrast", 5 );
716 if ( contrast < 0 ) 715 if ( contrast < 0 )
717 contrast = 0; 716 contrast = 0;
718 else if ( contrast > 10 ) 717 else if ( contrast > 10 )
719 contrast = 10; 718 contrast = 10;
720 719
721 QPalette pal = QApplication::palette(); 720// QPalette pal = QApplication::palette();
722 721
723 // button color stuff 722 // button color stuff
724 config. setGroup ( "Appearance" ); 723 config. setGroup ( "Appearance" );
725 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 724 QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
726 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { 725 appPal. color ( QPalette::Active, QColorGroup::Button );
726 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )
727 //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
728 ) {
727 // force button color to be different from background 729 // force button color to be different from background
728 QBrush btnBrush(QColor(200, 202, 228)); 730 QBrush btnBrush(QColor(200, 202, 228));
729 appPal.setBrush(QColorGroup::Button, btnBrush); 731 appPal.setBrush(QColorGroup::Button, btnBrush);
730 } 732 }
731 c.hsv(&btnH, &btnS, &btnV); 733 c.hsv(&btnH, &btnS, &btnV);
732 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 734 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
@@ -771,13 +773,13 @@ void LiquidStyle::polish(QPalette &appPal)
771 smallBevelFillDict.insert(c.rgb(), pix); 773 smallBevelFillDict.insert(c.rgb(), pix);
772 } 774 }
773 pagerBrush.setColor(c); 775 pagerBrush.setColor(c);
774 pagerBrush.setPixmap(*pix); 776 pagerBrush.setPixmap(*pix);
775 777
776 // background color stuff 778 // background color stuff
777 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); 779 c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background );
778 c.hsv(&bH, &bS, &bV); 780 c.hsv(&bH, &bS, &bV);
779 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 781 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
780 782
781 // FIXME? 783 // FIXME?
782 if(vsbSliderFillPix) 784 if(vsbSliderFillPix)
783 delete vsbSliderFillPix; 785 delete vsbSliderFillPix;
@@ -797,13 +799,13 @@ void LiquidStyle::polish(QPalette &appPal)
797 painter.end(); 799 painter.end();
798 bgBrush.setColor(c); 800 bgBrush.setColor(c);
799 bgBrush.setPixmap(wallPaper); 801 bgBrush.setPixmap(wallPaper);
800 appPal.setBrush(QColorGroup::Background, bgBrush); 802 appPal.setBrush(QColorGroup::Background, bgBrush);
801 803
802 // lineedits 804 // lineedits
803 c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); 805 c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base );
804 QPixmap basePix; 806 QPixmap basePix;
805 basePix.resize(32, 32); 807 basePix.resize(32, 32);
806 basePix.fill(c.rgb()); 808 basePix.fill(c.rgb());
807 painter.begin(&basePix); 809 painter.begin(&basePix);
808 painter.setPen(c.dark(105)); 810 painter.setPen(c.dark(105));
809 for(i=0; i < 32; i+=4){ 811 for(i=0; i < 32; i+=4){
@@ -822,13 +824,12 @@ void LiquidStyle::polish(QPalette &appPal)
822 w->setPalette(pal); 824 w->setPalette(pal);
823 } 825 }
824 else if(w->inherits("QPushButton")){ 826 else if(w->inherits("QPushButton")){
825 applyCustomAttributes((QPushButton *)w); 827 applyCustomAttributes((QPushButton *)w);
826 } 828 }
827 } 829 }
828
829} 830}
830 831
831void LiquidStyle::polish(QWidget *w) 832void LiquidStyle::polish(QWidget *w)
832{ 833{
833 if(w->inherits("QMenuBar")){ 834 if(w->inherits("QMenuBar")){
834 //((QFrame*)w)->setLineWidth(0); 835 //((QFrame*)w)->setLineWidth(0);
@@ -945,13 +946,13 @@ void LiquidStyle::unPolish(QWidget *w)
945 946
946 // for viewport children, don't just check for NoBackground.... 947 // for viewport children, don't just check for NoBackground....
947 bool isViewportChild = w->parent() && 948 bool isViewportChild = w->parent() &&
948 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 949 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
949 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 950 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
950 951
951 w->setPalette(QApplication::palette()); 952 w->unsetPalette();
952 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 953 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
953 if(w->inherits("QPushButton")) 954 if(w->inherits("QPushButton"))
954 w->setBackgroundMode(QWidget::PaletteButton); 955 w->setBackgroundMode(QWidget::PaletteButton);
955 else 956 else
956 w->setBackgroundMode(QWidget::PaletteBackground); 957 w->setBackgroundMode(QWidget::PaletteBackground);
957 } 958 }
@@ -1002,27 +1003,27 @@ void LiquidStyle::polish(QApplication *app)
1002 1003
1003 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 1004 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
1004 1005
1005 Config config ( "qpe" ); 1006 Config config ( "qpe" );
1006 config. setGroup ( "Liquid-Style" ); 1007 config. setGroup ( "Liquid-Style" );
1007 1008
1008 if ( config. readBoolEntry ( "WinDecoration", true )) 1009 // if ( config. readBoolEntry ( "WinDecoration", true ))
1009 QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 1010 // QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
1010 1011
1011 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 1012 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
1012} 1013}
1013 1014
1014void LiquidStyle::unPolish(QApplication *app) 1015void LiquidStyle::unPolish(QApplication *app)
1015{ 1016{
1016 QWindowsStyle::unPolish(app); 1017 QWindowsStyle::unPolish(app);
1017 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1018 app->setEffectEnabled(UI_AnimateMenu, menuAni);
1018 app->setEffectEnabled(UI_FadeMenu, menuFade); 1019 app->setEffectEnabled(UI_FadeMenu, menuFade);
1019 1020
1020 qt_set_draw_menu_bar_impl ( 0 ); 1021 qt_set_draw_menu_bar_impl ( 0 );
1021 1022
1022 QApplication::qwsSetDecoration ( new QPEDecoration ( )); 1023// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
1023} 1024}
1024 1025
1025/* 1026/*
1026 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1027 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1027 * force everything to erase and repaint on resize. This is going away, I'm 1028 * force everything to erase and repaint on resize. This is going away, I'm
1028 * trying to get shaped widgets to work right without masking. QPushButton, 1029 * trying to get shaped widgets to work right without masking. QPushButton,