summaryrefslogtreecommitdiff
path: root/core/settings/light-and-power/sensor.cpp
Side-by-side diff
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.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp
index c1df04d..5ca54d4 100644
--- a/core/settings/light-and-power/sensor.cpp
+++ b/core/settings/light-and-power/sensor.cpp
@@ -32,2 +32,6 @@
+#include <opie/odevice.h>
+
+using namespace Opie;
+
#include "calibration.h"
@@ -54,2 +58,5 @@ Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
}
+
+ int xscale = ODevice::inst ( )-> lightSensorResolution ( );
+ int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
@@ -58,9 +65,9 @@ Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
m_calib = new Calibration ( frame );
- lay-> add ( m_calib );
+ lay-> add ( m_calib );
- m_calib-> setScale ( QSize ( 256, 256 ));
+ m_calib-> setScale ( QSize ( xscale, yscale ));
m_calib-> setLineSteps ( steps );
m_calib-> setInterval ( inter );
- m_calib-> setStartPoint ( QPoint ( smin, lmax ));
- m_calib-> setEndPoint ( QPoint ( smax, lmin ));
+ m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 ));
+ m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 ));
@@ -71,2 +78,5 @@ Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int )));
+
+ connect ( m_calib, SIGNAL( startPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & )));
+ connect ( m_calib, SIGNAL( endPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & )));
}
@@ -75,2 +85,5 @@ void Sensor::accept ( )
{
+ int xscale = ODevice::inst ( )-> lightSensorResolution ( );
+ int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
+
m_params. clear ( );
@@ -78,6 +91,6 @@ void Sensor::accept ( )
<< QString::number ( m_calib-> lineSteps ( ))
- << QString::number ( m_calib-> startPoint ( ). x ( ))
- << QString::number ( m_calib-> endPoint ( ). x ( ))
- << QString::number ( m_calib-> endPoint ( ). y ( ))
- << QString::number ( m_calib-> startPoint ( ). y ( ));
+ << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale )
+ << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale )
+ << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale )
+ << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale );
@@ -85 +98,6 @@ void Sensor::accept ( )
}
+
+void Sensor::pointDrag ( const QPoint &p )
+{
+ emit viewBacklight ( p. y ( ));
+}