-rw-r--r-- | core/settings/light-and-power/light.cpp | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 63 |
2 files changed, 39 insertions, 26 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 24e1fab..960a165 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp @@ -1,133 +1,135 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "settings.h" #include <qpe/global.h> #include <qpe/fontmanager.h> #include <qpe/config.h> #include <qpe/applnk.h> #include <qpe/qpeapplication.h> #if defined(Q_WS_QWS) && !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif #include <qlabel.h> #include <qcheckbox.h> #include <qradiobutton.h> #include <qtabwidget.h> #include <qslider.h> #include <qfile.h> #include <qtextstream.h> #include <qdatastream.h> #include <qmessagebox.h> #include <qcombobox.h> #include <qspinbox.h> #include <qlistbox.h> #include <qdir.h> #if QT_VERSION >= 300 #include <qstylefactory.h> #endif extern int qpe_sysBrightnessSteps(); LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) : LightSettingsBase( parent, name, TRUE, fl ) { // Not supported auto_brightness->hide(); Config config( "qpe" ); config.setGroup( "Screensaver" ); int interval; interval = config.readNumEntry( "Interval_Dim", 30 ); interval_dim->setValue( interval ); interval = config.readNumEntry( "Interval_LightOff", 20 ); interval_lightoff->setValue( interval ); interval = config.readNumEntry( "Interval", 60 ); if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) interval_suspend->setValue( interval ); screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); + LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); int maxbright = qpe_sysBrightnessSteps(); initbright = config.readNumEntry("Brightness",255); brightness->setMaxValue( maxbright ); brightness->setTickInterval( QMAX(1,maxbright/16) ); brightness->setLineStep( QMAX(1,maxbright/16) ); brightness->setPageStep( QMAX(1,maxbright/16) ); brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); } LightSettings::~LightSettings() { } static void set_fl(int bright) { QCopEnvelope e("QPE/System", "setBacklight(int)" ); e << bright; } void LightSettings::reject() { set_fl(initbright); QDialog::reject(); } void LightSettings::accept() { if ( qApp->focusWidget() ) qApp->focusWidget()->clearFocus(); applyBrightness(); int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); int i_suspend = interval_suspend->value(); QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); e << i_dim << i_lightoff << i_suspend; Config config( "qpe" ); config.setGroup( "Screensaver" ); config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); + config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); config.writeEntry( "Interval_Dim", interval_dim->value() ); config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); config.writeEntry( "Interval", interval_suspend->value() ); config.writeEntry( "Brightness", (brightness->maxValue()-brightness->value())*255/brightness->maxValue() ); config.write(); QDialog::accept(); } void LightSettings::applyBrightness() { int bright = (brightness->maxValue()-brightness->value())*255 / brightness->maxValue(); set_fl(bright); } diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index 47775f7..f2a4552 100644 --- a/core/settings/light-and-power/lightsettingsbase.ui +++ b/core/settings/light-and-power/lightsettingsbase.ui @@ -1,305 +1,316 @@ <!DOCTYPE UI><UI> <class>LightSettingsBase</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>LightSettingsBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>256</width> - <height>316</height> + <width>269</width> + <height>317</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Light Settings</string> </property> <property> <name>layoutMargin</name> </property> <vbox> <property stdset="1"> <name>margin</name> <number>7</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>auto_brightness</cstring> </property> <property stdset="1"> <name>text</name> <string>Adjust to environment</string> </property> <property> <name>whatsThis</name> <string>By sensing the ambient light where you are using your device, the screen light can be adjusted automatically. The brightness setting still affects the average brightness.</string> </property> </widget> <widget> <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>GroupBox3</cstring> </property> <property stdset="1"> <name>title</name> <string>Power saving</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> - <number>6</number> + <number>11</number> </property> <property stdset="1"> <name>spacing</name> - <number>3</number> + <number>6</number> </property> <widget row="1" column="1" > <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>interval_lightoff</cstring> </property> <property stdset="1"> <name>suffix</name> <string> seconds</string> </property> <property stdset="1"> <name>buttonSymbols</name> <enum>PlusMinus</enum> </property> <property stdset="1"> <name>maxValue</name> <number>3600</number> </property> <property stdset="1"> <name>minValue</name> <number>10</number> </property> <property stdset="1"> <name>lineStep</name> <number>15</number> </property> </widget> <widget row="2" column="1" > <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>interval_suspend</cstring> </property> <property stdset="1"> <name>suffix</name> <string> seconds</string> </property> <property stdset="1"> <name>buttonSymbols</name> <enum>PlusMinus</enum> </property> <property stdset="1"> <name>maxValue</name> <number>3600</number> </property> <property stdset="1"> <name>minValue</name> <number>10</number> </property> <property stdset="1"> <name>lineStep</name> <number>15</number> </property> </widget> - <widget row="1" column="0" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>screensaver_lightoff</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>text</name> - <string>Light off after</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> <widget row="0" column="0" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>screensaver_dim</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>1</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>text</name> <string>Dim light after</string> </property> <property stdset="1"> <name>checked</name> <bool>true</bool> </property> </widget> <widget row="0" column="1" > <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>interval_dim</cstring> </property> <property stdset="1"> <name>suffix</name> <string> seconds</string> </property> <property stdset="1"> <name>buttonSymbols</name> <enum>PlusMinus</enum> </property> <property stdset="1"> <name>maxValue</name> <number>3600</number> </property> <property stdset="1"> <name>minValue</name> <number>10</number> </property> <property stdset="1"> <name>lineStep</name> <number>15</number> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1_2</cstring> </property> <property stdset="1"> <name>text</name> <string>Suspend after</string> </property> </widget> + <widget row="3" column="0" rowspan="1" colspan="2" > + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>LcdOffOnly</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Only deactivate LCD during Suspend</string> + </property> + </widget> + <widget row="1" column="0" > + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>screensaver_lightoff</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>text</name> + <string>Light off after</string> + </property> + <property stdset="1"> + <name>checked</name> + <bool>true</bool> + </property> + </widget> </grid> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout18</cstring> </property> <property> <name>layoutMargin</name> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QSlider</class> <property stdset="1"> <name>name</name> <cstring>brightness</cstring> </property> <property stdset="1"> <name>maxValue</name> <number>255</number> </property> <property stdset="1"> <name>lineStep</name> <number>16</number> </property> <property stdset="1"> <name>pageStep</name> <number>16</number> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>tickmarks</name> <enum>Right</enum> </property> <property stdset="1"> <name>tickInterval</name> <number>32</number> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout16</cstring> </property> <property> <name>layoutSpacing</name> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout10</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>PixmapLabel1</cstring> </property> <property stdset="1"> <name>pixmap</name> <pixmap>image0</pixmap> </property> <property stdset="1"> <name>scaledContents</name> |