-rw-r--r-- | core/settings/light-and-power/light.cpp | 64 | ||||
-rw-r--r-- | core/settings/light-and-power/light.h | 1 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 300 |
3 files changed, 236 insertions, 129 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 @@ -18,3 +18,3 @@ ..}^=.= = ; Public License for more details. -++= -. .` .: +++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU @@ -36,2 +36,3 @@ +#include <qlabel.h> #include <qcheckbox.h> @@ -56,2 +57,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // check whether to show the light sensor stuff + if ( !ODevice::inst ( )-> hasLightSensor ( )) { @@ -62,2 +65,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } + + // check whether to show the contrast stuff + if (m_cres) { @@ -70,2 +76,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // check whether to show the cpu frequency stuff + QStrList freq = ODevice::inst()->allowedCpuFrequencies(); @@ -75,3 +83,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } else { + frequencyLabel->hide(); frequency->hide(); + frequencyLabel_ac->hide(); frequency_ac->hide(); @@ -79,2 +89,11 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // 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" ); @@ -93,3 +112,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - int bright = config. readNumEntry ( "Brightness", 127 ); + // hinge action + closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); + + int bright = config. readNumEntry ( "Brightness", 127 ); int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); @@ -112,3 +134,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) config. setGroup ( "AC" ); - + // ac spinboxes @@ -124,2 +146,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // hinge action + closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); + bright = config. readNumEntry ( "Brightness", 255 ); @@ -141,4 +166,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); - - // advanced settings + + // warnings config. setGroup ( "Warnings" ); @@ -152,3 +177,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { - tabs-> setCurrentPage ( 0 ); + tabs-> setCurrentPage ( 0 ); } @@ -157,3 +182,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } - + connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); @@ -164,6 +189,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } - connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(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 ( ) +LightSettings::~LightSettings ( ) { @@ -193,3 +221,3 @@ void LightSettings::setBacklight ( int bright ) e << bright; - + if ( bright != -1 ) { @@ -197,3 +225,3 @@ void LightSettings::setBacklight ( int bright ) m_resettimer-> start ( 4000, true ); - } + } } @@ -203,3 +231,2 @@ void LightSettings::setContrast ( int contr ) if (contr == -1) contr = m_oldcontrast; - ODevice::inst ( )-> setDisplayContrast(contr); @@ -209,3 +236,3 @@ void LightSettings::setFrequency ( int index ) { -qWarning("LightSettings::setFrequency(%d)", index); + qWarning("LightSettings::setFrequency(%d)", index); ODevice::inst ( )-> setCurrentCpuFrequency(index); @@ -219,2 +246,7 @@ void LightSettings::resetBacklight ( ) +void LightSettings::setCloseHingeAction ( int index ) +{ + qWarning("LightSettings::setCloseHingeStatus(%d)", index); +} + void LightSettings::accept ( ) @@ -233,2 +265,3 @@ void LightSettings::accept ( ) config. writeEntry ( "Freq", frequency->currentItem() ); + config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); @@ -244,4 +277,5 @@ void LightSettings::accept ( ) config. writeEntry ( "Freq", frequency_ac->currentItem() ); + config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); - // only make light sensor stuff appear if the unit has a sensor + // only make light sensor stuff appear if the unit has a sensor if ( ODevice::inst ( )-> hasLightSensor ( )) { @@ -277,3 +311,3 @@ void LightSettings::done ( int r ) resetBacklight ( ); - + LightSettingsBase::done ( r ); 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 @@ -56,2 +56,3 @@ protected slots: void setFrequency ( int ); + void setCloseHingeAction ( int ); void resetBacklight ( ); 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 @@ -13,3 +13,3 @@ <y>0</y> - <width>343</width> + <width>331</width> <height>532</height> @@ -107,34 +107,57 @@ </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> @@ -142,3 +165,3 @@ <name>name</name> - <cstring>TL1</cstring> + <cstring>frequencyLabel</cstring> </property> @@ -153,6 +176,17 @@ <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> @@ -187,75 +221,34 @@ </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> + <cstring>interval_lightoff</cstring> </property> <property stdset="1"> - <name>text</name> - <string>Suspend after</string> - </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> @@ -290,3 +283,3 @@ </widget> - <widget row="3" column="1" > + <widget row="3" column="2" > <class>QComboBox</class> @@ -297,2 +290,45 @@ </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> @@ -554,3 +590,3 @@ <name>margin</name> - <number>-1</number> + <number>5</number> </property> @@ -558,3 +594,3 @@ <name>spacing</name> - <number>-1</number> + <number>3</number> </property> @@ -620,20 +656,2 @@ </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" > @@ -700,2 +718,27 @@ </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" > @@ -718,3 +761,3 @@ </widget> - <widget row="2" column="0" > + <widget row="0" column="0" > <class>QLabel</class> @@ -722,3 +765,3 @@ <name>name</name> - <cstring>TextLabel1_2_2_3</cstring> + <cstring>TextLabel1_3_2</cstring> </property> @@ -733,13 +776,24 @@ <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> @@ -761,14 +815,32 @@ </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> @@ -776,3 +848,3 @@ <name>text</name> - <string>CPU frequency</string> + <string>On closing the hinge</string> </property> |