-rw-r--r-- | noncore/styles/liquid/liquidset.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp index 7747da7..a7cfccc 100644 --- a/noncore/styles/liquid/liquidset.cpp +++ b/noncore/styles/liquid/liquidset.cpp | |||
@@ -1,169 +1,169 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
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 <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 | ||
41 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) | 41 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) |
42 | : QWidget ( parent, name, fl ) | 42 | : QWidget ( parent, name, fl ) |
43 | { | 43 | { |
44 | setCaption ( tr( "Liquid Style" ) ); | 44 | setCaption ( tr( "Liquid Style" ) ); |
45 | 45 | ||
46 | Config config ( "qpe" ); | 46 | Config config ( "qpe" ); |
47 | config. setGroup ( "Liquid-Style" ); | 47 | config. setGroup ( "Liquid-Style" ); |
48 | 48 | ||
49 | m_type = config. readNumEntry ( "Type", TransStippleBg ); | 49 | m_type = config. readNumEntry ( "Type", TransStippleBg ); |
50 | QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); | 50 | QColor mcol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); |
51 | QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); | 51 | QColor tcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); |
52 | int opacity = config. readNumEntry ( "Opacity", 10 ); | 52 | int opacity = config. readNumEntry ( "Opacity", 10 ); |
53 | m_shadow = config. readBoolEntry ( "ShadowText", true ); | 53 | m_shadow = config. readBoolEntry ( "ShadowText", true ); |
54 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); | 54 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); |
55 | m_flat = config. readBoolEntry ( "FlatToolButtons", false ); | 55 | m_flat = config. readBoolEntry ( "FlatToolButtons", false ); |
56 | 56 | ||
57 | QVBoxLayout *vbox = new QVBoxLayout ( this ); | 57 | QVBoxLayout *vbox = new QVBoxLayout ( this ); |
58 | vbox-> setSpacing ( 3 ); | 58 | vbox-> setSpacing ( 3 ); |
59 | vbox-> setMargin ( 4 ); | 59 | vbox-> setMargin ( 4 ); |
60 | 60 | ||
61 | QComboBox *cb = new QComboBox ( this ); | 61 | QComboBox *cb = new QComboBox ( this ); |
62 | cb-> insertItem ( tr( "No translucency" ), None ); | 62 | cb-> insertItem ( tr( "No translucency" ), None ); |
63 | cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); | 63 | cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); |
64 | cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); | 64 | cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); |
65 | cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); | 65 | cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); |
66 | cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); | 66 | cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); |
67 | cb-> insertItem ( tr( "Custom translucency" ), Custom ); | 67 | cb-> insertItem ( tr( "Custom translucency" ), Custom ); |
68 | 68 | ||
69 | cb-> setCurrentItem ( m_type ); | 69 | cb-> setCurrentItem ( m_type ); |
70 | vbox-> addWidget ( cb ); | 70 | vbox-> addWidget ( cb ); |
71 | 71 | ||
72 | 72 | ||
73 | QGridLayout *grid = new QGridLayout ( vbox ); | 73 | QGridLayout *grid = new QGridLayout ( vbox ); |
74 | grid-> addColSpacing ( 0, 16 ); | 74 | grid-> addColSpacing ( 0, 16 ); |
75 | grid-> addColSpacing ( 3, 8 ); | 75 | grid-> addColSpacing ( 3, 8 ); |
76 | 76 | ||
77 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); | 77 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); |
78 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); | 78 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); |
79 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); | 79 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); |
80 | 80 | ||
81 | m_menubtn = new OColorButton ( this, mcol ); | 81 | m_menubtn = new OColorButton ( this, mcol ); |
82 | grid-> addWidget ( m_menubtn, 0, 2 ); | 82 | grid-> addWidget ( m_menubtn, 0, 2 ); |
83 | 83 | ||
84 | m_textbtn = new OColorButton ( this, tcol ); | 84 | m_textbtn = new OColorButton ( this, tcol ); |
85 | grid-> addWidget ( m_textbtn, 0, 5 ); | 85 | grid-> addWidget ( m_textbtn, 0, 5 ); |
86 | 86 | ||
87 | m_opacsld = new QSlider ( Horizontal, this ); | 87 | m_opacsld = new QSlider ( Horizontal, this ); |
88 | m_opacsld-> setRange ( -20, 20 ); | 88 | m_opacsld-> setRange ( -20, 20 ); |
89 | m_opacsld-> setSteps ( 1, 1 ); | 89 | m_opacsld-> setSteps ( 1, 1 ); |
90 | m_opacsld-> setValue ( opacity ); | 90 | m_opacsld-> setValue ( opacity ); |
91 | m_opacsld-> setTickmarks ( QSlider::Below ); | 91 | m_opacsld-> setTickmarks ( QSlider::Below ); |
92 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); | 92 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); |
93 | 93 | ||
94 | vbox-> addSpacing ( 4 ); | 94 | vbox-> addSpacing ( 4 ); |
95 | 95 | ||
96 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); | 96 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); |
97 | shadow-> setChecked ( m_shadow ); | 97 | shadow-> setChecked ( m_shadow ); |
98 | vbox-> addWidget ( shadow ); | 98 | vbox-> addWidget ( shadow ); |
99 | 99 | ||
100 | vbox-> addSpacing ( 4 ); | 100 | vbox-> addSpacing ( 4 ); |
101 | 101 | ||
102 | QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); | 102 | QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); |
103 | flattb-> setChecked ( m_flat ); | 103 | flattb-> setChecked ( m_flat ); |
104 | vbox-> addWidget ( flattb ); | 104 | vbox-> addWidget ( flattb ); |
105 | 105 | ||
106 | vbox-> addSpacing ( 4 ); | 106 | vbox-> addSpacing ( 4 ); |
107 | 107 | ||
108 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); | 108 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); |
109 | 109 | ||
110 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); | 110 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); |
111 | 111 | ||
112 | m_contsld = new QSlider ( Horizontal, this ); | 112 | m_contsld = new QSlider ( Horizontal, this ); |
113 | m_contsld-> setRange ( 0, 10 ); | 113 | m_contsld-> setRange ( 0, 10 ); |
114 | m_contsld-> setSteps ( 1, 1 ); | 114 | m_contsld-> setSteps ( 1, 1 ); |
115 | m_contsld-> setValue ( contrast ); | 115 | m_contsld-> setValue ( contrast ); |
116 | m_contsld-> setTickmarks ( QSlider::Below ); | 116 | m_contsld-> setTickmarks ( QSlider::Below ); |
117 | hbox-> addWidget ( m_contsld, 10 ); | 117 | hbox-> addWidget ( m_contsld, 10 ); |
118 | 118 | ||
119 | vbox-> addStretch ( 10 ); | 119 | vbox-> addStretch ( 10 ); |
120 | 120 | ||
121 | changeType ( m_type ); | 121 | changeType ( m_type ); |
122 | 122 | ||
123 | connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); | 123 | connect ( cb, SIGNAL( highlighted(int) ), this, SLOT( changeType(int) ) ); |
124 | connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); | 124 | connect ( shadow, SIGNAL( toggled(bool) ), this, SLOT( changeShadow(bool) ) ); |
125 | connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); | 125 | connect ( flattb, SIGNAL( toggled(bool) ), this, SLOT( changeFlat(bool) ) ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void LiquidSettings::changeType ( int t ) | 128 | void LiquidSettings::changeType ( int t ) |
129 | { | 129 | { |
130 | bool custom = ( t == Custom ); | 130 | bool custom = ( t == Custom ); |
131 | 131 | ||
132 | m_menulbl-> setEnabled ( custom ); | 132 | m_menulbl-> setEnabled ( custom ); |
133 | m_textlbl-> setEnabled ( custom ); | 133 | m_textlbl-> setEnabled ( custom ); |
134 | m_opaclbl-> setEnabled ( custom ); | 134 | m_opaclbl-> setEnabled ( custom ); |
135 | m_menubtn-> setEnabled ( custom ); | 135 | m_menubtn-> setEnabled ( custom ); |
136 | m_textbtn-> setEnabled ( custom ); | 136 | m_textbtn-> setEnabled ( custom ); |
137 | m_opacsld-> setEnabled ( custom ); | 137 | m_opacsld-> setEnabled ( custom ); |
138 | 138 | ||
139 | m_type = t; | 139 | m_type = t; |
140 | } | 140 | } |
141 | 141 | ||
142 | void LiquidSettings::changeShadow ( bool b ) | 142 | void LiquidSettings::changeShadow ( bool b ) |
143 | { | 143 | { |
144 | m_shadow = b; | 144 | m_shadow = b; |
145 | } | 145 | } |
146 | 146 | ||
147 | void LiquidSettings::changeFlat ( bool b ) | 147 | void LiquidSettings::changeFlat ( bool b ) |
148 | { | 148 | { |
149 | m_flat = b; | 149 | m_flat = b; |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | bool LiquidSettings::writeConfig ( ) | 153 | bool LiquidSettings::writeConfig ( ) |
154 | { | 154 | { |
155 | Config config ( "qpe" ); | 155 | Config config ( "qpe" ); |
156 | config. setGroup ( "Liquid-Style" ); | 156 | config. setGroup ( "Liquid-Style" ); |
157 | 157 | ||
158 | config. writeEntry ( "Type", m_type ); | 158 | config. writeEntry ( "Type", m_type ); |
159 | config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); | 159 | config. writeEntry ( "Color", m_menubtn-> color ( ). name ( )); |
160 | config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); | 160 | config. writeEntry ( "TextColor", m_textbtn-> color ( ). name ( )); |
161 | config. writeEntry ( "Opacity", m_opacsld-> value ( )); | 161 | config. writeEntry ( "Opacity", m_opacsld-> value ( )); |
162 | config. writeEntry ( "ShadowText", m_shadow ); | 162 | config. writeEntry ( "ShadowText", m_shadow ); |
163 | config. writeEntry ( "StippleContrast", m_contsld-> value ( )); | 163 | config. writeEntry ( "StippleContrast", m_contsld-> value ( )); |
164 | config. writeEntry ( "FlatToolButtons", m_flat ); | 164 | config. writeEntry ( "FlatToolButtons", m_flat ); |
165 | config. write ( ); | 165 | config. write ( ); |
166 | 166 | ||
167 | return true; | 167 | return true; |
168 | } | 168 | } |
169 | 169 | ||