summaryrefslogtreecommitdiff
path: root/core/settings/light-and-power/sensor.cpp
authoralwin <alwin>2004-03-02 12:14:15 (UTC)
committer alwin <alwin>2004-03-02 12:14:15 (UTC)
commit0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff)
tree503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /core/settings/light-and-power/sensor.cpp
parenta0981652d61776d70f25980f035748b21339e946 (diff)
downloadopie-0d59c780513da78033f4d9040475dee9db0256d4.zip
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you can check the diff (but it had compiled and run here)
Diffstat (limited to 'core/settings/light-and-power/sensor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/sensor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp
index 41de851..013e655 100644
--- a/core/settings/light-and-power/sensor.cpp
+++ b/core/settings/light-and-power/sensor.cpp
@@ -28,75 +28,75 @@
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qslider.h> 29#include <qslider.h>
30#include <qspinbox.h> 30#include <qspinbox.h>
31 31
32#include <opie/odevice.h> 32#include <opie/odevice.h>
33 33
34using namespace Opie; 34using namespace Opie;
35 35
36#include "calibration.h" 36#include "calibration.h"
37#include "sensor.h" 37#include "sensor.h"
38 38
39Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name ) 39Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
40 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) 40 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params )
41{ 41{
42 int steps = 12; 42 int steps = 12;
43 int inter = 2; 43 int inter = 2;
44 44
45 int smin = 40; 45 int smin = 40;
46 int smax = 215; 46 int smax = 215;
47 int lmin = 1; 47 int lmin = 1;
48 int lmax = 255; 48 int lmax = 255;
49 49
50 switch ( params. count ( )) { 50 switch ( params. count ( )) {
51 case 6: lmax = params [5]. toInt ( ); 51 case 6: lmax = params [5]. toInt ( );
52 case 5: lmin = params [4]. toInt ( ); 52 case 5: lmin = params [4]. toInt ( );
53 case 4: smax = params [3]. toInt ( ); 53 case 4: smax = params [3]. toInt ( );
54 case 3: smin = params [2]. toInt ( ); 54 case 3: smin = params [2]. toInt ( );
55 case 2: steps = params [1]. toInt ( ); 55 case 2: steps = params [1]. toInt ( );
56 case 1: inter = params [0]. toInt ( ) / 1000; 56 case 1: inter = params [0]. toInt ( ) / 1000;
57 } 57 }
58 58
59 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 59 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
60 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 60 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
61 61
62 QVBoxLayout *lay = new QVBoxLayout ( frame ); 62 QVBoxLayout *lay = new QVBoxLayout ( frame );
63 lay-> setMargin ( 2 ); 63 lay-> setMargin ( 2 );
64 m_calib = new Calibration ( frame ); 64 m_calib = new Calibration ( frame );
65 lay-> add ( m_calib ); 65 lay-> add ( m_calib );
66 66
67 m_calib-> setScale ( QSize ( xscale, yscale )); 67 m_calib-> setScale ( QSize ( xscale, yscale ));
68 m_calib-> setLineSteps ( steps ); 68 m_calib-> setLineSteps ( steps );
69 m_calib-> setInterval ( inter ); 69 m_calib-> setInterval ( inter );
70 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 )); 70 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 ));
71 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 )); 71 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 ));
72 72
73 interval-> setValue ( inter ); 73 interval-> setValue ( inter );
74 linesteps-> setValue ( steps ); 74 linesteps-> setValue ( steps );
75 75
76 connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int ))); 76 connect ( interval, SIGNAL( valueChanged(int)), m_calib, SLOT( setInterval(int)));
77 connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); 77 connect ( linesteps, SIGNAL( valueChanged(int)), m_calib, SLOT( setLineSteps(int)));
78 78
79 connect ( m_calib, SIGNAL( startPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); 79 connect ( m_calib, SIGNAL( startPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
80 connect ( m_calib, SIGNAL( endPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); 80 connect ( m_calib, SIGNAL( endPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
81} 81}
82 82
83void Sensor::accept ( ) 83void Sensor::accept ( )
84{ 84{
85 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 85 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
86 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 86 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
87 87
88 m_params. clear ( ); 88 m_params. clear ( );
89 m_params << QString::number ( m_calib-> interval ( ) * 1000 ) 89 m_params << QString::number ( m_calib-> interval ( ) * 1000 )
90 << QString::number ( m_calib-> lineSteps ( )) 90 << QString::number ( m_calib-> lineSteps ( ))
91 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale ) 91 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale )
92 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale ) 92 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale )
93 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale ) 93 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale )
94 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale ); 94 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale );
95 95
96 QDialog::accept ( ); 96 QDialog::accept ( );
97} 97}
98 98
99void Sensor::pointDrag ( const QPoint &p ) 99void Sensor::pointDrag ( const QPoint &p )
100{ 100{
101 emit viewBacklight ( p. y ( )); 101 emit viewBacklight ( p. y ( ));
102} 102}