summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/liquidset.cpp
Unidiff
Diffstat (limited to 'noncore/styles/liquid/liquidset.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquidset.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp
index 4fffe12..ea0b3c9 100644
--- a/noncore/styles/liquid/liquidset.cpp
+++ b/noncore/styles/liquid/liquidset.cpp
@@ -29,55 +29,37 @@
29#include <qslider.h> 29#include <qslider.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qradiobutton.h> 31#include <qradiobutton.h>
32#include <qcheckbox.h> 32#include <qcheckbox.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qlayout.h> 34#include <qlayout.h>
35 35
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38#include <opie/ocolorbutton.h> 38#include <opie/ocolorbutton.h>
39 39
40 40
41static void changeButtonColor ( QWidget *btn, const QColor &col )
42{
43 QPalette pal = btn-> palette ( );
44
45 pal. setColor ( QPalette::Normal, QColorGroup::Button, col );
46 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
47 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col );
48 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col );
49 pal. setColor ( QPalette::Normal, QColorGroup::Background, col );
50 pal. setColor ( QPalette::Active, QColorGroup::Background, col );
51 pal. setColor ( QPalette::Disabled, QColorGroup::Background, col );
52 pal. setColor ( QPalette::Inactive, QColorGroup::Background, col );
53
54 btn-> setPalette ( pal );
55}
56
57
58LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) 41LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl )
59 : QWidget ( parent, name, fl ) 42 : QWidget ( parent, name, fl )
60{ 43{
61 setCaption ( tr( "Liquid Style" ) ); 44 setCaption ( tr( "Liquid Style" ) );
62 45
63 Config config ( "qpe" ); 46 Config config ( "qpe" );
64 config. setGroup ( "Liquid-Style" ); 47 config. setGroup ( "Liquid-Style" );
65 48
66 m_type = config. readNumEntry ( "Type", TransStippleBg ); 49 m_type = config. readNumEntry ( "Type", TransStippleBg );
67 QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); 50 QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( )));
68 QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); 51 QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( )));
69 int opacity = config. readNumEntry ( "Opacity", 10 ); 52 int opacity = config. readNumEntry ( "Opacity", 10 );
70 m_shadow = config. readBoolEntry ( "ShadowText", true ); 53 m_shadow = config. readBoolEntry ( "ShadowText", true );
71 m_deco = config. readBoolEntry ( "WinDecoration", true );
72 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 54 int contrast = config. readNumEntry ( "StippleContrast", 5 );
73 m_flat = config. readBoolEntry ( "FlatToolButtons", false ); 55 m_flat = config. readBoolEntry ( "FlatToolButtons", false );
74 56
75 QVBoxLayout *vbox = new QVBoxLayout ( this ); 57 QVBoxLayout *vbox = new QVBoxLayout ( this );
76 vbox-> setSpacing ( 3 ); 58 vbox-> setSpacing ( 3 );
77 vbox-> setMargin ( 4 ); 59 vbox-> setMargin ( 4 );
78 60
79 QComboBox *cb = new QComboBox ( this ); 61 QComboBox *cb = new QComboBox ( this );
80 cb-> insertItem ( tr( "No translucency" ), None ); 62 cb-> insertItem ( tr( "No translucency" ), None );
81 cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); 63 cb-> insertItem ( tr( "Stippled, background color" ), StippledBg );
82 cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); 64 cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn );
83 cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); 65 cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg );
@@ -109,92 +91,79 @@ LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl )
109 m_opacsld-> setValue ( opacity ); 91 m_opacsld-> setValue ( opacity );
110 m_opacsld-> setTickmarks ( QSlider::Below ); 92 m_opacsld-> setTickmarks ( QSlider::Below );
111 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); 93 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 );
112 94
113 vbox-> addSpacing ( 4 ); 95 vbox-> addSpacing ( 4 );
114 96
115 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); 97 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this );
116 shadow-> setChecked ( m_shadow ); 98 shadow-> setChecked ( m_shadow );
117 vbox-> addWidget ( shadow ); 99 vbox-> addWidget ( shadow );
118 100
119 vbox-> addSpacing ( 4 ); 101 vbox-> addSpacing ( 4 );
120 102
121 QCheckBox *windeco = new QCheckBox ( tr( "Draw liquid window title bars" ), this );
122 windeco-> setChecked ( m_deco );
123 vbox-> addWidget ( windeco );
124
125 vbox-> addSpacing ( 4 );
126
127 QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); 103 QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this );
128 flattb-> setChecked ( m_flat ); 104 flattb-> setChecked ( m_flat );
129 vbox-> addWidget ( flattb ); 105 vbox-> addWidget ( flattb );
130 106
131 vbox-> addSpacing ( 4 ); 107 vbox-> addSpacing ( 4 );
132 108
133 QHBoxLayout *hbox = new QHBoxLayout ( vbox ); 109 QHBoxLayout *hbox = new QHBoxLayout ( vbox );
134 110
135 hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); 111 hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this ));
136 112
137 m_contsld = new QSlider ( Horizontal, this ); 113 m_contsld = new QSlider ( Horizontal, this );
138 m_contsld-> setRange ( 0, 10 ); 114 m_contsld-> setRange ( 0, 10 );
139 m_contsld-> setValue ( contrast ); 115 m_contsld-> setValue ( contrast );
140 m_contsld-> setTickmarks ( QSlider::Below ); 116 m_contsld-> setTickmarks ( QSlider::Below );
141 hbox-> addWidget ( m_contsld, 10 ); 117 hbox-> addWidget ( m_contsld, 10 );
142 118
143 vbox-> addStretch ( 10 ); 119 vbox-> addStretch ( 10 );
144 120
145 changeType ( m_type ); 121 changeType ( m_type );
146 122
147 connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); 123 connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) );
148 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); 124 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) );
149 connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) );
150 connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); 125 connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) );
151} 126}
152 127
153void LiquidSettings::changeType ( int t ) 128void LiquidSettings::changeType ( int t )
154{ 129{
155 bool custom = ( t == Custom ); 130 bool custom = ( t == Custom );
156 131
157 m_menulbl-> setEnabled ( custom ); 132 m_menulbl-> setEnabled ( custom );
158 m_textlbl-> setEnabled ( custom ); 133 m_textlbl-> setEnabled ( custom );
159 m_opaclbl-> setEnabled ( custom ); 134 m_opaclbl-> setEnabled ( custom );
160 m_menubtn-> setEnabled ( custom ); 135 m_menubtn-> setEnabled ( custom );
161 m_textbtn-> setEnabled ( custom ); 136 m_textbtn-> setEnabled ( custom );
162 m_opacsld-> setEnabled ( custom ); 137 m_opacsld-> setEnabled ( custom );
163 138
164 m_type = t; 139 m_type = t;
165} 140}
166 141
167void LiquidSettings::changeShadow ( bool b ) 142void LiquidSettings::changeShadow ( bool b )
168{ 143{
169 m_shadow = b; 144 m_shadow = b;
170} 145}
171 146
172void LiquidSettings::changeDeco ( bool b )
173{
174 m_deco = b;
175}
176
177void LiquidSettings::changeFlat ( bool b ) 147void LiquidSettings::changeFlat ( bool b )
178{ 148{
179 m_flat = b; 149 m_flat = b;
180} 150}
181 151
182 152
183bool LiquidSettings::writeConfig ( ) 153bool LiquidSettings::writeConfig ( )
184{ 154{
185 Config config ( "qpe" ); 155 Config config ( "qpe" );
186 config. setGroup ( "Liquid-Style" ); 156 config. setGroup ( "Liquid-Style" );
187 157
188 config. writeEntry ( "Type", m_type ); 158 config. writeEntry ( "Type", m_type );
189 config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); 159 config. writeEntry ( "Color", m_menubtn-> color ( ). name ( ));
190 config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); 160 config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( ));
191 config. writeEntry ( "Opacity", m_opacsld-> value ( )); 161 config. writeEntry ( "Opacity", m_opacsld-> value ( ));
192 config. writeEntry ( "ShadowText", m_shadow ); 162 config. writeEntry ( "ShadowText", m_shadow );
193 config. writeEntry ( "WinDecoration", m_deco );
194 config. writeEntry ( "StippleContrast", m_contsld-> value ( )); 163 config. writeEntry ( "StippleContrast", m_contsld-> value ( ));
195 config. writeEntry ( "FlatToolButtons", m_flat ); 164 config. writeEntry ( "FlatToolButtons", m_flat );
196 config. write ( ); 165 config. write ( );
197 166
198 return true; 167 return true;
199} 168}
200 169