summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp38
-rw-r--r--core/settings/light-and-power/light.h1
-rw-r--r--core/settings/light-and-power/lightsettingsbase.ui300
3 files changed, 223 insertions, 116 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 6115178..d6d09a1 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -33,8 +33,9 @@
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
+#include <qlabel.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
#include <qslider.h>
#include <qspinbox.h>
@@ -53,31 +54,49 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
{
m_bres = ODevice::inst ( )-> displayBrightnessResolution ( );
m_cres = ODevice::inst ( )-> displayContrastResolution ( );
+ // check whether to show the light sensor stuff
+
if ( !ODevice::inst ( )-> hasLightSensor ( )) {
auto_brightness-> hide ( );
CalibrateLightSensor-> hide ( );
auto_brightness_ac-> hide ( );
CalibrateLightSensor_ac-> hide ( );
}
+
+ // check whether to show the contrast stuff
+
if (m_cres) {
GroupLight->setTitle(tr("Backlight && Contrast"));
GroupLight_ac->setTitle(GroupLight->title());
} else {
contrast->hide();
contrast_ac->hide();
}
+ // check whether to show the cpu frequency stuff
+
QStrList freq = ODevice::inst()->allowedCpuFrequencies();
if ( freq.count() ) {
frequency->insertStrList( freq );
frequency_ac->insertStrList( freq );
} else {
+ frequencyLabel->hide();
frequency->hide();
+ frequencyLabel_ac->hide();
frequency_ac->hide();
}
+ // check whether to show the hinge action stuff
+
+ if ( !ODevice::inst()->hasHingeSensor() ) {
+ closeHingeLabel->hide();
+ closeHingeAction->hide();
+ closeHingeLabel_ac->hide();
+ closeHingeAction_ac->hide();
+ }
+
Config config ( "apm" );
config. setGroup ( "Battery" );
// battery spinboxes
@@ -90,8 +109,11 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
// CPU frequency
frequency->setCurrentItem( config.readNumEntry("Freq", 0) );
+ // hinge action
+ closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
+
int bright = config. readNumEntry ( "Brightness", 127 );
int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
brightness-> setTickInterval ( QMAX( 16, 256 / m_bres ));
brightness-> setLineStep ( QMAX( 1, 256 / m_bres ));
@@ -121,8 +143,11 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
// CPU frequency
frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) );
+ // hinge action
+ closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
+
bright = config. readNumEntry ( "Brightness", 255 );
brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres ));
brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres ));
@@ -139,9 +164,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
// light sensor
auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
- // advanced settings
+ // warnings
config. setGroup ( "Warnings" );
warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
@@ -162,8 +187,11 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
}
connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
+ connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
+ connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
+ connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
}
LightSettings::~LightSettings ( )
{
@@ -200,9 +228,8 @@ void LightSettings::setBacklight ( int bright )
void LightSettings::setContrast ( int contr )
{
if (contr == -1) contr = m_oldcontrast;
-
ODevice::inst ( )-> setDisplayContrast(contr);
}
void LightSettings::setFrequency ( int index )
@@ -216,8 +243,13 @@ void LightSettings::resetBacklight ( )
setBacklight ( -1 );
setContrast ( -1 );
}
+void LightSettings::setCloseHingeAction ( int index )
+{
+ qWarning("LightSettings::setCloseHingeStatus(%d)", index);
+}
+
void LightSettings::accept ( )
{
Config config ( "apm" );
@@ -230,8 +262,9 @@ void LightSettings::accept ( )
config. writeEntry ( "Brightness", brightness-> value () );
if (m_cres)
config. writeEntry ( "Contrast", contrast-> value () );
config. writeEntry ( "Freq", frequency->currentItem() );
+ config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() );
// ac
config. setGroup ( "AC" );
config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( ));
@@ -241,8 +274,9 @@ void LightSettings::accept ( )
config. writeEntry ( "Brightness", brightness_ac-> value () );
if (m_cres)
config. writeEntry ( "Contrast", contrast_ac-> value () );
config. writeEntry ( "Freq", frequency_ac->currentItem() );
+ config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() );
// only make light sensor stuff appear if the unit has a sensor
if ( ODevice::inst ( )-> hasLightSensor ( )) {
config. setGroup ( "Battery" );
diff --git a/core/settings/light-and-power/light.h b/core/settings/light-and-power/light.h
index 83d5520..2167817 100644
--- a/core/settings/light-and-power/light.h
+++ b/core/settings/light-and-power/light.h
@@ -53,8 +53,9 @@ protected slots:
virtual void calibrateSensorAC ( );
void setBacklight ( int );
void setContrast ( int );
void setFrequency ( int );
+ void setCloseHingeAction ( int );
void resetBacklight ( );
private:
int m_bres;
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui
index e4d5f0e..2af0331 100644
--- a/core/settings/light-and-power/lightsettingsbase.ui
+++ b/core/settings/light-and-power/lightsettingsbase.ui
@@ -10,9 +10,9 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>343</width>
+ <width>331</width>
<height>532</height>
</rect>
</property>
<property stdset="1">
@@ -104,44 +104,67 @@
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
- <widget row="1" column="1" >
- <class>QSpinBox</class>
+ <widget row="0" column="0" rowspan="1" colspan="2" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>interval_lightoff</cstring>
+ <cstring>TL1</cstring>
</property>
<property stdset="1">
- <name>suffix</name>
- <string> sec</string>
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
</property>
<property stdset="1">
- <name>specialValueText</name>
- <string>never</string>
+ <name>text</name>
+ <string>Dim light after</string>
</property>
+ </widget>
+ <widget row="2" column="0" rowspan="1" colspan="2" >
+ <class>QLabel</class>
<property stdset="1">
- <name>buttonSymbols</name>
- <enum>PlusMinus</enum>
+ <name>name</name>
+ <cstring>TL3</cstring>
</property>
<property stdset="1">
- <name>maxValue</name>
- <number>3600</number>
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
</property>
<property stdset="1">
- <name>minValue</name>
- <number>0</number>
+ <name>text</name>
+ <string>Suspend after</string>
</property>
+ </widget>
+ <widget row="4" column="0" rowspan="1" colspan="3" >
+ <class>QCheckBox</class>
<property stdset="1">
- <name>lineStep</name>
- <number>10</number>
+ <name>name</name>
+ <cstring>LcdOffOnly</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Deactivate LCD only (does not suspend)</string>
</property>
</widget>
- <widget row="0" column="0" >
+ <widget row="3" column="0" rowspan="1" colspan="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TL1</cstring>
+ <cstring>frequencyLabel</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
@@ -150,12 +173,23 @@
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
- <string>Dim light after</string>
+ <string>CPU Frequency</string>
</property>
</widget>
- <widget row="0" column="1" >
+ <widget row="5" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>closeHingeLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>On closing the hinge</string>
+ </property>
+ </widget>
+ <widget row="0" column="2" >
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>interval_dim</cstring>
@@ -184,81 +218,40 @@
<name>lineStep</name>
<number>10</number>
</property>
</widget>
- <widget row="4" column="0" rowspan="1" colspan="2" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>LcdOffOnly</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Deactivate LCD only (does not suspend)</string>
- </property>
- </widget>
- <widget row="2" column="0" >
- <class>QLabel</class>
+ <widget row="1" column="2" >
+ <class>QSpinBox</class>
<property stdset="1">
<name>name</name>
- <cstring>TL3</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Suspend after</string>
+ <cstring>interval_lightoff</cstring>
</property>
- </widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
<property stdset="1">
- <name>name</name>
- <cstring>TL2</cstring>
+ <name>suffix</name>
+ <string> sec</string>
</property>
<property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
+ <name>specialValueText</name>
+ <string>never</string>
</property>
<property stdset="1">
- <name>text</name>
- <string>Light off after</string>
+ <name>buttonSymbols</name>
+ <enum>PlusMinus</enum>
</property>
- </widget>
- <widget row="3" column="0" >
- <class>QLabel</class>
<property stdset="1">
- <name>name</name>
- <cstring>TL3_2</cstring>
+ <name>maxValue</name>
+ <number>3600</number>
</property>
<property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
+ <name>minValue</name>
+ <number>0</number>
</property>
<property stdset="1">
- <name>text</name>
- <string>CPU Frequency</string>
+ <name>lineStep</name>
+ <number>10</number>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget row="2" column="2" >
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>interval_suspend</cstring>
@@ -287,15 +280,58 @@
<name>lineStep</name>
<number>10</number>
</property>
</widget>
- <widget row="3" column="1" >
+ <widget row="3" column="2" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>frequency</cstring>
</property>
</widget>
+ <widget row="5" column="1" rowspan="1" colspan="2" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>ignore</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>display off</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>suspend</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>closeHingeAction</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TL2</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Light off after</string>
+ </property>
+ </widget>
</grid>
</widget>
<widget>
<class>QGroupBox</class>
@@ -551,13 +587,13 @@
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>-1</number>
+ <number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>-1</number>
+ <number>3</number>
</property>
<widget>
<class>QGroupBox</class>
<property stdset="1">
@@ -617,26 +653,8 @@
<name>lineStep</name>
<number>10</number>
</property>
</widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel1_3_2</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Dim light after</string>
- </property>
- </widget>
<widget row="2" column="1" >
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
@@ -697,8 +715,33 @@
<name>lineStep</name>
<number>10</number>
</property>
</widget>
+ <widget row="3" column="1" >
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>frequency_ac</cstring>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>frequencyLabel_ac</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>CPU Frequency</string>
+ </property>
+ </widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -715,13 +758,13 @@
<name>text</name>
<string>Light off after</string>
</property>
</widget>
- <widget row="2" column="0" >
+ <widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1_2_2_3</cstring>
+ <cstring>TextLabel1_3_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
@@ -730,19 +773,30 @@
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
- <string>Suspend after</string>
+ <string>Dim light after</string>
</property>
</widget>
- <widget row="3" column="1" >
- <class>QComboBox</class>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>frequency_ac</cstring>
+ <cstring>TextLabel1_2_2_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Suspend after</string>
</property>
</widget>
- <widget row="4" column="0" >
+ <widget row="4" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>LcdOffOnly_ac</cstring>
@@ -758,24 +812,42 @@
<name>text</name>
<string>Deactivate LCD only (does not suspend)</string>
</property>
</widget>
- <widget row="3" column="0" >
- <class>QLabel</class>
+ <widget row="5" column="1" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>ignore</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>display off</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>suspend</string>
+ </property>
+ </item>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1_2_2_3_2</cstring>
+ <cstring>closeHingeAction_ac</cstring>
</property>
+ </widget>
+ <widget row="5" column="0" >
+ <class>QLabel</class>
<property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>1</vsizetype>
- </sizepolicy>
+ <name>name</name>
+ <cstring>closeHingeLabel_ac</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>CPU frequency</string>
+ <string>On closing the hinge</string>
</property>
</widget>
</grid>
</widget>