author | sandman <sandman> | 2002-11-18 03:48:58 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-18 03:48:58 (UTC) |
commit | c2d7749ca68a545b67e1b07ffbb65f08da203702 (patch) (unidiff) | |
tree | b5d867ada033b4c98ffaba8bb1d4cfbb8c0e023a | |
parent | ee9696cbb7a39e0f13739ae86cd925b0f675a43c (diff) | |
download | opie-c2d7749ca68a545b67e1b07ffbb65f08da203702.zip opie-c2d7749ca68a545b67e1b07ffbb65f08da203702.tar.gz opie-c2d7749ca68a545b67e1b07ffbb65f08da203702.tar.bz2 |
Optimized Liquid for handhelds:
- removed some dead code from the original liquid
- removed all code related to mouse-hover
- rewrote QToolButton drawing, so navigating toolbars with Menu/Direction
keys looks nicer
- changed the way focus indicators are drawn on many widgets
- support for libqte's with version < 2.3.4
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 567 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.h | 18 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 1117 | ||||
-rw-r--r-- | noncore/styles/liquid/plugin.cpp | 5 |
4 files changed, 1090 insertions, 617 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 6812d16..ba732aa 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -2,6 +2,9 @@ | |||
2 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. | 2 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | // | ||
6 | // (c) 2002 Robert 'sandman' Griebl | ||
7 | // | ||
5 | 8 | ||
6 | 9 | ||
7 | #ifndef INCLUDE_MENUITEM_DEF | 10 | #ifndef INCLUDE_MENUITEM_DEF |
@@ -31,6 +34,7 @@ | |||
31 | #include <unistd.h> | 34 | #include <unistd.h> |
32 | #include <qmenubar.h> | 35 | #include <qmenubar.h> |
33 | #include <qprogressbar.h> | 36 | #include <qprogressbar.h> |
37 | #include <qlineedit.h> | ||
34 | 38 | ||
35 | #include <stdio.h> | 39 | #include <stdio.h> |
36 | 40 | ||
@@ -162,11 +166,19 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | |||
162 | } | 166 | } |
163 | 167 | ||
164 | 168 | ||
169 | static int qt_version ( ) | ||
170 | { | ||
171 | const char *qver = qVersion ( ); | ||
172 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | ||
173 | } | ||
174 | |||
175 | |||
165 | LiquidStyle::LiquidStyle() | 176 | LiquidStyle::LiquidStyle() |
166 | :QWindowsStyle() | 177 | :QWindowsStyle() |
167 | { | 178 | { |
168 | setName ( "LiquidStyle" ); | 179 | setName ( "LiquidStyle" ); |
169 | 180 | ||
181 | oldqte = ( qt_version ( ) < 234 ); | ||
170 | flatTBButtons = false; | 182 | flatTBButtons = false; |
171 | 183 | ||
172 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 184 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
@@ -179,12 +191,8 @@ LiquidStyle::LiquidStyle() | |||
179 | btnDict.setAutoDelete(true); | 191 | btnDict.setAutoDelete(true); |
180 | bevelFillDict.setAutoDelete(true); | 192 | bevelFillDict.setAutoDelete(true); |
181 | smallBevelFillDict.setAutoDelete(true); | 193 | smallBevelFillDict.setAutoDelete(true); |
182 | customBtnColorList.setAutoDelete(true); | ||
183 | customBtnIconList.setAutoDelete(true); | ||
184 | customBtnLabelList.setAutoDelete(true); | ||
185 | 194 | ||
186 | rMatrix.rotate(270.0); | 195 | rMatrix.rotate(270.0); |
187 | highcolor = QPixmap::defaultDepth() > 8; | ||
188 | btnBorderPix = new QPixmap; | 196 | btnBorderPix = new QPixmap; |
189 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); | 197 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); |
190 | btnBlendPix = new QPixmap; | 198 | btnBlendPix = new QPixmap; |
@@ -544,131 +552,119 @@ QPixmap* LiquidStyle::getPixmap(BitmapData item) | |||
544 | case HTMLBtnBorderDown: | 552 | case HTMLBtnBorderDown: |
545 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); | 553 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); |
546 | break; | 554 | break; |
555 | |||
547 | case HTMLCB: | 556 | case HTMLCB: |
548 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); | 557 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); |
549 | break; | 558 | break; |
559 | case HTMLCBHover: | ||
560 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); | ||
561 | break; | ||
550 | case HTMLCBDown: | 562 | case HTMLCBDown: |
551 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); | 563 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); |
552 | break; | 564 | break; |
553 | case HTMLCBHover: | ||
554 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); | ||
555 | break; | ||
556 | case HTMLCBDownHover: | 565 | case HTMLCBDownHover: |
557 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", | 566 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); |
558 | btnHoverH, btnHoverS, | ||
559 | btnHoverV); | ||
560 | break; | 567 | break; |
568 | |||
561 | case HTMLRadio: | 569 | case HTMLRadio: |
562 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); | 570 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); |
571 | break; | ||
572 | case HTMLRadioHover: | ||
573 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); | ||
574 | break; | ||
563 | case HTMLRadioDown: | 575 | case HTMLRadioDown: |
564 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); | 576 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); |
565 | case HTMLRadioHover: | 577 | break; |
566 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); | ||
567 | case HTMLRadioDownHover: | 578 | case HTMLRadioDownHover: |
568 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", | 579 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); |
569 | btnHoverH, btnHoverS, | 580 | break; |
570 | btnHoverV); | 581 | |
571 | case RadioOn: | 582 | case RadioOff: |
572 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); | 583 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); |
584 | break; | ||
585 | case RadioOffHover: | ||
586 | pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); | ||
587 | break; | ||
588 | case RadioOn: | ||
589 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); | ||
573 | break; | 590 | break; |
574 | case RadioOnHover: | 591 | case RadioOnHover: |
575 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, | 592 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); |
576 | btnHoverV, true); | ||
577 | break; | 593 | break; |
578 | case RadioOffHover: | 594 | |
579 | pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); | 595 | case Tab: |
596 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); | ||
580 | break; | 597 | break; |
581 | case TabDown: | 598 | case TabDown: |
582 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); | 599 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); |
583 | break; | 600 | break; |
584 | case TabFocus: | 601 | case TabFocus: |
585 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, | 602 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); |
586 | btnHoverS, true); | 603 | break; |
604 | |||
605 | case CB: | ||
606 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); | ||
607 | break; | ||
608 | case CBHover: | ||
609 | pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); | ||
587 | break; | 610 | break; |
588 | case CBDown: | 611 | case CBDown: |
589 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); | 612 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); |
590 | break; | 613 | break; |
591 | case CBDownHover: | 614 | case CBDownHover: |
592 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, | 615 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); |
593 | btnHoverS, btnHoverV, true); | ||
594 | break; | ||
595 | case CBHover: | ||
596 | pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); | ||
597 | break; | 616 | break; |
598 | case HSlider: | 617 | |
599 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | 618 | case VSlider: |
600 | break; | 619 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); |
601 | case VSlider: | ||
602 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | ||
603 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); | 620 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); |
604 | break; | 621 | break; |
605 | case RadioOff: | ||
606 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); | ||
607 | break; | ||
608 | case Tab: | ||
609 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); | ||
610 | break; | ||
611 | case CB: | ||
612 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); | ||
613 | break; | ||
614 | case VSBSliderTop: | 622 | case VSBSliderTop: |
615 | pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 623 | case VSBSliderTopHover: |
624 | pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); | ||
616 | break; | 625 | break; |
617 | case VSBSliderBtm: | 626 | case VSBSliderBtm: |
618 | pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | 627 | case VSBSliderBtmHover: |
628 | pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); | ||
619 | break; | 629 | break; |
620 | case VSBSliderMid: | 630 | case VSBSliderMid: |
621 | pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | 631 | case VSBSliderMidHover: |
632 | pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | ||
622 | break; | 633 | break; |
623 | case VSBSliderTopHover: | 634 | case VSBSliderTopBg: |
624 | pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 635 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); |
625 | break; | 636 | break; |
626 | case VSBSliderBtmHover: | 637 | case VSBSliderBtmBg: |
627 | pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 638 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); |
628 | break; | 639 | break; |
629 | case VSBSliderMidHover: | 640 | case VSBSliderMidBg: |
630 | pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 641 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); |
631 | break; | 642 | break; |
632 | 643 | ||
633 | case HSBSliderTop: | 644 | case HSlider: |
634 | pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 645 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); |
635 | *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); | ||
636 | break; | ||
637 | case HSBSliderBtm: | ||
638 | pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | ||
639 | *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); | ||
640 | break; | ||
641 | case HSBSliderMid: | ||
642 | pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | ||
643 | *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); | ||
644 | break; | 646 | break; |
647 | case HSBSliderTop: | ||
645 | case HSBSliderTopHover: | 648 | case HSBSliderTopHover: |
646 | pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 649 | pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); |
647 | *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); | 650 | *pixmaps[item] = pixmaps[item]->xForm(rMatrix); |
648 | break; | 651 | break; |
652 | case HSBSliderBtm: | ||
649 | case HSBSliderBtmHover: | 653 | case HSBSliderBtmHover: |
650 | pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 654 | pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); |
651 | *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); | 655 | *pixmaps[item] = pixmaps[item]->xForm(rMatrix); |
652 | break; | 656 | break; |
657 | case HSBSliderMid: | ||
653 | case HSBSliderMidHover: | 658 | case HSBSliderMidHover: |
654 | pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 659 | pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); |
655 | *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); | 660 | *pixmaps[item] = pixmaps[item]->xForm(rMatrix); |
656 | break; | ||
657 | case VSBSliderTopBg: | ||
658 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | ||
659 | break; | ||
660 | case VSBSliderBtmBg: | ||
661 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | ||
662 | break; | ||
663 | case VSBSliderMidBg: | ||
664 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | ||
665 | break; | 661 | break; |
666 | case HSBSliderTopBg: | 662 | case HSBSliderTopBg: |
667 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | 663 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); |
668 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); | 664 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); |
669 | break; | 665 | break; |
670 | case HSBSliderBtmBg: | 666 | case HSBSliderBtmBg: |
671 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | 667 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); |
672 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); | 668 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); |
673 | break; | 669 | break; |
674 | case HSBSliderMidBg: | 670 | case HSBSliderMidBg: |
@@ -690,17 +686,6 @@ void LiquidStyle::polish(QPalette &appPal) | |||
690 | pixmaps[i] = NULL; | 686 | pixmaps[i] = NULL; |
691 | } | 687 | } |
692 | } | 688 | } |
693 | QWidgetList *list = QApplication::allWidgets(); | ||
694 | QWidgetListIt it( *list ); | ||
695 | QWidget *w; | ||
696 | while ((w=it.current()) != 0 ){ | ||
697 | ++it; | ||
698 | if(w->inherits("QPushButton")){ | ||
699 | unapplyCustomAttributes((QPushButton *)w); | ||
700 | } | ||
701 | } | ||
702 | |||
703 | loadCustomButtons(); | ||
704 | lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | 689 | lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; |
705 | btnDict.clear(); | 690 | btnDict.clear(); |
706 | btnBorderDict.clear(); | 691 | btnBorderDict.clear(); |
@@ -719,11 +704,10 @@ void LiquidStyle::polish(QPalette &appPal) | |||
719 | 704 | ||
720 | // button color stuff | 705 | // button color stuff |
721 | config. setGroup ( "Appearance" ); | 706 | config. setGroup ( "Appearance" ); |
722 | QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 707 | QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) |
723 | appPal. color ( QPalette::Active, QColorGroup::Button ); | 708 | : appPal. color ( QPalette::Active, QColorGroup::Button ); |
724 | if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) | 709 | if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) |
725 | //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) | 710 | : appPal. color ( QPalette::Active, QColorGroup::Background ))) { |
726 | ) { | ||
727 | // force button color to be different from background | 711 | // force button color to be different from background |
728 | QBrush btnBrush(QColor(200, 202, 228)); | 712 | QBrush btnBrush(QColor(200, 202, 228)); |
729 | appPal.setBrush(QColorGroup::Button, btnBrush); | 713 | appPal.setBrush(QColorGroup::Button, btnBrush); |
@@ -758,8 +742,8 @@ void LiquidStyle::polish(QPalette &appPal) | |||
758 | adjustHSV(*pix, h, s, v); | 742 | adjustHSV(*pix, h, s, v); |
759 | smallBevelFillDict.insert(c.rgb(), pix); | 743 | smallBevelFillDict.insert(c.rgb(), pix); |
760 | } | 744 | } |
761 | pagerHoverBrush.setColor(c); | 745 | // pagerHoverBrush.setColor(c); |
762 | pagerHoverBrush.setPixmap(*pix); | 746 | // pagerHoverBrush.setPixmap(*pix); |
763 | 747 | ||
764 | c = c.dark(120); | 748 | c = c.dark(120); |
765 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 749 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
@@ -770,11 +754,13 @@ void LiquidStyle::polish(QPalette &appPal) | |||
770 | adjustHSV(*pix, h, s, v); | 754 | adjustHSV(*pix, h, s, v); |
771 | smallBevelFillDict.insert(c.rgb(), pix); | 755 | smallBevelFillDict.insert(c.rgb(), pix); |
772 | } | 756 | } |
773 | pagerBrush.setColor(c); | 757 | // pagerBrush.setColor(c); |
774 | pagerBrush.setPixmap(*pix); | 758 | // pagerBrush.setPixmap(*pix); |
775 | 759 | ||
776 | // background color stuff | 760 | // background color stuff |
777 | c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); | 761 | c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) |
762 | : appPal. color ( QPalette::Active, QColorGroup::Background ); | ||
763 | |||
778 | c.hsv(&bH, &bS, &bV); | 764 | c.hsv(&bH, &bS, &bV); |
779 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 765 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
780 | 766 | ||
@@ -798,33 +784,6 @@ void LiquidStyle::polish(QPalette &appPal) | |||
798 | bgBrush.setColor(c); | 784 | bgBrush.setColor(c); |
799 | bgBrush.setPixmap(wallPaper); | 785 | bgBrush.setPixmap(wallPaper); |
800 | appPal.setBrush(QColorGroup::Background, bgBrush); | 786 | appPal.setBrush(QColorGroup::Background, bgBrush); |
801 | |||
802 | // lineedits | ||
803 | c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); | ||
804 | QPixmap basePix; | ||
805 | basePix.resize(32, 32); | ||
806 | basePix.fill(c.rgb()); | ||
807 | painter.begin(&basePix); | ||
808 | painter.setPen(c.dark(105)); | ||
809 | for(i=0; i < 32; i+=4){ | ||
810 | painter.drawLine(0, i, 32, i); | ||
811 | painter.drawLine(0, i+1, 32, i+1); | ||
812 | }; | ||
813 | painter.end(); | ||
814 | baseBrush.setColor(c); | ||
815 | baseBrush.setPixmap(basePix); | ||
816 | it.toFirst(); | ||
817 | while ((w=it.current()) != 0 ){ | ||
818 | ++it; | ||
819 | if(w->inherits("QLineEdit")){ | ||
820 | QPalette pal = w->palette(); | ||
821 | pal.setBrush(QColorGroup::Base, baseBrush); | ||
822 | w->setPalette(pal); | ||
823 | } | ||
824 | else if(w->inherits("QPushButton")){ | ||
825 | applyCustomAttributes((QPushButton *)w); | ||
826 | } | ||
827 | } | ||
828 | } | 787 | } |
829 | 788 | ||
830 | void LiquidStyle::polish(QWidget *w) | 789 | void LiquidStyle::polish(QWidget *w) |
@@ -853,20 +812,10 @@ void LiquidStyle::polish(QWidget *w) | |||
853 | return; | 812 | return; |
854 | } | 813 | } |
855 | 814 | ||
856 | if(w->inherits("QComboBox") || w->inherits("QProgressBar") || | 815 | if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { |
857 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | ||
858 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | ||
859 | w->installEventFilter(this); | ||
860 | } | ||
861 | if(w->inherits("QLineEdit")){ | ||
862 | QPalette pal = w->palette(); | ||
863 | pal.setBrush(QColorGroup::Base, baseBrush); | ||
864 | w->setPalette(pal); | ||
865 | } | ||
866 | if(w->inherits("QPushButton")){ | ||
867 | applyCustomAttributes((QPushButton *)w); | ||
868 | w->installEventFilter(this); | 816 | w->installEventFilter(this); |
869 | } | 817 | } |
818 | |||
870 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 819 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
871 | w-> setBackgroundMode ( QWidget::PaletteBackground ); | 820 | w-> setBackgroundMode ( QWidget::PaletteBackground ); |
872 | w->setBackgroundOrigin ( QWidget::ParentOrigin); | 821 | w->setBackgroundOrigin ( QWidget::ParentOrigin); |
@@ -900,10 +849,13 @@ void LiquidStyle::polish(QWidget *w) | |||
900 | w->setMouseTracking(true); | 849 | w->setMouseTracking(true); |
901 | w->installEventFilter(this); | 850 | w->installEventFilter(this); |
902 | } | 851 | } |
903 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { | 852 | if(w-> inherits("QToolButton")) { |
904 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); | 853 | if (w->parent()->inherits("QToolBar")) { |
905 | if ( flatTBButtons ) | 854 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
906 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 855 | if ( flatTBButtons ) |
856 | w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
857 | } | ||
858 | w-> installEventFilter ( this ); | ||
907 | } | 859 | } |
908 | if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { | 860 | if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { |
909 | ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); | 861 | ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); |
@@ -971,25 +923,22 @@ void LiquidStyle::unPolish(QWidget *w) | |||
971 | if(isViewportChild) | 923 | if(isViewportChild) |
972 | w->setAutoMask(false); | 924 | w->setAutoMask(false); |
973 | 925 | ||
974 | if(w->inherits("QPushButton")){ | ||
975 | unapplyCustomAttributes((QPushButton *)w); | ||
976 | w->removeEventFilter(this); | ||
977 | } | ||
978 | /* | 926 | /* |
979 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 927 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
980 | w-> setBackgroundMode ( PaletteBackground ); | 928 | w-> setBackgroundMode ( PaletteBackground ); |
981 | } | 929 | } |
982 | */ | 930 | */ |
983 | if(w->inherits("QComboBox") || | 931 | if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { |
984 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 932 | w->removeEventFilter(this); |
985 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | ||
986 | w->removeEventFilter(this); | ||
987 | } | 933 | } |
988 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 934 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
989 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ | 935 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ |
990 | w->setAutoMask(false); | 936 | w->setAutoMask(false); |
991 | } | 937 | } |
992 | } | 938 | } |
939 | if(w-> inherits("QToolButton")) { | ||
940 | w-> removeEventFilter ( this ); | ||
941 | } | ||
993 | if(w->inherits("QToolBar")){ | 942 | if(w->inherits("QToolBar")){ |
994 | w->removeEventFilter(this); | 943 | w->removeEventFilter(this); |
995 | w->setBackgroundMode(QWidget::PaletteBackground); | 944 | w->setBackgroundMode(QWidget::PaletteBackground); |
@@ -1095,6 +1044,26 @@ public: | |||
1095 | }; | 1044 | }; |
1096 | 1045 | ||
1097 | 1046 | ||
1047 | /* | ||
1048 | * The same for QToolButton: | ||
1049 | * TT hardcoded the drawing of the focus rect ... | ||
1050 | * | ||
1051 | * - sandman | ||
1052 | */ | ||
1053 | |||
1054 | |||
1055 | class HackToolButton : public QToolButton { | ||
1056 | public: | ||
1057 | HackToolButton ( ); | ||
1058 | |||
1059 | void paint ( QPaintEvent *ev ) | ||
1060 | { | ||
1061 | erase ( ev-> region ( )); | ||
1062 | QPainter p ( this ); | ||
1063 | style ( ). drawToolButton ( this, &p ); | ||
1064 | drawButtonLabel ( &p ); | ||
1065 | } | ||
1066 | }; | ||
1098 | 1067 | ||
1099 | /* | 1068 | /* |
1100 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to | 1069 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to |
@@ -1128,75 +1097,27 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | |||
1128 | 1097 | ||
1129 | } | 1098 | } |
1130 | } | 1099 | } |
1131 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | ||
1132 | QWidget *btn = (QWidget *)obj; | ||
1133 | if(ev->type() == QEvent::Enter){ | ||
1134 | if(btn->isEnabled()){ | ||
1135 | highlightWidget = btn; | ||
1136 | btn->repaint(false); | ||
1137 | } | ||
1138 | } | ||
1139 | else if(ev->type() == QEvent::Leave){ | ||
1140 | if(btn == highlightWidget){ | ||
1141 | highlightWidget = NULL; | ||
1142 | btn->repaint(false); | ||
1143 | } | ||
1144 | } | ||
1145 | } | ||
1146 | else if(obj->inherits("QToolButton")){ | 1100 | else if(obj->inherits("QToolButton")){ |
1147 | QToolButton *btn = (QToolButton *)btn; | 1101 | QToolButton *btn = (QToolButton *)obj; |
1148 | if(!btn->autoRaise()){ | 1102 | if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () |
1149 | if(btn->isEnabled()){ | 1103 | if(btn->isEnabled()){ |
1150 | highlightWidget = btn; | 1104 | highlightWidget = btn; |
1151 | btn->repaint(false); | 1105 | btn->repaint(false); |
1106 | |||
1107 | qDebug ( "TB FOCUS IN [%p]", btn ); | ||
1152 | } | 1108 | } |
1153 | } | 1109 | } |
1154 | else if(ev->type() == QEvent::Leave){ | 1110 | else if(ev->type() == QEvent::FocusOut ){ |
1155 | QWidget *btn = (QWidget *)obj; | ||
1156 | if(btn == highlightWidget){ | 1111 | if(btn == highlightWidget){ |
1157 | highlightWidget = NULL; | 1112 | highlightWidget = NULL; |
1158 | btn->repaint(false); | 1113 | btn->repaint(false); |
1114 | |||
1115 | qDebug ( "TB FOCUS OUT [%p]", btn ); | ||
1159 | } | 1116 | } |
1160 | } | 1117 | } |
1161 | else | 1118 | else if(ev->type() == QEvent::Paint) { |
1162 | highlightWidget = NULL; | 1119 | (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev ); |
1163 | } | 1120 | return true; |
1164 | else if(obj->inherits("QScrollBar")){ | ||
1165 | QScrollBar *sb = (QScrollBar *)obj; | ||
1166 | if(ev->type() == QEvent::Enter){ | ||
1167 | if(sb->isEnabled()){ | ||
1168 | highlightWidget = sb; | ||
1169 | sb->repaint(false); | ||
1170 | } | ||
1171 | } | ||
1172 | else if(ev->type() == QEvent::Leave){ | ||
1173 | if(sb == highlightWidget && !sb->draggingSlider()){ | ||
1174 | highlightWidget = NULL; | ||
1175 | sb->repaint(false); | ||
1176 | } | ||
1177 | } | ||
1178 | else if(ev->type() == QEvent::MouseButtonRelease){ | ||
1179 | QMouseEvent *me = (QMouseEvent *)ev; | ||
1180 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ | ||
1181 | highlightWidget = NULL; | ||
1182 | sb->repaint(false); | ||
1183 | } | ||
1184 | } | ||
1185 | } | ||
1186 | else if(obj->inherits("QLineEdit")){ | ||
1187 | if(obj->parent() && obj->parent()->inherits("QComboBox")){ | ||
1188 | QWidget *btn = (QComboBox *)obj->parent(); | ||
1189 | if(ev->type() == QEvent::Enter){ | ||
1190 | if (btn->isEnabled()){ | ||
1191 | highlightWidget = btn; | ||
1192 | btn->repaint(false); | ||
1193 | } | ||
1194 | } | ||
1195 | else if(ev->type() == QEvent::Leave){ | ||
1196 | if (btn == highlightWidget) | ||
1197 | highlightWidget = NULL; | ||
1198 | btn->repaint(false); | ||
1199 | } | ||
1200 | } | 1121 | } |
1201 | } | 1122 | } |
1202 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ | 1123 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ |
@@ -1212,6 +1133,7 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | |||
1212 | QSize sz = isRadio ? exclusiveIndicatorSize() | 1133 | QSize sz = isRadio ? exclusiveIndicatorSize() |
1213 | : indicatorSize(); | 1134 | : indicatorSize(); |
1214 | 1135 | ||
1136 | /* | ||
1215 | if(btn->hasFocus()){ | 1137 | if(btn->hasFocus()){ |
1216 | QRect r = QRect(0, 0, btn->width(), btn->height()); | 1138 | QRect r = QRect(0, 0, btn->width(), btn->height()); |
1217 | p.setPen(btn->colorGroup().button().dark(140)); | 1139 | p.setPen(btn->colorGroup().button().dark(140)); |
@@ -1220,7 +1142,8 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | |||
1220 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); | 1142 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); |
1221 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); | 1143 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); |
1222 | } | 1144 | } |
1223 | int x = 0; | 1145 | */ |
1146 | int x = 0; | ||
1224 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | 1147 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; |
1225 | if(isRadio) | 1148 | if(isRadio) |
1226 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | 1149 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), |
@@ -1239,36 +1162,6 @@ bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | |||
1239 | p.end(); | 1162 | p.end(); |
1240 | return(true); | 1163 | return(true); |
1241 | } | 1164 | } |
1242 | // for hover, just redraw the indicator (not the text) | ||
1243 | else if((ev->type() == QEvent::Enter && btn->isEnabled()) || | ||
1244 | (ev->type() == QEvent::Leave && btn == highlightWidget)){ | ||
1245 | QButton *btn = (QButton *)obj; | ||
1246 | bool isRadio = obj->inherits("QRadioButton"); | ||
1247 | |||
1248 | if(ev->type() == QEvent::Enter) | ||
1249 | highlightWidget = btn; | ||
1250 | else | ||
1251 | highlightWidget = NULL; | ||
1252 | QFontMetrics fm = btn->fontMetrics(); | ||
1253 | QSize lsz = fm.size(ShowPrefix, btn->text()); | ||
1254 | QSize sz = isRadio ? exclusiveIndicatorSize() | ||
1255 | : indicatorSize(); | ||
1256 | int x = 0; | ||
1257 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | ||
1258 | //if(btn->autoMask()) | ||
1259 | // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); | ||
1260 | QPainter p; | ||
1261 | p.begin(btn); | ||
1262 | if(isRadio) | ||
1263 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | ||
1264 | btn->colorGroup(), btn->isOn(), | ||
1265 | btn->isDown(), btn->isEnabled()); | ||
1266 | else | ||
1267 | drawIndicator(&p, x, y, sz.width(), sz.height(), | ||
1268 | btn->colorGroup(), btn->state(), btn->isDown(), | ||
1269 | btn->isEnabled()); | ||
1270 | p.end(); | ||
1271 | } | ||
1272 | } | 1165 | } |
1273 | else if(obj->inherits("QHeader")){ | 1166 | else if(obj->inherits("QHeader")){ |
1274 | QHeader *hw = (QHeader *)obj; | 1167 | QHeader *hw = (QHeader *)obj; |
@@ -1353,8 +1246,11 @@ void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, | |||
1353 | } | 1246 | } |
1354 | 1247 | ||
1355 | p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | 1248 | p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); |
1249 | qDebug ( "DRAW TOOLBUTTON IN PIXMAP" ); | ||
1356 | } | 1250 | } |
1357 | else{ | 1251 | else{ |
1252 | qDebug ( "DRAW TOOLBUTTON sunken=%d/high=%p/device=%p", sunken, highlightWidget,p->device() ); | ||
1253 | |||
1358 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : | 1254 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : |
1359 | highlightWidget == p->device() ? g.button().light(110) : | 1255 | highlightWidget == p->device() ? g.button().light(110) : |
1360 | g.background(), g.background()); | 1256 | g.background(), g.background()); |
@@ -1511,7 +1407,20 @@ void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, | |||
1511 | const QColorGroup &g, bool sunken, | 1407 | const QColorGroup &g, bool sunken, |
1512 | bool edit, bool, const QBrush *) | 1408 | bool edit, bool, const QBrush *) |
1513 | { | 1409 | { |
1514 | bool isHover = highlightWidget == painter->device(); | 1410 | bool isActive = false; |
1411 | if (( painter->device()->devType() == QInternal::Widget ) && | ||
1412 | ( | ||
1413 | ( qApp-> focusWidget ( ) == painter-> device ( )) || | ||
1414 | ( | ||
1415 | edit && | ||
1416 | ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) && | ||
1417 | ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( )) | ||
1418 | ) | ||
1419 | ) | ||
1420 | ) { | ||
1421 | isActive = true; | ||
1422 | } | ||
1423 | |||
1515 | bool isMasked = false; | 1424 | bool isMasked = false; |
1516 | if(painter->device()->devType() == QInternal::Widget) | 1425 | if(painter->device()->devType() == QInternal::Widget) |
1517 | isMasked = ((QWidget*)painter->device())->autoMask(); | 1426 | isMasked = ((QWidget*)painter->device())->autoMask(); |
@@ -1521,7 +1430,7 @@ void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, | |||
1521 | 1430 | ||
1522 | drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, | 1431 | drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, |
1523 | sunken, false, isMasked); | 1432 | sunken, false, isMasked); |
1524 | if(!isHover){ | 1433 | if(!isActive){ |
1525 | p.setClipRect(0, 0, w-17, h); | 1434 | p.setClipRect(0, 0, w-17, h); |
1526 | drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, | 1435 | drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, |
1527 | sunken, false, isMasked); | 1436 | sunken, false, isMasked); |
@@ -1573,16 +1482,17 @@ QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h) | |||
1573 | return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); | 1482 | return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); |
1574 | } | 1483 | } |
1575 | 1484 | ||
1576 | QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) | 1485 | QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) |
1577 | { | 1486 | { |
1578 | return(QRect(x+5, y+3, w-(h/3)-13, h-5)); | 1487 | return QRect ( ); |
1488 | |||
1489 | // return(QRect(x+5, y+3, w-(h/3)-13, h-5)); | ||
1579 | } | 1490 | } |
1580 | 1491 | ||
1581 | void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, | 1492 | void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, |
1582 | int sliderStart, uint controls, | 1493 | int sliderStart, uint controls, |
1583 | uint activeControl) | 1494 | uint activeControl) |
1584 | { | 1495 | { |
1585 | bool isHover = highlightWidget == p->device(); | ||
1586 | int sliderMin, sliderMax, sliderLength, buttonDim; | 1496 | int sliderMin, sliderMax, sliderLength, buttonDim; |
1587 | scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); | 1497 | scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); |
1588 | 1498 | ||
@@ -1671,25 +1581,15 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, | |||
1671 | } | 1581 | } |
1672 | if(controls & Slider){ | 1582 | if(controls & Slider){ |
1673 | if(sliderR.height() >= 16){ | 1583 | if(sliderR.height() >= 16){ |
1674 | painter.drawPixmap(sliderR.x()+1, sliderR.y(), | 1584 | painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop)); |
1675 | isHover ? *getPixmap(VSBSliderTopHover): | ||
1676 | *getPixmap(VSBSliderTop)); | ||
1677 | painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, | 1585 | painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, |
1678 | sliderR.height()-16, isHover ? | 1586 | sliderR.height()-16, *getPixmap(VSBSliderMid)); |
1679 | *getPixmap(VSBSliderMidHover) : | 1587 | painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm)); |
1680 | *getPixmap(VSBSliderMid)); | ||
1681 | painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, | ||
1682 | isHover ? *getPixmap(VSBSliderBtmHover) : | ||
1683 | *getPixmap(VSBSliderBtm)); | ||
1684 | } | 1588 | } |
1685 | else if(sliderR.height() >= 8){ | 1589 | else if(sliderR.height() >= 8){ |
1686 | int m = sliderR.height()/2; | 1590 | int m = sliderR.height()/2; |
1687 | painter.drawPixmap(sliderR.x()+1, sliderR.y(), | 1591 | painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m); |
1688 | isHover ? *getPixmap(VSBSliderTopHover): | 1592 | painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); |
1689 | *getPixmap(VSBSliderTop), 0, 0, 13, m); | ||
1690 | painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, | ||
1691 | isHover ? *getPixmap(VSBSliderBtmHover): | ||
1692 | *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); | ||
1693 | } | 1593 | } |
1694 | else{ | 1594 | else{ |
1695 | painter.setPen(g.button().dark(210)); | 1595 | painter.setPen(g.button().dark(210)); |
@@ -1697,7 +1597,6 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, | |||
1697 | 13, sliderR.height()); | 1597 | 13, sliderR.height()); |
1698 | painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, | 1598 | painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, |
1699 | 11, sliderR.height()-2, | 1599 | 11, sliderR.height()-2, |
1700 | isHover ? *getPixmap(VSBSliderMidHover) : | ||
1701 | *getPixmap(VSBSliderMid), 1, 0); | 1600 | *getPixmap(VSBSliderMid), 1, 0); |
1702 | } | 1601 | } |
1703 | } | 1602 | } |
@@ -1738,22 +1637,17 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, | |||
1738 | if(controls & Slider){ | 1637 | if(controls & Slider){ |
1739 | if(sliderR.width() >= 16){ | 1638 | if(sliderR.width() >= 16){ |
1740 | painter.drawPixmap(sliderR.x(), sliderR.y()+1, | 1639 | painter.drawPixmap(sliderR.x(), sliderR.y()+1, |
1741 | isHover ? *getPixmap(HSBSliderTopHover) : | ||
1742 | *getPixmap(HSBSliderTop)); | 1640 | *getPixmap(HSBSliderTop)); |
1743 | painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, | 1641 | painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, |
1744 | 13, isHover ? *getPixmap(HSBSliderMidHover) : | 1642 | 13, *getPixmap(HSBSliderMid)); |
1745 | *getPixmap(HSBSliderMid)); | 1643 | painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, |
1746 | painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? | ||
1747 | *getPixmap(HSBSliderBtmHover) : | ||
1748 | *getPixmap(HSBSliderBtm)); | 1644 | *getPixmap(HSBSliderBtm)); |
1749 | } | 1645 | } |
1750 | else if(sliderR.width() >= 8){ | 1646 | else if(sliderR.width() >= 8){ |
1751 | int m = sliderR.width()/2; | 1647 | int m = sliderR.width()/2; |
1752 | painter.drawPixmap(sliderR.x(), sliderR.y()+1, | 1648 | painter.drawPixmap(sliderR.x(), sliderR.y()+1, |
1753 | isHover ? *getPixmap(HSBSliderTopHover) : | ||
1754 | *getPixmap(HSBSliderTop), 0, 0, m, 13); | 1649 | *getPixmap(HSBSliderTop), 0, 0, m, 13); |
1755 | painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? | 1650 | painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, |
1756 | *getPixmap(HSBSliderBtmHover) : | ||
1757 | *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); | 1651 | *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); |
1758 | } | 1652 | } |
1759 | else{ | 1653 | else{ |
@@ -1761,8 +1655,7 @@ void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, | |||
1761 | drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, | 1655 | drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, |
1762 | sliderR.width(), 13); | 1656 | sliderR.width(), 13); |
1763 | painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, | 1657 | painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, |
1764 | sliderR.width()-2, 11, isHover ? | 1658 | sliderR.width()-2, 11, |
1765 | *getPixmap(HSBSliderMidHover) : | ||
1766 | *getPixmap(HSBSliderMid), 0, 1); | 1659 | *getPixmap(HSBSliderMid), 0, 1); |
1767 | } | 1660 | } |
1768 | } | 1661 | } |
@@ -1941,27 +1834,27 @@ void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, | |||
1941 | int /*h*/, const QColorGroup &/*g*/, bool on, | 1834 | int /*h*/, const QColorGroup &/*g*/, bool on, |
1942 | bool down, bool) | 1835 | bool down, bool) |
1943 | { | 1836 | { |
1944 | bool isHover = highlightWidget == p->device(); | 1837 | bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); |
1945 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget | 1838 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget |
1946 | && ((QWidget*)p->device())->autoMask(); | 1839 | && ((QWidget*)p->device())->autoMask(); |
1947 | 1840 | ||
1948 | if(isMasked){ | 1841 | if(isMasked){ |
1949 | if(on || down){ | 1842 | if(on || down){ |
1950 | p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : | 1843 | p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) : |
1951 | *getPixmap(HTMLRadioDown)); | 1844 | *getPixmap(HTMLRadioDown)); |
1952 | } | 1845 | } |
1953 | else | 1846 | else |
1954 | p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : | 1847 | p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) : |
1955 | *getPixmap(HTMLRadio)); | 1848 | *getPixmap(HTMLRadio)); |
1956 | 1849 | ||
1957 | } | 1850 | } |
1958 | else{ | 1851 | else{ |
1959 | if(on || down){ | 1852 | if(on || down){ |
1960 | p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : | 1853 | p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) : |
1961 | *getPixmap(RadioOn)); | 1854 | *getPixmap(RadioOn)); |
1962 | } | 1855 | } |
1963 | else | 1856 | else |
1964 | p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : | 1857 | p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) : |
1965 | *getPixmap(RadioOff)); | 1858 | *getPixmap(RadioOff)); |
1966 | } | 1859 | } |
1967 | } | 1860 | } |
@@ -1983,22 +1876,22 @@ QSize LiquidStyle::indicatorSize() const | |||
1983 | void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 1876 | void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
1984 | const QColorGroup &/*g*/, int state, bool /*down*/, bool) | 1877 | const QColorGroup &/*g*/, int state, bool /*down*/, bool) |
1985 | { | 1878 | { |
1986 | bool isHover = highlightWidget == p->device(); | 1879 | bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); |
1987 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget | 1880 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget |
1988 | && ((QWidget*)p->device())->autoMask(); | 1881 | && ((QWidget*)p->device())->autoMask(); |
1989 | if(isMasked){ | 1882 | if(isMasked){ |
1990 | if(state != QButton::Off){ | 1883 | if(state != QButton::Off){ |
1991 | p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : | 1884 | p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) : |
1992 | *getPixmap(HTMLCBDown)); | 1885 | *getPixmap(HTMLCBDown)); |
1993 | } | 1886 | } |
1994 | else | 1887 | else |
1995 | p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : | 1888 | p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) : |
1996 | *getPixmap(HTMLCB)); | 1889 | *getPixmap(HTMLCB)); |
1997 | 1890 | ||
1998 | } | 1891 | } |
1999 | else{ | 1892 | else{ |
2000 | if(state != QButton::Off){ | 1893 | if(state != QButton::Off){ |
2001 | p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : | 1894 | p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) : |
2002 | *getPixmap(CBDown)); | 1895 | *getPixmap(CBDown)); |
2003 | /* Todo - tristate | 1896 | /* Todo - tristate |
2004 | if(state == QButton::On){ | 1897 | if(state == QButton::On){ |
@@ -2015,7 +1908,7 @@ void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, | |||
2015 | }*/ | 1908 | }*/ |
2016 | } | 1909 | } |
2017 | else | 1910 | else |
2018 | p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); | 1911 | p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB)); |
2019 | } | 1912 | } |
2020 | } | 1913 | } |
2021 | 1914 | ||
@@ -2360,7 +2253,7 @@ void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | |||
2360 | if(p->device()->devType() == QInternal::Widget){ | 2253 | if(p->device()->devType() == QInternal::Widget){ |
2361 | // if so does it use a special focus rectangle? | 2254 | // if so does it use a special focus rectangle? |
2362 | QWidget *w = (QWidget *)p->device(); | 2255 | QWidget *w = (QWidget *)p->device(); |
2363 | if(w->inherits("QPushButton") || w->inherits("QSlider")){ | 2256 | if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ |
2364 | return; | 2257 | return; |
2365 | } | 2258 | } |
2366 | else{ | 2259 | else{ |
@@ -2713,109 +2606,5 @@ void LiquidStyle::drawSliderGrooveMask (QPainter * p, int x, int y, int w, | |||
2713 | } | 2606 | } |
2714 | } | 2607 | } |
2715 | 2608 | ||
2716 | // I'm debating if to use QValueList or QList here. I like QValueList better, | ||
2717 | // but QList handles pointers which is good for a lot of empty icons... | ||
2718 | |||
2719 | void LiquidStyle::loadCustomButtons() | ||
2720 | { | ||
2721 | return; // TODO | ||
2722 | customBtnColorList.clear(); | ||
2723 | customBtnIconList.clear(); | ||
2724 | customBtnLabelList.clear(); | ||
2725 | |||
2726 | // KConfig *config = KGlobal::config(); | ||
2727 | // QString oldGrp = config->group(); | ||
2728 | // config->setGroup("MosfetButtons"); | ||
2729 | |||
2730 | QStrList iconList, colorList; //temp, we store QPixmaps and QColors | ||
2731 | iconList.setAutoDelete(true); | ||
2732 | colorList.setAutoDelete(true); | ||
2733 | // config->readListEntry("Labels", customBtnLabelList); | ||
2734 | // config->readListEntry("Icons", iconList); | ||
2735 | // config->readListEntry("Colors", colorList); | ||
2736 | |||
2737 | const char *labelStr = customBtnLabelList.first(); | ||
2738 | const char *colorStr = colorList.first(); | ||
2739 | const char *iconStr = iconList.first(); | ||
2740 | |||
2741 | // KIconLoader *ldr = KGlobal::iconLoader(); | ||
2742 | while(labelStr != NULL){ | ||
2743 | QColor *c = new QColor; | ||
2744 | c->setNamedColor(QString(colorStr)); | ||
2745 | customBtnColorList.append(c); | ||
2746 | |||
2747 | QString tmpStr(iconStr); | ||
2748 | if(!tmpStr.isEmpty()){ | ||
2749 | QPixmap *pixmap = | ||
2750 | new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); | ||
2751 | if(pixmap->isNull()){ | ||
2752 | delete pixmap; | ||
2753 | customBtnIconList.append(NULL); | ||
2754 | } | ||
2755 | else | ||
2756 | customBtnIconList.append(pixmap); | ||
2757 | } | ||
2758 | else | ||
2759 | customBtnIconList.append(NULL); | ||
2760 | |||
2761 | labelStr = customBtnLabelList.next(); | ||
2762 | colorStr = colorList.next(); | ||
2763 | iconStr = iconList.next(); | ||
2764 | } | ||
2765 | } | ||
2766 | |||
2767 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) | ||
2768 | { | ||
2769 | return; // TODO | ||
2770 | QString str = btn->text(); | ||
2771 | if(str.isEmpty()) | ||
2772 | return; | ||
2773 | while(str.contains('&') != 0) | ||
2774 | str = str.remove(str.find('&'), 1); | ||
2775 | |||
2776 | const char *s; | ||
2777 | int idx = 0; | ||
2778 | for(s = customBtnLabelList.first(); s != NULL; | ||
2779 | ++idx, s = customBtnLabelList.next()){ | ||
2780 | if(qstricmp(s, str.latin1()) == 0){ | ||
2781 | QPalette pal = btn->palette(); | ||
2782 | pal.setColor(QColorGroup::Button, | ||
2783 | *customBtnColorList.at(idx)); | ||
2784 | btn->setPalette(pal); | ||
2785 | /* | ||
2786 | if(customBtnIconList.at(idx) != NULL){ | ||
2787 | QPixmap *pix = customBtnIconList.at(idx); | ||
2788 | btn->setIconSet(QIconSet(*pix)); | ||
2789 | }*/ | ||
2790 | break; | ||
2791 | } | ||
2792 | } | ||
2793 | } | ||
2794 | |||
2795 | void LiquidStyle::unapplyCustomAttributes(QPushButton *btn) | ||
2796 | { | ||
2797 | return; // TODO | ||
2798 | QString str = btn->text(); | ||
2799 | if(str.isEmpty()) | ||
2800 | return; | ||
2801 | while(str.contains('&') != 0) | ||
2802 | str = str.remove(str.find('&'), 1); | ||
2803 | |||
2804 | const char *s; | ||
2805 | for(s = customBtnLabelList.first(); s != NULL; s = customBtnLabelList.next()){ | ||
2806 | if(qstricmp(s, str.latin1()) == 0){ | ||
2807 | btn->setPalette(QApplication::palette()); | ||
2808 | btn->setIconSet(QIconSet()); | ||
2809 | break; | ||
2810 | } | ||
2811 | } | ||
2812 | } | ||
2813 | |||
2814 | // #include "liquid.moc" | ||
2815 | |||
2816 | |||
2817 | |||
2818 | |||
2819 | |||
2820 | 2609 | ||
2821 | /* vim: set noet sw=8 ts=8: */ | 2610 | /* vim: set noet sw=8 ts=8: */ |
diff --git a/noncore/styles/liquid/liquid.h b/noncore/styles/liquid/liquid.h index 00cfb35..0582c9a 100644 --- a/noncore/styles/liquid/liquid.h +++ b/noncore/styles/liquid/liquid.h | |||
@@ -171,26 +171,15 @@ protected: | |||
171 | void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, | 171 | void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, |
172 | bool down=false, bool fast = true); | 172 | bool down=false, bool fast = true); |
173 | void drawRoundRect(QPainter *p, int x, int y, int w, int h); | 173 | void drawRoundRect(QPainter *p, int x, int y, int w, int h); |
174 | void loadCustomButtons(); | ||
175 | void applyCustomAttributes(QPushButton *btn); | ||
176 | void unapplyCustomAttributes(QPushButton *btn); | ||
177 | QPixmap* getPixmap(BitmapData item); | 174 | QPixmap* getPixmap(BitmapData item); |
178 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); | 175 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); |
179 | private: | 176 | private: |
177 | bool oldqte; | ||
180 | bool flatTBButtons; | 178 | bool flatTBButtons; |
181 | bool highcolor; | ||
182 | QColorGroup radioOnGrp; | ||
183 | QWidget *highlightWidget; | 179 | QWidget *highlightWidget; |
184 | QBrush wallpaper; | ||
185 | QBitmap lightBmp; | ||
186 | QBitmap grayBmp; | ||
187 | QBitmap dgrayBmp; | ||
188 | QBitmap maskBmp; | ||
189 | QBitmap xBmp; | ||
190 | QBitmap btnMaskBmp, htmlBtnMaskBmp; | 180 | QBitmap btnMaskBmp, htmlBtnMaskBmp; |
191 | QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; | 181 | QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; |
192 | QBitmap paper1, paper2, paper3; | 182 | QBrush bgBrush, menuBrush; |
193 | QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; | ||
194 | bool menuAni, menuFade; | 183 | bool menuAni, menuFade; |
195 | 184 | ||
196 | QIntDict<QPixmap>btnDict; | 185 | QIntDict<QPixmap>btnDict; |
@@ -198,9 +187,6 @@ private: | |||
198 | QIntDict<QPixmap>bevelFillDict; | 187 | QIntDict<QPixmap>bevelFillDict; |
199 | QIntDict<QPixmap>smallBevelFillDict; | 188 | QIntDict<QPixmap>smallBevelFillDict; |
200 | 189 | ||
201 | QList<QColor>customBtnColorList; | ||
202 | QList<QPixmap>customBtnIconList; | ||
203 | QStrList customBtnLabelList; | ||
204 | QPixmap *vsbSliderFillPix; | 190 | QPixmap *vsbSliderFillPix; |
205 | TransMenuHandler *menuHandler; | 191 | TransMenuHandler *menuHandler; |
206 | QPixmap *pixmaps[BITMAP_ITEMS]; | 192 | QPixmap *pixmaps[BITMAP_ITEMS]; |
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff index f3531e5..29ae6f3 100644 --- a/noncore/styles/liquid/opie-liquid.diff +++ b/noncore/styles/liquid/opie-liquid.diff | |||
@@ -3,8 +3,8 @@ Features: | |||
3 | - Qt-only | 3 | - Qt-only |
4 | - works with Qt/E on QPE/OPIE | 4 | - works with Qt/E on QPE/OPIE |
5 | 5 | ||
6 | --- -2002-10-24 03:19:30.000000000 +0200 | 6 | --- -2002-11-18 04:47:41.000000000 +0100 |
7 | +++ liquid.h2002-07-15 02:52:50.000000000 +0200 | 7 | +++ liquid.h2002-11-18 03:32:40.000000000 +0100 |
8 | @@ -2,7 +2,7 @@ | 8 | @@ -2,7 +2,7 @@ |
9 | #define LIQUID_STYLE_H | 9 | #define LIQUID_STYLE_H |
10 | 10 | ||
@@ -102,17 +102,58 @@ Features: | |||
102 | // for repainting toolbuttons when the toolbar is resized | 102 | // for repainting toolbuttons when the toolbar is resized |
103 | bool eventFilter(QObject *obj, QEvent *ev); | 103 | bool eventFilter(QObject *obj, QEvent *ev); |
104 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, | 104 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, |
105 | @@ -204,6 +177,7 @@ | 105 | @@ -198,25 +171,15 @@ |
106 | void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, | ||
107 | bool down=false, bool fast = true); | ||
108 | void drawRoundRect(QPainter *p, int x, int y, int w, int h); | ||
109 | - void loadCustomButtons(); | ||
110 | - void applyCustomAttributes(QPushButton *btn); | ||
111 | - void unapplyCustomAttributes(QPushButton *btn); | ||
106 | QPixmap* getPixmap(BitmapData item); | 112 | QPixmap* getPixmap(BitmapData item); |
107 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); | 113 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); |
108 | private: | 114 | private: |
115 | - bool highcolor; | ||
116 | - QColorGroup radioOnGrp; | ||
117 | +bool oldqte; | ||
109 | +bool flatTBButtons; | 118 | +bool flatTBButtons; |
110 | bool highcolor; | ||
111 | QColorGroup radioOnGrp; | ||
112 | QWidget *highlightWidget; | 119 | QWidget *highlightWidget; |
113 | --- -2002-10-24 03:19:31.000000000 +0200 | 120 | - QBrush wallpaper; |
114 | +++ liquid.cpp2002-10-24 03:18:15.000000000 +0200 | 121 | - QBitmap lightBmp; |
115 | @@ -10,12 +10,10 @@ | 122 | - QBitmap grayBmp; |
123 | - QBitmap dgrayBmp; | ||
124 | - QBitmap maskBmp; | ||
125 | - QBitmap xBmp; | ||
126 | QBitmap btnMaskBmp, htmlBtnMaskBmp; | ||
127 | QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; | ||
128 | - QBitmap paper1, paper2, paper3; | ||
129 | - QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; | ||
130 | + QBrush bgBrush, menuBrush; | ||
131 | bool menuAni, menuFade; | ||
132 | |||
133 | QIntDict<QPixmap>btnDict; | ||
134 | @@ -224,9 +187,6 @@ | ||
135 | QIntDict<QPixmap>bevelFillDict; | ||
136 | QIntDict<QPixmap>smallBevelFillDict; | ||
137 | |||
138 | - QList<QColor>customBtnColorList; | ||
139 | - QList<QPixmap>customBtnIconList; | ||
140 | - QStrList customBtnLabelList; | ||
141 | QPixmap *vsbSliderFillPix; | ||
142 | TransMenuHandler *menuHandler; | ||
143 | QPixmap *pixmaps[BITMAP_ITEMS]; | ||
144 | --- -2002-11-18 04:47:41.000000000 +0100 | ||
145 | +++ liquid.cpp2002-11-18 04:46:13.000000000 +0100 | ||
146 | @@ -2,6 +2,9 @@ | ||
147 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. | ||
148 | */ | ||
149 | |||
150 | +// | ||
151 | +// (c) 2002 Robert 'sandman' Griebl | ||
152 | +// | ||
153 | |||
154 | |||
155 | #ifndef INCLUDE_MENUITEM_DEF | ||
156 | @@ -10,12 +13,10 @@ | ||
116 | 157 | ||
117 | #include <qmenudata.h> | 158 | #include <qmenudata.h> |
118 | #include "liquid.h" | 159 | #include "liquid.h" |
@@ -129,7 +170,7 @@ Features: | |||
129 | #include <qpalette.h> | 170 | #include <qpalette.h> |
130 | #include <qbitmap.h> | 171 | #include <qbitmap.h> |
131 | #include <qtabbar.h> | 172 | #include <qtabbar.h> |
132 | @@ -25,28 +23,29 @@ | 173 | @@ -25,28 +26,30 @@ |
133 | #include <qtimer.h> | 174 | #include <qtimer.h> |
134 | #include <qpixmapcache.h> | 175 | #include <qpixmapcache.h> |
135 | #include <qradiobutton.h> | 176 | #include <qradiobutton.h> |
@@ -147,6 +188,7 @@ Features: | |||
147 | -#include <kipc.h> | 188 | -#include <kipc.h> |
148 | +#include <qmenubar.h> | 189 | +#include <qmenubar.h> |
149 | +#include <qprogressbar.h> | 190 | +#include <qprogressbar.h> |
191 | +#include <qlineedit.h> | ||
150 | 192 | ||
151 | -#include <X11/X.h> | 193 | -#include <X11/X.h> |
152 | -#include <X11/Xlib.h> | 194 | -#include <X11/Xlib.h> |
@@ -169,7 +211,7 @@ Features: | |||
169 | int x, y; | 211 | int x, y; |
170 | int r, g, b; | 212 | int r, g, b; |
171 | for(y=0; y < img.height(); y+=3){ | 213 | for(y=0; y < img.height(); y+=3){ |
172 | @@ -71,35 +70,37 @@ | 214 | @@ -71,35 +74,37 @@ |
173 | : QObject(parent) | 215 | : QObject(parent) |
174 | { | 216 | { |
175 | pixDict.setAutoDelete(true); | 217 | pixDict.setAutoDelete(true); |
@@ -220,7 +262,7 @@ Features: | |||
220 | if(p->testWFlags(Qt::WType_Popup)){ | 262 | if(p->testWFlags(Qt::WType_Popup)){ |
221 | QRect r(p->x(), p->y(), p->width(), p->height()); | 263 | QRect r(p->x(), p->y(), p->width(), p->height()); |
222 | QRect deskR = QApplication::desktop()->rect(); | 264 | QRect deskR = QApplication::desktop()->rect(); |
223 | @@ -107,7 +108,7 @@ | 265 | @@ -107,7 +112,7 @@ |
224 | r.setBottom(deskR.bottom()); | 266 | r.setBottom(deskR.bottom()); |
225 | r.setRight(deskR.right()); | 267 | r.setRight(deskR.right()); |
226 | } | 268 | } |
@@ -229,7 +271,7 @@ Features: | |||
229 | r.width(), r.height()); | 271 | r.width(), r.height()); |
230 | } | 272 | } |
231 | else{ // tear off menu | 273 | else{ // tear off menu |
232 | @@ -121,82 +122,53 @@ | 274 | @@ -121,82 +126,61 @@ |
233 | stripePixmap(*pix, p->colorGroup().button()); | 275 | stripePixmap(*pix, p->colorGroup().button()); |
234 | } | 276 | } |
235 | else{ | 277 | else{ |
@@ -266,11 +308,11 @@ Features: | |||
266 | -{ | 308 | -{ |
267 | - if(id == LIQUID_MENU_CHANGE){ | 309 | - if(id == LIQUID_MENU_CHANGE){ |
268 | - bool oldShadow = shadowText; | 310 | - bool oldShadow = shadowText; |
269 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 311 | - |
270 | |||
271 | - KConfig *config = KGlobal::config(); | 312 | - KConfig *config = KGlobal::config(); |
272 | - config->reparseConfiguration(); // in case KControl changed values | 313 | - config->reparseConfiguration(); // in case KControl changed values |
273 | - | 314 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
315 | |||
274 | - // Make sure no popupmenus are shown. There shouldn't be any because | 316 | - // Make sure no popupmenus are shown. There shouldn't be any because |
275 | - // the user just clicked "Apply", but there can be tear offs ;-) | 317 | - // the user just clicked "Apply", but there can be tear offs ;-) |
276 | - // We just close them so the pixmaps are deleted and regenerated. | 318 | - // We just close them so the pixmaps are deleted and regenerated. |
@@ -299,10 +341,9 @@ Features: | |||
299 | - ++it; | 341 | - ++it; |
300 | - if(w->inherits("QMenuBar")){ | 342 | - if(w->inherits("QMenuBar")){ |
301 | - w->repaint(); | 343 | - w->repaint(); |
344 | - } | ||
345 | - } | ||
302 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); | 346 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); |
303 | } | ||
304 | + delete ol; | ||
305 | } | ||
306 | } | 347 | } |
307 | - } | 348 | - } |
308 | - else if(id == MOSFET_BUTTON_CHANGE){ | 349 | - else if(id == MOSFET_BUTTON_CHANGE){ |
@@ -323,11 +364,18 @@ Features: | |||
323 | - ++it; | 364 | - ++it; |
324 | - if(w->inherits("QPushButton")){ | 365 | - if(w->inherits("QPushButton")){ |
325 | - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); | 366 | - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); |
326 | - } | 367 | + delete ol; |
327 | - } | 368 | } |
328 | - | 369 | } |
329 | - } | ||
330 | + return(false); | 370 | + return(false); |
371 | +} | ||
372 | |||
373 | - } | ||
374 | + | ||
375 | +static int qt_version ( ) | ||
376 | +{ | ||
377 | +const char *qver = qVersion ( ); | ||
378 | +return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | ||
331 | } | 379 | } |
332 | 380 | ||
333 | + | 381 | + |
@@ -337,12 +385,221 @@ Features: | |||
337 | { | 385 | { |
338 | + setName ( "LiquidStyle" ); | 386 | + setName ( "LiquidStyle" ); |
339 | + | 387 | + |
388 | +oldqte = ( qt_version ( ) < 234 ); | ||
340 | +flatTBButtons = false; | 389 | +flatTBButtons = false; |
341 | + | 390 | + |
342 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 391 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
343 | btnMaskBmp.setMask(btnMaskBmp); | 392 | btnMaskBmp.setMask(btnMaskBmp); |
344 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 393 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
345 | @@ -711,7 +683,6 @@ | 394 | @@ -207,12 +191,8 @@ |
395 | btnDict.setAutoDelete(true); | ||
396 | bevelFillDict.setAutoDelete(true); | ||
397 | smallBevelFillDict.setAutoDelete(true); | ||
398 | - customBtnColorList.setAutoDelete(true); | ||
399 | - customBtnIconList.setAutoDelete(true); | ||
400 | - customBtnLabelList.setAutoDelete(true); | ||
401 | |||
402 | rMatrix.rotate(270.0); | ||
403 | - highcolor = QPixmap::defaultDepth() > 8; | ||
404 | btnBorderPix = new QPixmap; | ||
405 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); | ||
406 | btnBlendPix = new QPixmap; | ||
407 | @@ -572,131 +552,119 @@ | ||
408 | case HTMLBtnBorderDown: | ||
409 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); | ||
410 | break; | ||
411 | + | ||
412 | case HTMLCB: | ||
413 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); | ||
414 | break; | ||
415 | + case HTMLCBHover: | ||
416 | + pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); | ||
417 | + break; | ||
418 | case HTMLCBDown: | ||
419 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); | ||
420 | break; | ||
421 | - case HTMLCBHover: | ||
422 | - pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); | ||
423 | - break; | ||
424 | case HTMLCBDownHover: | ||
425 | - pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", | ||
426 | - btnHoverH, btnHoverS, | ||
427 | - btnHoverV); | ||
428 | + pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); | ||
429 | break; | ||
430 | + | ||
431 | case HTMLRadio: | ||
432 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); | ||
433 | + break; | ||
434 | + case HTMLRadioHover: | ||
435 | + pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); | ||
436 | + break; | ||
437 | case HTMLRadioDown: | ||
438 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); | ||
439 | - case HTMLRadioHover: | ||
440 | - pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); | ||
441 | + break; | ||
442 | case HTMLRadioDownHover: | ||
443 | - pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", | ||
444 | - btnHoverH, btnHoverS, | ||
445 | - btnHoverV); | ||
446 | + pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); | ||
447 | + break; | ||
448 | + | ||
449 | + case RadioOff: | ||
450 | + pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); | ||
451 | + break; | ||
452 | + case RadioOffHover: | ||
453 | + pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); | ||
454 | + break; | ||
455 | case RadioOn: | ||
456 | - pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); | ||
457 | + pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); | ||
458 | break; | ||
459 | case RadioOnHover: | ||
460 | - pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, | ||
461 | - btnHoverV, true); | ||
462 | + pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); | ||
463 | break; | ||
464 | - case RadioOffHover: | ||
465 | - pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); | ||
466 | + | ||
467 | + case Tab: | ||
468 | + pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); | ||
469 | break; | ||
470 | case TabDown: | ||
471 | - pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); | ||
472 | + pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); | ||
473 | break; | ||
474 | case TabFocus: | ||
475 | - pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, | ||
476 | - btnHoverS, true); | ||
477 | - break; | ||
478 | - case CBDown: | ||
479 | - pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); | ||
480 | + pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); | ||
481 | break; | ||
482 | - case CBDownHover: | ||
483 | - pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, | ||
484 | - btnHoverS, btnHoverV, true); | ||
485 | + | ||
486 | +case CB: | ||
487 | + pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); | ||
488 | break; | ||
489 | case CBHover: | ||
490 | - pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); | ||
491 | + pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); | ||
492 | break; | ||
493 | - case HSlider: | ||
494 | - pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | ||
495 | + case CBDown: | ||
496 | + pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); | ||
497 | break; | ||
498 | + case CBDownHover: | ||
499 | + pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); | ||
500 | + break; | ||
501 | + | ||
502 | case VSlider: | ||
503 | - pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | ||
504 | + pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); | ||
505 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); | ||
506 | break; | ||
507 | - case RadioOff: | ||
508 | - pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); | ||
509 | - break; | ||
510 | - case Tab: | ||
511 | - pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); | ||
512 | - break; | ||
513 | - case CB: | ||
514 | - pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); | ||
515 | - break; | ||
516 | case VSBSliderTop: | ||
517 | - pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | ||
518 | + case VSBSliderTopHover: | ||
519 | + pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); | ||
520 | break; | ||
521 | case VSBSliderBtm: | ||
522 | - pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | ||
523 | + case VSBSliderBtmHover: | ||
524 | + pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); | ||
525 | break; | ||
526 | case VSBSliderMid: | ||
527 | - pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | ||
528 | + case VSBSliderMidHover: | ||
529 | + pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | ||
530 | break; | ||
531 | - case VSBSliderTopHover: | ||
532 | - pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | ||
533 | +case VSBSliderTopBg: | ||
534 | + pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); | ||
535 | break; | ||
536 | - case VSBSliderBtmHover: | ||
537 | - pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | ||
538 | + case VSBSliderBtmBg: | ||
539 | + pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); | ||
540 | break; | ||
541 | - case VSBSliderMidHover: | ||
542 | - pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | ||
543 | + case VSBSliderMidBg: | ||
544 | + pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | ||
545 | break; | ||
546 | |||
547 | - case HSBSliderTop: | ||
548 | - pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | ||
549 | - *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); | ||
550 | - break; | ||
551 | - case HSBSliderBtm: | ||
552 | - pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | ||
553 | - *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); | ||
554 | - break; | ||
555 | - case HSBSliderMid: | ||
556 | - pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | ||
557 | - *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); | ||
558 | +case HSlider: | ||
559 | + pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); | ||
560 | break; | ||
561 | + case HSBSliderTop: | ||
562 | case HSBSliderTopHover: | ||
563 | - pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | ||
564 | - *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); | ||
565 | + pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); | ||
566 | + *pixmaps[item] = pixmaps[item]->xForm(rMatrix); | ||
567 | break; | ||
568 | + case HSBSliderBtm: | ||
569 | case HSBSliderBtmHover: | ||
570 | - pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | ||
571 | - *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); | ||
572 | + pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); | ||
573 | + *pixmaps[item] = pixmaps[item]->xForm(rMatrix); | ||
574 | break; | ||
575 | + case HSBSliderMid: | ||
576 | case HSBSliderMidHover: | ||
577 | - pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | ||
578 | - *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); | ||
579 | - break; | ||
580 | - case VSBSliderTopBg: | ||
581 | - pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | ||
582 | - break; | ||
583 | - case VSBSliderBtmBg: | ||
584 | - pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | ||
585 | - break; | ||
586 | - case VSBSliderMidBg: | ||
587 | - pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | ||
588 | + pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | ||
589 | + *pixmaps[item] = pixmaps[item]->xForm(rMatrix); | ||
590 | break; | ||
591 | case HSBSliderTopBg: | ||
592 | - pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | ||
593 | + pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); | ||
594 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); | ||
595 | break; | ||
596 | case HSBSliderBtmBg: | ||
597 | - pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | ||
598 | + pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); | ||
599 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); | ||
600 | break; | ||
601 | case HSBSliderMidBg: | ||
602 | @@ -711,7 +679,6 @@ | ||
346 | 603 | ||
347 | void LiquidStyle::polish(QPalette &appPal) | 604 | void LiquidStyle::polish(QPalette &appPal) |
348 | { | 605 | { |
@@ -350,10 +607,21 @@ Features: | |||
350 | int i; | 607 | int i; |
351 | for(i=0; i < BITMAP_ITEMS; ++i){ | 608 | for(i=0; i < BITMAP_ITEMS; ++i){ |
352 | if(pixmaps[i]){ | 609 | if(pixmaps[i]){ |
353 | @@ -730,20 +701,29 @@ | 610 | @@ -719,31 +686,28 @@ |
611 | pixmaps[i] = NULL; | ||
612 | } | ||
354 | } | 613 | } |
355 | 614 | - QWidgetList *list = QApplication::allWidgets(); | |
356 | loadCustomButtons(); | 615 | - QWidgetListIt it( *list ); |
616 | - QWidget *w; | ||
617 | - while ((w=it.current()) != 0 ){ | ||
618 | - ++it; | ||
619 | - if(w->inherits("QPushButton")){ | ||
620 | - unapplyCustomAttributes((QPushButton *)w); | ||
621 | - } | ||
622 | - } | ||
623 | - | ||
624 | - loadCustomButtons(); | ||
357 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; | 625 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; |
358 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | 626 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; |
359 | btnDict.clear(); | 627 | btnDict.clear(); |
@@ -379,16 +647,32 @@ Features: | |||
379 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); | 647 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); |
380 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ | 648 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ |
381 | + config. setGroup ( "Appearance" ); | 649 | + config. setGroup ( "Appearance" ); |
382 | + QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 650 | + QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) |
383 | + appPal. color ( QPalette::Active, QColorGroup::Button ); | 651 | + : appPal. color ( QPalette::Active, QColorGroup::Button ); |
384 | + if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) | 652 | + if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) |
385 | + //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) | 653 | + : appPal. color ( QPalette::Active, QColorGroup::Background ))) { |
386 | + ) { | ||
387 | // force button color to be different from background | 654 | // force button color to be different from background |
388 | QBrush btnBrush(QColor(200, 202, 228)); | 655 | QBrush btnBrush(QColor(200, 202, 228)); |
389 | appPal.setBrush(QColorGroup::Button, btnBrush); | 656 | appPal.setBrush(QColorGroup::Button, btnBrush); |
390 | @@ -794,15 +774,7 @@ | 657 | @@ -778,8 +742,8 @@ |
391 | pagerBrush.setPixmap(*pix); | 658 | adjustHSV(*pix, h, s, v); |
659 | smallBevelFillDict.insert(c.rgb(), pix); | ||
660 | } | ||
661 | - pagerHoverBrush.setColor(c); | ||
662 | - pagerHoverBrush.setPixmap(*pix); | ||
663 | +// pagerHoverBrush.setColor(c); | ||
664 | +// pagerHoverBrush.setPixmap(*pix); | ||
665 | |||
666 | c = c.dark(120); | ||
667 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | ||
668 | @@ -790,19 +754,13 @@ | ||
669 | adjustHSV(*pix, h, s, v); | ||
670 | smallBevelFillDict.insert(c.rgb(), pix); | ||
671 | } | ||
672 | - pagerBrush.setColor(c); | ||
673 | - pagerBrush.setPixmap(*pix); | ||
674 | +// pagerBrush.setColor(c); | ||
675 | +// pagerBrush.setPixmap(*pix); | ||
392 | 676 | ||
393 | // background color stuff | 677 | // background color stuff |
394 | - c = config->readColorEntry("background", &Qt::lightGray); | 678 | - c = config->readColorEntry("background", &Qt::lightGray); |
@@ -400,11 +684,13 @@ Features: | |||
400 | - menuBrush.setColor(c); // hack - used for kicker applets | 684 | - menuBrush.setColor(c); // hack - used for kicker applets |
401 | - appPal.setBrush(QColorGroup::Background, menuBrush); | 685 | - appPal.setBrush(QColorGroup::Background, menuBrush); |
402 | - } | 686 | - } |
403 | + c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); | 687 | + c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) |
688 | + : appPal. color ( QPalette::Active, QColorGroup::Background ); | ||
689 | + | ||
404 | c.hsv(&bH, &bS, &bV); | 690 | c.hsv(&bH, &bS, &bV); |
405 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 691 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
406 | 692 | ||
407 | @@ -817,21 +789,18 @@ | 693 | @@ -817,101 +775,50 @@ |
408 | wallPaper.fill(c.rgb()); | 694 | wallPaper.fill(c.rgb()); |
409 | painter.begin(&wallPaper); | 695 | painter.begin(&wallPaper); |
410 | for(i=0; i < 32; i+=4){ | 696 | for(i=0; i < 32; i+=4){ |
@@ -422,17 +708,33 @@ Features: | |||
422 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ | 708 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ |
423 | appPal.setBrush(QColorGroup::Background, bgBrush); | 709 | appPal.setBrush(QColorGroup::Background, bgBrush); |
424 | - } | 710 | - } |
425 | 711 | - | |
426 | // lineedits | 712 | - // lineedits |
427 | - c = config->readColorEntry("windowBackground", &Qt::white); | 713 | - c = config->readColorEntry("windowBackground", &Qt::white); |
428 | + c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); | 714 | - QPixmap basePix; |
429 | QPixmap basePix; | 715 | - basePix.resize(32, 32); |
430 | basePix.resize(32, 32); | 716 | - basePix.fill(c.rgb()); |
431 | basePix.fill(c.rgb()); | 717 | - painter.begin(&basePix); |
432 | @@ -856,52 +825,37 @@ | 718 | - painter.setPen(c.dark(105)); |
433 | applyCustomAttributes((QPushButton *)w); | 719 | - for(i=0; i < 32; i+=4){ |
434 | } | 720 | - painter.drawLine(0, i, 32, i); |
435 | } | 721 | - painter.drawLine(0, i+1, 32, i+1); |
722 | - }; | ||
723 | - painter.end(); | ||
724 | - baseBrush.setColor(c); | ||
725 | - baseBrush.setPixmap(basePix); | ||
726 | - it.toFirst(); | ||
727 | - while ((w=it.current()) != 0 ){ | ||
728 | - ++it; | ||
729 | - if(w->inherits("QLineEdit")){ | ||
730 | - QPalette pal = w->palette(); | ||
731 | - pal.setBrush(QColorGroup::Base, baseBrush); | ||
732 | - w->setPalette(pal); | ||
733 | - } | ||
734 | - else if(w->inherits("QPushButton")){ | ||
735 | - applyCustomAttributes((QPushButton *)w); | ||
736 | - } | ||
737 | - } | ||
436 | - | 738 | - |
437 | - config->setGroup(oldGrp); | 739 | - config->setGroup(oldGrp); |
438 | } | 740 | } |
@@ -489,34 +791,39 @@ Features: | |||
489 | - } | 791 | - } |
490 | 792 | ||
491 | - if(w->inherits("QComboBox") || | 793 | - if(w->inherits("QComboBox") || |
492 | + if(w->inherits("QComboBox") || w->inherits("QProgressBar") || | 794 | - w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
493 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | ||
494 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | 795 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || |
495 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 796 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
496 | - w->inherits("TaskContainer")){ | 797 | - w->inherits("TaskContainer")){ |
497 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 798 | + if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { |
498 | w->installEventFilter(this); | ||
499 | } | ||
500 | if(w->inherits("QLineEdit")){ | ||
501 | @@ -913,6 +867,10 @@ | ||
502 | applyCustomAttributes((QPushButton *)w); | ||
503 | w->installEventFilter(this); | 799 | w->installEventFilter(this); |
504 | } | 800 | } |
801 | - if(w->inherits("QLineEdit")){ | ||
802 | - QPalette pal = w->palette(); | ||
803 | - pal.setBrush(QColorGroup::Base, baseBrush); | ||
804 | - w->setPalette(pal); | ||
805 | - } | ||
806 | - if(w->inherits("QPushButton")){ | ||
807 | - applyCustomAttributes((QPushButton *)w); | ||
808 | - w->installEventFilter(this); | ||
809 | + | ||
505 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 810 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
506 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); | 811 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); |
507 | + w->setBackgroundOrigin ( QWidget::ParentOrigin); | 812 | + w->setBackgroundOrigin ( QWidget::ParentOrigin); |
508 | + } | 813 | } |
509 | 814 | ||
510 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 815 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
511 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 816 | @@ -942,11 +849,20 @@ |
512 | @@ -942,11 +900,17 @@ | ||
513 | w->setMouseTracking(true); | 817 | w->setMouseTracking(true); |
514 | w->installEventFilter(this); | 818 | w->installEventFilter(this); |
515 | } | 819 | } |
516 | + if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { | 820 | + if(w-> inherits("QToolButton")) { |
517 | + ((QToolButton*)w)->setAutoRaise (flatTBButtons); | 821 | + if (w->parent()->inherits("QToolBar")) { |
518 | + if ( flatTBButtons ) | 822 | + ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
519 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | 823 | + if ( flatTBButtons ) |
824 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
825 | + } | ||
826 | + w-> installEventFilter ( this ); | ||
520 | + } | 827 | + } |
521 | + if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { | 828 | + if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { |
522 | + ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); | 829 | + ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); |
@@ -529,7 +836,7 @@ Features: | |||
529 | 836 | ||
530 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 837 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
531 | palette().active().brush(QColorGroup::Background).pixmap()){ | 838 | palette().active().brush(QColorGroup::Background).pixmap()){ |
532 | @@ -954,16 +918,21 @@ | 839 | @@ -954,16 +870,21 @@ |
533 | return; | 840 | return; |
534 | } | 841 | } |
535 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 842 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
@@ -557,7 +864,7 @@ Features: | |||
557 | } | 864 | } |
558 | } | 865 | } |
559 | 866 | ||
560 | @@ -977,6 +946,11 @@ | 867 | @@ -977,6 +898,11 @@ |
561 | 868 | ||
562 | if(w->inherits("QPopupMenu")) | 869 | if(w->inherits("QPopupMenu")) |
563 | w->setBackgroundMode(QWidget::PaletteButton); | 870 | w->setBackgroundMode(QWidget::PaletteButton); |
@@ -569,7 +876,7 @@ Features: | |||
569 | 876 | ||
570 | if(w->isTopLevel()) | 877 | if(w->isTopLevel()) |
571 | return; | 878 | return; |
572 | @@ -986,7 +960,7 @@ | 879 | @@ -986,7 +912,7 @@ |
573 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 880 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
574 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 881 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
575 | 882 | ||
@@ -578,30 +885,36 @@ Features: | |||
578 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 885 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
579 | if(w->inherits("QPushButton")) | 886 | if(w->inherits("QPushButton")) |
580 | w->setBackgroundMode(QWidget::PaletteButton); | 887 | w->setBackgroundMode(QWidget::PaletteButton); |
581 | @@ -1001,12 +975,14 @@ | 888 | @@ -997,16 +923,12 @@ |
582 | unapplyCustomAttributes((QPushButton *)w); | 889 | if(isViewportChild) |
583 | w->removeEventFilter(this); | 890 | w->setAutoMask(false); |
584 | } | 891 | |
585 | - | 892 | - if(w->inherits("QPushButton")){ |
893 | - unapplyCustomAttributes((QPushButton *)w); | ||
894 | - w->removeEventFilter(this); | ||
586 | +/* | 895 | +/* |
587 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 896 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
588 | + w-> setBackgroundMode ( PaletteBackground ); | 897 | + w-> setBackgroundMode ( PaletteBackground ); |
589 | + } | 898 | } |
590 | +*/ | 899 | - |
591 | if(w->inherits("QComboBox") || | 900 | - if(w->inherits("QComboBox") || |
592 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 901 | - w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
593 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | 902 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || |
594 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 903 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
595 | - w->inherits("TaskContainer")){ | 904 | - w->inherits("TaskContainer")){ |
596 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 905 | +*/ |
906 | + if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { | ||
597 | w->removeEventFilter(this); | 907 | w->removeEventFilter(this); |
598 | } | 908 | } |
599 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 909 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
600 | @@ -1014,9 +990,9 @@ | 910 | @@ -1014,9 +936,12 @@ |
601 | w->setAutoMask(false); | 911 | w->setAutoMask(false); |
602 | } | 912 | } |
603 | } | 913 | } |
604 | - if(w->inherits("KToolBar")){ | 914 | - if(w->inherits("KToolBar")){ |
915 | + if(w-> inherits("QToolButton")) { | ||
916 | + w-> removeEventFilter ( this ); | ||
917 | + } | ||
605 | + if(w->inherits("QToolBar")){ | 918 | + if(w->inherits("QToolBar")){ |
606 | w->removeEventFilter(this); | 919 | w->removeEventFilter(this); |
607 | - //w->setBackgroundMode(QWidget::PaletteBackground); | 920 | - //w->setBackgroundMode(QWidget::PaletteBackground); |
@@ -609,7 +922,7 @@ Features: | |||
609 | return; | 922 | return; |
610 | } | 923 | } |
611 | if(w->inherits("QHeader")){ | 924 | if(w->inherits("QHeader")){ |
612 | @@ -1028,22 +1004,98 @@ | 925 | @@ -1028,22 +953,118 @@ |
613 | void LiquidStyle::polish(QApplication *app) | 926 | void LiquidStyle::polish(QApplication *app) |
614 | { | 927 | { |
615 | 928 | ||
@@ -706,11 +1019,31 @@ Features: | |||
706 | +}; | 1019 | +}; |
707 | + | 1020 | + |
708 | + | 1021 | + |
1022 | +/* | ||
1023 | + * The same for QToolButton: | ||
1024 | + * TT hardcoded the drawing of the focus rect ... | ||
1025 | + * | ||
1026 | + * - sandman | ||
1027 | + */ | ||
1028 | + | ||
1029 | + | ||
1030 | +class HackToolButton : public QToolButton { | ||
1031 | +public: | ||
1032 | +HackToolButton ( ); | ||
1033 | + | ||
1034 | +void paint ( QPaintEvent *ev ) | ||
1035 | +{ | ||
1036 | + erase ( ev-> region ( )); | ||
1037 | + QPainter p ( this ); | ||
1038 | + style ( ). drawToolButton ( this, &p ); | ||
1039 | + drawButtonLabel ( &p ); | ||
1040 | +} | ||
1041 | +}; | ||
709 | + | 1042 | + |
710 | /* | 1043 | /* |
711 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to | 1044 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to |
712 | * force everything to erase and repaint on resize. This is going away, I'm | 1045 | * force everything to erase and repaint on resize. This is going away, I'm |
713 | @@ -1063,7 +1115,7 @@ | 1046 | @@ -1063,7 +1084,7 @@ |
714 | */ | 1047 | */ |
715 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 1048 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
716 | { | 1049 | { |
@@ -719,7 +1052,7 @@ Features: | |||
719 | if(ev->type() == QEvent::Resize){ | 1052 | if(ev->type() == QEvent::Resize){ |
720 | const QObjectList *tbChildList = obj->children(); | 1053 | const QObjectList *tbChildList = obj->children(); |
721 | QObjectListIt it(*tbChildList); | 1054 | QObjectListIt it(*tbChildList); |
722 | @@ -1076,35 +1128,7 @@ | 1055 | @@ -1076,116 +1097,27 @@ |
723 | 1056 | ||
724 | } | 1057 | } |
725 | } | 1058 | } |
@@ -752,14 +1085,20 @@ Features: | |||
752 | - } | 1085 | - } |
753 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || | 1086 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || |
754 | - obj->isA("AppletHandle")){ | 1087 | - obj->isA("AppletHandle")){ |
755 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 1088 | - QWidget *btn = (QWidget *)obj; |
756 | QWidget *btn = (QWidget *)obj; | 1089 | - if(ev->type() == QEvent::Enter){ |
757 | if(ev->type() == QEvent::Enter){ | 1090 | - if(btn->isEnabled()){ |
758 | if(btn->isEnabled()){ | 1091 | - highlightWidget = btn; |
759 | @@ -1119,20 +1143,7 @@ | 1092 | - btn->repaint(false); |
760 | } | 1093 | - } |
761 | } | 1094 | - } |
762 | } | 1095 | - else if(ev->type() == QEvent::Leave){ |
1096 | - if(btn == highlightWidget){ | ||
1097 | - highlightWidget = NULL; | ||
1098 | - btn->repaint(false); | ||
1099 | - } | ||
1100 | - } | ||
1101 | - } | ||
763 | - else if(obj->inherits("TaskContainer")){ | 1102 | - else if(obj->inherits("TaskContainer")){ |
764 | - QButton *btn = (QButton *)obj; | 1103 | - QButton *btn = (QButton *)obj; |
765 | - QPalette pal = btn->palette(); | 1104 | - QPalette pal = btn->palette(); |
@@ -774,11 +1113,127 @@ Features: | |||
774 | - } | 1113 | - } |
775 | - } | 1114 | - } |
776 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ | 1115 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ |
1116 | - QToolButton *btn = (QToolButton *)btn; | ||
1117 | - if(!btn->autoRaise()){ | ||
777 | + else if(obj->inherits("QToolButton")){ | 1118 | + else if(obj->inherits("QToolButton")){ |
778 | QToolButton *btn = (QToolButton *)btn; | 1119 | + QToolButton *btn = (QToolButton *)obj; |
779 | if(!btn->autoRaise()){ | 1120 | + if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () |
780 | if(btn->isEnabled()){ | 1121 | if(btn->isEnabled()){ |
781 | @@ -1290,7 +1301,24 @@ | 1122 | highlightWidget = btn; |
1123 | btn->repaint(false); | ||
1124 | + | ||
1125 | + qDebug ( "TB FOCUS IN [%p]", btn ); | ||
1126 | } | ||
1127 | } | ||
1128 | - else if(ev->type() == QEvent::Leave){ | ||
1129 | - QWidget *btn = (QWidget *)obj; | ||
1130 | + else if(ev->type() == QEvent::FocusOut ){ | ||
1131 | if(btn == highlightWidget){ | ||
1132 | highlightWidget = NULL; | ||
1133 | btn->repaint(false); | ||
1134 | + | ||
1135 | + qDebug ( "TB FOCUS OUT [%p]", btn ); | ||
1136 | } | ||
1137 | } | ||
1138 | - else | ||
1139 | - highlightWidget = NULL; | ||
1140 | - } | ||
1141 | - else if(obj->inherits("QScrollBar")){ | ||
1142 | - QScrollBar *sb = (QScrollBar *)obj; | ||
1143 | - if(ev->type() == QEvent::Enter){ | ||
1144 | - if(sb->isEnabled()){ | ||
1145 | - highlightWidget = sb; | ||
1146 | - sb->repaint(false); | ||
1147 | - } | ||
1148 | - } | ||
1149 | - else if(ev->type() == QEvent::Leave){ | ||
1150 | - if(sb == highlightWidget && !sb->draggingSlider()){ | ||
1151 | - highlightWidget = NULL; | ||
1152 | - sb->repaint(false); | ||
1153 | - } | ||
1154 | - } | ||
1155 | - else if(ev->type() == QEvent::MouseButtonRelease){ | ||
1156 | - QMouseEvent *me = (QMouseEvent *)ev; | ||
1157 | - if(sb == highlightWidget && !sb->rect().contains(me->pos())){ | ||
1158 | - highlightWidget = NULL; | ||
1159 | - sb->repaint(false); | ||
1160 | - } | ||
1161 | - } | ||
1162 | - } | ||
1163 | - else if(obj->inherits("QLineEdit")){ | ||
1164 | - if(obj->parent() && obj->parent()->inherits("QComboBox")){ | ||
1165 | - QWidget *btn = (QComboBox *)obj->parent(); | ||
1166 | - if(ev->type() == QEvent::Enter){ | ||
1167 | - if (btn->isEnabled()){ | ||
1168 | - highlightWidget = btn; | ||
1169 | - btn->repaint(false); | ||
1170 | - } | ||
1171 | - } | ||
1172 | - else if(ev->type() == QEvent::Leave){ | ||
1173 | - if (btn == highlightWidget) | ||
1174 | - highlightWidget = NULL; | ||
1175 | - btn->repaint(false); | ||
1176 | - } | ||
1177 | + else if(ev->type() == QEvent::Paint) { | ||
1178 | + (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev ); | ||
1179 | + return true; | ||
1180 | } | ||
1181 | } | ||
1182 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ | ||
1183 | @@ -1201,6 +1133,7 @@ | ||
1184 | QSize sz = isRadio ? exclusiveIndicatorSize() | ||
1185 | : indicatorSize(); | ||
1186 | |||
1187 | +/* | ||
1188 | if(btn->hasFocus()){ | ||
1189 | QRect r = QRect(0, 0, btn->width(), btn->height()); | ||
1190 | p.setPen(btn->colorGroup().button().dark(140)); | ||
1191 | @@ -1209,6 +1142,7 @@ | ||
1192 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); | ||
1193 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); | ||
1194 | } | ||
1195 | +*/ | ||
1196 | int x = 0; | ||
1197 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | ||
1198 | if(isRadio) | ||
1199 | @@ -1228,36 +1162,6 @@ | ||
1200 | p.end(); | ||
1201 | return(true); | ||
1202 | } | ||
1203 | - // for hover, just redraw the indicator (not the text) | ||
1204 | - else if((ev->type() == QEvent::Enter && btn->isEnabled()) || | ||
1205 | - (ev->type() == QEvent::Leave && btn == highlightWidget)){ | ||
1206 | - QButton *btn = (QButton *)obj; | ||
1207 | - bool isRadio = obj->inherits("QRadioButton"); | ||
1208 | - | ||
1209 | - if(ev->type() == QEvent::Enter) | ||
1210 | - highlightWidget = btn; | ||
1211 | - else | ||
1212 | - highlightWidget = NULL; | ||
1213 | - QFontMetrics fm = btn->fontMetrics(); | ||
1214 | - QSize lsz = fm.size(ShowPrefix, btn->text()); | ||
1215 | - QSize sz = isRadio ? exclusiveIndicatorSize() | ||
1216 | - : indicatorSize(); | ||
1217 | - int x = 0; | ||
1218 | - int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | ||
1219 | - //if(btn->autoMask()) | ||
1220 | - // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); | ||
1221 | - QPainter p; | ||
1222 | - p.begin(btn); | ||
1223 | - if(isRadio) | ||
1224 | - drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | ||
1225 | - btn->colorGroup(), btn->isOn(), | ||
1226 | - btn->isDown(), btn->isEnabled()); | ||
1227 | - else | ||
1228 | - drawIndicator(&p, x, y, sz.width(), sz.height(), | ||
1229 | - btn->colorGroup(), btn->state(), btn->isDown(), | ||
1230 | - btn->isEnabled()); | ||
1231 | - p.end(); | ||
1232 | - } | ||
1233 | } | ||
1234 | else if(obj->inherits("QHeader")){ | ||
1235 | QHeader *hw = (QHeader *)obj; | ||
1236 | @@ -1290,7 +1194,24 @@ | ||
782 | } | 1237 | } |
783 | } | 1238 | } |
784 | } | 1239 | } |
@@ -804,7 +1259,19 @@ Features: | |||
804 | } | 1259 | } |
805 | 1260 | ||
806 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, | 1261 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, |
807 | @@ -1340,11 +1368,6 @@ | 1262 | @@ -1325,8 +1246,11 @@ |
1263 | } | ||
1264 | |||
1265 | p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | ||
1266 | + qDebug ( "DRAW TOOLBUTTON IN PIXMAP" ); | ||
1267 | } | ||
1268 | else{ | ||
1269 | + qDebug ( "DRAW TOOLBUTTON sunken=%d/high=%p/device=%p", sunken, highlightWidget,p->device() ); | ||
1270 | + | ||
1271 | drawClearBevel(p, x, y, w, h, sunken ? g.button() : | ||
1272 | highlightWidget == p->device() ? g.button().light(110) : | ||
1273 | g.background(), g.background()); | ||
1274 | @@ -1340,11 +1264,6 @@ | ||
808 | QColorGroup g = btn->colorGroup(); | 1275 | QColorGroup g = btn->colorGroup(); |
809 | 1276 | ||
810 | 1277 | ||
@@ -816,7 +1283,59 @@ Features: | |||
816 | //int dw = buttonDefaultIndicatorWidth(); | 1283 | //int dw = buttonDefaultIndicatorWidth(); |
817 | if(btn->hasFocus() || btn->isDefault()){ | 1284 | if(btn->hasFocus() || btn->isDefault()){ |
818 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); | 1285 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); |
819 | @@ -1596,7 +1619,7 @@ | 1286 | @@ -1488,7 +1407,20 @@ |
1287 | const QColorGroup &g, bool sunken, | ||
1288 | bool edit, bool, const QBrush *) | ||
1289 | { | ||
1290 | - bool isHover = highlightWidget == painter->device(); | ||
1291 | + bool isActive = false; | ||
1292 | + if (( painter->device()->devType() == QInternal::Widget ) && | ||
1293 | + ( | ||
1294 | + ( qApp-> focusWidget ( ) == painter-> device ( )) || | ||
1295 | + ( | ||
1296 | + edit && | ||
1297 | + ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) && | ||
1298 | + ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( )) | ||
1299 | + ) | ||
1300 | + ) | ||
1301 | + ) { | ||
1302 | + isActive = true; | ||
1303 | + } | ||
1304 | + | ||
1305 | bool isMasked = false; | ||
1306 | if(painter->device()->devType() == QInternal::Widget) | ||
1307 | isMasked = ((QWidget*)painter->device())->autoMask(); | ||
1308 | @@ -1498,7 +1430,7 @@ | ||
1309 | |||
1310 | drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, | ||
1311 | sunken, false, isMasked); | ||
1312 | - if(!isHover){ | ||
1313 | + if(!isActive){ | ||
1314 | p.setClipRect(0, 0, w-17, h); | ||
1315 | drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, | ||
1316 | sunken, false, isMasked); | ||
1317 | @@ -1550,16 +1482,17 @@ | ||
1318 | return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); | ||
1319 | } | ||
1320 | |||
1321 | -QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) | ||
1322 | +QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) | ||
1323 | { | ||
1324 | - return(QRect(x+5, y+3, w-(h/3)-13, h-5)); | ||
1325 | +return QRect ( ); | ||
1326 | + | ||
1327 | +// return(QRect(x+5, y+3, w-(h/3)-13, h-5)); | ||
1328 | } | ||
1329 | |||
1330 | void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, | ||
1331 | int sliderStart, uint controls, | ||
1332 | uint activeControl) | ||
1333 | { | ||
1334 | - bool isHover = highlightWidget == p->device(); | ||
1335 | int sliderMin, sliderMax, sliderLength, buttonDim; | ||
1336 | scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); | ||
1337 | |||
1338 | @@ -1596,7 +1529,7 @@ | ||
820 | if(sbBuffer.size() != sb->size()) | 1339 | if(sbBuffer.size() != sb->size()) |
821 | sbBuffer.resize(sb->size()); | 1340 | sbBuffer.resize(sb->size()); |
822 | } | 1341 | } |
@@ -825,7 +1344,7 @@ Features: | |||
825 | addB.setRect( addX,addY,buttonDim,buttonDim ); | 1344 | addB.setRect( addX,addY,buttonDim,buttonDim ); |
826 | if(horiz) | 1345 | if(horiz) |
827 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); | 1346 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); |
828 | @@ -1624,7 +1647,7 @@ | 1347 | @@ -1624,7 +1557,7 @@ |
829 | QPainter painter; | 1348 | QPainter painter; |
830 | if(!horiz){ | 1349 | if(!horiz){ |
831 | painter.begin(&sbBuffer); | 1350 | painter.begin(&sbBuffer); |
@@ -834,7 +1353,46 @@ Features: | |||
834 | if(sliderR.height() >= 8){ | 1353 | if(sliderR.height() >= 8){ |
835 | painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, | 1354 | painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, |
836 | 13, 8); | 1355 | 13, 8); |
837 | @@ -1690,7 +1713,7 @@ | 1356 | @@ -1648,25 +1581,15 @@ |
1357 | } | ||
1358 | if(controls & Slider){ | ||
1359 | if(sliderR.height() >= 16){ | ||
1360 | - painter.drawPixmap(sliderR.x()+1, sliderR.y(), | ||
1361 | - isHover ? *getPixmap(VSBSliderTopHover): | ||
1362 | - *getPixmap(VSBSliderTop)); | ||
1363 | + painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop)); | ||
1364 | painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, | ||
1365 | - sliderR.height()-16, isHover ? | ||
1366 | - *getPixmap(VSBSliderMidHover) : | ||
1367 | - *getPixmap(VSBSliderMid)); | ||
1368 | - painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, | ||
1369 | - isHover ? *getPixmap(VSBSliderBtmHover) : | ||
1370 | - *getPixmap(VSBSliderBtm)); | ||
1371 | + sliderR.height()-16, *getPixmap(VSBSliderMid)); | ||
1372 | + painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm)); | ||
1373 | } | ||
1374 | else if(sliderR.height() >= 8){ | ||
1375 | int m = sliderR.height()/2; | ||
1376 | - painter.drawPixmap(sliderR.x()+1, sliderR.y(), | ||
1377 | - isHover ? *getPixmap(VSBSliderTopHover): | ||
1378 | - *getPixmap(VSBSliderTop), 0, 0, 13, m); | ||
1379 | - painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, | ||
1380 | - isHover ? *getPixmap(VSBSliderBtmHover): | ||
1381 | - *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); | ||
1382 | + painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m); | ||
1383 | + painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); | ||
1384 | } | ||
1385 | else{ | ||
1386 | painter.setPen(g.button().dark(210)); | ||
1387 | @@ -1674,7 +1597,6 @@ | ||
1388 | 13, sliderR.height()); | ||
1389 | painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, | ||
1390 | 11, sliderR.height()-2, | ||
1391 | - isHover ? *getPixmap(VSBSliderMidHover) : | ||
1392 | *getPixmap(VSBSliderMid), 1, 0); | ||
1393 | } | ||
1394 | } | ||
1395 | @@ -1690,7 +1612,7 @@ | ||
838 | } | 1396 | } |
839 | else{ | 1397 | else{ |
840 | painter.begin(&sbBuffer); | 1398 | painter.begin(&sbBuffer); |
@@ -843,7 +1401,43 @@ Features: | |||
843 | if(sliderR.width() >= 8){ | 1401 | if(sliderR.width() >= 8){ |
844 | painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, | 1402 | painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, |
845 | 8, 13); | 1403 | 8, 13); |
846 | @@ -1761,10 +1784,10 @@ | 1404 | @@ -1715,22 +1637,17 @@ |
1405 | if(controls & Slider){ | ||
1406 | if(sliderR.width() >= 16){ | ||
1407 | painter.drawPixmap(sliderR.x(), sliderR.y()+1, | ||
1408 | - isHover ? *getPixmap(HSBSliderTopHover) : | ||
1409 | *getPixmap(HSBSliderTop)); | ||
1410 | painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, | ||
1411 | - 13, isHover ? *getPixmap(HSBSliderMidHover) : | ||
1412 | - *getPixmap(HSBSliderMid)); | ||
1413 | - painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? | ||
1414 | - *getPixmap(HSBSliderBtmHover) : | ||
1415 | + 13, *getPixmap(HSBSliderMid)); | ||
1416 | + painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, | ||
1417 | *getPixmap(HSBSliderBtm)); | ||
1418 | } | ||
1419 | else if(sliderR.width() >= 8){ | ||
1420 | int m = sliderR.width()/2; | ||
1421 | painter.drawPixmap(sliderR.x(), sliderR.y()+1, | ||
1422 | - isHover ? *getPixmap(HSBSliderTopHover) : | ||
1423 | *getPixmap(HSBSliderTop), 0, 0, m, 13); | ||
1424 | - painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? | ||
1425 | - *getPixmap(HSBSliderBtmHover) : | ||
1426 | + painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, | ||
1427 | *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); | ||
1428 | } | ||
1429 | else{ | ||
1430 | @@ -1738,8 +1655,7 @@ | ||
1431 | drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, | ||
1432 | sliderR.width(), 13); | ||
1433 | painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, | ||
1434 | - sliderR.width()-2, 11, isHover ? | ||
1435 | - *getPixmap(HSBSliderMidHover) : | ||
1436 | + sliderR.width()-2, 11, | ||
1437 | *getPixmap(HSBSliderMid), 0, 1); | ||
1438 | } | ||
1439 | } | ||
1440 | @@ -1761,10 +1677,10 @@ | ||
847 | addB.width()-8, addB.height()-8, g, !maxed); | 1441 | addB.width()-8, addB.height()-8, g, !maxed); |
848 | } | 1442 | } |
849 | if ( controls & SubLine ) { | 1443 | if ( controls & SubLine ) { |
@@ -858,7 +1452,7 @@ Features: | |||
858 | drawSBButton(p, subHC, g, activeControl == SubLine); | 1452 | drawSBButton(p, subHC, g, activeControl == SubLine); |
859 | drawArrow( p, horiz ? LeftArrow : UpArrow, | 1453 | drawArrow( p, horiz ? LeftArrow : UpArrow, |
860 | false, subHC.x()+4, subHC.y()+4, | 1454 | false, subHC.x()+4, subHC.y()+4, |
861 | @@ -1865,8 +1888,8 @@ | 1455 | @@ -1865,8 +1781,8 @@ |
862 | else | 1456 | else |
863 | buttonDim = ( length - b*2 )/2 - 1; | 1457 | buttonDim = ( length - b*2 )/2 - 1; |
864 | 1458 | ||
@@ -869,7 +1463,7 @@ Features: | |||
869 | 1463 | ||
870 | if ( sb->maxValue() == sb->minValue() ) { | 1464 | if ( sb->maxValue() == sb->minValue() ) { |
871 | sliderLength = maxLength; | 1465 | sliderLength = maxLength; |
872 | @@ -1914,8 +1937,8 @@ | 1466 | @@ -1914,31 +1830,31 @@ |
873 | return(QSize(16, 16)); | 1467 | return(QSize(16, 16)); |
874 | } | 1468 | } |
875 | 1469 | ||
@@ -879,8 +1473,36 @@ Features: | |||
879 | + int /*h*/, const QColorGroup &/*g*/, bool on, | 1473 | + int /*h*/, const QColorGroup &/*g*/, bool on, |
880 | bool down, bool) | 1474 | bool down, bool) |
881 | { | 1475 | { |
882 | bool isHover = highlightWidget == p->device(); | 1476 | - bool isHover = highlightWidget == p->device(); |
883 | @@ -1957,8 +1980,8 @@ | 1477 | + bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); |
1478 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget | ||
1479 | && ((QWidget*)p->device())->autoMask(); | ||
1480 | |||
1481 | if(isMasked){ | ||
1482 | if(on || down){ | ||
1483 | - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : | ||
1484 | + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) : | ||
1485 | *getPixmap(HTMLRadioDown)); | ||
1486 | } | ||
1487 | else | ||
1488 | - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : | ||
1489 | + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) : | ||
1490 | *getPixmap(HTMLRadio)); | ||
1491 | |||
1492 | } | ||
1493 | else{ | ||
1494 | if(on || down){ | ||
1495 | - p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : | ||
1496 | + p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) : | ||
1497 | *getPixmap(RadioOn)); | ||
1498 | } | ||
1499 | else | ||
1500 | - p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : | ||
1501 | + p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) : | ||
1502 | *getPixmap(RadioOff)); | ||
1503 | } | ||
1504 | } | ||
1505 | @@ -1957,25 +1873,25 @@ | ||
884 | return(QSize(20, 22)); | 1506 | return(QSize(20, 22)); |
885 | } | 1507 | } |
886 | 1508 | ||
@@ -889,9 +1511,35 @@ Features: | |||
889 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 1511 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
890 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) | 1512 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) |
891 | { | 1513 | { |
892 | bool isHover = highlightWidget == p->device(); | 1514 | - bool isHover = highlightWidget == p->device(); |
1515 | + bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); | ||
893 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget | 1516 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget |
894 | @@ -1996,8 +2019,8 @@ | 1517 | && ((QWidget*)p->device())->autoMask(); |
1518 | if(isMasked){ | ||
1519 | if(state != QButton::Off){ | ||
1520 | - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : | ||
1521 | + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) : | ||
1522 | *getPixmap(HTMLCBDown)); | ||
1523 | } | ||
1524 | else | ||
1525 | - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : | ||
1526 | + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) : | ||
1527 | *getPixmap(HTMLCB)); | ||
1528 | |||
1529 | } | ||
1530 | else{ | ||
1531 | if(state != QButton::Off){ | ||
1532 | - p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : | ||
1533 | + p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) : | ||
1534 | *getPixmap(CBDown)); | ||
1535 | /* Todo - tristate | ||
1536 | if(state == QButton::On){ | ||
1537 | @@ -1992,12 +1908,12 @@ | ||
1538 | }*/ | ||
1539 | } | ||
1540 | else | ||
1541 | - p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); | ||
1542 | + p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB)); | ||
895 | } | 1543 | } |
896 | } | 1544 | } |
897 | 1545 | ||
@@ -902,7 +1550,7 @@ Features: | |||
902 | { | 1550 | { |
903 | // needed for some reason by KHtml, even tho it's all filled ;P | 1551 | // needed for some reason by KHtml, even tho it's all filled ;P |
904 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); | 1552 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); |
905 | @@ -2005,18 +2028,17 @@ | 1553 | @@ -2005,18 +1921,17 @@ |
906 | } | 1554 | } |
907 | 1555 | ||
908 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, | 1556 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, |
@@ -924,7 +1572,7 @@ Features: | |||
924 | Orientation orient, bool, bool) | 1572 | Orientation orient, bool, bool) |
925 | { | 1573 | { |
926 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : | 1574 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : |
927 | @@ -2065,203 +2087,26 @@ | 1575 | @@ -2065,203 +1980,26 @@ |
928 | p->drawLineSegments(a); | 1576 | p->drawLineSegments(a); |
929 | } | 1577 | } |
930 | 1578 | ||
@@ -946,7 +1594,7 @@ Features: | |||
946 | - p->drawPoint(x, y2); | 1594 | - p->drawPoint(x, y2); |
947 | - p->drawPoint(x2, y2); | 1595 | - p->drawPoint(x2, y2); |
948 | - | 1596 | - |
949 | 1597 | - | |
950 | - | 1598 | - |
951 | - // p->drawRect(x, y, w, h); | 1599 | - // p->drawRect(x, y, w, h); |
952 | - QPixmap *pix = bevelFillDict.find(g.button().rgb()); | 1600 | - QPixmap *pix = bevelFillDict.find(g.button().rgb()); |
@@ -963,9 +1611,7 @@ Features: | |||
963 | - | 1611 | - |
964 | -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, | 1612 | -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, |
965 | - const QColorGroup &g, bool mac, QBrush *) | 1613 | - const QColorGroup &g, bool mac, QBrush *) |
966 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 1614 | -{ |
967 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | ||
968 | { | ||
969 | - if(p->device() && p->device()->devType() == QInternal::Widget && | 1615 | - if(p->device() && p->device()->devType() == QInternal::Widget && |
970 | - ((KMenuBar *)p->device())->isTopLevelMenu()){ | 1616 | - ((KMenuBar *)p->device())->isTopLevelMenu()){ |
971 | - p->setPen(Qt::black); | 1617 | - p->setPen(Qt::black); |
@@ -989,10 +1635,12 @@ Features: | |||
989 | - } | 1635 | - } |
990 | - | 1636 | - |
991 | -} | 1637 | -} |
992 | - | 1638 | |
993 | -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, | 1639 | -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, |
994 | - const QColorGroup &g, KToolBarPos, QBrush *) | 1640 | - const QColorGroup &g, KToolBarPos, QBrush *) |
995 | -{ | 1641 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
1642 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | ||
1643 | { | ||
996 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | 1644 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); |
997 | -} | 1645 | -} |
998 | - | 1646 | - |
@@ -1118,8 +1766,8 @@ Features: | |||
1118 | + h += 2; | 1766 | + h += 2; |
1119 | } | 1767 | } |
1120 | -} | 1768 | -} |
1121 | |||
1122 | - | 1769 | - |
1770 | |||
1123 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, | 1771 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, |
1124 | - const QColorGroup &g, bool active, QMenuItem *mi, | 1772 | - const QColorGroup &g, bool active, QMenuItem *mi, |
1125 | - QBrush *) | 1773 | - QBrush *) |
@@ -1140,7 +1788,7 @@ Features: | |||
1140 | g.background().dark(130); | 1788 | g.background().dark(130); |
1141 | } | 1789 | } |
1142 | else | 1790 | else |
1143 | @@ -2300,8 +2145,8 @@ | 1791 | @@ -2300,8 +2038,8 @@ |
1144 | } | 1792 | } |
1145 | 1793 | ||
1146 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 1794 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
@@ -1151,7 +1799,7 @@ Features: | |||
1151 | { | 1799 | { |
1152 | QColor c; | 1800 | QColor c; |
1153 | switch(menuHandler->transType()){ | 1801 | switch(menuHandler->transType()){ |
1154 | @@ -2336,8 +2181,6 @@ | 1802 | @@ -2336,8 +2074,6 @@ |
1155 | 1803 | ||
1156 | maxpmw = QMAX( maxpmw, 20 ); | 1804 | maxpmw = QMAX( maxpmw, 20 ); |
1157 | 1805 | ||
@@ -1160,7 +1808,7 @@ Features: | |||
1160 | 1808 | ||
1161 | bool dis = !enabled; | 1809 | bool dis = !enabled; |
1162 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); | 1810 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); |
1163 | @@ -2363,7 +2206,7 @@ | 1811 | @@ -2363,7 +2099,7 @@ |
1164 | p->fillRect(x, y, w, h, menuBrush); | 1812 | p->fillRect(x, y, w, h, menuBrush); |
1165 | } | 1813 | } |
1166 | else{ | 1814 | else{ |
@@ -1169,7 +1817,7 @@ Features: | |||
1169 | if(pix) | 1817 | if(pix) |
1170 | p->drawPixmap(x, y, *pix, x, y, w, h); | 1818 | p->drawPixmap(x, y, *pix, x, y, w, h); |
1171 | } | 1819 | } |
1172 | @@ -2508,25 +2351,6 @@ | 1820 | @@ -2508,25 +2244,6 @@ |
1173 | return h; | 1821 | return h; |
1174 | } | 1822 | } |
1175 | 1823 | ||
@@ -1195,7 +1843,12 @@ Features: | |||
1195 | 1843 | ||
1196 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | 1844 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, |
1197 | const QColorGroup &g, const QColor *c, | 1845 | const QColorGroup &g, const QColor *c, |
1198 | @@ -2540,25 +2364,25 @@ | 1846 | @@ -2536,29 +2253,29 @@ |
1847 | if(p->device()->devType() == QInternal::Widget){ | ||
1848 | // if so does it use a special focus rectangle? | ||
1849 | QWidget *w = (QWidget *)p->device(); | ||
1850 | - if(w->inherits("QPushButton") || w->inherits("QSlider")){ | ||
1851 | + if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ | ||
1199 | return; | 1852 | return; |
1200 | } | 1853 | } |
1201 | else{ | 1854 | else{ |
@@ -1225,7 +1878,7 @@ Features: | |||
1225 | return; | 1878 | return; |
1226 | } | 1879 | } |
1227 | QPixmap tilePix; | 1880 | QPixmap tilePix; |
1228 | @@ -2671,7 +2495,7 @@ | 1881 | @@ -2671,7 +2388,7 @@ |
1229 | vFrame = 8; // was 10 | 1882 | vFrame = 8; // was 10 |
1230 | } | 1883 | } |
1231 | else | 1884 | else |
@@ -1234,7 +1887,7 @@ Features: | |||
1234 | } | 1887 | } |
1235 | 1888 | ||
1236 | 1889 | ||
1237 | @@ -2699,7 +2523,7 @@ | 1890 | @@ -2699,7 +2416,7 @@ |
1238 | p->drawLine(x+1, y+1, x+1, y2-1); | 1891 | p->drawLine(x+1, y+1, x+1, y2-1); |
1239 | } | 1892 | } |
1240 | else if(lineWidth != 2 || !sunken) | 1893 | else if(lineWidth != 2 || !sunken) |
@@ -1243,7 +1896,7 @@ Features: | |||
1243 | else{ | 1896 | else{ |
1244 | QPen oldPen = p->pen(); | 1897 | QPen oldPen = p->pen(); |
1245 | int x2 = x+w-1; | 1898 | int x2 = x+w-1; |
1246 | @@ -2726,105 +2550,6 @@ | 1899 | @@ -2726,105 +2443,6 @@ |
1247 | } | 1900 | } |
1248 | } | 1901 | } |
1249 | 1902 | ||
@@ -1349,65 +2002,120 @@ Features: | |||
1349 | 2002 | ||
1350 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) | 2003 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) |
1351 | { | 2004 | { |
1352 | @@ -2998,22 +2723,22 @@ | 2005 | @@ -2988,110 +2606,5 @@ |
1353 | customBtnIconList.clear(); | 2006 | } |
1354 | customBtnLabelList.clear(); | 2007 | } |
1355 | 2008 | ||
2009 | -// I'm debating if to use QValueList or QList here. I like QValueList better, | ||
2010 | -// but QList handles pointers which is good for a lot of empty icons... | ||
2011 | - | ||
2012 | -void LiquidStyle::loadCustomButtons() | ||
2013 | -{ | ||
2014 | - return; // TODO | ||
2015 | - customBtnColorList.clear(); | ||
2016 | - customBtnIconList.clear(); | ||
2017 | - customBtnLabelList.clear(); | ||
2018 | - | ||
1356 | - KConfig *config = KGlobal::config(); | 2019 | - KConfig *config = KGlobal::config(); |
1357 | - QString oldGrp = config->group(); | 2020 | - QString oldGrp = config->group(); |
1358 | - config->setGroup("MosfetButtons"); | 2021 | - config->setGroup("MosfetButtons"); |
1359 | +// KConfig *config = KGlobal::config(); | 2022 | - |
1360 | +// QString oldGrp = config->group(); | 2023 | - QStrList iconList, colorList; //temp, we store QPixmaps and QColors |
1361 | +// config->setGroup("MosfetButtons"); | 2024 | - iconList.setAutoDelete(true); |
1362 | 2025 | - colorList.setAutoDelete(true); | |
1363 | QStrList iconList, colorList; //temp, we store QPixmaps and QColors | ||
1364 | iconList.setAutoDelete(true); | ||
1365 | colorList.setAutoDelete(true); | ||
1366 | - config->readListEntry("Labels", customBtnLabelList); | 2026 | - config->readListEntry("Labels", customBtnLabelList); |
1367 | - config->readListEntry("Icons", iconList); | 2027 | - config->readListEntry("Icons", iconList); |
1368 | - config->readListEntry("Colors", colorList); | 2028 | - config->readListEntry("Colors", colorList); |
1369 | +// config->readListEntry("Labels", customBtnLabelList); | 2029 | - |
1370 | +// config->readListEntry("Icons", iconList); | 2030 | - const char *labelStr = customBtnLabelList.first(); |
1371 | +// config->readListEntry("Colors", colorList); | 2031 | - const char *colorStr = colorList.first(); |
1372 | 2032 | - const char *iconStr = iconList.first(); | |
1373 | const char *labelStr = customBtnLabelList.first(); | 2033 | - |
1374 | const char *colorStr = colorList.first(); | ||
1375 | const char *iconStr = iconList.first(); | ||
1376 | |||
1377 | - KIconLoader *ldr = KGlobal::iconLoader(); | 2034 | - KIconLoader *ldr = KGlobal::iconLoader(); |
1378 | +// KIconLoader *ldr = KGlobal::iconLoader(); | 2035 | - while(labelStr != NULL){ |
1379 | while(labelStr != NULL){ | 2036 | - QColor *c = new QColor; |
1380 | QColor *c = new QColor; | 2037 | - c->setNamedColor(QString(colorStr)); |
1381 | c->setNamedColor(QString(colorStr)); | 2038 | - customBtnColorList.append(c); |
1382 | @@ -3022,7 +2747,7 @@ | 2039 | - |
1383 | QString tmpStr(iconStr); | 2040 | - QString tmpStr(iconStr); |
1384 | if(!tmpStr.isEmpty()){ | 2041 | - if(!tmpStr.isEmpty()){ |
1385 | QPixmap *pixmap = | 2042 | - QPixmap *pixmap = |
1386 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); | 2043 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); |
1387 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); | 2044 | - if(pixmap->isNull()){ |
1388 | if(pixmap->isNull()){ | 2045 | - delete pixmap; |
1389 | delete pixmap; | 2046 | - customBtnIconList.append(NULL); |
1390 | customBtnIconList.append(NULL); | 2047 | - } |
1391 | @@ -3037,7 +2762,6 @@ | 2048 | - else |
1392 | colorStr = colorList.next(); | 2049 | - customBtnIconList.append(pixmap); |
1393 | iconStr = iconList.next(); | 2050 | - } |
1394 | } | 2051 | - else |
2052 | - customBtnIconList.append(NULL); | ||
2053 | - | ||
2054 | - labelStr = customBtnLabelList.next(); | ||
2055 | - colorStr = colorList.next(); | ||
2056 | - iconStr = iconList.next(); | ||
2057 | - } | ||
1395 | - config->setGroup(oldGrp); | 2058 | - config->setGroup(oldGrp); |
1396 | } | 2059 | -} |
1397 | 2060 | - | |
1398 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) | 2061 | -void LiquidStyle::applyCustomAttributes(QPushButton *btn) |
1399 | @@ -3087,7 +2811,7 @@ | 2062 | -{ |
1400 | } | 2063 | - return; // TODO |
1401 | } | 2064 | - QString str = btn->text(); |
1402 | 2065 | - if(str.isEmpty()) | |
2066 | - return; | ||
2067 | - while(str.contains('&') != 0) | ||
2068 | - str = str.remove(str.find('&'), 1); | ||
2069 | - | ||
2070 | - const char *s; | ||
2071 | - int idx = 0; | ||
2072 | - for(s = customBtnLabelList.first(); s != NULL; | ||
2073 | - ++idx, s = customBtnLabelList.next()){ | ||
2074 | - if(qstricmp(s, str.latin1()) == 0){ | ||
2075 | - QPalette pal = btn->palette(); | ||
2076 | - pal.setColor(QColorGroup::Button, | ||
2077 | - *customBtnColorList.at(idx)); | ||
2078 | - btn->setPalette(pal); | ||
2079 | - /* | ||
2080 | - if(customBtnIconList.at(idx) != NULL){ | ||
2081 | - QPixmap *pix = customBtnIconList.at(idx); | ||
2082 | - btn->setIconSet(QIconSet(*pix)); | ||
2083 | - }*/ | ||
2084 | - break; | ||
2085 | - } | ||
2086 | - } | ||
2087 | -} | ||
2088 | - | ||
2089 | -void LiquidStyle::unapplyCustomAttributes(QPushButton *btn) | ||
2090 | -{ | ||
2091 | - return; // TODO | ||
2092 | - QString str = btn->text(); | ||
2093 | - if(str.isEmpty()) | ||
2094 | - return; | ||
2095 | - while(str.contains('&') != 0) | ||
2096 | - str = str.remove(str.find('&'), 1); | ||
2097 | - | ||
2098 | - const char *s; | ||
2099 | - for(s = customBtnLabelList.first(); s != NULL; s = customBtnLabelList.next()){ | ||
2100 | - if(qstricmp(s, str.latin1()) == 0){ | ||
2101 | - btn->setPalette(QApplication::palette()); | ||
2102 | - btn->setIconSet(QIconSet()); | ||
2103 | - break; | ||
2104 | - } | ||
2105 | - } | ||
2106 | -} | ||
2107 | - | ||
1403 | -#include "liquid.moc" | 2108 | -#include "liquid.moc" |
1404 | +// #include "liquid.moc" | 2109 | - |
1405 | 2110 | - | |
1406 | 2111 | - | |
2112 | - | ||
2113 | - | ||
1407 | 2114 | ||
1408 | --- -2002-10-24 03:19:31.000000000 +0200 | 2115 | /* vim: set noet sw=8 ts=8: */ |
1409 | +++ plugin.cpp2002-10-04 03:37:38.000000000 +0200 | 2116 | --- -2002-11-18 04:47:41.000000000 +0100 |
1410 | @@ -1,29 +1,84 @@ | 2117 | +++ plugin.cpp2002-11-18 03:54:56.000000000 +0100 |
2118 | @@ -1,29 +1,79 @@ | ||
1411 | +#include <qapplication.h> | 2119 | +#include <qapplication.h> |
1412 | + | 2120 | + |
1413 | #include "liquid.h" | 2121 | #include "liquid.h" |
@@ -1421,64 +2129,66 @@ Features: | |||
1421 | +{ | 2129 | +{ |
1422 | +m_widget = 0; | 2130 | +m_widget = 0; |
1423 | +} | 2131 | +} |
1424 | + | 2132 | |
2133 | -extern "C" { | ||
2134 | - KStyle* allocate(); | ||
2135 | - int minor_version(); | ||
2136 | - int major_version(); | ||
2137 | - const char *description(); | ||
1425 | +LiquidInterface::~LiquidInterface ( ) | 2138 | +LiquidInterface::~LiquidInterface ( ) |
1426 | +{ | 2139 | +{ |
1427 | +} | 2140 | } |
1428 | + | 2141 | |
2142 | -KStyle* allocate() | ||
1429 | +QStyle *LiquidInterface::style ( ) | 2143 | +QStyle *LiquidInterface::style ( ) |
1430 | +{ | 2144 | { |
2145 | - return(new LiquidStyle); | ||
1431 | +return new LiquidStyle ( ); | 2146 | +return new LiquidStyle ( ); |
1432 | +} | 2147 | } |
1433 | + | 2148 | |
2149 | -int minor_version() | ||
1434 | +QString LiquidInterface::name ( ) const | 2150 | +QString LiquidInterface::name ( ) const |
1435 | +{ | 2151 | { |
2152 | - return(0); | ||
1436 | +return qApp-> translate ( "Styles", "Liquid" ); | 2153 | +return qApp-> translate ( "Styles", "Liquid" ); |
1437 | +} | 2154 | } |
1438 | + | 2155 | |
2156 | -int major_version() | ||
1439 | +QString LiquidInterface::description ( ) const | 2157 | +QString LiquidInterface::description ( ) const |
1440 | +{ | 2158 | { |
2159 | - return(1); | ||
1441 | +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); | 2160 | +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); |
1442 | +} | 2161 | } |
1443 | + | 2162 | |
2163 | -const char *description() | ||
1444 | +bool LiquidInterface::hasSettings ( ) const | 2164 | +bool LiquidInterface::hasSettings ( ) const |
1445 | +{ | 2165 | { |
2166 | - return(i18n("High performance liquid plugin").utf8()); | ||
1446 | +return true; | 2167 | +return true; |
1447 | +} | 2168 | +} |
1448 | + | 2169 | + |
1449 | +QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) | 2170 | +QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) |
1450 | +{ | 2171 | +{ |
1451 | +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); | 2172 | +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); |
1452 | 2173 | + | |
1453 | -extern "C" { | ||
1454 | - KStyle* allocate(); | ||
1455 | - int minor_version(); | ||
1456 | - int major_version(); | ||
1457 | - const char *description(); | ||
1458 | +return m_widget; | 2174 | +return m_widget; |
1459 | } | 2175 | +} |
1460 | 2176 | + | |
1461 | -KStyle* allocate() | ||
1462 | +bool LiquidInterface::accept ( ) | 2177 | +bool LiquidInterface::accept ( ) |
1463 | { | 2178 | +{ |
1464 | - return(new LiquidStyle); | ||
1465 | +if ( !m_widget ) | 2179 | +if ( !m_widget ) |
1466 | + return false; | 2180 | + return false; |
1467 | + | 2181 | + |
1468 | +return m_widget-> writeConfig ( ); | 2182 | +return m_widget-> writeConfig ( ); |
1469 | } | 2183 | } |
1470 | 2184 | + | |
1471 | -int minor_version() | ||
1472 | +void LiquidInterface::reject ( ) | 2185 | +void LiquidInterface::reject ( ) |
1473 | { | 2186 | +{ |
1474 | - return(0); | 2187 | +} |
1475 | } | 2188 | + |
1476 | |||
1477 | -int major_version() | ||
1478 | + | 2189 | + |
1479 | +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 2190 | +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
1480 | { | 2191 | +{ |
1481 | - return(1); | ||
1482 | +*iface = 0; | 2192 | +*iface = 0; |
1483 | + | 2193 | + |
1484 | +if ( uuid == IID_QUnknown ) | 2194 | +if ( uuid == IID_QUnknown ) |
@@ -1492,17 +2202,10 @@ Features: | |||
1492 | + (*iface)-> addRef ( ); | 2202 | + (*iface)-> addRef ( ); |
1493 | + | 2203 | + |
1494 | +return QS_OK; | 2204 | +return QS_OK; |
1495 | } | 2205 | +} |
1496 | 2206 | + | |
1497 | -const char *description() | ||
1498 | +Q_EXPORT_INTERFACE() | 2207 | +Q_EXPORT_INTERFACE() |
1499 | { | 2208 | +{ |
1500 | - return(i18n("High performance liquid plugin").utf8()); | ||
1501 | +Q_CREATE_INSTANCE( LiquidInterface ) | 2209 | +Q_CREATE_INSTANCE( LiquidInterface ) |
1502 | } | 2210 | +} |
1503 | + | ||
1504 | + | ||
1505 | + | ||
1506 | + | 2211 | + |
1507 | +// Hack for Retail Z experiments | ||
1508 | +extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } | ||
diff --git a/noncore/styles/liquid/plugin.cpp b/noncore/styles/liquid/plugin.cpp index 0740420..6813fc5 100644 --- a/noncore/styles/liquid/plugin.cpp +++ b/noncore/styles/liquid/plugin.cpp | |||
@@ -77,8 +77,3 @@ Q_EXPORT_INTERFACE() | |||
77 | Q_CREATE_INSTANCE( LiquidInterface ) | 77 | Q_CREATE_INSTANCE( LiquidInterface ) |
78 | } | 78 | } |
79 | 79 | ||
80 | |||
81 | |||
82 | |||
83 | // Hack for Retail Z experiments | ||
84 | extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } | ||