author | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
commit | 0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff) | |
tree | 503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /core/settings/light-and-power/sensor.cpp | |
parent | a0981652d61776d70f25980f035748b21339e946 (diff) | |
download | opie-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.cpp | 8 |
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 | |||
@@ -1,102 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
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 | ||
34 | using namespace Opie; | 34 | using namespace Opie; |
35 | 35 | ||
36 | #include "calibration.h" | 36 | #include "calibration.h" |
37 | #include "sensor.h" | 37 | #include "sensor.h" |
38 | 38 | ||
39 | Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) | 39 | Sensor::Sensor ( QStringList ¶ms, 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 | ||
83 | void Sensor::accept ( ) | 83 | void 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 | ||
99 | void Sensor::pointDrag ( const QPoint &p ) | 99 | void Sensor::pointDrag ( const QPoint &p ) |
100 | { | 100 | { |
101 | emit viewBacklight ( p. y ( )); | 101 | emit viewBacklight ( p. y ( )); |
102 | } | 102 | } |