-rw-r--r-- | core/settings/light-and-power/light.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index ebcc25c..d64a063 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -8,194 +8,194 @@ | |||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "light.h" | 29 | #include "light.h" |
30 | #include "sensor.h" | 30 | #include "sensor.h" |
31 | 31 | ||
32 | #include <opie2/odevice.h> | 32 | #include <opie2/odevice.h> |
33 | 33 | ||
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/power.h> | 35 | #include <qpe/power.h> |
36 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 36 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include <qslider.h> | 43 | #include <qslider.h> |
44 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | using namespace Opie::Core; | 51 | using namespace Opie::Core; |
52 | 52 | ||
53 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 53 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
54 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) | 54 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
55 | { | 55 | { |
56 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); | 56 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); |
57 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); | 57 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); |
58 | 58 | ||
59 | // check whether to show the light sensor stuff | 59 | // check whether to show the light sensor stuff |
60 | 60 | ||
61 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 61 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
62 | auto_brightness-> hide ( ); | 62 | auto_brightness-> hide ( ); |
63 | CalibrateLightSensor-> hide ( ); | 63 | CalibrateLightSensor-> hide ( ); |
64 | auto_brightness_ac-> hide ( ); | 64 | auto_brightness_ac-> hide ( ); |
65 | CalibrateLightSensor_ac-> hide ( ); | 65 | CalibrateLightSensor_ac-> hide ( ); |
66 | } | 66 | } |
67 | 67 | ||
68 | // check whether to show the contrast stuff | 68 | // check whether to show the contrast stuff |
69 | 69 | ||
70 | if (m_cres) { | 70 | if (m_cres) { |
71 | GroupLight->setTitle(tr("Backlight && Contrast")); | 71 | GroupLight->setTitle(tr("Backlight && Contrast")); |
72 | GroupLight_ac->setTitle(GroupLight->title()); | 72 | GroupLight_ac->setTitle(GroupLight->title()); |
73 | } else { | 73 | } else { |
74 | contrast->hide(); | 74 | contrast->hide(); |
75 | contrast_ac->hide(); | 75 | contrast_ac->hide(); |
76 | } | 76 | } |
77 | 77 | ||
78 | // check whether to show the cpu frequency stuff | 78 | // check whether to show the cpu frequency stuff |
79 | 79 | ||
80 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 80 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
81 | if ( freq.count() ) { | 81 | if ( freq.count() ) { |
82 | frequency->insertStrList( freq ); | 82 | frequency->insertStrList( freq ); |
83 | frequency_ac->insertStrList( freq ); | 83 | frequency_ac->insertStrList( freq ); |
84 | } else { | 84 | } else { |
85 | frequencyLabel->hide(); | 85 | frequencyLabel->hide(); |
86 | frequency->hide(); | 86 | frequency->hide(); |
87 | frequencyLabel_ac->hide(); | 87 | frequencyLabel_ac->hide(); |
88 | frequency_ac->hide(); | 88 | frequency_ac->hide(); |
89 | } | 89 | } |
90 | 90 | ||
91 | // check whether to show the hinge action stuff | 91 | // check whether to show the hinge action stuff |
92 | 92 | ||
93 | if ( !ODevice::inst()->hasHingeSensor() ) { | 93 | if ( !ODevice::inst()->hasHingeSensor() ) { |
94 | closeHingeLabel->hide(); | 94 | closeHingeLabel->hide(); |
95 | closeHingeAction->hide(); | 95 | closeHingeAction->hide(); |
96 | closeHingeLabel_ac->hide(); | 96 | closeHingeLabel_ac->hide(); |
97 | closeHingeAction_ac->hide(); | 97 | closeHingeAction_ac->hide(); |
98 | } | 98 | } |
99 | 99 | ||
100 | Config config ( "apm" ); | 100 | Config config ( "apm" ); |
101 | config. setGroup ( "Battery" ); | 101 | config. setGroup ( "Battery" ); |
102 | 102 | ||
103 | // battery spinboxes | 103 | // battery spinboxes |
104 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); | 104 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); |
105 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); | 105 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); |
106 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 106 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
107 | 107 | ||
108 | // battery check and slider | 108 | // battery check and slider |
109 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 109 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
110 | 110 | ||
111 | // CPU frequency | 111 | // CPU frequency |
112 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | 112 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); |
113 | 113 | ||
114 | // hinge action | 114 | // hinge action |
115 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 115 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
116 | 116 | ||
117 | int bright = config. readNumEntry ( "Brightness", 127 ); | 117 | int bright = config. readNumEntry ( "Brightness", 127 ); |
118 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 118 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
119 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 119 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
120 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); | 120 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); |
121 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); | 121 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); |
122 | brightness-> setValue ( bright ); | 122 | brightness-> setValue ( bright ); |
123 | 123 | ||
124 | if (m_cres) { | 124 | if (m_cres) { |
125 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 125 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
126 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); | 126 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); |
127 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); | 127 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); |
128 | contrast-> setValue ( contr ); | 128 | contrast-> setValue ( contr ); |
129 | } | 129 | } |
130 | 130 | ||
131 | // light sensor | 131 | // light sensor |
132 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 132 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
133 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); | 133 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); |
134 | 134 | ||
135 | config. setGroup ( "AC" ); | 135 | config. setGroup ( "AC" ); |
136 | 136 | ||
137 | // ac spinboxes | 137 | // ac spinboxes |
138 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); | 138 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); |
139 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); | 139 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); |
140 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); | 140 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); |
141 | 141 | ||
142 | // ac check and slider | 142 | // ac check and slider |
143 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 143 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
144 | 144 | ||
145 | // CPU frequency | 145 | // CPU frequency |
146 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); | 146 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); |
147 | 147 | ||
148 | // hinge action | 148 | // hinge action |
149 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 149 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
150 | 150 | ||
151 | bright = config. readNumEntry ( "Brightness", 255 ); | 151 | bright = config. readNumEntry ( "Brightness", 255 ); |
152 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 152 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
153 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); | 153 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); |
154 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); | 154 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); |
155 | brightness_ac-> setValue ( bright ); | 155 | brightness_ac-> setValue ( bright ); |
156 | 156 | ||
157 | if (m_cres) { | 157 | if (m_cres) { |
158 | contr = config. readNumEntry ( "Contrast", 127); | 158 | contr = config. readNumEntry ( "Contrast", 127); |
159 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 159 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
160 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); | 160 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); |
161 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); | 161 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); |
162 | contrast_ac-> setValue ( contr ); | 162 | contrast_ac-> setValue ( contr ); |
163 | } | 163 | } |
164 | 164 | ||
165 | // light sensor | 165 | // light sensor |
166 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 166 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
167 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); | 167 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); |
168 | 168 | ||
169 | // warnings | 169 | // warnings |
170 | config. setGroup ( "Warnings" ); | 170 | config. setGroup ( "Warnings" ); |
171 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); | 171 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); |
172 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); | 172 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); |
173 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); | 173 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); |
174 | 174 | ||
175 | m_resettimer = new QTimer ( this ); | 175 | m_resettimer = new QTimer ( this ); |
176 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); | 176 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); |
177 | 177 | ||
178 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 178 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
179 | tabs-> setCurrentPage ( 0 ); | 179 | tabs-> setCurrentPage ( 0 ); |
180 | } | 180 | } |
181 | else { | 181 | else { |
182 | tabs-> setCurrentPage ( 1 ); | 182 | tabs-> setCurrentPage ( 1 ); |
183 | } | 183 | } |
184 | 184 | ||
185 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 185 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
186 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 186 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
187 | if (m_cres) { | 187 | if (m_cres) { |
188 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 188 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
189 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 189 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
190 | } | 190 | } |
191 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 191 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
192 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 192 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
193 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 193 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
194 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 194 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
195 | } | 195 | } |
196 | 196 | ||
197 | LightSettings::~LightSettings ( ) | 197 | LightSettings::~LightSettings ( ) |
198 | { | 198 | { |
199 | } | 199 | } |
200 | 200 | ||
201 | void LightSettings::calibrateSensor ( ) | 201 | void LightSettings::calibrateSensor ( ) |