summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-28 23:46:23 (UTC)
committer sandman <sandman>2002-10-28 23:46:23 (UTC)
commit4251429b30aaf4175c74f714ee01d59368c950f4 (patch) (side-by-side diff)
tree717fb8fd8f17780c86b4bca84acd490f3191d0bf
parenta775c3be38fc7fbd5d120e7e3c1dd3a80a250293 (diff)
downloadopie-4251429b30aaf4175c74f714ee01d59368c950f4.zip
opie-4251429b30aaf4175c74f714ee01d59368c950f4.tar.gz
opie-4251429b30aaf4175c74f714ee01d59368c950f4.tar.bz2
- some minor UI fixes
- parameters for sensor light range were reversed - added reasonable calibration default values (at least on my 3870) - l&p now automatically shows the 'right' (Batt/AC) tab when started
Diffstat (more/less context) (ignore 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
@@ -91,32 +91,32 @@ 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 ( );
@@ -201,18 +201,18 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e )
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 );
@@ -250,14 +250,13 @@ void Calibration::paintEvent ( QPaintEvent * )
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 );
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
@@ -25,40 +25,24 @@
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;
@@ -121,16 +105,20 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
// 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 ( )
{
}
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
@@ -8,13 +8,13 @@
</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>
@@ -46,13 +46,13 @@
<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>
@@ -960,13 +960,13 @@
<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>
@@ -1292,13 +1292,13 @@
<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>
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
@@ -33,53 +33,53 @@
#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
@@ -8,13 +8,13 @@
</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>
@@ -777,17 +777,21 @@
<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">