summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/settings/liquidset.cpp
Unidiff
Diffstat (limited to 'noncore/styles/liquid/settings/liquidset.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/settings/liquidset.cpp234
1 files changed, 0 insertions, 234 deletions
diff --git a/noncore/styles/liquid/settings/liquidset.cpp b/noncore/styles/liquid/settings/liquidset.cpp
deleted file mode 100644
index 1479ac0..0000000
--- a/noncore/styles/liquid/settings/liquidset.cpp
+++ b/dev/null
@@ -1,234 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22
23#include "liquidset.h"
24#include "../liquid.h"
25
26#include <qpe/qpeapplication.h>
27#include <qpe/global.h>
28
29#include <qslider.h>
30#include <qtoolbutton.h>
31#include <qbuttongroup.h>
32#include <qradiobutton.h>
33#include <qcheckbox.h>
34#include <qlabel.h>
35#include <qlayout.h>
36#include <qpalette.h>
37
38#include <qpe/config.h>
39
40#include <opie/colorpopupmenu.h>
41
42
43static void changeButtonColor ( QWidget *btn, const QColor &col )
44{
45 QPalette pal = btn-> palette ( );
46
47 pal. setColor ( QPalette::Normal, QColorGroup::Button, col );
48 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
49 pal. setColor ( QPalette::Disabled, 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 );
55
56 btn-> setPalette ( pal );
57}
58
59
60LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl )
61 : QDialog ( parent, name, fl )
62{
63 setCaption ( tr( "Liquid Style" ) );
64
65 Config config ( "qpe" );
66 config. setGroup ( "Liquid-Style" );
67
68 m_type = config. readNumEntry ( "Type", TransStippleBg );
69 m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( )));
70 m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( )));
71 int opacity = config. readNumEntry ( "Opacity", 10 );
72 m_shadow = config. readBoolEntry ( "ShadowText", true );
73 m_deco = config. readBoolEntry ( "WinDecoration", true );
74 int contrast = config. readNumEntry ( "StippleContrast", 5 );
75
76 QVBoxLayout *vbox = new QVBoxLayout ( this );
77 vbox-> setSpacing ( 3 );
78 vbox-> setMargin ( 6 );
79
80 QButtonGroup *btngrp = new QButtonGroup ( this );
81 btngrp-> hide ( );
82
83 QRadioButton *rad;
84
85 rad = new QRadioButton ( tr( "No translucency" ), this );
86 btngrp-> insert ( rad, None );
87 vbox-> addWidget ( rad );
88
89 rad = new QRadioButton ( tr( "Stippled, background color" ), this );
90 btngrp-> insert ( rad, StippledBg );
91 vbox-> addWidget ( rad );
92
93 rad = new QRadioButton ( tr( "Stippled, button color" ), this );
94 btngrp-> insert ( rad, StippledBtn );
95 vbox-> addWidget ( rad );
96
97 rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this );
98 btngrp-> insert ( rad, TransStippleBg );
99 vbox-> addWidget ( rad );
100
101 rad = new QRadioButton ( tr( "Translucent stippled, button color" ), this );
102 btngrp-> insert ( rad, TransStippleBtn );
103 vbox-> addWidget ( rad );
104
105 rad = new QRadioButton ( tr( "Custom translucency" ), this );
106 btngrp-> insert ( rad, Custom );
107 vbox-> addWidget ( rad );
108
109 btngrp-> setExclusive ( true );
110 btngrp-> setButton ( m_type );
111
112 QGridLayout *grid = new QGridLayout ( vbox );
113 grid-> addColSpacing ( 0, 16 );
114 grid-> addColSpacing ( 3, 8 );
115
116 grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 );
117 grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 );
118 grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 );
119
120 m_menubtn = new QToolButton ( this );
121 grid-> addWidget ( m_menubtn, 0, 2 );
122
123 QPopupMenu *popup;
124
125 popup = new ColorPopupMenu ( m_menucol, this );
126 m_menubtn-> setPopup ( popup );
127 m_menubtn-> setPopupDelay ( 0 );
128 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & )));
129 changeMenuColor ( m_menucol );
130
131 m_textbtn = new QToolButton ( this );
132 grid-> addWidget ( m_textbtn, 0, 5 );
133
134 popup = new ColorPopupMenu ( m_textcol, this );
135 m_textbtn-> setPopup ( popup );
136 m_textbtn-> setPopupDelay ( 0 );
137 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & )));
138 changeTextColor ( m_textcol );
139
140 m_opacsld = new QSlider ( Horizontal, this );
141 m_opacsld-> setRange ( -20, 20 );
142 m_opacsld-> setValue ( opacity );
143 m_opacsld-> setTickmarks ( QSlider::Below );
144 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 );
145
146 vbox-> addSpacing ( 4 );
147
148 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this );
149 shadow-> setChecked ( m_shadow );
150 vbox-> addWidget ( shadow );
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
170 vbox-> addStretch ( 10 );
171
172 changeType ( m_type );
173
174 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) );
175 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) );
176 connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) );
177}
178
179void LiquidSet::changeType ( int t )
180{
181 bool custom = ( t == Custom );
182
183 m_menulbl-> setEnabled ( custom );
184 m_textlbl-> setEnabled ( custom );
185 m_opaclbl-> setEnabled ( custom );
186 m_menubtn-> setEnabled ( custom );
187 m_textbtn-> setEnabled ( custom );
188 m_opacsld-> setEnabled ( custom );
189
190 m_type = t;
191}
192
193void LiquidSet::changeMenuColor ( const QColor &col )
194{
195 changeButtonColor ( m_menubtn, col );
196 m_menucol = col;
197}
198
199void LiquidSet::changeTextColor ( const QColor &col )
200{
201 changeButtonColor ( m_textbtn, col );
202 m_textcol = col;
203}
204
205void LiquidSet::changeShadow ( bool b )
206{
207 m_shadow = b;
208}
209
210void LiquidSet::changeDeco ( bool b )
211{
212 m_deco = b;
213}
214
215
216void LiquidSet::accept ( )
217{
218 Config config ( "qpe" );
219 config. setGroup ( "Liquid-Style" );
220
221 config. writeEntry ( "Type", m_type );
222 config. writeEntry ( "Color", m_menucol. name ( ));
223 config. writeEntry ( "TextColor", m_textcol. name ( ));
224 config. writeEntry ( "Opacity", m_opacsld-> value ( ));
225 config. writeEntry ( "ShadowText", m_shadow );
226 config. writeEntry ( "WinDecoration", m_deco );
227 config. writeEntry ( "StippleContrast", m_contsld-> value ( ));
228 config. write ( );
229
230 Global::applyStyle ( );
231
232 QDialog::accept ( );
233}
234