author | sandman <sandman> | 2002-11-01 18:13:18 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-01 18:13:18 (UTC) |
commit | 2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba (patch) (unidiff) | |
tree | f3e6bb8ee6c0d8f2671a63c240d1145e710da82d /core/settings/light-and-power/light.cpp | |
parent | 7b7b760ca3886d5b6562a88b5c2ef8e610b73eb8 (diff) | |
download | opie-2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba.zip opie-2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba.tar.gz opie-2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba.tar.bz2 |
- Completly reworked the backlight "preview":
every slider/control that relates to backlight levels, is now switching the
lcd to this level for 2 seconds - after that the backlight switches back to
the standard level (or light sensor control)
- Many bugfixes and usability improvements in light sensor calibration
Diffstat (limited to 'core/settings/light-and-power/light.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index c0ba60b..21377b7 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -28,3 +28,3 @@ | |||
28 | 28 | ||
29 | #include "settings.h" | 29 | #include "light.h" |
30 | 30 | ||
@@ -40,2 +40,3 @@ | |||
40 | #include <qslider.h> | 40 | #include <qslider.h> |
41 | #include <qtimer.h> | ||
41 | #include <qspinbox.h> | 42 | #include <qspinbox.h> |
@@ -50,3 +51,3 @@ using namespace Opie; | |||
50 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 51 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
51 | : LightSettingsBase( parent, name, true, WStyle_ContextHelp ) | 52 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
52 | { | 53 | { |
@@ -65,4 +66,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
65 | // battery spinboxes | 66 | // battery spinboxes |
66 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); | 67 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); |
67 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); | 68 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); |
68 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 69 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
@@ -72,3 +73,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
72 | 73 | ||
73 | int bright = config. readNumEntry ( "Brightness", 255 ); | 74 | int bright = config. readNumEntry ( "Brightness", 127 ); |
74 | brightness-> setMaxValue ( m_res - 1 ); | 75 | brightness-> setMaxValue ( m_res - 1 ); |
@@ -86,5 +87,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
86 | // ac spinboxes | 87 | // ac spinboxes |
87 | interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 20 )); | 88 | interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 60 )); |
88 | interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 30 )); | 89 | interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 120 )); |
89 | interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 90 | interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 0 )); |
90 | 91 | ||
@@ -110,4 +111,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
110 | 111 | ||
112 | m_resettimer = new QTimer ( this ); | ||
113 | connect ( m_resettimer, SIGNAL( timeout ( )), this, SLOT( resetBacklight ( ))); | ||
114 | |||
111 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 115 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
112 | connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
113 | tabs-> setCurrentPage ( 0 ); | 116 | tabs-> setCurrentPage ( 0 ); |
@@ -115,5 +118,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
115 | else { | 118 | else { |
116 | connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
117 | tabs-> setCurrentPage ( 1 ); | 119 | tabs-> setCurrentPage ( 1 ); |
118 | } | 120 | } |
121 | |||
122 | connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
123 | connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
119 | } | 124 | } |
@@ -124,3 +129,2 @@ LightSettings::~LightSettings ( ) | |||
124 | 129 | ||
125 | |||
126 | void LightSettings::calibrateSensor ( ) | 130 | void LightSettings::calibrateSensor ( ) |
@@ -128,2 +132,3 @@ void LightSettings::calibrateSensor ( ) | |||
128 | Sensor *s = new Sensor ( m_sensordata, this ); | 132 | Sensor *s = new Sensor ( m_sensordata, this ); |
133 | connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); | ||
129 | s-> showMaximized ( ); | 134 | s-> showMaximized ( ); |
@@ -136,2 +141,3 @@ void LightSettings::calibrateSensorAC ( ) | |||
136 | Sensor *s = new Sensor ( m_sensordata_ac, this ); | 141 | Sensor *s = new Sensor ( m_sensordata_ac, this ); |
142 | connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); | ||
137 | s-> showMaximized ( ); | 143 | s-> showMaximized ( ); |
@@ -143,14 +149,17 @@ void LightSettings::setBacklight ( int bright ) | |||
143 | { | 149 | { |
150 | if ( bright >= 0 ) | ||
144 | bright = bright * 255 / ( m_res - 1 ); | 151 | bright = bright * 255 / ( m_res - 1 ); |
152 | |||
145 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | 153 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); |
146 | e << bright; | 154 | e << bright; |
155 | |||
156 | if ( bright != -1 ) { | ||
157 | m_resettimer-> stop ( ); | ||
158 | m_resettimer-> start ( 2000, true ); | ||
159 | } | ||
147 | } | 160 | } |
148 | 161 | ||
149 | void LightSettings::reject ( ) | 162 | void LightSettings::resetBacklight ( ) |
150 | { | 163 | { |
151 | { | 164 | setBacklight ( -1 ); |
152 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | ||
153 | e << -1; | ||
154 | } | ||
155 | QDialog::reject ( ); | ||
156 | } | 165 | } |
@@ -202,8 +211,3 @@ void LightSettings::accept ( ) | |||
202 | } | 211 | } |
203 | { | 212 | LightSettingsBase::accept ( ); |
204 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | ||
205 | e << -1; | ||
206 | } | ||
207 | |||
208 | QDialog::accept ( ); | ||
209 | } | 213 | } |
@@ -212,3 +216,6 @@ void LightSettings::done ( int r ) | |||
212 | { | 216 | { |
213 | QDialog::done ( r ); | 217 | m_resettimer-> stop ( ); |
218 | resetBacklight ( ); | ||
219 | |||
220 | LightSettingsBase::done ( r ); | ||
214 | close ( ); | 221 | close ( ); |