summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/calibrate/calibrate.cpp37
-rw-r--r--core/apps/calibrate/calibrate.h6
2 files changed, 34 insertions, 9 deletions
diff --git a/core/apps/calibrate/calibrate.cpp b/core/apps/calibrate/calibrate.cpp
index a5f8792..e079195 100644
--- a/core/apps/calibrate/calibrate.cpp
+++ b/core/apps/calibrate/calibrate.cpp
@@ -28,3 +28,3 @@
28 28
29#if defined(Q_WS_QWS) || defined(_WS_QWS_) 29//#if defined(Q_WS_QWS) || defined(_WS_QWS_)
30 30
@@ -39,2 +39,3 @@ Calibrate::Calibrate( QWidget* parent, const char * name, WFlags wf ) :
39{ 39{
40#ifdef QWS
40 showCross = TRUE; 41 showCross = TRUE;
@@ -60,2 +61,3 @@ Calibrate::Calibrate( QWidget* parent, const char * name, WFlags wf ) :
60 connect( timer, SIGNAL( timeout() ), this, SLOT( timeout() ) ); 61 connect( timer, SIGNAL( timeout() ), this, SLOT( timeout() ) );
62#endif
61} 63}
@@ -69,2 +71,3 @@ void Calibrate::show()
69{ 71{
72#ifdef QWS
70 grabMouse(); 73 grabMouse();
@@ -73,2 +76,3 @@ void Calibrate::show()
73 QDialog::show(); 76 QDialog::show();
77#endif
74} 78}
@@ -77,3 +81,5 @@ void Calibrate::store()
77{ 81{
82#ifdef QWS
78 QWSServer::mouseHandler() ->calibrate( &goodcd ); 83 QWSServer::mouseHandler() ->calibrate( &goodcd );
84#endif
79} 85}
@@ -89,3 +95,3 @@ void Calibrate::hide()
89 e << QString ( "calibrate" ); 95 e << QString ( "calibrate" );
90 } 96 }
91 } 97 }
@@ -96,2 +102,3 @@ void Calibrate::reset()
96{ 102{
103#ifdef QWS
97 penPos = QPoint(); 104 penPos = QPoint();
@@ -99,2 +106,3 @@ void Calibrate::reset()
99 crossPos = fromDevice( cd.screenPoints[ location ] ); 106 crossPos = fromDevice( cd.screenPoints[ location ] );
107#endif
100} 108}
@@ -103,3 +111,8 @@ QPoint Calibrate::fromDevice( const QPoint &p )
103{ 111{
112#ifdef QWS
104 return qt_screen->mapFromDevice ( p, QSize( qt_screen->deviceWidth ( ), qt_screen->deviceHeight() ) ); 113 return qt_screen->mapFromDevice ( p, QSize( qt_screen->deviceWidth ( ), qt_screen->deviceHeight() ) );
114#else
115 return QPoint();
116#endif
117
105} 118}
@@ -108,2 +121,3 @@ bool Calibrate::sanityCheck()
108{ 121{
122#ifdef QWS
109 QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft]; 123 QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft];
@@ -129,4 +143,4 @@ bool Calibrate::sanityCheck()
129 int db = (int) ::sqrt (( dbx * dbx ) + ( dby * dby )); 143 int db = (int) ::sqrt (( dbx * dbx ) + ( dby * dby ));
130 144
131 // Calculate leeway for x/y (we do not care if diff1/diff2 is for x or y here !) 145 // Calculate leeway for x/y (we do not care if diff1/diff2 is for x or y here !)
132 int diff1 = QABS( dl - dr ); 146 int diff1 = QABS( dl - dr );
@@ -139,3 +153,3 @@ bool Calibrate::sanityCheck()
139 // It needs to be performed only for the triange (bl, tl, tr) 153 // It needs to be performed only for the triange (bl, tl, tr)
140 int diff3 = QABS(( dlx + dly + dtx + dty ) - ( dl + dt )); 154 int diff3 = QABS(( dlx + dly + dtx + dty ) - ( dl + dt ));
141 int avg3 = (( dlx + dly + dtx + dty ) + ( dl + dt )) / 2; 155 int avg3 = (( dlx + dly + dtx + dty ) + ( dl + dt )) / 2;
@@ -148,3 +162,6 @@ bool Calibrate::sanityCheck()
148 return true; 162 return true;
149 } 163#else
164return true;
165#endif
166}
150 167
@@ -192,2 +209,3 @@ void Calibrate::mousePressEvent( QMouseEvent *e )
192{ 209{
210#ifdef QWS
193 // map to device coordinates 211 // map to device coordinates
@@ -199,2 +217,3 @@ void Calibrate::mousePressEvent( QMouseEvent *e )
199 ( penPos.y() + devPos.y() ) / 2 ); 217 ( penPos.y() + devPos.y() ) / 2 );
218#endif
200} 219}
@@ -203,2 +222,3 @@ void Calibrate::mouseReleaseEvent( QMouseEvent * )
203{ 222{
223#ifdef QWS
204 if ( timer->isActive() ) 224 if ( timer->isActive() )
@@ -231,2 +251,3 @@ void Calibrate::mouseReleaseEvent( QMouseEvent * )
231 } 251 }
252#endif
232} 253}
@@ -235,2 +256,3 @@ void Calibrate::timeout()
235{ 256{
257#ifdef QWS
236 QPoint target = fromDevice( cd.screenPoints[ location ] ); 258 QPoint target = fromDevice( cd.screenPoints[ location ] );
@@ -257,4 +279,5 @@ void Calibrate::timeout()
257 moveCrosshair( newPos ); 279 moveCrosshair( newPos );
280#endif
258} 281}
259 282
260#endif // _WS_QWS_ 283//#endif // _WS_QWS_
diff --git a/core/apps/calibrate/calibrate.h b/core/apps/calibrate/calibrate.h
index 97108c9..06aa0c9 100644
--- a/core/apps/calibrate/calibrate.h
+++ b/core/apps/calibrate/calibrate.h
@@ -22,3 +22,3 @@
22 22
23#if defined(Q_WS_QWS) || defined(_WS_QWS_) 23//#if defined(Q_WS_QWS) || defined(_WS_QWS_)
24 24
@@ -54,4 +54,6 @@ private:
54 QPixmap logo; 54 QPixmap logo;
55#ifdef QWS
55 QWSPointerCalibrationData goodcd,cd; 56 QWSPointerCalibrationData goodcd,cd;
56 QWSPointerCalibrationData::Location location; 57 QWSPointerCalibrationData::Location location;
58#endif
57 QPoint crossPos; 59 QPoint crossPos;
@@ -65,3 +67,3 @@ private:
65 67
66#endif // _WS_QWS_ 68//#endif // _WS_QWS_
67 69