author | harlekin <harlekin> | 2002-10-27 16:24:16 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-27 16:24:16 (UTC) |
commit | 417d7bd0d307921b4540e99b8f52d10a03729153 (patch) (unidiff) | |
tree | 25d2ccf03282fc494c8a9e17ace70ad52b990a70 /core/settings/light-and-power/light.cpp | |
parent | 1d1fdae1ff88ed6f1e331cbbab59fc978c04b370 (diff) | |
download | opie-417d7bd0d307921b4540e99b8f52d10a03729153.zip opie-417d7bd0d307921b4540e99b8f52d10a03729153.tar.gz opie-417d7bd0d307921b4540e99b8f52d10a03729153.tar.bz2 |
next try for light and power gui
Diffstat (limited to 'core/settings/light-and-power/light.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 107 |
1 files changed, 62 insertions, 45 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 04d2249..97120f2 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -46,2 +46,3 @@ | |||
46 | #include <qspinbox.h> | 46 | #include <qspinbox.h> |
47 | #include <qpushbutton.h> | ||
47 | #include <qlistbox.h> | 48 | #include <qlistbox.h> |
@@ -60,15 +61,14 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
60 | 61 | ||
61 | if ( ODevice::inst()->model() == Model_iPAQ_H31xx || | 62 | if ( ODevice::inst()->hasLightSensor() ) { |
62 | ODevice::inst()->model() == Model_iPAQ_H36xx || | ||
63 | ODevice::inst()->model() == Model_iPAQ_H37xx || | ||
64 | ODevice::inst()->model() == Model_iPAQ_H38xx ) { | ||
65 | // Not supported yet - hide until implemented | 63 | // Not supported yet - hide until implemented |
66 | IpaqGroupBox->setEnabled( false ); | 64 | auto_brightness->setEnabled( false ); |
67 | IpaqGroupBoxAC->setEnabled( false ); | 65 | CalibrateLightSensor->setEnabled( false ); |
68 | LightSensorGroupBox->setEnabled( false ); | 66 | auto_brightness_ac_3->setEnabled( false ); |
67 | CalibrateLightSensorAC->setEnabled( false ); | ||
69 | } else { | 68 | } else { |
70 | // if ipaq no need to show the sensor box | 69 | // if ipaq no need to show the sensor box |
71 | IpaqGroupBox->hide(); | 70 | auto_brightness->hide(); |
72 | IpaqGroupBoxAC->hide(); | 71 | CalibrateLightSensor->hide(); |
73 | LightSensorGroupBox->hide(); | 72 | auto_brightness_ac_3->hide(); |
73 | CalibrateLightSensorAC->hide(); | ||
74 | } | 74 | } |
@@ -82,5 +82,15 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
82 | interval = config.readNumEntry( "Interval_Dim", 20 ); | 82 | interval = config.readNumEntry( "Interval_Dim", 20 ); |
83 | interval_dim->setValue( interval ); | 83 | if ( config.readNumEntry("Dim",1) == 0 ) { |
84 | interval_dim->setSpecialValueText( tr("never") ); | ||
85 | } else { | ||
86 | interval_dim->setValue( interval ); | ||
87 | } | ||
88 | |||
84 | interval = config.readNumEntry( "Interval_LightOff", 30 ); | 89 | interval = config.readNumEntry( "Interval_LightOff", 30 ); |
85 | interval_lightoff->setValue( interval ); | 90 | if ( config.readNumEntry("LightOff",1) == 0 ) { |
91 | interval_lightoff->setSpecialValueText( tr("never") ); | ||
92 | } else { | ||
93 | interval_lightoff->setValue( interval ); | ||
94 | } | ||
95 | |||
86 | interval = config.readNumEntry( "Interval", 60 ); | 96 | interval = config.readNumEntry( "Interval", 60 ); |
@@ -91,5 +101,15 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
91 | interval = config.readNumEntry( "Interval_DimAC", 20 ); | 101 | interval = config.readNumEntry( "Interval_DimAC", 20 ); |
102 | if ( config.readNumEntry("DimAC",1) == 0 ) { | ||
103 | interval_dim_ac_3->setSpecialValueText( tr("never") ); | ||
104 | } else { | ||
92 | interval_dim_ac_3->setValue( interval ); | 105 | interval_dim_ac_3->setValue( interval ); |
106 | } | ||
107 | |||
93 | interval = config.readNumEntry( "Interval_LightOffAC", 30 ); | 108 | interval = config.readNumEntry( "Interval_LightOffAC", 30 ); |
94 | interval_lightoff_ac_3->setValue( interval ); | 109 | if ( config.readNumEntry("LightOffAC",1) == 0 ) { |
110 | interval_lightoff_ac_3->setSpecialValueText( tr("never") ); | ||
111 | } else { | ||
112 | interval_lightoff_ac_3->setValue( interval ); | ||
113 | } | ||
114 | |||
95 | interval = config.readNumEntry( "IntervalAC", 60 ); | 115 | interval = config.readNumEntry( "IntervalAC", 60 ); |
@@ -98,3 +118,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
98 | } | 118 | } |
99 | interval_suspend_ac_3->setValue( interval ); | 119 | if ( config.readNumEntry("NoApmAC", 0) == 0 ) { |
120 | interval_suspend_ac_3->setSpecialValueText( tr("never") ); | ||
121 | } else { | ||
122 | interval_suspend_ac_3->setValue( interval ); | ||
123 | } | ||
100 | 124 | ||
@@ -102,4 +126,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
102 | // battery check and slider | 126 | // battery check and slider |
103 | screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); | 127 | |
104 | screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); | 128 | |
129 | |||
130 | |||
105 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | 131 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); |
@@ -114,6 +140,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
114 | // ac check and slider | 140 | // ac check and slider |
115 | screensaver_dim_ac_3->setChecked( config.readNumEntry("DimAC",1) != 0 ); | ||
116 | screensaver_lightoff_ac_3->setChecked( config.readNumEntry("LightOffAC",1) != 0 ); | ||
117 | LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 ); | 141 | LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 ); |
118 | noApmAC->setChecked( config.readNumEntry("NoApmAC",0) != 0 ); | ||
119 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); | 142 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); |
@@ -131,6 +154,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
131 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 ); | 154 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 ); |
132 | LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); | 155 | //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); |
133 | LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); | 156 | //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); |
134 | connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; | 157 | //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; |
135 | LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); | 158 | //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); |
136 | 159 | ||
@@ -143,4 +166,2 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
143 | 166 | ||
144 | |||
145 | |||
146 | connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); | 167 | connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); |
@@ -154,3 +175,3 @@ LightSettings::~LightSettings() | |||
154 | void LightSettings::slotSliderTicks( int steps ) { | 175 | void LightSettings::slotSliderTicks( int steps ) { |
155 | LightMinValueSlider->setTickInterval( steps ); | 176 | // LightMinValueSlider->setTickInterval( steps ); |
156 | } | 177 | } |
@@ -173,4 +194,5 @@ void LightSettings::accept() | |||
173 | { | 194 | { |
174 | if ( qApp->focusWidget() ) | 195 | if ( qApp->focusWidget() ) { |
175 | qApp->focusWidget()->clearFocus(); | 196 | qApp->focusWidget()->clearFocus(); |
197 | } | ||
176 | 198 | ||
@@ -179,4 +201,4 @@ void LightSettings::accept() | |||
179 | // bat | 201 | // bat |
180 | int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); | 202 | int i_dim = ( !( interval_dim->specialValueText() == tr("never") ) ? interval_dim->value() : 0); |
181 | int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); | 203 | int i_lightoff = ( !( interval_lightoff->specialValueText() == tr("never") ) ? interval_lightoff->value() : 0); |
182 | int i_suspend = interval_suspend->value(); | 204 | int i_suspend = interval_suspend->value(); |
@@ -186,4 +208,4 @@ void LightSettings::accept() | |||
186 | // ac | 208 | // ac |
187 | int i_dim_ac = (screensaver_dim_ac_3->isChecked() ? interval_dim_ac_3->value() : 0); | 209 | int i_dim_ac = ( !( interval_dim_ac_3->specialValueText() == tr("never") ) ? interval_dim_ac_3->value() : 0); |
188 | int i_lightoff_ac = (screensaver_lightoff_ac_3->isChecked() ? interval_lightoff_ac_3->value() : 0); | 210 | int i_lightoff_ac = ( !( interval_lightoff_ac_3->specialValueText() == tr("never") ) ? interval_lightoff_ac_3->value() : 0); |
189 | int i_suspend_ac = interval_suspend_ac_3->value(); | 211 | int i_suspend_ac = interval_suspend_ac_3->value(); |
@@ -196,4 +218,4 @@ void LightSettings::accept() | |||
196 | // bat | 218 | // bat |
197 | config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); | 219 | config.writeEntry( "Dim", interval_dim->specialValueText() == tr("never") ); |
198 | config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); | 220 | config.writeEntry( "LightOff", interval_lightoff->specialValueText() == tr("never") ); |
199 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); | 221 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); |
@@ -206,6 +228,6 @@ void LightSettings::accept() | |||
206 | // ac | 228 | // ac |
207 | config.writeEntry( "DimAC", (int)screensaver_dim_ac_3->isChecked() ); | 229 | config.writeEntry( "DimAC", interval_dim_ac_3->specialValueText() == tr("never") ); |
208 | config.writeEntry( "LightOffAC", (int)screensaver_lightoff_ac_3->isChecked() ); | 230 | config.writeEntry( "LightOffAC", interval_lightoff_ac_3->specialValueText() == tr("never") ); |
209 | config.writeEntry( "LcdOffOnlyAC", (int)LcdOffOnly_2_3->isChecked() ); | 231 | config.writeEntry( "LcdOffOnlyAC", (int)LcdOffOnly_2_3->isChecked() ); |
210 | config.writeEntry( "NoAPmAC", (int)noApmAC->isChecked() ); | 232 | config.writeEntry( "NoAPmAC", interval_suspend_ac_3->specialValueText() == tr("never") ); |
211 | config.writeEntry( "Interval_DimAC", interval_dim_ac_3->value() ); | 233 | config.writeEntry( "Interval_DimAC", interval_dim_ac_3->value() ); |
@@ -218,15 +240,10 @@ void LightSettings::accept() | |||
218 | // only make ipaq light sensor entries in config file if on an ipaq | 240 | // only make ipaq light sensor entries in config file if on an ipaq |
219 | if ( ODevice::inst()->model() == Model_iPAQ_H31xx || | 241 | if ( ODevice::inst()->hasLightSensor() ) { |
220 | ODevice::inst()->model() == Model_iPAQ_H36xx || | ||
221 | ODevice::inst()->model() == Model_iPAQ_H37xx || | ||
222 | ODevice::inst()->model() == Model_iPAQ_H38xx ) { | ||
223 | |||
224 | // ipaq sensor | 242 | // ipaq sensor |
225 | config.setGroup( "Ipaqlightsensor" ); | 243 | config.setGroup( "Ipaqlightsensor" ); |
226 | |||
227 | config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); | 244 | config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); |
228 | config.writeEntry( "LightSensorAC", (int)auto_brightness_ac_3->isChecked() ); | 245 | config.writeEntry( "LightSensorAC", (int)auto_brightness_ac_3->isChecked() ); |
229 | config.writeEntry( "Steps", LightStepSpin->value() ); | 246 | //config.writeEntry( "Steps", LightStepSpin->value() ); |
230 | config.writeEntry( "MinValue", LightMinValueSlider->value() ); | 247 | //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); |
231 | config.writeEntry( "Shift", LightShiftSpin->value() ); | 248 | //config.writeEntry( "Shift", LightShiftSpin->value() ); |
232 | } | 249 | } |