summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/settings/light-and-power/calibration.cpp19
-rw-r--r--core/settings/light-and-power/light.cpp24
-rw-r--r--core/settings/light-and-power/lightsettingsbase.ui8
-rw-r--r--core/settings/light-and-power/sensor.cpp22
-rw-r--r--core/settings/light-and-power/sensorbase.ui10
5 files changed, 37 insertions, 46 deletions
diff --git a/core/settings/light-and-power/calibration.cpp b/core/settings/light-and-power/calibration.cpp
index 307de1f..6a3360f 100644
--- a/core/settings/light-and-power/calibration.cpp
+++ b/core/settings/light-and-power/calibration.cpp
@@ -1,278 +1,277 @@
/*
This file is part of the OPIE Project
               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org>
             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "calibration.h"
#include <qpainter.h>
#include <qpalette.h>
#define BRD 2
Calibration::Calibration ( QWidget *parent, const char *name, WFlags fl )
: QWidget ( parent, name, fl )
{
m_scale = QSize ( 256, 256 );
m_steps = 5;
m_dragged = -1;
m_interval = 5;
m_p [0] = QPoint ( 0, 0 );
m_p [1] = QPoint ( 255, 255 );
}
Calibration::~Calibration ( )
{
}
void Calibration::setScale ( const QSize &s )
{
if ( s. width ( ) < 1 || s. height ( ) < 1 )
return;
m_scale = s;
checkPoints ( );
update ( );
}
QSize Calibration::scale ( ) const
{
return m_scale;
}
void Calibration::setLineSteps ( int steps )
{
if ( m_steps < 2 )
return;
m_steps = steps;
update ( );
}
int Calibration::lineSteps ( ) const
{
return m_steps;
}
void Calibration::setInterval ( int iv )
{
if ( iv < 1 )
return;
m_interval = iv;
// update ( );
}
int Calibration::interval ( ) const
{
return m_interval;
}
void Calibration::setStartPoint ( const QPoint &p )
{
- m_p [0] = p;
+ m_p [0] = QPoint ( p. x ( ), m_scale. height ( ) - p. y ( ) - 1 );
checkPoints ( );
update ( );
}
QPoint Calibration::startPoint ( ) const
{
- return m_p [0];
+ return QPoint ( m_p [0]. x ( ), m_scale. height ( ) - m_p [0]. y ( ) - 1 );
}
void Calibration::setEndPoint ( const QPoint &p )
{
- m_p [1] = p;
+ m_p [1] = QPoint ( p. x ( ), m_scale. height ( ) - p. y ( ) - 1 );
checkPoints ( );
update ( );
}
QPoint Calibration::endPoint ( ) const
{
- return m_p [1];
+ return QPoint ( m_p [1]. x ( ), m_scale. height ( ) - m_p [1]. y ( ) - 1 );
}
void Calibration::checkPoints ( )
{
int dx = m_scale. width ( );
int dy = m_scale. height ( );
if ( m_p [1]. x ( ) >= dx )
m_p [1]. setX ( dx - 1 );
if ( m_p [0]. x ( ) > m_p [1]. x ( ))
m_p [0]. setX ( m_p [1]. x ( ));
if ( m_p [1]. y ( ) >= dy )
m_p [1]. setY ( dy - 1 );
if ( m_p [0]. y ( ) > m_p [1]. y ( ))
m_p [0]. setY ( m_p [1]. y ( ));
}
#define SCALEX(x) (BRD+x*(width()- 2*BRD)/m_scale.width())
#define SCALEY(y) (BRD+y*(height()-2*BRD)/m_scale.height())
static QRect around ( int x, int y )
{
return QRect ( x - BRD, y - BRD, 2 * BRD + 1, 2 * BRD + 1 );
}
void Calibration::mousePressEvent ( QMouseEvent *e )
{
if ( e-> button ( ) != LeftButton )
return QWidget::mousePressEvent ( e );
int olddragged = m_dragged;
int x [2], y [2];
m_dragged = -1;
for ( int i = 0; i < 2; i++ ) {
x [i] = SCALEX( m_p [i]. x ( ));
y [i] = SCALEY( m_p [i]. y ( ));
if (( QABS( e-> x ( ) - x [i] ) <= BRD ) &&
( QABS( e-> y ( ) - y [i] ) <= BRD )) {
m_dragged = i;
break;
}
}
if ( m_dragged != olddragged ) {
QRect r;
if ( olddragged >= 0 )
r |= around ( x [olddragged], y [olddragged] );
if ( m_dragged >= 0 )
r |= around ( x [m_dragged], y [m_dragged] );
repaint ( r );
}
}
void Calibration::mouseMoveEvent ( QMouseEvent *e )
{
if ( m_dragged < 0 )
return;
QPoint n [2];
n [m_dragged]. setX (( e-> x ( ) - BRD ) * m_scale. width ( ) / ( width ( ) - 2 * BRD ));
n [m_dragged]. setY (( e-> y ( ) - BRD ) * m_scale. height ( ) / ( height ( ) - 2 * BRD ));
n [1 - m_dragged] = m_p [1 - m_dragged];
if (( n [0]. x ( ) > n [1]. x ( )) || ( n [m_dragged]. x ( ) < 0 ) || ( n [m_dragged]. x ( ) >= m_scale. width ( )))
n [m_dragged]. setX ( m_p [m_dragged]. x ( ));
if (( n [0]. y ( ) > n [1]. y ( )) || ( n [m_dragged]. y ( ) < 0 ) || ( n [m_dragged]. y ( ) >= m_scale. height ( )))
n [m_dragged]. setY ( m_p [m_dragged]. y ( ));
QRect r;
int ox [2], oy [2], nx [2], ny [2];
for ( int i = 0; i < 2; i++ ) {
nx [i] = SCALEX( n [i]. x ( ));
ny [i] = SCALEY( n [i]. y ( ));
ox [i] = SCALEX( m_p [i]. x ( ));
oy [i] = SCALEY( m_p [i]. y ( ));
if ( n [i] != m_p [i] ) {
r |= around ( nx [i], ny [i] );
r |= around ( ox [i], oy [i] );
m_p [i] = n [i];
if ( i == 0 ) {
- r |= QRect ( 0, 0, nx [0] - 0 + 1, ny [0] - 0 + 1 );
- r |= QRect ( 0, 0, ox [0] - 0 + 1, oy [0] - 0 + 1 );
+ r |= QRect ( 0, ny [0], nx [0] - 0 + 1, 1 );
+ r |= QRect ( 0, oy [0], ox [0] - 0 + 1, 1 );
}
else if ( i == 1 ) {
- r |= QRect ( nx [1], ny [1], width ( ) - nx [1], height ( ) - ny [1] );
- r |= QRect ( ox [1], oy [1], width ( ) - ox [1], height ( ) - oy [1] );
+ r |= QRect ( nx [1], ny [1], width ( ) - nx [1], 1 );
+ r |= QRect ( ox [1], oy [1], width ( ) - ox [1], 1 );
}
}
}
if ( r. isValid ( )) {
r |= QRect ( nx [0], ny [0], nx [1] - nx [0] + 1, ny [1] - ny [0] + 1 );
r |= QRect ( ox [0], oy [0], ox [1] - ox [0] + 1, oy [1] - oy [0] + 1 );
repaint ( r );
}
}
void Calibration::mouseReleaseEvent ( QMouseEvent *e )
{
if ( e-> button ( ) != LeftButton )
return QWidget::mouseReleaseEvent ( e );
if ( m_dragged < 0 )
return;
int x = SCALEX( m_p [m_dragged]. x ( ));
int y = SCALEY( m_p [m_dragged]. y ( ));
m_dragged = -1;
repaint ( around ( x, y ));
}
void Calibration::paintEvent ( QPaintEvent * )
{
QPainter p ( this );
QColorGroup g = colorGroup ( );
int x0 = SCALEX( m_p [0]. x ( ));
int y0 = SCALEY( m_p [0]. y ( ));
int x1 = SCALEX( m_p [1]. x ( ));
int y1 = SCALEY( m_p [1]. y ( ));
int dx = x1 - x0;
int dy = y1 - y0;
int ex = x0, ey = y0;
p. setPen ( g. highlight ( ));
- p. drawLine ( BRD, BRD, ex, BRD );
- p. drawLine ( ex, BRD, ex, ey );
+ p. drawLine ( BRD, ey, ex, ey );
for ( int i = 1; i < m_steps; i++ ) {
int fx = x0 + dx * i / m_steps;
int fy = y0 + dy * i / ( m_steps - 1 );
p. drawLine ( ex, ey, fx, ey );
p. drawLine ( fx, ey, fx, fy );
ex = fx;
ey = fy;
}
p. drawLine ( ex, ey, width ( ) - 1 - BRD, ey );
p. fillRect ( around ( x0, y0 ), m_dragged == 0 ? g. highlightedText ( ) : g. text ( ));
p. fillRect ( around ( x1, y1 ), m_dragged == 1 ? g. highlightedText ( ) : g. text ( ));
p. setPen ( g. text ( ));
p. drawText ( QRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD ), AlignTop | AlignRight, tr( "%1 Steps" ). arg ( m_steps ));
}
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 2ea0356..c0ba60b 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -1,226 +1,214 @@
/*
This file is part of the OPIE Project
               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org>
             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "settings.h"
-#include <qpe/global.h>
-#include <qpe/fontmanager.h>
#include <qpe/config.h>
-#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qpe/power.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 <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>
#include "sensor.h"
using namespace Opie;
LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
: LightSettingsBase( parent, name, true, WStyle_ContextHelp )
{
m_res = ODevice::inst ( )-> displayBrightnessResolution ( );
if ( !ODevice::inst ( )-> hasLightSensor ( )) {
auto_brightness-> hide ( );
CalibrateLightSensor-> hide ( );
auto_brightness_ac_3-> hide ( );
CalibrateLightSensorAC-> hide ( );
}
Config config ( "apm" );
config. setGroup ( "Battery" );
// battery spinboxes
interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 ));
interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 ));
interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 ));
// battery check and slider
LcdOffOnly-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
int bright = config. readNumEntry ( "Brightness", 255 );
brightness-> setMaxValue ( m_res - 1 );
brightness-> setTickInterval ( QMAX( 1, m_res / 16 ));
brightness-> setLineStep ( QMAX( 1, m_res / 16 ));
brightness-> setPageStep ( QMAX( 1, m_res / 16 ));
brightness-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 );
// light sensor
auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
m_sensordata = config. readListEntry ( "LightSensorData", ';' );
config. setGroup ( "AC" );
// ac spinboxes
interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 20 ));
interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 30 ));
interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 60 ));
// ac check and slider
LcdOffOnly_2_3-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
bright = config. readNumEntry ( "Brightness", 255 );
brightness_ac_3-> setMaxValue ( m_res - 1 );
brightness_ac_3-> setTickInterval ( QMAX( 1, m_res / 16 ));
brightness_ac_3-> setLineStep ( QMAX( 1, m_res / 16 ));
brightness_ac_3-> setPageStep ( QMAX( 1, m_res / 16 ));
brightness_ac_3-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 );
// light sensor
auto_brightness_ac_3-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
// advanced settings
config. setGroup ( "Warnings" );
warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
- if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online )
+ if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
- else
+ tabs-> setCurrentPage ( 0 );
+ }
+ else {
connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
+ tabs-> setCurrentPage ( 1 );
+ }
}
LightSettings::~LightSettings ( )
{
}
void LightSettings::calibrateSensor ( )
{
Sensor *s = new Sensor ( m_sensordata, this );
s-> showMaximized ( );
s-> exec ( );
delete s;
}
void LightSettings::calibrateSensorAC ( )
{
Sensor *s = new Sensor ( m_sensordata_ac, this );
s-> showMaximized ( );
s-> exec ( );
delete s;
}
void LightSettings::setBacklight ( int bright )
{
bright = bright * 255 / ( m_res - 1 );
QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
e << bright;
}
void LightSettings::reject ( )
{
{
QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
e << -1;
}
QDialog::reject ( );
}
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 ( ) * 255 / ( m_res - 1 ) );
// ac
config. setGroup ( "AC" );
config. writeEntry ( "LcdOffOnly", LcdOffOnly_2_3-> isChecked ( ));
config. writeEntry ( "Dim", interval_dim_ac_3-> value ( ));
config. writeEntry ( "LightOff", interval_lightoff_ac_3-> value ( ));
config. writeEntry ( "Suspend", interval_suspend_ac_3-> value ( ));
config. writeEntry ( "Brightness", brightness_ac_3-> value ( ) * 255 / ( m_res - 1 ));
// only make light sensor stuff appear if the unit has a sensor
if ( ODevice::inst ( )-> hasLightSensor ( )) {
config. setGroup ( "Battery" );
config. writeEntry ( "LightSensor", auto_brightness->isChecked() );
config. writeEntry ( "LightSensorData", m_sensordata, ';' );
config. setGroup ( "AC" );
config. writeEntry ( "LightSensor", auto_brightness_ac_3->isChecked() );
config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' );
}
// advanced
config. setGroup ( "Warnings" );
config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 );
config. writeEntry ( "power_verylow", lowSpinBox-> value ( ));
config. writeEntry ( "power_critical", criticalSpinBox-> value ( ));
config. write ( );
// notify the launcher
{
QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" );
}
{
QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" );
e << -1;
}
{
QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
e << -1;
}
QDialog::accept ( );
}
void LightSettings::done ( int r )
{
QDialog::done ( r );
close ( );
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui
index 4df6024..04c6726 100644
--- a/core/settings/light-and-power/lightsettingsbase.ui
+++ b/core/settings/light-and-power/lightsettingsbase.ui
@@ -1,148 +1,148 @@
<!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>387</width>
+ <width>379</width>
<height>532</height>
</rect>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>caption</name>
<string>Light and Power Settings</string>
</property>
<property stdset="1">
<name>sizeGripEnabled</name>
<bool>false</bool>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<class>QTabWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>TabWidget3</cstring>
+ <cstring>tabs</cstring>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>on Battery</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>GroupBox3</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>title</name>
<string>General Settings</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</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> sec</string>
</property>
<property stdset="1">
<name>specialValueText</name>
<string>never</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>0</number>
</property>
<property stdset="1">
<name>lineStep</name>
<number>10</number>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>3</hsizetype>
@@ -870,193 +870,193 @@
<cstring>PixmapLabel1_2_3</cstring>
</property>
<property stdset="1">
<name>pixmap</name>
<pixmap>image1</pixmap>
</property>
<property stdset="1">
<name>scaledContents</name>
<bool>false</bool>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout10</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<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>
</property>
</spacer>
</vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
- <string>Advanced Settings</string>
+ <string>Warnings</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>GroupBox5</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Warnings</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>5</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>Low power warning interval</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>WordBreak|AlignVCenter|AlignLeft</set>
</property>
<property>
<name>wordwrap</name>
</property>
</widget>
<widget row="1" column="1" >
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>lowSpinBox</cstring>
</property>
<property stdset="1">
<name>suffix</name>
<string> %</string>
</property>
<property stdset="1">
<name>buttonSymbols</name>
<enum>PlusMinus</enum>
</property>
<property stdset="1">
<name>maxValue</name>
<number>80</number>
</property>
<property stdset="1">
<name>minValue</name>
<number>2</number>
</property>
<property>
<name>whatsThis</name>
<string>At what battery level should the low power warning pop up</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>warnintervalBox</cstring>
</property>
<property stdset="1">
<name>suffix</name>
<string> sec</string>
@@ -1202,109 +1202,109 @@
</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>
<connection>
<sender>CalibrateLightSensor</sender>
<signal>clicked()</signal>
<receiver>LightSettingsBase</receiver>
<slot>calibrateSensor()</slot>
</connection>
<connection>
<sender>CalibrateLightSensorAC</sender>
<signal>clicked()</signal>
<receiver>LightSettingsBase</receiver>
<slot>calibrateSensorAC()</slot>
</connection>
<slot access="public">calibrateSensor()</slot>
<slot access="public">calibrateSensorAC()</slot>
</connections>
<tabstops>
<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>tabs</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>
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp
index ddd71d6..c1df04d 100644
--- a/core/settings/light-and-power/sensor.cpp
+++ b/core/settings/light-and-power/sensor.cpp
@@ -1,85 +1,85 @@
/*
This file is part of the OPIE Project
               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org>
             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qframe.h>
#include <qlayout.h>
#include <qslider.h>
#include <qspinbox.h>
#include "calibration.h"
#include "sensor.h"
Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
: SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params )
{
- int steps = 5;
- int inter = 5;
+ int steps = 12;
+ int inter = 2;
- int smin = 0;
- int smax = 255;
- int lmin = 0;
+ int smin = 40;
+ int smax = 215;
+ int lmin = 1;
int lmax = 255;
switch ( params. count ( )) {
case 6: lmax = params [5]. toInt ( );
case 5: lmin = params [4]. toInt ( );
case 4: smax = params [3]. toInt ( );
case 3: smin = params [2]. toInt ( );
case 2: steps = params [1]. toInt ( );
- case 1: inter = params [0]. toInt ( );
+ case 1: inter = params [0]. toInt ( ) / 1000;
}
QVBoxLayout *lay = new QVBoxLayout ( frame );
lay-> setMargin ( 2 );
m_calib = new Calibration ( frame );
lay-> add ( m_calib );
m_calib-> setScale ( QSize ( 256, 256 ));
m_calib-> setLineSteps ( steps );
m_calib-> setInterval ( inter );
- m_calib-> setStartPoint ( QPoint ( smin, lmin ));
- m_calib-> setEndPoint ( QPoint ( smax, lmax ));
+ m_calib-> setStartPoint ( QPoint ( smin, lmax ));
+ m_calib-> setEndPoint ( QPoint ( smax, lmin ));
interval-> setValue ( inter );
linesteps-> setValue ( steps );
connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int )));
connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int )));
}
void Sensor::accept ( )
{
m_params. clear ( );
- m_params << QString::number ( m_calib-> interval ( ))
+ m_params << QString::number ( m_calib-> interval ( ) * 1000 )
<< QString::number ( m_calib-> lineSteps ( ))
<< QString::number ( m_calib-> startPoint ( ). x ( ))
<< QString::number ( m_calib-> endPoint ( ). x ( ))
- << QString::number ( m_calib-> startPoint ( ). y ( ))
- << QString::number ( m_calib-> endPoint ( ). y ( ));
+ << QString::number ( m_calib-> endPoint ( ). y ( ))
+ << QString::number ( m_calib-> startPoint ( ). y ( ));
QDialog::accept ( );
}
diff --git a/core/settings/light-and-power/sensorbase.ui b/core/settings/light-and-power/sensorbase.ui
index 98fce88..64b9a27 100644
--- a/core/settings/light-and-power/sensorbase.ui
+++ b/core/settings/light-and-power/sensorbase.ui
@@ -1,110 +1,110 @@
<!DOCTYPE UI><UI>
<class>SensorBase</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>SensorBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>293</width>
+ <width>289</width>
<height>443</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Sensor Calibration</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout21</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout20</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>3</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>
<bool>false</bool>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel5</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Full</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
@@ -687,184 +687,188 @@
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>10</red>
<green>95</green>
<blue>137</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</inactive>
</palette>
</property>
<property stdset="1">
<name>frameShape</name>
<enum>Box</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
<enum>Plain</enum>
</property>
</widget>
</hbox>
</widget>
</grid>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout22</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel4</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Steps</string>
</property>
</widget>
<widget>
<class>QSlider</class>
<property stdset="1">
<name>name</name>
<cstring>linesteps</cstring>
</property>
<property stdset="1">
<name>minValue</name>
<number>2</number>
</property>
<property stdset="1">
<name>maxValue</name>
- <number>127</number>
+ <number>63</number>
</property>
<property stdset="1">
<name>lineStep</name>
- <number>10</number>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>pageStep</name>
+ <number>5</number>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>tickmarks</name>
<enum>Right</enum>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout28</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel6</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Check interval</string>
</property>
</widget>
<widget>
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>interval</cstring>
</property>
<property stdset="1">
<name>suffix</name>
<string> sec</string>
</property>
<property stdset="1">
<name>buttonSymbols</name>
<enum>PlusMinus</enum>
</property>
<property stdset="1">
<name>maxValue</name>
<number>10</number>
</property>
<property stdset="1">
<name>minValue</name>
<number>1</number>
</property>
<property stdset="1">
<name>lineStep</name>
<number>1</number>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<images>
<image>
<name>image0</name>
<data format="XPM.GZ" length="439">789c6d8ec10ac2300c86ef7b8ad0ff36a4730777111f41f1288887b4b3e8610a3a0f22bebb6dd3d54d0ca5cdffe54f9aaaa4dd764d6555dc7beecf96ec896f54b68fae7bee0fab57a1ea86fc5950ad6685d2646973bd1c43ce3ec73c46903648e79a5624443a27d20cd2b9382704747e124382f11a7c5e30b364b957b331866331b3800c38f70282121c7c628367c098c1e0eb03121ccd4b46fcb0f80b26bb4833987f76b6d6f274de5fe6a1a031d30969f55e161fe4715f7b</data>
</image>
<image>
<name>image1</name>
<data format="XPM.GZ" length="424">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022130543251d2e253d856405bffcbc54105b19c856360003103711c4354b324b364b06719340dcb434b36488ac1e1a2020a6acac8c2ea60cc54862606ea232b218541b5810452c3111432c510f550c22886a1e482c115d0c2c88e6168818babaa4a42462c48082cae8e68102011a06b5d65c004336518f</data>
</image>
</images>
</UI>