summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 1d01c65..259f6af 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -665,455 +665,467 @@ QPixmap* LiquidStyle::getPixmap(BitmapData item)
665 case VSBSliderMidBg: 665 case VSBSliderMidBg:
666 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 666 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
667 break; 667 break;
668 case HSBSliderTopBg: 668 case HSBSliderTopBg:
669 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 669 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
670 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 670 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
671 break; 671 break;
672 case HSBSliderBtmBg: 672 case HSBSliderBtmBg:
673 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 673 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
674 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 674 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
675 break; 675 break;
676 case HSBSliderMidBg: 676 case HSBSliderMidBg:
677 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 677 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
678 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 678 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
679 break; 679 break;
680 default: 680 default:
681 break; 681 break;
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 int i; 688 int i;
689 for(i=0; i < BITMAP_ITEMS; ++i){ 689 for(i=0; i < BITMAP_ITEMS; ++i){
690 if(pixmaps[i]){ 690 if(pixmaps[i]){
691 delete pixmaps[i]; 691 delete pixmaps[i];
692 pixmaps[i] = NULL; 692 pixmaps[i] = NULL;
693 } 693 }
694 } 694 }
695 QWidgetList *list = QApplication::allWidgets(); 695 QWidgetList *list = QApplication::allWidgets();
696 QWidgetListIt it( *list ); 696 QWidgetListIt it( *list );
697 QWidget *w; 697 QWidget *w;
698 while ((w=it.current()) != 0 ){ 698 while ((w=it.current()) != 0 ){
699 ++it; 699 ++it;
700 if(w->inherits("QPushButton")){ 700 if(w->inherits("QPushButton")){
701 unapplyCustomAttributes((QPushButton *)w); 701 unapplyCustomAttributes((QPushButton *)w);
702 } 702 }
703 } 703 }
704 704
705 loadCustomButtons(); 705 loadCustomButtons();
706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
707 btnDict.clear(); 707 btnDict.clear();
708 btnBorderDict.clear(); 708 btnBorderDict.clear();
709 bevelFillDict.clear(); 709 bevelFillDict.clear();
710 smallBevelFillDict.clear(); 710 smallBevelFillDict.clear();
711 711
712 Config config ( "qpe" ); 712 Config config ( "qpe" );
713 config. setGroup ( "Liquid-Style" ); 713 config. setGroup ( "Liquid-Style" );
714 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 714 int contrast = config. readNumEntry ( "StippleContrast", 5 );
715 if ( contrast < 0 ) 715 if ( contrast < 0 )
716 contrast = 0; 716 contrast = 0;
717 else if ( contrast > 10 ) 717 else if ( contrast > 10 )
718 contrast = 10; 718 contrast = 10;
719 719
720// QPalette pal = QApplication::palette(); 720// QPalette pal = QApplication::palette();
721 721
722 // button color stuff 722 // button color stuff
723 config. setGroup ( "Appearance" ); 723 config. setGroup ( "Appearance" );
724 QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 724 QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
725 appPal. color ( QPalette::Active, QColorGroup::Button ); 725 appPal. color ( QPalette::Active, QColorGroup::Button );
726 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) 726 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )
727 //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) 727 //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
728 ) { 728 ) {
729 // force button color to be different from background 729 // force button color to be different from background
730 QBrush btnBrush(QColor(200, 202, 228)); 730 QBrush btnBrush(QColor(200, 202, 228));
731 appPal.setBrush(QColorGroup::Button, btnBrush); 731 appPal.setBrush(QColorGroup::Button, btnBrush);
732 } 732 }
733 c.hsv(&btnH, &btnS, &btnV); 733 c.hsv(&btnH, &btnS, &btnV);
734 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 734 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
735 735
736 // menu pixmap 736 // menu pixmap
737 if(!menuPix){ 737 if(!menuPix){
738 menuPix = new QPixmap; 738 menuPix = new QPixmap;
739 menuPix->resize(64, 64); 739 menuPix->resize(64, 64);
740 } 740 }
741 QPainter painter; 741 QPainter painter;
742 menuPix->fill(c.rgb()); 742 menuPix->fill(c.rgb());
743 painter.begin(menuPix); 743 painter.begin(menuPix);
744 painter.setPen(c.dark(105)); 744 painter.setPen(c.dark(105));
745 for(i=0; i < 63; i+=4){ 745 for(i=0; i < 63; i+=4){
746 painter.drawLine(0, i, 63, i); 746 painter.drawLine(0, i, 63, i);
747 painter.drawLine(0, i+1, 63, i+1); 747 painter.drawLine(0, i+1, 63, i+1);
748 }; 748 };
749 painter.end(); 749 painter.end();
750 menuBrush.setColor(c); 750 menuBrush.setColor(c);
751 menuBrush.setPixmap(*menuPix); 751 menuBrush.setPixmap(*menuPix);
752 752
753 // pager brush 753 // pager brush
754 c = c.dark(120); 754 c = c.dark(120);
755 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 755 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
756 if(!pix){ 756 if(!pix){
757 int h, s, v; 757 int h, s, v;
758 c.hsv(&h, &s, &v); 758 c.hsv(&h, &s, &v);
759 pix = new QPixmap(*smallBevelFillPix); 759 pix = new QPixmap(*smallBevelFillPix);
760 adjustHSV(*pix, h, s, v); 760 adjustHSV(*pix, h, s, v);
761 smallBevelFillDict.insert(c.rgb(), pix); 761 smallBevelFillDict.insert(c.rgb(), pix);
762 } 762 }
763 pagerHoverBrush.setColor(c); 763 pagerHoverBrush.setColor(c);
764 pagerHoverBrush.setPixmap(*pix); 764 pagerHoverBrush.setPixmap(*pix);
765 765
766 c = c.dark(120); 766 c = c.dark(120);
767 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 767 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
768 if(!pix){ 768 if(!pix){
769 int h, s, v; 769 int h, s, v;
770 c.hsv(&h, &s, &v); 770 c.hsv(&h, &s, &v);
771 pix = new QPixmap(*smallBevelFillPix); 771 pix = new QPixmap(*smallBevelFillPix);
772 adjustHSV(*pix, h, s, v); 772 adjustHSV(*pix, h, s, v);
773 smallBevelFillDict.insert(c.rgb(), pix); 773 smallBevelFillDict.insert(c.rgb(), pix);
774 } 774 }
775 pagerBrush.setColor(c); 775 pagerBrush.setColor(c);
776 pagerBrush.setPixmap(*pix); 776 pagerBrush.setPixmap(*pix);
777 777
778 // background color stuff 778 // background color stuff
779 c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); 779 c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background );
780 c.hsv(&bH, &bS, &bV); 780 c.hsv(&bH, &bS, &bV);
781 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 781 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
782 782
783 // FIXME? 783 // FIXME?
784 if(vsbSliderFillPix) 784 if(vsbSliderFillPix)
785 delete vsbSliderFillPix; 785 delete vsbSliderFillPix;
786 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 786 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
787 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 787 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
788 788
789 // background brush 789 // background brush
790 QPixmap wallPaper(32, 32); 790 QPixmap wallPaper(32, 32);
791 wallPaper.fill(c.rgb()); 791 wallPaper.fill(c.rgb());
792 painter.begin(&wallPaper); 792 painter.begin(&wallPaper);
793 for(i=0; i < 32; i+=4){ 793 for(i=0; i < 32; i+=4){
794 painter.setPen(c.dark(100 + contrast)); 794 painter.setPen(c.dark(100 + contrast));
795 painter.drawLine(0, i, 32, i); 795 painter.drawLine(0, i, 32, i);
796 painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 796 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
797 painter.drawLine(0, i+1, 32, i+1); 797 painter.drawLine(0, i+1, 32, i+1);
798 }; 798 };
799 painter.end(); 799 painter.end();
800 bgBrush.setColor(c); 800 bgBrush.setColor(c);
801 bgBrush.setPixmap(wallPaper); 801 bgBrush.setPixmap(wallPaper);
802 appPal.setBrush(QColorGroup::Background, bgBrush); 802 appPal.setBrush(QColorGroup::Background, bgBrush);
803 803
804 // lineedits 804 // lineedits
805 c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); 805 c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base );
806 QPixmap basePix; 806 QPixmap basePix;
807 basePix.resize(32, 32); 807 basePix.resize(32, 32);
808 basePix.fill(c.rgb()); 808 basePix.fill(c.rgb());
809 painter.begin(&basePix); 809 painter.begin(&basePix);
810 painter.setPen(c.dark(105)); 810 painter.setPen(c.dark(105));
811 for(i=0; i < 32; i+=4){ 811 for(i=0; i < 32; i+=4){
812 painter.drawLine(0, i, 32, i); 812 painter.drawLine(0, i, 32, i);
813 painter.drawLine(0, i+1, 32, i+1); 813 painter.drawLine(0, i+1, 32, i+1);
814 }; 814 };
815 painter.end(); 815 painter.end();
816 baseBrush.setColor(c); 816 baseBrush.setColor(c);
817 baseBrush.setPixmap(basePix); 817 baseBrush.setPixmap(basePix);
818 it.toFirst(); 818 it.toFirst();
819 while ((w=it.current()) != 0 ){ 819 while ((w=it.current()) != 0 ){
820 ++it; 820 ++it;
821 if(w->inherits("QLineEdit")){ 821 if(w->inherits("QLineEdit")){
822 QPalette pal = w->palette(); 822 QPalette pal = w->palette();
823 pal.setBrush(QColorGroup::Base, baseBrush); 823 pal.setBrush(QColorGroup::Base, baseBrush);
824 w->setPalette(pal); 824 w->setPalette(pal);
825 } 825 }
826 else if(w->inherits("QPushButton")){ 826 else if(w->inherits("QPushButton")){
827 applyCustomAttributes((QPushButton *)w); 827 applyCustomAttributes((QPushButton *)w);
828 } 828 }
829 } 829 }
830} 830}
831 831
832void LiquidStyle::polish(QWidget *w) 832void LiquidStyle::polish(QWidget *w)
833{ 833{
834 if(w->inherits("QMenuBar")){ 834 if(w->inherits("QMenuBar")){
835 //((QFrame*)w)->setLineWidth(0); 835 //((QFrame*)w)->setLineWidth(0);
836 w->setBackgroundMode(QWidget::PaletteBackground); 836 w->setBackgroundMode(QWidget::PaletteBackground);
837 w->setBackgroundOrigin(QWidget::ParentOrigin); 837 w->setBackgroundOrigin(QWidget::ParentOrigin);
838 return; 838 return;
839 } 839 }
840 if(w->inherits("QToolBar")){ 840 if(w->inherits("QToolBar")){
841 w->installEventFilter(this); 841 w->installEventFilter(this);
842 w->setBackgroundMode(QWidget::PaletteBackground); 842 w->setBackgroundMode(QWidget::PaletteBackground);
843 w->setBackgroundOrigin(QWidget::WidgetOrigin); 843 w->setBackgroundOrigin(QWidget::WidgetOrigin);
844 return; 844 return;
845 } 845 }
846 if(w->inherits("QPopupMenu")) 846 if(w->inherits("QPopupMenu"))
847 w->setBackgroundMode(QWidget::NoBackground); 847 w->setBackgroundMode(QWidget::NoBackground);
848 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 848 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
849 w->installEventFilter(menuHandler); 849 w->installEventFilter(menuHandler);
850 } 850 }
851 851
852 if(w->isTopLevel()){ 852 if(w->isTopLevel()){
853 return; 853 return;
854 } 854 }
855 855
856 856
857 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 857
858 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
859 858
860 if(w->inherits("QComboBox") || 859 if(w->inherits("QComboBox") ||
861 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 860 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
862 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 861 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
863 w->installEventFilter(this); 862 w->installEventFilter(this);
864 } 863 }
865 if(w->inherits("QLineEdit")){ 864 if(w->inherits("QLineEdit")){
866 QPalette pal = w->palette(); 865 QPalette pal = w->palette();
867 pal.setBrush(QColorGroup::Base, baseBrush); 866 pal.setBrush(QColorGroup::Base, baseBrush);
868 w->setPalette(pal); 867 w->setPalette(pal);
869 } 868 }
870 if(w->inherits("QPushButton")){ 869 if(w->inherits("QPushButton")){
871 applyCustomAttributes((QPushButton *)w); 870 applyCustomAttributes((QPushButton *)w);
872 w->installEventFilter(this); 871 w->installEventFilter(this);
873 } 872 }
874 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 873 if(w->inherits("QButton") || w-> inherits("QComboBox")){
875 w-> setBackgroundMode ( QWidget::PaletteBackground ); 874 w-> setBackgroundMode ( QWidget::PaletteBackground );
875 w->setBackgroundOrigin ( QWidget::ParentOrigin);
876 } 876 }
877 877
878 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 878 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
879 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 879 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
880 bool isViewportChild = w->parent() && 880 bool isViewportChild = w->parent() &&
881 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 881 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
882 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 882 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
883 883
884 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 884 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
885 w->setBackgroundMode(QWidget::X11ParentRelative); 885 w->setBackgroundMode(QWidget::X11ParentRelative);
886 return; 886 return;
887 } 887 }
888 if(isViewportChild){ 888 if(isViewportChild){
889 if(w->inherits("QButton") || w->inherits("QComboBox")){ 889 if(w->inherits("QButton") || w->inherits("QComboBox")){
890 if(w->parent()){ // heh, only way to test for KHTML children ;-) 890 if(w->parent()){ // heh, only way to test for KHTML children ;-)
891 if(w->parent()->parent()){ 891 if(w->parent()->parent()){
892 if(w->parent()->parent()->parent() && 892 if(w->parent()->parent()->parent() &&
893 w->parent()->parent()->parent()->inherits("KHTMLView")){ 893 w->parent()->parent()->parent()->inherits("KHTMLView")){
894 w->setAutoMask(true); 894 w->setAutoMask(true);
895 w->setBackgroundMode(QWidget::NoBackground); 895 w->setBackgroundMode(QWidget::NoBackground);
896 } 896 }
897 } 897 }
898 } 898 }
899 return; 899 return;
900 } 900 }
901 } 901 }
902 if(w->inherits("QHeader")){ 902 if(w->inherits("QHeader")){
903 w->setMouseTracking(true); 903 w->setMouseTracking(true);
904 w->installEventFilter(this); 904 w->installEventFilter(this);
905 } 905 }
906 if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { 906 if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) {
907 ((QToolButton*)w)->setAutoRaise (flatTBButtons); 907 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
908 if ( flatTBButtons ) 908 if ( flatTBButtons )
909 w->setBackgroundOrigin(QWidget::ParentOrigin); 909 w->setBackgroundOrigin(QWidget::ParentOrigin);
910 } 910 }
911 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
912 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
913 }
911 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 914 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
912 return; 915 return;
913 } 916 }
914 917
915 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 918 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
916 palette().active().brush(QColorGroup::Background).pixmap()){ 919 palette().active().brush(QColorGroup::Background).pixmap()){
917 qWarning("No parent pixmap for child widget %s", w->className()); 920 qWarning("No parent pixmap for child widget %s", w->className());
918 return; 921 return;
919 } 922 }
920 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 923 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
921 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 924 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
922 if(w->backgroundMode() == QWidget::PaletteBackground || 925 if(w->backgroundMode() == QWidget::PaletteBackground ||
923 w->backgroundMode() == QWidget::PaletteButton){ 926 w->backgroundMode() == QWidget::PaletteButton){
924 w->setBackgroundMode(QWidget::X11ParentRelative); 927 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
928 w->setBackgroundOrigin(QWidget::ParentOrigin);
929 // w->setBackgroundMode(QWidget::NoBackground);
925 } 930 }
926 } 931 }
932 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
933 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
934 else if ( w-> inherits("QFrame") )
935 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
927 936
937 if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
938 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
939 }
928} 940}
929 941
930void LiquidStyle::unPolish(QWidget *w) 942void LiquidStyle::unPolish(QWidget *w)
931{ 943{
932 if(w->inherits("QMenuBar")){ 944 if(w->inherits("QMenuBar")){
933 ((QFrame *)w)->setLineWidth(1); 945 ((QFrame *)w)->setLineWidth(1);
934 w->setBackgroundMode(QWidget::PaletteBackground); 946 w->setBackgroundMode(QWidget::PaletteBackground);
935 return; 947 return;
936 } 948 }
937 949
938 if(w->inherits("QPopupMenu")) 950 if(w->inherits("QPopupMenu"))
939 w->setBackgroundMode(QWidget::PaletteButton); 951 w->setBackgroundMode(QWidget::PaletteButton);
940 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 952 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
941 w->removeEventFilter(menuHandler); 953 w->removeEventFilter(menuHandler);
942 } 954 }
943 955
944 if(w->isTopLevel()) 956 if(w->isTopLevel())
945 return; 957 return;
946 958
947 // for viewport children, don't just check for NoBackground.... 959 // for viewport children, don't just check for NoBackground....
948 bool isViewportChild = w->parent() && 960 bool isViewportChild = w->parent() &&
949 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 961 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
950 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 962 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
951 963
952 w->unsetPalette(); 964 w->unsetPalette();
953 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 965 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
954 if(w->inherits("QPushButton")) 966 if(w->inherits("QPushButton"))
955 w->setBackgroundMode(QWidget::PaletteButton); 967 w->setBackgroundMode(QWidget::PaletteButton);
956 else 968 else
957 w->setBackgroundMode(QWidget::PaletteBackground); 969 w->setBackgroundMode(QWidget::PaletteBackground);
958 } 970 }
959 971
960 if(isViewportChild) 972 if(isViewportChild)
961 w->setAutoMask(false); 973 w->setAutoMask(false);
962 974
963 if(w->inherits("QPushButton")){ 975 if(w->inherits("QPushButton")){
964 unapplyCustomAttributes((QPushButton *)w); 976 unapplyCustomAttributes((QPushButton *)w);
965 w->removeEventFilter(this); 977 w->removeEventFilter(this);
966 } 978 }
967/* 979/*
968 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 980 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
969 w-> setBackgroundMode ( PaletteBackground ); 981 w-> setBackgroundMode ( PaletteBackground );
970 } 982 }
971*/ 983*/
972 if(w->inherits("QComboBox") || 984 if(w->inherits("QComboBox") ||
973 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 985 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
974 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 986 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
975 w->removeEventFilter(this); 987 w->removeEventFilter(this);
976 } 988 }
977 if(w->inherits("QButton") || w->inherits("QComboBox")){ 989 if(w->inherits("QButton") || w->inherits("QComboBox")){
978 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 990 if(w->parent() && w->parent()->inherits("KHTMLPart")){
979 w->setAutoMask(false); 991 w->setAutoMask(false);
980 } 992 }
981 } 993 }
982 if(w->inherits("QToolBar")){ 994 if(w->inherits("QToolBar")){
983 w->removeEventFilter(this); 995 w->removeEventFilter(this);
984 w->setBackgroundMode(QWidget::PaletteBackground); 996 w->setBackgroundMode(QWidget::PaletteBackground);
985 return; 997 return;
986 } 998 }
987 if(w->inherits("QHeader")){ 999 if(w->inherits("QHeader")){
988 w->setMouseTracking(false); 1000 w->setMouseTracking(false);
989 w->removeEventFilter(this); 1001 w->removeEventFilter(this);
990 } 1002 }
991} 1003}
992 1004
993void LiquidStyle::polish(QApplication *app) 1005void LiquidStyle::polish(QApplication *app)
994{ 1006{
995 1007
996 QWindowsStyle::polish(app); 1008 QWindowsStyle::polish(app);
997 menuAni = app->isEffectEnabled(UI_AnimateMenu); 1009 menuAni = app->isEffectEnabled(UI_AnimateMenu);
998 menuFade = app->isEffectEnabled(UI_FadeMenu); 1010 menuFade = app->isEffectEnabled(UI_FadeMenu);
999 if(menuAni) 1011 if(menuAni)
1000 app->setEffectEnabled(UI_AnimateMenu, false); 1012 app->setEffectEnabled(UI_AnimateMenu, false);
1001 if(menuFade) 1013 if(menuFade)
1002 app->setEffectEnabled(UI_FadeMenu, false); 1014 app->setEffectEnabled(UI_FadeMenu, false);
1003 1015
1004 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 1016 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
1005 1017
1006 Config config ( "qpe" ); 1018 Config config ( "qpe" );
1007 config. setGroup ( "Liquid-Style" ); 1019 config. setGroup ( "Liquid-Style" );
1008 1020
1009 // if ( config. readBoolEntry ( "WinDecoration", true )) 1021 // if ( config. readBoolEntry ( "WinDecoration", true ))
1010 // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 1022 // QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
1011 1023
1012 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 1024 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
1013} 1025}
1014 1026
1015void LiquidStyle::unPolish(QApplication *app) 1027void LiquidStyle::unPolish(QApplication *app)
1016{ 1028{
1017 QWindowsStyle::unPolish(app); 1029 QWindowsStyle::unPolish(app);
1018 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1030 app->setEffectEnabled(UI_AnimateMenu, menuAni);
1019 app->setEffectEnabled(UI_FadeMenu, menuFade); 1031 app->setEffectEnabled(UI_FadeMenu, menuFade);
1020 1032
1021 qt_set_draw_menu_bar_impl ( 0 ); 1033 qt_set_draw_menu_bar_impl ( 0 );
1022 1034
1023// QApplication::qwsSetDecoration ( new QPEDecoration ( )); 1035// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
1024} 1036}
1025 1037
1026/* 1038/*
1027 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1039 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1028 * force everything to erase and repaint on resize. This is going away, I'm 1040 * force everything to erase and repaint on resize. This is going away, I'm
1029 * trying to get shaped widgets to work right without masking. QPushButton, 1041 * trying to get shaped widgets to work right without masking. QPushButton,
1030 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1042 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1031 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1043 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1032 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1044 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1033 * caches them in QPixmapCache, which is bad for doing things like hover 1045 * caches them in QPixmapCache, which is bad for doing things like hover
1034 * because the style methods aren't called in paintEvents if everything 1046 * because the style methods aren't called in paintEvents if everything
1035 * is cached. We use our own Paint event handler instead. Taskbuttons and 1047 * is cached. We use our own Paint event handler instead. Taskbuttons and
1036 * pager buttons draw into a pixmap buffer, so we handle those with palette 1048 * pager buttons draw into a pixmap buffer, so we handle those with palette
1037 * modifications. For QHeader, different header items are actually one widget 1049 * modifications. For QHeader, different header items are actually one widget
1038 * that draws multiple items, so we need to check which ID is hightlighted 1050 * that draws multiple items, so we need to check which ID is hightlighted
1039 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1051 * and draw it. Finally, we also check enter and leave events for QLineEdit,
1040 * since if it's inside a combobox we want to highlight the combobox during 1052 * since if it's inside a combobox we want to highlight the combobox during
1041 * hovering in the edit. 1053 * hovering in the edit.
1042 */ 1054 */
1043bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1055bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1044{ 1056{
1045 if(obj->inherits("QToolBar")){ 1057 if(obj->inherits("QToolBar")){
1046 if(ev->type() == QEvent::Resize){ 1058 if(ev->type() == QEvent::Resize){
1047 const QObjectList *tbChildList = obj->children(); 1059 const QObjectList *tbChildList = obj->children();
1048 QObjectListIt it(*tbChildList); 1060 QObjectListIt it(*tbChildList);
1049 QObject *child; 1061 QObject *child;
1050 while((child = it.current()) != NULL){ 1062 while((child = it.current()) != NULL){
1051 ++it; 1063 ++it;
1052 if(child->isWidgetType()) 1064 if(child->isWidgetType())
1053 ((QWidget *)child)->repaint(true); 1065 ((QWidget *)child)->repaint(true);
1054 } 1066 }
1055 1067
1056 } 1068 }
1057 } 1069 }
1058 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ 1070 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){
1059 QWidget *btn = (QWidget *)obj; 1071 QWidget *btn = (QWidget *)obj;
1060 if(ev->type() == QEvent::Enter){ 1072 if(ev->type() == QEvent::Enter){
1061 if(btn->isEnabled()){ 1073 if(btn->isEnabled()){
1062 highlightWidget = btn; 1074 highlightWidget = btn;
1063 btn->repaint(false); 1075 btn->repaint(false);
1064 } 1076 }
1065 } 1077 }
1066 else if(ev->type() == QEvent::Leave){ 1078 else if(ev->type() == QEvent::Leave){
1067 if(btn == highlightWidget){ 1079 if(btn == highlightWidget){
1068 highlightWidget = NULL; 1080 highlightWidget = NULL;
1069 btn->repaint(false); 1081 btn->repaint(false);
1070 } 1082 }
1071 } 1083 }
1072 } 1084 }
1073 else if(obj->inherits("QToolButton")){ 1085 else if(obj->inherits("QToolButton")){
1074 QToolButton *btn = (QToolButton *)btn; 1086 QToolButton *btn = (QToolButton *)btn;
1075 if(!btn->autoRaise()){ 1087 if(!btn->autoRaise()){
1076 if(btn->isEnabled()){ 1088 if(btn->isEnabled()){
1077 highlightWidget = btn; 1089 highlightWidget = btn;
1078 btn->repaint(false); 1090 btn->repaint(false);
1079 } 1091 }
1080 } 1092 }
1081 else if(ev->type() == QEvent::Leave){ 1093 else if(ev->type() == QEvent::Leave){
1082 QWidget *btn = (QWidget *)obj; 1094 QWidget *btn = (QWidget *)obj;
1083 if(btn == highlightWidget){ 1095 if(btn == highlightWidget){
1084 highlightWidget = NULL; 1096 highlightWidget = NULL;
1085 btn->repaint(false); 1097 btn->repaint(false);
1086 } 1098 }
1087 } 1099 }
1088 else 1100 else
1089 highlightWidget = NULL; 1101 highlightWidget = NULL;
1090 } 1102 }
1091 else if(obj->inherits("QScrollBar")){ 1103 else if(obj->inherits("QScrollBar")){
1092 QScrollBar *sb = (QScrollBar *)obj; 1104 QScrollBar *sb = (QScrollBar *)obj;
1093 if(ev->type() == QEvent::Enter){ 1105 if(ev->type() == QEvent::Enter){
1094 if(sb->isEnabled()){ 1106 if(sb->isEnabled()){
1095 highlightWidget = sb; 1107 highlightWidget = sb;
1096 sb->repaint(false); 1108 sb->repaint(false);
1097 } 1109 }
1098 } 1110 }
1099 else if(ev->type() == QEvent::Leave){ 1111 else if(ev->type() == QEvent::Leave){
1100 if(sb == highlightWidget && !sb->draggingSlider()){ 1112 if(sb == highlightWidget && !sb->draggingSlider()){
1101 highlightWidget = NULL; 1113 highlightWidget = NULL;
1102 sb->repaint(false); 1114 sb->repaint(false);
1103 } 1115 }
1104 } 1116 }
1105 else if(ev->type() == QEvent::MouseButtonRelease){ 1117 else if(ev->type() == QEvent::MouseButtonRelease){
1106 QMouseEvent *me = (QMouseEvent *)ev; 1118 QMouseEvent *me = (QMouseEvent *)ev;
1107 if(sb == highlightWidget && !sb->rect().contains(me->pos())){ 1119 if(sb == highlightWidget && !sb->rect().contains(me->pos())){
1108 highlightWidget = NULL; 1120 highlightWidget = NULL;
1109 sb->repaint(false); 1121 sb->repaint(false);
1110 } 1122 }
1111 } 1123 }
1112 } 1124 }
1113 else if(obj->inherits("QLineEdit")){ 1125 else if(obj->inherits("QLineEdit")){
1114 if(obj->parent() && obj->parent()->inherits("QComboBox")){ 1126 if(obj->parent() && obj->parent()->inherits("QComboBox")){
1115 QWidget *btn = (QComboBox *)obj->parent(); 1127 QWidget *btn = (QComboBox *)obj->parent();
1116 if(ev->type() == QEvent::Enter){ 1128 if(ev->type() == QEvent::Enter){
1117 if (btn->isEnabled()){ 1129 if (btn->isEnabled()){
1118 highlightWidget = btn; 1130 highlightWidget = btn;
1119 btn->repaint(false); 1131 btn->repaint(false);