summaryrefslogtreecommitdiff
authorschurig <schurig>2003-06-10 16:35:43 (UTC)
committer schurig <schurig>2003-06-10 16:35:43 (UTC)
commitd2f78d2aba17a491739d10bd73f6fce033849537 (patch) (side-by-side diff)
tree0d8e5683afaa6da476001e00fc6db2ebc5c1a0df
parent8ffea5d37080bd173d55a458296c1fc461a54d13 (diff)
downloadopie-d2f78d2aba17a491739d10bd73f6fce033849537.zip
opie-d2f78d2aba17a491739d10bd73f6fce033849537.tar.gz
opie-d2f78d2aba17a491739d10bd73f6fce033849537.tar.bz2
renamed frequency access methods
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp4
-rw-r--r--libopie/odevice.cpp8
-rw-r--r--libopie/odevice.h5
3 files changed, 8 insertions, 9 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 68c2929..eda0c1f 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -49,49 +49,49 @@
#include "sensor.h"
using namespace Opie;
LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
: LightSettingsBase( parent, name, false, WStyle_ContextHelp )
{
m_bres = ODevice::inst ( )-> displayBrightnessResolution ( );
m_cres = ODevice::inst ( )-> displayContrastResolution ( );
if ( !ODevice::inst ( )-> hasLightSensor ( )) {
auto_brightness-> hide ( );
CalibrateLightSensor-> hide ( );
auto_brightness_ac-> hide ( );
CalibrateLightSensor_ac-> hide ( );
}
if (m_cres) {
GroupLight->setTitle(tr("Backlight && Contrast"));
GroupLight_ac->setTitle(GroupLight->title());
} else {
contrast->hide();
contrast_ac->hide();
}
- QStrList freq = ODevice::inst()->cpuFrequencies();
+ QStrList freq = ODevice::inst()->allowedCpuFrequencies();
if ( freq.count() ) {
frequency->insertStrList( freq );
frequency_ac->insertStrList( freq );
} else {
frequency->hide();
frequency_ac->hide();
}
Config config ( "apm" );
config. setGroup ( "Battery" );
// battery spinboxes
interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 ));
interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 ));
interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 ));
// battery check and slider
LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
// CPU frequency
frequency->setCurrentItem( config.readNumEntry("Freq", 0) );
int bright = config. readNumEntry ( "Brightness", 127 );
int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
@@ -189,49 +189,49 @@ void LightSettings::calibrateSensorAC ( )
delete s;
}
void LightSettings::setBacklight ( int bright )
{
QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
e << bright;
if ( bright != -1 ) {
m_resettimer-> stop ( );
m_resettimer-> start ( 4000, true );
}
}
void LightSettings::setContrast ( int contr )
{
if (contr == -1) contr = m_oldcontrast;
ODevice::inst ( )-> setDisplayContrast(contr);
}
void LightSettings::setFrequency ( int index )
{
qWarning("LightSettings::setFrequency(%d)", index);
- ODevice::inst ( )-> setCpuFrequency(index);
+ ODevice::inst ( )-> setCurrentCpuFrequency(index);
}
void LightSettings::resetBacklight ( )
{
setBacklight ( -1 );
setContrast ( -1 );
}
void LightSettings::accept ( )
{
Config config ( "apm" );
// bat
config. setGroup ( "Battery" );
config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( ));
config. writeEntry ( "Dim", interval_dim-> value ( ));
config. writeEntry ( "LightOff", interval_lightoff-> value ( ));
config. writeEntry ( "Suspend", interval_suspend-> value ( ));
config. writeEntry ( "Brightness", brightness-> value () );
if (m_cres)
config. writeEntry ( "Contrast", contrast-> value () );
config. writeEntry ( "Freq", frequency->currentItem() );
// ac
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 4c33a0e..d6e6892 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -754,62 +754,62 @@ bool ODevice::setLedState ( OLed which, OLedState st )
* @return if the device has a light sensor
*/
bool ODevice::hasLightSensor ( ) const
{
return false;
}
/**
* @return a value from the light senso
*/
int ODevice::readLightSensor ( )
{
return -1;
}
/**
* @return the light sensor resolution whatever that is ;)
*/
int ODevice::lightSensorResolution ( ) const
{
return 0;
}
/**
- * @return a list with valid CPU frequency
+ * @return a list with CPU frequencies supported by the hardware
*/
-QStrList &ODevice::cpuFrequencies ( ) const
+const QStrList &ODevice::allowedCpuFrequencies ( ) const
{
return *d->m_cpu_frequencies;
}
/**
- * Set desired cpu frequency
+ * Set desired CPU frequency
*
* @param index index into d->m_cpu_frequencies of the frequency to be set
*/
-bool ODevice::setCpuFrequency(uint index)
+bool ODevice::setCurrentCpuFrequency(uint index)
{
if (index >= d->m_cpu_frequencies->count())
return false;
char *freq = d->m_cpu_frequencies->at(index);
qWarning("set freq to %s", freq);
int fd;
if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) {
char writeCommand[50];
const int count = sprintf(writeCommand, "%s\n", freq);
int res = (::write(fd, writeCommand, count) != -1);
::close(fd);
return res;
}
return false;
}
/**
* @return a list of hardware buttons
*/
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 18ff5f1..f2f6467 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -177,51 +177,50 @@ public:
virtual bool setSoftSuspend ( bool on );
virtual bool suspend ( );
virtual bool setDisplayStatus ( bool on );
virtual bool setDisplayBrightness ( int brightness );
virtual int displayBrightnessResolution ( ) const;
virtual bool setDisplayContrast ( int contrast );
virtual int displayContrastResolution ( ) const;
// input / output
//FIXME playAlarmSound and al might be better -zecke
virtual void alarmSound ( );
virtual void keySound ( );
virtual void touchSound ( );
virtual QValueList <OLed> ledList ( ) const;
virtual QValueList <OLedState> ledStateList ( OLed led ) const;
virtual OLedState ledState ( OLed led ) const;
virtual bool setLedState ( OLed led, OLedState st );
virtual bool hasLightSensor ( ) const;
virtual int readLightSensor ( );
virtual int lightSensorResolution ( ) const;
- QStrList &cpuFrequencies() const;
- bool setCpuFrequency(uint index);
- int cpuFrequency() const;
+ const QStrList &allowedCpuFrequencies() const;
+ bool setCurrentCpuFrequency(uint index);
/**
* Returns the available buttons on this device. The number and location
* of buttons will vary depending on the device. Button numbers will be assigned
* by the device manufacturer and will be from most preferred button to least preffered
* button. Note that this list only contains "user mappable" buttons.
*/
const QValueList<ODeviceButton> &buttons ( );
/**
* Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
* returns 0L
*/
const ODeviceButton *buttonForKeycode ( ushort keyCode );
/**
* Reassigns the pressed action for \a button. To return to the factory
* default pass an empty string as \a qcopMessage.
*/
void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
/**
* Reassigns the held action for \a button. To return to the factory
* default pass an empty string as \a qcopMessage.