-rw-r--r-- | core/settings/light-and-power/light.cpp | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 63 |
2 files changed, 39 insertions, 26 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 24e1fab..960a165 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -55,32 +55,33 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
55 | 55 | ||
56 | Config config( "qpe" ); | 56 | Config config( "qpe" ); |
57 | 57 | ||
58 | config.setGroup( "Screensaver" ); | 58 | config.setGroup( "Screensaver" ); |
59 | 59 | ||
60 | int interval; | 60 | int interval; |
61 | interval = config.readNumEntry( "Interval_Dim", 30 ); | 61 | interval = config.readNumEntry( "Interval_Dim", 30 ); |
62 | interval_dim->setValue( interval ); | 62 | interval_dim->setValue( interval ); |
63 | interval = config.readNumEntry( "Interval_LightOff", 20 ); | 63 | interval = config.readNumEntry( "Interval_LightOff", 20 ); |
64 | interval_lightoff->setValue( interval ); | 64 | interval_lightoff->setValue( interval ); |
65 | interval = config.readNumEntry( "Interval", 60 ); | 65 | interval = config.readNumEntry( "Interval", 60 ); |
66 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) | 66 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) |
67 | interval_suspend->setValue( interval ); | 67 | interval_suspend->setValue( interval ); |
68 | 68 | ||
69 | screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); | 69 | screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); |
70 | screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); | 70 | screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); |
71 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | ||
71 | int maxbright = qpe_sysBrightnessSteps(); | 72 | int maxbright = qpe_sysBrightnessSteps(); |
72 | initbright = config.readNumEntry("Brightness",255); | 73 | initbright = config.readNumEntry("Brightness",255); |
73 | brightness->setMaxValue( maxbright ); | 74 | brightness->setMaxValue( maxbright ); |
74 | brightness->setTickInterval( QMAX(1,maxbright/16) ); | 75 | brightness->setTickInterval( QMAX(1,maxbright/16) ); |
75 | brightness->setLineStep( QMAX(1,maxbright/16) ); | 76 | brightness->setLineStep( QMAX(1,maxbright/16) ); |
76 | brightness->setPageStep( QMAX(1,maxbright/16) ); | 77 | brightness->setPageStep( QMAX(1,maxbright/16) ); |
77 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); | 78 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); |
78 | 79 | ||
79 | connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); | 80 | connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); |
80 | } | 81 | } |
81 | 82 | ||
82 | LightSettings::~LightSettings() | 83 | LightSettings::~LightSettings() |
83 | { | 84 | { |
84 | } | 85 | } |
85 | 86 | ||
86 | static void set_fl(int bright) | 87 | static void set_fl(int bright) |
@@ -100,32 +101,33 @@ void LightSettings::accept() | |||
100 | { | 101 | { |
101 | if ( qApp->focusWidget() ) | 102 | if ( qApp->focusWidget() ) |
102 | qApp->focusWidget()->clearFocus(); | 103 | qApp->focusWidget()->clearFocus(); |
103 | 104 | ||
104 | applyBrightness(); | 105 | applyBrightness(); |
105 | 106 | ||
106 | int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); | 107 | int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); |
107 | int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); | 108 | int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); |
108 | int i_suspend = interval_suspend->value(); | 109 | int i_suspend = interval_suspend->value(); |
109 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 110 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
110 | e << i_dim << i_lightoff << i_suspend; | 111 | e << i_dim << i_lightoff << i_suspend; |
111 | 112 | ||
112 | Config config( "qpe" ); | 113 | Config config( "qpe" ); |
113 | config.setGroup( "Screensaver" ); | 114 | config.setGroup( "Screensaver" ); |
114 | config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); | 115 | config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); |
115 | config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); | 116 | config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); |
117 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); | ||
116 | config.writeEntry( "Interval_Dim", interval_dim->value() ); | 118 | config.writeEntry( "Interval_Dim", interval_dim->value() ); |
117 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); | 119 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); |
118 | config.writeEntry( "Interval", interval_suspend->value() ); | 120 | config.writeEntry( "Interval", interval_suspend->value() ); |
119 | config.writeEntry( "Brightness", | 121 | config.writeEntry( "Brightness", |
120 | (brightness->maxValue()-brightness->value())*255/brightness->maxValue() ); | 122 | (brightness->maxValue()-brightness->value())*255/brightness->maxValue() ); |
121 | config.write(); | 123 | config.write(); |
122 | 124 | ||
123 | QDialog::accept(); | 125 | QDialog::accept(); |
124 | } | 126 | } |
125 | 127 | ||
126 | void LightSettings::applyBrightness() | 128 | void LightSettings::applyBrightness() |
127 | { | 129 | { |
128 | int bright = (brightness->maxValue()-brightness->value())*255 | 130 | int bright = (brightness->maxValue()-brightness->value())*255 |
129 | / brightness->maxValue(); | 131 | / brightness->maxValue(); |
130 | set_fl(bright); | 132 | set_fl(bright); |
131 | } | 133 | } |
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index 47775f7..f2a4552 100644 --- a/core/settings/light-and-power/lightsettingsbase.ui +++ b/core/settings/light-and-power/lightsettingsbase.ui | |||
@@ -1,31 +1,31 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>LightSettingsBase</class> | 2 | <class>LightSettingsBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>LightSettingsBase</cstring> | 7 | <cstring>LightSettingsBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>256</width> | 14 | <width>269</width> |
15 | <height>316</height> | 15 | <height>317</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Light Settings</string> | 20 | <string>Light Settings</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <vbox> | 25 | <vbox> |
26 | <property stdset="1"> | 26 | <property stdset="1"> |
27 | <name>margin</name> | 27 | <name>margin</name> |
28 | <number>7</number> | 28 | <number>7</number> |
29 | </property> | 29 | </property> |
30 | <property stdset="1"> | 30 | <property stdset="1"> |
31 | <name>spacing</name> | 31 | <name>spacing</name> |
@@ -52,37 +52,37 @@ | |||
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>GroupBox3</cstring> | 53 | <cstring>GroupBox3</cstring> |
54 | </property> | 54 | </property> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Power saving</string> | 57 | <string>Power saving</string> |
58 | </property> | 58 | </property> |
59 | <property> | 59 | <property> |
60 | <name>layoutMargin</name> | 60 | <name>layoutMargin</name> |
61 | </property> | 61 | </property> |
62 | <property> | 62 | <property> |
63 | <name>layoutSpacing</name> | 63 | <name>layoutSpacing</name> |
64 | </property> | 64 | </property> |
65 | <grid> | 65 | <grid> |
66 | <property stdset="1"> | 66 | <property stdset="1"> |
67 | <name>margin</name> | 67 | <name>margin</name> |
68 | <number>6</number> | 68 | <number>11</number> |
69 | </property> | 69 | </property> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>spacing</name> | 71 | <name>spacing</name> |
72 | <number>3</number> | 72 | <number>6</number> |
73 | </property> | 73 | </property> |
74 | <widget row="1" column="1" > | 74 | <widget row="1" column="1" > |
75 | <class>QSpinBox</class> | 75 | <class>QSpinBox</class> |
76 | <property stdset="1"> | 76 | <property stdset="1"> |
77 | <name>name</name> | 77 | <name>name</name> |
78 | <cstring>interval_lightoff</cstring> | 78 | <cstring>interval_lightoff</cstring> |
79 | </property> | 79 | </property> |
80 | <property stdset="1"> | 80 | <property stdset="1"> |
81 | <name>suffix</name> | 81 | <name>suffix</name> |
82 | <string> seconds</string> | 82 | <string> seconds</string> |
83 | </property> | 83 | </property> |
84 | <property stdset="1"> | 84 | <property stdset="1"> |
85 | <name>buttonSymbols</name> | 85 | <name>buttonSymbols</name> |
86 | <enum>PlusMinus</enum> | 86 | <enum>PlusMinus</enum> |
87 | </property> | 87 | </property> |
88 | <property stdset="1"> | 88 | <property stdset="1"> |
@@ -112,54 +112,32 @@ | |||
112 | <name>buttonSymbols</name> | 112 | <name>buttonSymbols</name> |
113 | <enum>PlusMinus</enum> | 113 | <enum>PlusMinus</enum> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>maxValue</name> | 116 | <name>maxValue</name> |
117 | <number>3600</number> | 117 | <number>3600</number> |
118 | </property> | 118 | </property> |
119 | <property stdset="1"> | 119 | <property stdset="1"> |
120 | <name>minValue</name> | 120 | <name>minValue</name> |
121 | <number>10</number> | 121 | <number>10</number> |
122 | </property> | 122 | </property> |
123 | <property stdset="1"> | 123 | <property stdset="1"> |
124 | <name>lineStep</name> | 124 | <name>lineStep</name> |
125 | <number>15</number> | 125 | <number>15</number> |
126 | </property> | 126 | </property> |
127 | </widget> | 127 | </widget> |
128 | <widget row="1" column="0" > | ||
129 | <class>QCheckBox</class> | ||
130 | <property stdset="1"> | ||
131 | <name>name</name> | ||
132 | <cstring>screensaver_lightoff</cstring> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
135 | <name>sizePolicy</name> | ||
136 | <sizepolicy> | ||
137 | <hsizetype>1</hsizetype> | ||
138 | <vsizetype>0</vsizetype> | ||
139 | </sizepolicy> | ||
140 | </property> | ||
141 | <property stdset="1"> | ||
142 | <name>text</name> | ||
143 | <string>Light off after</string> | ||
144 | </property> | ||
145 | <property stdset="1"> | ||
146 | <name>checked</name> | ||
147 | <bool>true</bool> | ||
148 | </property> | ||
149 | </widget> | ||
150 | <widget row="0" column="0" > | 128 | <widget row="0" column="0" > |
151 | <class>QCheckBox</class> | 129 | <class>QCheckBox</class> |
152 | <property stdset="1"> | 130 | <property stdset="1"> |
153 | <name>name</name> | 131 | <name>name</name> |
154 | <cstring>screensaver_dim</cstring> | 132 | <cstring>screensaver_dim</cstring> |
155 | </property> | 133 | </property> |
156 | <property stdset="1"> | 134 | <property stdset="1"> |
157 | <name>sizePolicy</name> | 135 | <name>sizePolicy</name> |
158 | <sizepolicy> | 136 | <sizepolicy> |
159 | <hsizetype>1</hsizetype> | 137 | <hsizetype>1</hsizetype> |
160 | <vsizetype>0</vsizetype> | 138 | <vsizetype>0</vsizetype> |
161 | </sizepolicy> | 139 | </sizepolicy> |
162 | </property> | 140 | </property> |
163 | <property stdset="1"> | 141 | <property stdset="1"> |
164 | <name>text</name> | 142 | <name>text</name> |
165 | <string>Dim light after</string> | 143 | <string>Dim light after</string> |
@@ -194,32 +172,65 @@ | |||
194 | <property stdset="1"> | 172 | <property stdset="1"> |
195 | <name>lineStep</name> | 173 | <name>lineStep</name> |
196 | <number>15</number> | 174 | <number>15</number> |
197 | </property> | 175 | </property> |
198 | </widget> | 176 | </widget> |
199 | <widget row="2" column="0" > | 177 | <widget row="2" column="0" > |
200 | <class>QLabel</class> | 178 | <class>QLabel</class> |
201 | <property stdset="1"> | 179 | <property stdset="1"> |
202 | <name>name</name> | 180 | <name>name</name> |
203 | <cstring>TextLabel1_2</cstring> | 181 | <cstring>TextLabel1_2</cstring> |
204 | </property> | 182 | </property> |
205 | <property stdset="1"> | 183 | <property stdset="1"> |
206 | <name>text</name> | 184 | <name>text</name> |
207 | <string>Suspend after</string> | 185 | <string>Suspend after</string> |
208 | </property> | 186 | </property> |
209 | </widget> | 187 | </widget> |
188 | <widget row="3" column="0" rowspan="1" colspan="2" > | ||
189 | <class>QCheckBox</class> | ||
190 | <property stdset="1"> | ||
191 | <name>name</name> | ||
192 | <cstring>LcdOffOnly</cstring> | ||
193 | </property> | ||
194 | <property stdset="1"> | ||
195 | <name>text</name> | ||
196 | <string>Only deactivate LCD during Suspend</string> | ||
197 | </property> | ||
198 | </widget> | ||
199 | <widget row="1" column="0" > | ||
200 | <class>QCheckBox</class> | ||
201 | <property stdset="1"> | ||
202 | <name>name</name> | ||
203 | <cstring>screensaver_lightoff</cstring> | ||
204 | </property> | ||
205 | <property stdset="1"> | ||
206 | <name>sizePolicy</name> | ||
207 | <sizepolicy> | ||
208 | <hsizetype>1</hsizetype> | ||
209 | <vsizetype>0</vsizetype> | ||
210 | </sizepolicy> | ||
211 | </property> | ||
212 | <property stdset="1"> | ||
213 | <name>text</name> | ||
214 | <string>Light off after</string> | ||
215 | </property> | ||
216 | <property stdset="1"> | ||
217 | <name>checked</name> | ||
218 | <bool>true</bool> | ||
219 | </property> | ||
220 | </widget> | ||
210 | </grid> | 221 | </grid> |
211 | </widget> | 222 | </widget> |
212 | <widget> | 223 | <widget> |
213 | <class>QLayoutWidget</class> | 224 | <class>QLayoutWidget</class> |
214 | <property stdset="1"> | 225 | <property stdset="1"> |
215 | <name>name</name> | 226 | <name>name</name> |
216 | <cstring>Layout18</cstring> | 227 | <cstring>Layout18</cstring> |
217 | </property> | 228 | </property> |
218 | <property> | 229 | <property> |
219 | <name>layoutMargin</name> | 230 | <name>layoutMargin</name> |
220 | </property> | 231 | </property> |
221 | <hbox> | 232 | <hbox> |
222 | <property stdset="1"> | 233 | <property stdset="1"> |
223 | <name>margin</name> | 234 | <name>margin</name> |
224 | <number>0</number> | 235 | <number>0</number> |
225 | </property> | 236 | </property> |