author | schurig <schurig> | 2003-06-06 14:32:51 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-06 14:32:51 (UTC) |
commit | 802e9457b1bc158c61849755215fe2a5bad6231d (patch) (unidiff) | |
tree | 81b8a5cdb9d4b5beaee2f18eec6ca995ec8e77d2 /core | |
parent | 225486a1c3714b4b0c0e60286df13d8ede029768 (diff) | |
download | opie-802e9457b1bc158c61849755215fe2a5bad6231d.zip opie-802e9457b1bc158c61849755215fe2a5bad6231d.tar.gz opie-802e9457b1bc158c61849755215fe2a5bad6231d.tar.bz2 |
frequency change works now
-rw-r--r-- | core/settings/light-and-power/light.cpp | 30 | ||||
-rw-r--r-- | core/settings/light-and-power/light.h | 3 |
2 files changed, 31 insertions, 2 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 8b98672..68c2929 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <qspinbox.h> | 42 | #include <qspinbox.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qgroupbox.h> | 44 | #include <qgroupbox.h> |
45 | #include <qcombobox.h> | ||
45 | 46 | ||
46 | #include <opie/odevice.h> | 47 | #include <opie/odevice.h> |
47 | 48 | ||
@@ -62,12 +63,22 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
62 | CalibrateLightSensor_ac-> hide ( ); | 63 | CalibrateLightSensor_ac-> hide ( ); |
63 | } | 64 | } |
64 | if (m_cres) { | 65 | if (m_cres) { |
65 | GroupLight->setTitle(tr("Backlight & Contrast")); | 66 | GroupLight->setTitle(tr("Backlight && Contrast")); |
67 | GroupLight_ac->setTitle(GroupLight->title()); | ||
66 | } else { | 68 | } else { |
67 | contrast->hide(); | 69 | contrast->hide(); |
68 | contrast_ac->hide(); | 70 | contrast_ac->hide(); |
69 | } | 71 | } |
70 | 72 | ||
73 | QStrList freq = ODevice::inst()->cpuFrequencies(); | ||
74 | if ( freq.count() ) { | ||
75 | frequency->insertStrList( freq ); | ||
76 | frequency_ac->insertStrList( freq ); | ||
77 | } else { | ||
78 | frequency->hide(); | ||
79 | frequency_ac->hide(); | ||
80 | } | ||
81 | |||
71 | Config config ( "apm" ); | 82 | Config config ( "apm" ); |
72 | config. setGroup ( "Battery" ); | 83 | config. setGroup ( "Battery" ); |
73 | 84 | ||
@@ -77,7 +88,10 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
77 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 88 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
78 | 89 | ||
79 | // battery check and slider | 90 | // battery check and slider |
80 | LcdOffOnly-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 91 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
92 | |||
93 | // CPU frequency | ||
94 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | ||
81 | 95 | ||
82 | int bright = config. readNumEntry ( "Brightness", 127 ); | 96 | int bright = config. readNumEntry ( "Brightness", 127 ); |
83 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 97 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
@@ -107,6 +121,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
107 | // ac check and slider | 121 | // ac check and slider |
108 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 122 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
109 | 123 | ||
124 | // CPU frequency | ||
125 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); | ||
126 | |||
110 | bright = config. readNumEntry ( "Brightness", 255 ); | 127 | bright = config. readNumEntry ( "Brightness", 255 ); |
111 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 128 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
112 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); | 129 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); |
@@ -147,6 +164,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
147 | connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); | 164 | connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); |
148 | connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); | 165 | connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); |
149 | } | 166 | } |
167 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | ||
150 | } | 168 | } |
151 | 169 | ||
152 | LightSettings::~LightSettings ( ) | 170 | LightSettings::~LightSettings ( ) |
@@ -189,6 +207,12 @@ void LightSettings::setContrast ( int contr ) | |||
189 | ODevice::inst ( )-> setDisplayContrast(contr); | 207 | ODevice::inst ( )-> setDisplayContrast(contr); |
190 | } | 208 | } |
191 | 209 | ||
210 | void LightSettings::setFrequency ( int index ) | ||
211 | { | ||
212 | qWarning("LightSettings::setFrequency(%d)", index); | ||
213 | ODevice::inst ( )-> setCpuFrequency(index); | ||
214 | } | ||
215 | |||
192 | void LightSettings::resetBacklight ( ) | 216 | void LightSettings::resetBacklight ( ) |
193 | { | 217 | { |
194 | setBacklight ( -1 ); | 218 | setBacklight ( -1 ); |
@@ -208,6 +232,7 @@ void LightSettings::accept ( ) | |||
208 | config. writeEntry ( "Brightness", brightness-> value () ); | 232 | config. writeEntry ( "Brightness", brightness-> value () ); |
209 | if (m_cres) | 233 | if (m_cres) |
210 | config. writeEntry ( "Contrast", contrast-> value () ); | 234 | config. writeEntry ( "Contrast", contrast-> value () ); |
235 | config. writeEntry ( "Freq", frequency->currentItem() ); | ||
211 | 236 | ||
212 | // ac | 237 | // ac |
213 | config. setGroup ( "AC" ); | 238 | config. setGroup ( "AC" ); |
@@ -218,6 +243,7 @@ void LightSettings::accept ( ) | |||
218 | config. writeEntry ( "Brightness", brightness_ac-> value () ); | 243 | config. writeEntry ( "Brightness", brightness_ac-> value () ); |
219 | if (m_cres) | 244 | if (m_cres) |
220 | config. writeEntry ( "Contrast", contrast_ac-> value () ); | 245 | config. writeEntry ( "Contrast", contrast_ac-> value () ); |
246 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); | ||
221 | 247 | ||
222 | // only make light sensor stuff appear if the unit has a sensor | 248 | // only make light sensor stuff appear if the unit has a sensor |
223 | if ( ODevice::inst ( )-> hasLightSensor ( )) { | 249 | if ( ODevice::inst ( )-> hasLightSensor ( )) { |
diff --git a/core/settings/light-and-power/light.h b/core/settings/light-and-power/light.h index 4a8bf6b..c48e5f6 100644 --- a/core/settings/light-and-power/light.h +++ b/core/settings/light-and-power/light.h | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | 31 | ||
32 | #include <qstringlist.h> | 32 | #include <qstringlist.h> |
33 | #include <qlistbox.h> | ||
33 | #include "lightsettingsbase.h" | 34 | #include "lightsettingsbase.h" |
34 | 35 | ||
35 | class QTimer; | 36 | class QTimer; |
@@ -51,12 +52,14 @@ protected slots: | |||
51 | virtual void calibrateSensorAC ( ); | 52 | virtual void calibrateSensorAC ( ); |
52 | void setBacklight ( int ); | 53 | void setBacklight ( int ); |
53 | void setContrast ( int ); | 54 | void setContrast ( int ); |
55 | void setFrequency ( int ); | ||
54 | void resetBacklight ( ); | 56 | void resetBacklight ( ); |
55 | 57 | ||
56 | private: | 58 | private: |
57 | int m_bres; | 59 | int m_bres; |
58 | int m_cres; | 60 | int m_cres; |
59 | int m_oldcontrast; | 61 | int m_oldcontrast; |
62 | int m_oldfreq; | ||
60 | QTimer *m_resettimer; | 63 | QTimer *m_resettimer; |
61 | QStringList m_sensordata; | 64 | QStringList m_sensordata; |
62 | QStringList m_sensordata_ac; | 65 | QStringList m_sensordata_ac; |