summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp12
-rw-r--r--core/settings/light-and-power/lightsettingsbase.ui4
2 files changed, 5 insertions, 11 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 1a94209..d93b0af 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -65,25 +65,24 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl )
65 // Not supported yet - hide until implemented 65 // Not supported yet - hide until implemented
66 IpaqGroupBox->setEnabled( false ); 66 IpaqGroupBox->setEnabled( false );
67 IpaqGroupBoxAC->setEnabled( false ); 67 IpaqGroupBoxAC->setEnabled( false );
68 LightSensorGroupBox->setEnabled( false ); 68 LightSensorGroupBox->setEnabled( false );
69 } else { 69 } else {
70 // if ipaq no need to show the sensor box 70 // if ipaq no need to show the sensor box
71 IpaqGroupBox->hide(); 71 IpaqGroupBox->hide();
72 IpaqGroupBoxAC->hide(); 72 IpaqGroupBoxAC->hide();
73 LightSensorGroupBox->hide(); 73 LightSensorGroupBox->hide();
74 } 74 }
75 75
76 Config config( "qpe" ); 76 Config config( "qpe" );
77
78 config.setGroup( "Screensaver" ); 77 config.setGroup( "Screensaver" );
79 78
80 int interval; 79 int interval;
81 80
82 // battery spinboxes 81 // battery spinboxes
83 interval = config.readNumEntry( "Interval_Dim", 20 ); 82 interval = config.readNumEntry( "Interval_Dim", 20 );
84 interval_dim->setValue( interval ); 83 interval_dim->setValue( interval );
85 interval = config.readNumEntry( "Interval_LightOff", 30 ); 84 interval = config.readNumEntry( "Interval_LightOff", 30 );
86 interval_lightoff->setValue( interval ); 85 interval_lightoff->setValue( interval );
87 interval = config.readNumEntry( "Interval", 60 ); 86 interval = config.readNumEntry( "Interval", 60 );
88 if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) 87 if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs)
89 interval_suspend->setValue( interval ); 88 interval_suspend->setValue( interval );
@@ -130,39 +129,39 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl )
130 lowSpinBox->setValue( config.readNumEntry("power_verylow", 10 ) ); 129 lowSpinBox->setValue( config.readNumEntry("power_verylow", 10 ) );
131 criticalSpinBox->setValue( config.readNumEntry("power_critical", 5 ) ); 130 criticalSpinBox->setValue( config.readNumEntry("power_critical", 5 ) );
132 131
133 // ipaq sensor 132 // ipaq sensor
134 config.setGroup( "Ipaq_light_sensor" ); 133 config.setGroup( "Ipaq_light_sensor" );
135 auto_brightness->setChecked( config.readNumEntry("LightSensor",1) != 0 ); 134 auto_brightness->setChecked( config.readNumEntry("LightSensor",1) != 0 );
136 auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 ); 135 auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 );
137 LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); 136 LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) );
138 LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); 137 LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) );
139 connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; 138 connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ;
140 LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); 139 LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) );
141 140
142 connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); 141 connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) );
143 connect(brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); 142 connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) );
144} 143}
145 144
146LightSettings::~LightSettings() 145LightSettings::~LightSettings()
147{ 146{
148} 147}
149 148
150void LightSettings::slotSliderTicks( int steps ) { 149void LightSettings::slotSliderTicks( int steps ) {
151 LightMinValueSlider->setTickInterval( steps ); 150 LightMinValueSlider->setTickInterval( steps );
152} 151}
153 152
154static void set_fl(int bright) 153static void set_fl(int bright)
155{ 154{
156 qDebug( QString("BRIGHT !! : %1").arg( bright ) ); 155 qDebug ( QString( "Brightness" ).arg( bright ) );
157 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 156 QCopEnvelope e("QPE/System", "setBacklight(int)" );
158 e << bright; 157 e << bright;
159} 158}
160 159
161void LightSettings::reject() 160void LightSettings::reject()
162{ 161{
163 set_fl(initbright); 162 set_fl(initbright);
164 163
165 QDialog::reject(); 164 QDialog::reject();
166} 165}
167 166
168void LightSettings::accept() 167void LightSettings::accept()
@@ -231,35 +230,34 @@ void LightSettings::accept()
231 config.writeEntry( "Steps", LightStepSpin->value() ); 230 config.writeEntry( "Steps", LightStepSpin->value() );
232 config.writeEntry( "MinValue", LightMinValueSlider->value() ); 231 config.writeEntry( "MinValue", LightMinValueSlider->value() );
233 config.writeEntry( "Shift", LightShiftSpin->value() ); 232 config.writeEntry( "Shift", LightShiftSpin->value() );
234 } 233 }
235 234
236 config.write(); 235 config.write();
237 236
238 QDialog::accept(); 237 QDialog::accept();
239} 238}
240 239
241void LightSettings::applyBrightness() 240void LightSettings::applyBrightness()
242{ 241{
243 if ( !PowerStatus::Online ) { 242 if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) {
244 int bright = ( brightness->value() ) * 255 / brightness->maxValue(); 243 int bright = ( brightness->value() ) * 255 / brightness->maxValue();
245 set_fl(bright); 244 set_fl(bright);
246 } 245 }
247} 246}
248 247
249void LightSettings::applyBrightnessAC() 248void LightSettings::applyBrightnessAC()
250{ 249{
251 qDebug( QString("SLIDER : %1").arg( brightness_ac_3->value() ) );
252 // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting 250 // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting
253 if ( PowerStatus::Online ) { 251 if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) {
254 int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); 252 int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue();
255 set_fl(bright); 253 set_fl(bright);
256 } 254 }
257} 255}
258 256
259 257
260 258
261void LightSettings::done(int r) 259void LightSettings::done(int r)
262{ 260{
263 QDialog::done(r); 261 QDialog::done(r);
264 close ( ); 262 close ( );
265} 263}
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui
index 5e62626..be096ac 100644
--- a/core/settings/light-and-power/lightsettingsbase.ui
+++ b/core/settings/light-and-power/lightsettingsbase.ui
@@ -749,28 +749,24 @@
749 <property stdset="1"> 749 <property stdset="1">
750 <name>tracking</name> 750 <name>tracking</name>
751 <bool>true</bool> 751 <bool>true</bool>
752 </property> 752 </property>
753 <property stdset="1"> 753 <property stdset="1">
754 <name>orientation</name> 754 <name>orientation</name>
755 <enum>Horizontal</enum> 755 <enum>Horizontal</enum>
756 </property> 756 </property>
757 <property stdset="1"> 757 <property stdset="1">
758 <name>tickmarks</name> 758 <name>tickmarks</name>
759 <enum>Right</enum> 759 <enum>Right</enum>
760 </property> 760 </property>
761 <property stdset="1">
762 <name>tickInterval</name>
763 <number>32</number>
764 </property>
765 </widget> 761 </widget>
766 <widget> 762 <widget>
767 <class>QLayoutWidget</class> 763 <class>QLayoutWidget</class>
768 <property stdset="1"> 764 <property stdset="1">
769 <name>name</name> 765 <name>name</name>
770 <cstring>Layout20</cstring> 766 <cstring>Layout20</cstring>
771 </property> 767 </property>
772 <hbox> 768 <hbox>
773 <property stdset="1"> 769 <property stdset="1">
774 <name>margin</name> 770 <name>margin</name>
775 <number>0</number> 771 <number>0</number>
776 </property> 772 </property>