author | sandman <sandman> | 2002-07-01 23:39:51 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-07-01 23:39:51 (UTC) |
commit | 329ea43b68180058bcd8e9d2af4d09d9c03c55a3 (patch) (unidiff) | |
tree | 8cb75f0d18be170c2def7ce8968fcbddeb004e82 | |
parent | 7191d788415f190680c8a699b2b7bb88ddf28917 (diff) | |
download | opie-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)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 17 | ||||
-rw-r--r-- | noncore/styles/liquid/liquiddeco.cpp | 8 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/liquidset.cpp | 45 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/liquidset.h | 3 |
4 files changed, 58 insertions, 15 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 | |||
@@ -75,13 +75,13 @@ TransMenuHandler::TransMenuHandler(QObject *parent) | |||
75 | 75 | ||
76 | void TransMenuHandler::reloadSettings() | 76 | void 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 ) |
@@ -707,12 +707,19 @@ void LiquidStyle::polish(QPalette &appPal) | |||
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 ( )))) { |
@@ -778,15 +785,15 @@ void LiquidStyle::polish(QPalette &appPal) | |||
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); |
@@ -986,12 +993,16 @@ void LiquidStyle::polish(QApplication *app) | |||
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 | ||
999 | Config config ( "qpe" ); | ||
1000 | config. setGroup ( "Liquid-Style" ); | ||
1001 | |||
1002 | if ( config. readBoolEntry ( "WinDecoration", true )) | ||
992 | QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | 1003 | QApplication::qwsSetDecoration ( new LiquidDecoration ( )); |
993 | } | 1004 | } |
994 | 1005 | ||
995 | void LiquidStyle::unPolish(QApplication *app) | 1006 | void LiquidStyle::unPolish(QApplication *app) |
996 | { | 1007 | { |
997 | QWindowsStyle::unPolish(app); | 1008 | QWindowsStyle::unPolish(app); |
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 | |||
@@ -95,18 +95,12 @@ void LiquidDecoration::paint( QPainter *painter, const QWidget *widget ) | |||
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 ); |
@@ -121,13 +115,13 @@ void LiquidDecoration::paint( QPainter *painter, const QWidget *widget ) | |||
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 ); |
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 | |||
@@ -41,33 +41,40 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | static void changeButtonColor ( QWidget *btn, const QColor &col ) | 43 | static 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 | ||
55 | LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) | 60 | LiquidSet::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 ); |
@@ -135,20 +142,41 @@ LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl ) | |||
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 ); |
146 | 171 | ||
172 | changeType ( m_type ); | ||
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 | ||
151 | void LiquidSet::changeType ( int t ) | 179 | void LiquidSet::changeType ( int t ) |
152 | { | 180 | { |
153 | bool custom = ( t == Custom ); | 181 | bool custom = ( t == Custom ); |
154 | 182 | ||
@@ -161,38 +189,45 @@ void LiquidSet::changeType ( int t ) | |||
161 | 189 | ||
162 | m_type = t; | 190 | m_type = t; |
163 | } | 191 | } |
164 | 192 | ||
165 | void LiquidSet::changeMenuColor ( const QColor &col ) | 193 | void 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 | ||
171 | void LiquidSet::changeTextColor ( const QColor &col ) | 199 | void 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 | ||
177 | void LiquidSet::changeShadow ( bool b ) | 205 | void LiquidSet::changeShadow ( bool b ) |
178 | { | 206 | { |
179 | m_shadow = b; | 207 | m_shadow = b; |
180 | } | 208 | } |
181 | 209 | ||
210 | void LiquidSet::changeDeco ( bool b ) | ||
211 | { | ||
212 | m_deco = b; | ||
213 | } | ||
214 | |||
182 | 215 | ||
183 | void LiquidSet::accept ( ) | 216 | void 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 | } |
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 | |||
@@ -16,23 +16,26 @@ public: | |||
16 | 16 | ||
17 | public slots: | 17 | public 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 | ||
23 | protected: | 24 | protected: |
24 | virtual void accept ( ); | 25 | virtual void accept ( ); |
25 | 26 | ||
26 | private: | 27 | private: |
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 | }; |