summaryrefslogtreecommitdiff
authorsandman <sandman>2002-07-01 23:39:51 (UTC)
committer sandman <sandman>2002-07-01 23:39:51 (UTC)
commit329ea43b68180058bcd8e9d2af4d09d9c03c55a3 (patch) (unidiff)
tree8cb75f0d18be170c2def7ce8968fcbddeb004e82
parent7191d788415f190680c8a699b2b7bb88ddf28917 (diff)
downloadopie-329ea43b68180058bcd8e9d2af4d09d9c03c55a3.zip
opie-329ea43b68180058bcd8e9d2af4d09d9c03c55a3.tar.gz
opie-329ea43b68180058bcd8e9d2af4d09d9c03c55a3.tar.bz2
Added two new settings to liquid-style / Liquid-Settings:
- en/disable the new window decoration - set the stipple contrast (from no stipple to twice the normal value)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp19
-rw-r--r--noncore/styles/liquid/liquiddeco.cpp18
-rw-r--r--noncore/styles/liquid/settings/liquidset.cpp55
-rw-r--r--noncore/styles/liquid/settings/liquidset.h3
4 files changed, 69 insertions, 26 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 313d52c..acf0a42 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -57,49 +57,49 @@ void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
57 if(r-10) 57 if(r-10)
58 r-=10; 58 r-=10;
59 if(g-10) 59 if(g-10)
60 g-=10; 60 g-=10;
61 if(b-10) 61 if(b-10)
62 b-=10; 62 b-=10;
63 data[x] = qRgb(r, g, b); 63 data[x] = qRgb(r, g, b);
64 } 64 }
65 } 65 }
66 pix.convertFromImage(img); 66 pix.convertFromImage(img);
67} 67}
68 68
69TransMenuHandler::TransMenuHandler(QObject *parent) 69TransMenuHandler::TransMenuHandler(QObject *parent)
70 : QObject(parent) 70 : QObject(parent)
71{ 71{
72 pixDict.setAutoDelete(true); 72 pixDict.setAutoDelete(true);
73 reloadSettings(); 73 reloadSettings();
74} 74}
75 75
76void TransMenuHandler::reloadSettings() 76void TransMenuHandler::reloadSettings()
77{ 77{
78 pixDict.clear(); 78 pixDict.clear();
79 79
80 Config config ( "qpe" ); 80 Config config ( "qpe" );
81 config. setGroup ( "MosfetMenus" ); 81 config. setGroup ( "Liquid-Style" );
82 82
83 type = config. readNumEntry("Type", TransStippleBg); 83 type = config. readNumEntry("Type", TransStippleBg);
84 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 84 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
85 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 85 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
86 opacity = config. readNumEntry("Opacity", 10); 86 opacity = config. readNumEntry("Opacity", 10);
87 if ( opacity < -20 ) 87 if ( opacity < -20 )
88 opacity = 20; 88 opacity = 20;
89 else if ( opacity > 20 ) 89 else if ( opacity > 20 )
90 opacity = 20; 90 opacity = 20;
91 91
92 shadowText = config. readBoolEntry("ShadowText", true); 92 shadowText = config. readBoolEntry("ShadowText", true);
93} 93}
94 94
95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
96{ 96{
97 QWidget *p = (QWidget *)obj; 97 QWidget *p = (QWidget *)obj;
98 98
99 if(ev->type() == QEvent::Show){ 99 if(ev->type() == QEvent::Show){
100 if(type == TransStippleBg || type == TransStippleBtn || 100 if(type == TransStippleBg || type == TransStippleBtn ||
101 type == Custom){ 101 type == Custom){
102 QApplication::syncX(); 102 QApplication::syncX();
103 QPixmap *pix = new QPixmap; 103 QPixmap *pix = new QPixmap;
104 if(p->testWFlags(Qt::WType_Popup)){ 104 if(p->testWFlags(Qt::WType_Popup)){
105 QRect r(p->x(), p->y(), p->width(), p->height()); 105 QRect r(p->x(), p->y(), p->width(), p->height());
@@ -689,48 +689,55 @@ void LiquidStyle::polish(QPalette &appPal)
689 for(i=0; i < BITMAP_ITEMS; ++i){ 689 for(i=0; i < BITMAP_ITEMS; ++i){
690 if(pixmaps[i]){ 690 if(pixmaps[i]){
691 delete pixmaps[i]; 691 delete pixmaps[i];
692 pixmaps[i] = NULL; 692 pixmaps[i] = NULL;
693 } 693 }
694 } 694 }
695 QWidgetList *list = QApplication::allWidgets(); 695 QWidgetList *list = QApplication::allWidgets();
696 QWidgetListIt it( *list ); 696 QWidgetListIt it( *list );
697 QWidget *w; 697 QWidget *w;
698 while ((w=it.current()) != 0 ){ 698 while ((w=it.current()) != 0 ){
699 ++it; 699 ++it;
700 if(w->inherits("QPushButton")){ 700 if(w->inherits("QPushButton")){
701 unapplyCustomAttributes((QPushButton *)w); 701 unapplyCustomAttributes((QPushButton *)w);
702 } 702 }
703 } 703 }
704 704
705 loadCustomButtons(); 705 loadCustomButtons();
706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
707 btnDict.clear(); 707 btnDict.clear();
708 btnBorderDict.clear(); 708 btnBorderDict.clear();
709 bevelFillDict.clear(); 709 bevelFillDict.clear();
710 smallBevelFillDict.clear(); 710 smallBevelFillDict.clear();
711 711
712 Config config ( "qpe" ); 712 Config config ( "qpe" );
713 config. setGroup ( "Liquid-Style" );
714 int contrast = config. readNumEntry ( "StippleContrast", 5 );
715 if ( contrast < 0 )
716 contrast = 0;
717 else if ( contrast > 10 )
718 contrast = 10;
719
713 QPalette pal = QApplication::palette(); 720 QPalette pal = QApplication::palette();
714 721
715 // button color stuff 722 // button color stuff
716 config. setGroup ( "Appearance" ); 723 config. setGroup ( "Appearance" );
717 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 724 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
718 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { 725 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) {
719 // force button color to be different from background 726 // force button color to be different from background
720 QBrush btnBrush(QColor(200, 202, 228)); 727 QBrush btnBrush(QColor(200, 202, 228));
721 appPal.setBrush(QColorGroup::Button, btnBrush); 728 appPal.setBrush(QColorGroup::Button, btnBrush);
722 } 729 }
723 c.hsv(&btnH, &btnS, &btnV); 730 c.hsv(&btnH, &btnS, &btnV);
724 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 731 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
725 732
726 // menu pixmap 733 // menu pixmap
727 if(!menuPix){ 734 if(!menuPix){
728 menuPix = new QPixmap; 735 menuPix = new QPixmap;
729 menuPix->resize(64, 64); 736 menuPix->resize(64, 64);
730 } 737 }
731 QPainter painter; 738 QPainter painter;
732 menuPix->fill(c.rgb()); 739 menuPix->fill(c.rgb());
733 painter.begin(menuPix); 740 painter.begin(menuPix);
734 painter.setPen(c.dark(105)); 741 painter.setPen(c.dark(105));
735 for(i=0; i < 63; i+=4){ 742 for(i=0; i < 63; i+=4){
736 painter.drawLine(0, i, 63, i); 743 painter.drawLine(0, i, 63, i);
@@ -760,51 +767,51 @@ void LiquidStyle::polish(QPalette &appPal)
760 c.hsv(&h, &s, &v); 767 c.hsv(&h, &s, &v);
761 pix = new QPixmap(*smallBevelFillPix); 768 pix = new QPixmap(*smallBevelFillPix);
762 adjustHSV(*pix, h, s, v); 769 adjustHSV(*pix, h, s, v);
763 smallBevelFillDict.insert(c.rgb(), pix); 770 smallBevelFillDict.insert(c.rgb(), pix);
764 } 771 }
765 pagerBrush.setColor(c); 772 pagerBrush.setColor(c);
766 pagerBrush.setPixmap(*pix); 773 pagerBrush.setPixmap(*pix);
767 774
768 // background color stuff 775 // background color stuff
769 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); 776 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));
770 c.hsv(&bH, &bS, &bV); 777 c.hsv(&bH, &bS, &bV);
771 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 778 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
772 779
773 // FIXME? 780 // FIXME?
774 if(vsbSliderFillPix) 781 if(vsbSliderFillPix)
775 delete vsbSliderFillPix; 782 delete vsbSliderFillPix;
776 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 783 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
777 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 784 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
778 785
779 // background brush 786 // background brush
780 QPixmap wallPaper(32, 32); 787 QPixmap wallPaper(32, 32);
781 wallPaper.fill(c.rgb()); 788 wallPaper.fill(c.rgb());
782 painter.begin(&wallPaper); 789 painter.begin(&wallPaper);
783 for(i=0; i < 32; i+=4){ 790 for(i=0; i < 32; i+=4){
784 painter.setPen(c.dark(105)); 791 painter.setPen(c.dark(100 + contrast));
785 painter.drawLine(0, i, 32, i); 792 painter.drawLine(0, i, 32, i);
786 painter.setPen(c.dark(103)); 793 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
787 painter.drawLine(0, i+1, 32, i+1); 794 painter.drawLine(0, i+1, 32, i+1);
788 }; 795 };
789 painter.end(); 796 painter.end();
790 bgBrush.setColor(c); 797 bgBrush.setColor(c);
791 bgBrush.setPixmap(wallPaper); 798 bgBrush.setPixmap(wallPaper);
792 appPal.setBrush(QColorGroup::Background, bgBrush); 799 appPal.setBrush(QColorGroup::Background, bgBrush);
793 800
794 // lineedits 801 // lineedits
795 c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); 802 c = QColor ( config. readEntry("Base", ( Qt::white). name ( )));
796 QPixmap basePix; 803 QPixmap basePix;
797 basePix.resize(32, 32); 804 basePix.resize(32, 32);
798 basePix.fill(c.rgb()); 805 basePix.fill(c.rgb());
799 painter.begin(&basePix); 806 painter.begin(&basePix);
800 painter.setPen(c.dark(105)); 807 painter.setPen(c.dark(105));
801 for(i=0; i < 32; i+=4){ 808 for(i=0; i < 32; i+=4){
802 painter.drawLine(0, i, 32, i); 809 painter.drawLine(0, i, 32, i);
803 painter.drawLine(0, i+1, 32, i+1); 810 painter.drawLine(0, i+1, 32, i+1);
804 }; 811 };
805 painter.end(); 812 painter.end();
806 baseBrush.setColor(c); 813 baseBrush.setColor(c);
807 baseBrush.setPixmap(basePix); 814 baseBrush.setPixmap(basePix);
808 it.toFirst(); 815 it.toFirst();
809 while ((w=it.current()) != 0 ){ 816 while ((w=it.current()) != 0 ){
810 ++it; 817 ++it;
@@ -968,49 +975,53 @@ void LiquidStyle::unPolish(QWidget *w)
968 if(w->inherits("QToolBar")){ 975 if(w->inherits("QToolBar")){
969 w->removeEventFilter(this); 976 w->removeEventFilter(this);
970 w->setBackgroundMode(QWidget::PaletteBackground); 977 w->setBackgroundMode(QWidget::PaletteBackground);
971 return; 978 return;
972 } 979 }
973 if(w->inherits("QHeader")){ 980 if(w->inherits("QHeader")){
974 w->setMouseTracking(false); 981 w->setMouseTracking(false);
975 w->removeEventFilter(this); 982 w->removeEventFilter(this);
976 } 983 }
977} 984}
978 985
979void LiquidStyle::polish(QApplication *app) 986void LiquidStyle::polish(QApplication *app)
980{ 987{
981 988
982 QWindowsStyle::polish(app); 989 QWindowsStyle::polish(app);
983 menuAni = app->isEffectEnabled(UI_AnimateMenu); 990 menuAni = app->isEffectEnabled(UI_AnimateMenu);
984 menuFade = app->isEffectEnabled(UI_FadeMenu); 991 menuFade = app->isEffectEnabled(UI_FadeMenu);
985 if(menuAni) 992 if(menuAni)
986 app->setEffectEnabled(UI_AnimateMenu, false); 993 app->setEffectEnabled(UI_AnimateMenu, false);
987 if(menuFade) 994 if(menuFade)
988 app->setEffectEnabled(UI_FadeMenu, false); 995 app->setEffectEnabled(UI_FadeMenu, false);
989 996
990 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 997 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
991 998
992 QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 999 Config config ( "qpe" );
1000 config. setGroup ( "Liquid-Style" );
1001
1002 if ( config. readBoolEntry ( "WinDecoration", true ))
1003 QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
993} 1004}
994 1005
995void LiquidStyle::unPolish(QApplication *app) 1006void LiquidStyle::unPolish(QApplication *app)
996{ 1007{
997 QWindowsStyle::unPolish(app); 1008 QWindowsStyle::unPolish(app);
998 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1009 app->setEffectEnabled(UI_AnimateMenu, menuAni);
999 app->setEffectEnabled(UI_FadeMenu, menuFade); 1010 app->setEffectEnabled(UI_FadeMenu, menuFade);
1000 1011
1001 qt_set_draw_menu_bar_impl ( 0 ); 1012 qt_set_draw_menu_bar_impl ( 0 );
1002 1013
1003 QApplication::qwsSetDecoration ( new QPEDecoration ( )); 1014 QApplication::qwsSetDecoration ( new QPEDecoration ( ));
1004} 1015}
1005 1016
1006/* 1017/*
1007 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1018 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1008 * force everything to erase and repaint on resize. This is going away, I'm 1019 * force everything to erase and repaint on resize. This is going away, I'm
1009 * trying to get shaped widgets to work right without masking. QPushButton, 1020 * trying to get shaped widgets to work right without masking. QPushButton,
1010 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1021 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1011 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1022 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1012 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1023 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1013 * caches them in QPixmapCache, which is bad for doing things like hover 1024 * caches them in QPixmapCache, which is bad for doing things like hover
1014 * because the style methods aren't called in paintEvents if everything 1025 * because the style methods aren't called in paintEvents if everything
1015 * is cached. We use our own Paint event handler instead. Taskbuttons and 1026 * is cached. We use our own Paint event handler instead. Taskbuttons and
1016 * pager buttons draw into a pixmap buffer, so we handle those with palette 1027 * pager buttons draw into a pixmap buffer, so we handle those with palette
diff --git a/noncore/styles/liquid/liquiddeco.cpp b/noncore/styles/liquid/liquiddeco.cpp
index 8eee1b1..5488c67 100644
--- a/noncore/styles/liquid/liquiddeco.cpp
+++ b/noncore/styles/liquid/liquiddeco.cpp
@@ -77,75 +77,69 @@ void LiquidDecoration::paint( QPainter *painter, const QWidget *widget )
77 rect.width() + 2 * BORDER_WIDTH, 77 rect.width() + 2 * BORDER_WIDTH,
78 rect.height() + BORDER_WIDTH + BOTTOM_BORDER_WIDTH + titleHeight ); 78 rect.height() + BORDER_WIDTH + BOTTOM_BORDER_WIDTH + titleHeight );
79 79
80 // title bar rect 80 // title bar rect
81 QRect tr; 81 QRect tr;
82 82
83 tr = QRect( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); 83 tr = QRect( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight );
84 84
85 QRegion oldClip = painter->clipRegion(); 85 QRegion oldClip = painter->clipRegion();
86 painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker 86 painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker
87 87
88 bool isActive = ( widget == qApp->activeWindow() ); 88 bool isActive = ( widget == qApp->activeWindow() );
89 89
90 QColorGroup cg = QApplication::palette().active(); 90 QColorGroup cg = QApplication::palette().active();
91 if ( isActive ) 91 if ( isActive )
92 cg. setBrush ( QColorGroup::Button, cg. brush ( QColorGroup::Highlight ) ); 92 cg. setBrush ( QColorGroup::Button, cg. brush ( QColorGroup::Highlight ) );
93 93
94 qDrawWinPanel( painter, br.x(), br.y(), br.width(), 94 qDrawWinPanel( painter, br.x(), br.y(), br.width(),
95 br.height() - 4, cg, FALSE, 95 br.height() - 4, cg, FALSE,
96 &cg.brush( QColorGroup::Background ) ); 96 &cg.brush( QColorGroup::Background ) );
97 97
98 painter->setClipRegion( oldClip ); 98 painter->setClipRegion( oldClip );
99 99
100 if ( titleWidth > 0 ) { 100 if ( titleWidth > 0 ) {
101 QBrush titleBrush;
102 QPen titlePen;
103 QPen titleLines;
104 int titleLeft = titleHeight + 4;
105
106 titleLeft = rect.left() + 5;
107 painter->setPen( cg.midlight() ); 101 painter->setPen( cg.midlight() );
108 painter->drawLine( rect.left() - BORDER_WIDTH + 2, 102 painter->drawLine( rect.left() - BORDER_WIDTH + 2,
109 rect.bottom() + 1, rect.right() + BORDER_WIDTH - 2, 103 rect.bottom() + 1, rect.right() + BORDER_WIDTH - 2,
110 rect.bottom() + 1 ); 104 rect.bottom() + 1 );
111 105
112 QRect t ( rect.left() - 2, rect.top() - titleHeight - 2, rect.width() + 3, titleHeight + 2 ); 106 QRect t ( rect.left() - 2, rect.top() - titleHeight - 2, rect.width() + 3, titleHeight + 2 );
113 107
114 108
115 109
116 QApplication::style().drawBevelButton( painter, t.x(), t.y(), t.width(), t.height(), cg, isActive ); 110 QApplication::style().drawBevelButton( painter, t.x(), t.y(), t.width(), t.height(), cg, isActive );
117 111
118 t.setLeft( t.left() + 4 ); 112 t .setLeft ( t. left ( ) + 4 );
119 t.setRight( t.right() - 2 ); 113 t .setRight ( t. right ( ) - 2 );
120 114
121 QFont f( QApplication::font() ); 115 QFont f ( QApplication::font ( ));
122 f.setWeight( QFont::Bold ); 116 f. setWeight ( QFont::Bold );
123 117
124 painter-> setFont( f ); 118 painter-> setFont ( f );
125 119
126 QColor textcol = cg.color( isActive ? QColorGroup::HighlightedText : QColorGroup::Text ); 120 QColor textcol = cg.color( isActive ? QColorGroup::HighlightedText : QColorGroup::Text );
127 QColor shadecol = ( qGray ( textcol. rgb ( ) ) > 128 ) ? textcol. dark ( 130 ) : textcol.light( 200 ); 121 QColor shadecol = ( qGray ( textcol. rgb ( ) ) > 128 ) ? textcol. dark ( 230 ) : textcol.light( 300 );
128 122
129 if ( textcol == shadecol ) { 123 if ( textcol == shadecol ) {
130 if ( qGray ( shadecol. rgb ( ) ) < 128 ) 124 if ( qGray ( shadecol. rgb ( ) ) < 128 )
131 shadecol = QColor ( 225, 225, 225 ); 125 shadecol = QColor ( 225, 225, 225 );
132 else 126 else
133 shadecol = QColor ( 30, 30, 30 ); 127 shadecol = QColor ( 30, 30, 30 );
134 } 128 }
135 129
136 painter-> setPen( shadecol ); 130 painter-> setPen( shadecol );
137 painter-> drawText( t.x() + 1, t.y() + 1, t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() ); 131 painter-> drawText( t.x() + 1, t.y() + 1, t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() );
138 painter-> setPen( textcol ); 132 painter-> setPen( textcol );
139 painter-> drawText( t.x(), t.y(), t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() ); 133 painter-> drawText( t.x(), t.y(), t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() );
140 } 134 }
141 135
142#ifndef MINIMIZE_HELP_HACK 136#ifndef MINIMIZE_HELP_HACK
143 paintButton( painter, widget, ( QWSDecoration::Region ) Help, 0 ); 137 paintButton( painter, widget, ( QWSDecoration::Region ) Help, 0 );
144#endif 138#endif
145} 139}
146 140
147void LiquidDecoration::paintButton( QPainter *painter, const QWidget *w, 141void LiquidDecoration::paintButton( QPainter *painter, const QWidget *w,
148 QWSDecoration::Region type, int state ) 142 QWSDecoration::Region type, int state )
149{ 143{
150 const QColorGroup & cg = w->palette().active(); 144 const QColorGroup & cg = w->palette().active();
151 145
diff --git a/noncore/styles/liquid/settings/liquidset.cpp b/noncore/styles/liquid/settings/liquidset.cpp
index 0ef5dbe..1479ac0 100644
--- a/noncore/styles/liquid/settings/liquidset.cpp
+++ b/noncore/styles/liquid/settings/liquidset.cpp
@@ -23,69 +23,76 @@
23#include "liquidset.h" 23#include "liquidset.h"
24#include "../liquid.h" 24#include "../liquid.h"
25 25
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28 28
29#include <qslider.h> 29#include <qslider.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31#include <qbuttongroup.h> 31#include <qbuttongroup.h>
32#include <qradiobutton.h> 32#include <qradiobutton.h>
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qpalette.h> 36#include <qpalette.h>
37 37
38#include <qpe/config.h> 38#include <qpe/config.h>
39 39
40#include <opie/colorpopupmenu.h> 40#include <opie/colorpopupmenu.h>
41 41
42 42
43static void changeButtonColor ( QWidget *btn, const QColor &col ) 43static void changeButtonColor ( QWidget *btn, const QColor &col )
44{ 44{
45 QPalette pal = btn-> palette ( ); 45 QPalette pal = btn-> palette ( );
46 46
47 pal. setColor ( QPalette::Normal, QColorGroup::Button, col );
47 pal. setColor ( QPalette::Active, QColorGroup::Button, col ); 48 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
48 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); 49 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col );
49 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); 50 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col );
51 pal. setColor ( QPalette::Normal, QColorGroup::Background, col );
52 pal. setColor ( QPalette::Active, QColorGroup::Background, col );
53 pal. setColor ( QPalette::Disabled, QColorGroup::Background, col );
54 pal. setColor ( QPalette::Inactive, QColorGroup::Background, col );
50 55
51 btn-> setPalette ( pal ); 56 btn-> setPalette ( pal );
52} 57}
53 58
54 59
55LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) 60LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl )
56 : QDialog ( parent, name, fl ) 61 : QDialog ( parent, name, fl )
57{ 62{
58 setCaption ( tr( "Liquid Style" ) ); 63 setCaption ( tr( "Liquid Style" ) );
59 64
60 Config config ( "qpe" ); 65 Config config ( "qpe" );
61 config. setGroup ( "MosfetMenus" ); 66 config. setGroup ( "Liquid-Style" );
62 67
63 m_type = config. readNumEntry ( "Type", TransStippleBg ); 68 m_type = config. readNumEntry ( "Type", TransStippleBg );
64 m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); 69 m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( )));
65 m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); 70 m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( )));
66 int opacity = config. readNumEntry ( "Opacity", 10 ); 71 int opacity = config. readNumEntry ( "Opacity", 10 );
67 m_shadow = config. readBoolEntry ( "ShadowText", true ); 72 m_shadow = config. readBoolEntry ( "ShadowText", true );
73 m_deco = config. readBoolEntry ( "WinDecoration", true );
74 int contrast = config. readNumEntry ( "StippleContrast", 5 );
68 75
69 QVBoxLayout *vbox = new QVBoxLayout ( this ); 76 QVBoxLayout *vbox = new QVBoxLayout ( this );
70 vbox-> setSpacing ( 3 ); 77 vbox-> setSpacing ( 3 );
71 vbox-> setMargin ( 6 ); 78 vbox-> setMargin ( 6 );
72 79
73 QButtonGroup *btngrp = new QButtonGroup ( this ); 80 QButtonGroup *btngrp = new QButtonGroup ( this );
74 btngrp-> hide ( ); 81 btngrp-> hide ( );
75 82
76 QRadioButton *rad; 83 QRadioButton *rad;
77 84
78 rad = new QRadioButton ( tr( "No translucency" ), this ); 85 rad = new QRadioButton ( tr( "No translucency" ), this );
79 btngrp-> insert ( rad, None ); 86 btngrp-> insert ( rad, None );
80 vbox-> addWidget ( rad ); 87 vbox-> addWidget ( rad );
81 88
82 rad = new QRadioButton ( tr( "Stippled, background color" ), this ); 89 rad = new QRadioButton ( tr( "Stippled, background color" ), this );
83 btngrp-> insert ( rad, StippledBg ); 90 btngrp-> insert ( rad, StippledBg );
84 vbox-> addWidget ( rad ); 91 vbox-> addWidget ( rad );
85 92
86 rad = new QRadioButton ( tr( "Stippled, button color" ), this ); 93 rad = new QRadioButton ( tr( "Stippled, button color" ), this );
87 btngrp-> insert ( rad, StippledBtn ); 94 btngrp-> insert ( rad, StippledBtn );
88 vbox-> addWidget ( rad ); 95 vbox-> addWidget ( rad );
89 96
90 rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this ); 97 rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this );
91 btngrp-> insert ( rad, TransStippleBg ); 98 btngrp-> insert ( rad, TransStippleBg );
@@ -117,83 +124,111 @@ LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl )
117 124
118 popup = new ColorPopupMenu ( m_menucol, this ); 125 popup = new ColorPopupMenu ( m_menucol, this );
119 m_menubtn-> setPopup ( popup ); 126 m_menubtn-> setPopup ( popup );
120 m_menubtn-> setPopupDelay ( 0 ); 127 m_menubtn-> setPopupDelay ( 0 );
121 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & ))); 128 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & )));
122 changeMenuColor ( m_menucol ); 129 changeMenuColor ( m_menucol );
123 130
124 m_textbtn = new QToolButton ( this ); 131 m_textbtn = new QToolButton ( this );
125 grid-> addWidget ( m_textbtn, 0, 5 ); 132 grid-> addWidget ( m_textbtn, 0, 5 );
126 133
127 popup = new ColorPopupMenu ( m_textcol, this ); 134 popup = new ColorPopupMenu ( m_textcol, this );
128 m_textbtn-> setPopup ( popup ); 135 m_textbtn-> setPopup ( popup );
129 m_textbtn-> setPopupDelay ( 0 ); 136 m_textbtn-> setPopupDelay ( 0 );
130 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & ))); 137 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & )));
131 changeTextColor ( m_textcol ); 138 changeTextColor ( m_textcol );
132 139
133 m_opacsld = new QSlider ( Horizontal, this ); 140 m_opacsld = new QSlider ( Horizontal, this );
134 m_opacsld-> setRange ( -20, 20 ); 141 m_opacsld-> setRange ( -20, 20 );
135 m_opacsld-> setValue ( opacity ); 142 m_opacsld-> setValue ( opacity );
136 m_opacsld-> setTickmarks ( QSlider::Below ); 143 m_opacsld-> setTickmarks ( QSlider::Below );
137 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); 144 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 );
138 145
139 vbox-> addSpacing ( 4 ); 146 vbox-> addSpacing ( 4 );
140 147
141 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed text" ), this ); 148 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this );
142 shadow-> setChecked ( m_shadow ); 149 shadow-> setChecked ( m_shadow );
143 vbox-> addWidget ( shadow ); 150 vbox-> addWidget ( shadow );
144 151
152 vbox-> addSpacing ( 4 );
153
154 QCheckBox *windeco = new QCheckBox ( tr( "Draw liquid window title bars" ), this );
155 windeco-> setChecked ( m_deco );
156 vbox-> addWidget ( windeco );
157
158 vbox-> addSpacing ( 4 );
159
160 QHBoxLayout *hbox = new QHBoxLayout ( vbox );
161
162 hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this ));
163
164 m_contsld = new QSlider ( Horizontal, this );
165 m_contsld-> setRange ( 0, 10 );
166 m_contsld-> setValue ( contrast );
167 m_contsld-> setTickmarks ( QSlider::Below );
168 hbox-> addWidget ( m_contsld, 10 );
169
145 vbox-> addStretch ( 10 ); 170 vbox-> addStretch ( 10 );
171
172 changeType ( m_type );
146 173
147 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) ); 174 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) );
148 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); 175 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) );
176 connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) );
149} 177}
150 178
151void LiquidSet::changeType ( int t ) 179void LiquidSet::changeType ( int t )
152{ 180{
153 bool custom = ( t == Custom ); 181 bool custom = ( t == Custom );
154 182
155 m_menulbl-> setEnabled ( custom ); 183 m_menulbl-> setEnabled ( custom );
156 m_textlbl-> setEnabled ( custom ); 184 m_textlbl-> setEnabled ( custom );
157 m_opaclbl-> setEnabled ( custom ); 185 m_opaclbl-> setEnabled ( custom );
158 m_menubtn-> setEnabled ( custom ); 186 m_menubtn-> setEnabled ( custom );
159 m_textbtn-> setEnabled ( custom ); 187 m_textbtn-> setEnabled ( custom );
160 m_opacsld-> setEnabled ( custom ); 188 m_opacsld-> setEnabled ( custom );
161 189
162 m_type = t; 190 m_type = t;
163} 191}
164 192
165void LiquidSet::changeMenuColor ( const QColor &col ) 193void LiquidSet::changeMenuColor ( const QColor &col )
166{ 194{
167 m_menubtn-> setPalette ( col ); 195 changeButtonColor ( m_menubtn, col );
168 m_menucol = col; 196 m_menucol = col;
169} 197}
170 198
171void LiquidSet::changeTextColor ( const QColor &col ) 199void LiquidSet::changeTextColor ( const QColor &col )
172{ 200{
173 m_textbtn-> setPalette ( col ); 201 changeButtonColor ( m_textbtn, col );
174 m_textcol = col; 202 m_textcol = col;
175} 203}
176 204
177void LiquidSet::changeShadow ( bool b ) 205void LiquidSet::changeShadow ( bool b )
178{ 206{
179 m_shadow = b; 207 m_shadow = b;
180} 208}
181 209
210void LiquidSet::changeDeco ( bool b )
211{
212 m_deco = b;
213}
214
182 215
183void LiquidSet::accept ( ) 216void LiquidSet::accept ( )
184{ 217{
185 Config config ( "qpe" ); 218 Config config ( "qpe" );
186 config. setGroup ( "MosfetMenus" ); 219 config. setGroup ( "Liquid-Style" );
187 220
188 config. writeEntry ( "Type", m_type ); 221 config. writeEntry ( "Type", m_type );
189 config. writeEntry ( "Color", m_menucol. name ( )); 222 config. writeEntry ( "Color", m_menucol. name ( ));
190 config. writeEntry ( "TextColor", m_textcol. name ( )); 223 config. writeEntry ( "TextColor", m_textcol. name ( ));
191 config. writeEntry ( "Opacity", m_opacsld-> value ( )); 224 config. writeEntry ( "Opacity", m_opacsld-> value ( ));
192 config. writeEntry ( "ShadowText", m_shadow ); 225 config. writeEntry ( "ShadowText", m_shadow );
226 config. writeEntry ( "WinDecoration", m_deco );
227 config. writeEntry ( "StippleContrast", m_contsld-> value ( ));
193 config. write ( ); 228 config. write ( );
194 229
195 Global::applyStyle ( ); 230 Global::applyStyle ( );
196 231
197 QDialog::accept ( ); 232 QDialog::accept ( );
198} 233}
199 234
diff --git a/noncore/styles/liquid/settings/liquidset.h b/noncore/styles/liquid/settings/liquidset.h
index 944b1ec..a0f590a 100644
--- a/noncore/styles/liquid/settings/liquidset.h
+++ b/noncore/styles/liquid/settings/liquidset.h
@@ -1,39 +1,42 @@
1#ifndef __OPIE_LIQUID_SET_H__ 1#ifndef __OPIE_LIQUID_SET_H__
2#define __OPIE_LIQUID_SET_H__ 2#define __OPIE_LIQUID_SET_H__
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5#include <qcolor.h> 5#include <qcolor.h>
6 6
7class QLabel; 7class QLabel;
8class QToolButton; 8class QToolButton;
9class QSlider; 9class QSlider;
10 10
11class LiquidSet : public QDialog { 11class LiquidSet : public QDialog {
12 Q_OBJECT 12 Q_OBJECT
13 13
14public: 14public:
15 LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); 15 LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
16 16
17public slots: 17public slots:
18 void changeType ( int t ); 18 void changeType ( int t );
19 void changeMenuColor ( const QColor &col ); 19 void changeMenuColor ( const QColor &col );
20 void changeTextColor ( const QColor &col ); 20 void changeTextColor ( const QColor &col );
21 void changeShadow ( bool b ); 21 void changeShadow ( bool b );
22 void changeDeco ( bool b );
22 23
23protected: 24protected:
24 virtual void accept ( ); 25 virtual void accept ( );
25 26
26private: 27private:
27 QColor m_menucol; 28 QColor m_menucol;
28 QColor m_textcol; 29 QColor m_textcol;
29 int m_type; 30 int m_type;
30 bool m_shadow; 31 bool m_shadow;
32 bool m_deco;
31 33
32 QSlider * m_opacsld; 34 QSlider * m_opacsld;
35 QSlider * m_contsld;
33 QLabel * m_menulbl; 36 QLabel * m_menulbl;
34 QLabel * m_textlbl; 37 QLabel * m_textlbl;
35 QLabel * m_opaclbl; 38 QLabel * m_opaclbl;
36 QToolButton *m_menubtn; 39 QToolButton *m_menubtn;
37 QToolButton *m_textbtn; 40 QToolButton *m_textbtn;
38}; 41};
39#endif 42#endif