summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-27 16:55:45 (UTC)
committer harlekin <harlekin>2002-10-27 16:55:45 (UTC)
commit27a2748d4a5893a888b19d3ed453be29cac0d75b (patch) (side-by-side diff)
treec9fdf0333553ab90c0f017d45e57992a63035079
parent417d7bd0d307921b4540e99b8f52d10a03729153 (diff)
downloadopie-27a2748d4a5893a888b19d3ed453be29cac0d75b.zip
opie-27a2748d4a5893a888b19d3ed453be29cac0d75b.tar.gz
opie-27a2748d4a5893a888b19d3ed453be29cac0d75b.tar.bz2
some whatsthis and further updates ( disabling dim when on light sensor)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp22
-rw-r--r--core/settings/light-and-power/lightsettingsbase.ui117
2 files changed, 122 insertions, 17 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 97120f2..77c6b40 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -34,180 +34,170 @@
#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 <qgroupbox.h>
#include <qspinbox.h>
#include <qpushbutton.h>
#include <qlistbox.h>
#include <qdir.h>
#if QT_VERSION >= 300
#include <qstylefactory.h>
#endif
#include <opie/odevice.h>
using namespace Opie;
-LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl )
- : LightSettingsBase( parent, name, TRUE, fl )
+LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
+ : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp )
{
if ( ODevice::inst()->hasLightSensor() ) {
// Not supported yet - hide until implemented
- auto_brightness->setEnabled( false );
CalibrateLightSensor->setEnabled( false );
- auto_brightness_ac_3->setEnabled( false );
CalibrateLightSensorAC->setEnabled( false );
} else {
// if ipaq no need to show the sensor box
auto_brightness->hide();
CalibrateLightSensor->hide();
auto_brightness_ac_3->hide();
CalibrateLightSensorAC->hide();
}
Config config( "qpe" );
config.setGroup( "Screensaver" );
-
int interval;
-
// battery spinboxes
interval = config.readNumEntry( "Interval_Dim", 20 );
if ( config.readNumEntry("Dim",1) == 0 ) {
interval_dim->setSpecialValueText( tr("never") );
} else {
interval_dim->setValue( interval );
}
interval = config.readNumEntry( "Interval_LightOff", 30 );
if ( config.readNumEntry("LightOff",1) == 0 ) {
interval_lightoff->setSpecialValueText( tr("never") );
} else {
interval_lightoff->setValue( interval );
}
interval = config.readNumEntry( "Interval", 60 );
if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs)
interval_suspend->setValue( interval );
// ac spinboxes
interval = config.readNumEntry( "Interval_DimAC", 20 );
if ( config.readNumEntry("DimAC",1) == 0 ) {
interval_dim_ac_3->setSpecialValueText( tr("never") );
} else {
interval_dim_ac_3->setValue( interval );
}
interval = config.readNumEntry( "Interval_LightOffAC", 30 );
if ( config.readNumEntry("LightOffAC",1) == 0 ) {
interval_lightoff_ac_3->setSpecialValueText( tr("never") );
} else {
interval_lightoff_ac_3->setValue( interval );
}
interval = config.readNumEntry( "IntervalAC", 60 );
if ( interval > 3600 ) {
interval /= 1000; // compatibility (was millisecs)
}
if ( config.readNumEntry("NoApmAC", 0) == 0 ) {
interval_suspend_ac_3->setSpecialValueText( tr("never") );
} else {
interval_suspend_ac_3->setValue( interval );
}
// battery check and slider
-
-
-
-
LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 );
int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( );
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 );
// ac check and slider
LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 );
int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( );
initbright_ac = config.readNumEntry("BrightnessAC",255);
brightness_ac_3->setMaxValue( maxbright_ac );
brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) );
brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) );
brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) );
brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 );
// ipaq sensor
config.setGroup( "Ipaqlightsensor" );
- auto_brightness->setChecked( config.readNumEntry("LightSensor",1) != 0 );
- auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 );
+ auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 );
+ auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",0) != 0 );
//LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) );
//LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) );
//connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ;
//LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) );
// advanced settings
Config conf("apm");
conf.setGroup( "warnings" );
warnintervalBox->setValue( conf.readNumEntry("checkinterval", 10000)/1000 );
lowSpinBox->setValue( conf.readNumEntry("powerverylow", 10 ) );
criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) );
connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) );
connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) );
}
-LightSettings::~LightSettings()
-{
+LightSettings::~LightSettings() {
}
void LightSettings::slotSliderTicks( int steps ) {
// LightMinValueSlider->setTickInterval( steps );
}
static void set_fl(int bright)
{
qDebug ( QString( "Brightness" ).arg( 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();
// bat
int i_dim = ( !( interval_dim->specialValueText() == tr("never") ) ? interval_dim->value() : 0);
int i_lightoff = ( !( interval_lightoff->specialValueText() == tr("never") ) ? 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;
// ac
int i_dim_ac = ( !( interval_dim_ac_3->specialValueText() == tr("never") ) ? interval_dim_ac_3->value() : 0);
int i_lightoff_ac = ( !( interval_lightoff_ac_3->specialValueText() == tr("never") ) ? interval_lightoff_ac_3->value() : 0);
int i_suspend_ac = interval_suspend_ac_3->value();
QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" );
e << i_dim_ac << i_lightoff_ac << i_suspend_ac;
@@ -263,26 +253,26 @@ void LightSettings::accept()
}
void LightSettings::applyBrightness()
{
if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) {
int bright = ( brightness->value() ) * 255 / brightness->maxValue();
set_fl(bright);
}
}
void LightSettings::applyBrightnessAC()
{
// if ac is attached, set directly that sliders setting, else the "on battery" sliders setting
if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) {
int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue();
set_fl(bright);
}
}
void LightSettings::done(int r)
{
QDialog::done(r);
- close ( );
+ close ();
}
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui
index fee5c2c..effa460 100644
--- a/core/settings/light-and-power/lightsettingsbase.ui
+++ b/core/settings/light-and-power/lightsettingsbase.ui
@@ -312,48 +312,52 @@
<property stdset="1">
<name>lineStep</name>
<number>1</number>
</property>
<property stdset="1">
<name>pageStep</name>
<number>16</number>
</property>
<property stdset="1">
<name>tracking</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>tickmarks</name>
<enum>Right</enum>
</property>
<property stdset="1">
<name>tickInterval</name>
<number>32</number>
</property>
+ <property>
+ <name>whatsThis</name>
+ <string>set a fix value for backlight</string>
+ </property>
</widget>
<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>PixmapLabel2</cstring>
</property>
<property stdset="1">
<name>pixmap</name>
@@ -443,48 +447,52 @@
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>auto_brightness</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Use Light Sensor</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>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>CalibrateLightSensor</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Calibrate</string>
</property>
+ <property>
+ <name>whatsThis</name>
+ <string>Advanced settings for light sensor handling</string>
+ </property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer4</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
@@ -751,48 +759,52 @@
<property stdset="1">
<name>lineStep</name>
<number>16</number>
</property>
<property stdset="1">
<name>pageStep</name>
<number>16</number>
</property>
<property stdset="1">
<name>value</name>
<number>255</number>
</property>
<property stdset="1">
<name>tracking</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>tickmarks</name>
<enum>Right</enum>
</property>
+ <property>
+ <name>whatsThis</name>
+ <string>set a fix value for backlight</string>
+ </property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout20</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>PixmapLabel2_2_3</cstring>
</property>
<property stdset="1">
<name>pixmap</name>
@@ -882,48 +894,52 @@
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>auto_brightness_ac_3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Use Light Sensor</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>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>CalibrateLightSensorAC</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Calibrate</string>
</property>
+ <property>
+ <name>whatsThis</name>
+ <string>Advanced settings for light sensor handling</string>
+ </property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer5</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
@@ -1153,32 +1169,131 @@
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</widget>
</vbox>
</widget>
<images>
<image>
<name>image0</name>
<data format="XPM.GZ" length="424">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022130543251d2e253d856405bffcbc54105b19c856360003103711c4354b324b364b06719340dcb434b36488ac1e1a2020a6acac8c2ea60cc54862606ea232b218541b5810452c3111432c510f550c22886a1e482c115d0c2c88e6168818babaa4a42462c48082cae8e68102011a06b5d65c004336518f</data>
</image>
<image>
<name>image1</name>
<data format="XPM.GZ" length="439">789c6d8ec10ac2300c86ef7b8ad0ff36a4730777111f41f1288887b4b3e8610a3a0f22bebb6dd3d54d0ca5cdffe54f9aaaa4dd764d6555dc7beecf96ec896f54b68fae7bee0fab57a1ea86fc5950ad6685d2646973bd1c43ce3ec73c46903648e79a5624443a27d20cd2b9382704747e124382f11a7c5e30b364b957b331866331b3800c38f70282121c7c628367c098c1e0eb03121ccd4b46fcb0f80b26bb4833987f76b6d6f274de5fe6a1a031d30969f55e161fe4715f7b</data>
</image>
<image>
<name>image2</name>
<data format="XPM.GZ" length="424">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022130543251d2e253d856405bffcbc54105b19c856360003103711c4354b344b314b04719340dcb434b31488ac1e1a2020a6acac8c2ea60cc54862606ea232b218541b5810452c3111432c510f550c22886a1e482c115d0c2c88e6168818babaa4a42462c48082cae8e68102011a06b5d65c0041d3518e</data>
</image>
</images>
+<connections>
+ <connection>
+ <sender>auto_brightness</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>brightness</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness_ac_3</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>brightness_ac_3</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness_ac_3</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel1_3_2</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel1_3</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>interval_dim</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness_ac_3</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>interval_dim_ac_3</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>PixmapLabel2</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel4</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel5</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>PixmapLabel1</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness_ac_3</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>PixmapLabel2_2_3</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness_ac_3</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel6</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness_ac_3</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>TextLabel7</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>auto_brightness_ac_3</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>PixmapLabel1_2_3</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
<tabstops>
- <tabstop>auto_brightness</tabstop>
<tabstop>interval_dim</tabstop>
<tabstop>interval_lightoff</tabstop>
<tabstop>interval_suspend</tabstop>
+ <tabstop>LcdOffOnly</tabstop>
<tabstop>brightness</tabstop>
+ <tabstop>auto_brightness</tabstop>
+ <tabstop>CalibrateLightSensor</tabstop>
+ <tabstop>TabWidget3</tabstop>
+ <tabstop>interval_lightoff_ac_3</tabstop>
+ <tabstop>interval_suspend_ac_3</tabstop>
+ <tabstop>interval_dim_ac_3</tabstop>
+ <tabstop>LcdOffOnly_2_3</tabstop>
+ <tabstop>brightness_ac_3</tabstop>
+ <tabstop>auto_brightness_ac_3</tabstop>
+ <tabstop>CalibrateLightSensorAC</tabstop>
+ <tabstop>lowSpinBox</tabstop>
+ <tabstop>warnintervalBox</tabstop>
+ <tabstop>criticalSpinBox</tabstop>
</tabstops>
</UI>