summaryrefslogtreecommitdiff
path: root/core/apps
Unidiff
Diffstat (limited to 'core/apps') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/calibrate/calibrate.cpp27
-rw-r--r--core/apps/calibrate/calibrate.h6
2 files changed, 29 insertions, 4 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
@@ -26,7 +26,7 @@
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27#include <qapplication.h> 27#include <qapplication.h>
28 28
29#if defined(Q_WS_QWS) || defined(_WS_QWS_) 29//#if defined(Q_WS_QWS) || defined(_WS_QWS_)
30 30
31#include <qpainter.h> 31#include <qpainter.h>
32#include <qtimer.h> 32#include <qtimer.h>
@@ -37,6 +37,7 @@
37Calibrate::Calibrate( QWidget* parent, const char * name, WFlags wf ) : 37Calibrate::Calibrate( QWidget* parent, const char * name, WFlags wf ) :
38 QDialog( parent, name, TRUE, wf | WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop ) 38 QDialog( parent, name, TRUE, wf | WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop )
39{ 39{
40#ifdef QWS
40 showCross = TRUE; 41 showCross = TRUE;
41 const int offset = 30; 42 const int offset = 30;
42 QRect desk = qApp->desktop() ->geometry(); 43 QRect desk = qApp->desktop() ->geometry();
@@ -58,6 +59,7 @@ Calibrate::Calibrate( QWidget* parent, const char * name, WFlags wf ) :
58 59
59 timer = new QTimer( this ); 60 timer = new QTimer( this );
60 connect( timer, SIGNAL( timeout() ), this, SLOT( timeout() ) ); 61 connect( timer, SIGNAL( timeout() ), this, SLOT( timeout() ) );
62#endif
61} 63}
62 64
63Calibrate::~Calibrate() 65Calibrate::~Calibrate()
@@ -67,15 +69,19 @@ Calibrate::~Calibrate()
67 69
68void Calibrate::show() 70void Calibrate::show()
69{ 71{
72#ifdef QWS
70 grabMouse(); 73 grabMouse();
71 QWSServer::mouseHandler() ->getCalibration( &goodcd ); 74 QWSServer::mouseHandler() ->getCalibration( &goodcd );
72 QWSServer::mouseHandler() ->clearCalibration(); 75 QWSServer::mouseHandler() ->clearCalibration();
73 QDialog::show(); 76 QDialog::show();
77#endif
74} 78}
75 79
76void Calibrate::store() 80void Calibrate::store()
77{ 81{
82#ifdef QWS
78 QWSServer::mouseHandler() ->calibrate( &goodcd ); 83 QWSServer::mouseHandler() ->calibrate( &goodcd );
84#endif
79} 85}
80 86
81void Calibrate::hide() 87void Calibrate::hide()
@@ -94,18 +100,26 @@ void Calibrate::hide()
94 100
95void Calibrate::reset() 101void Calibrate::reset()
96{ 102{
103#ifdef QWS
97 penPos = QPoint(); 104 penPos = QPoint();
98 location = QWSPointerCalibrationData::TopLeft; 105 location = QWSPointerCalibrationData::TopLeft;
99 crossPos = fromDevice( cd.screenPoints[ location ] ); 106 crossPos = fromDevice( cd.screenPoints[ location ] );
107#endif
100} 108}
101 109
102QPoint Calibrate::fromDevice( const QPoint &p ) 110QPoint 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}
106 119
107bool Calibrate::sanityCheck() 120bool Calibrate::sanityCheck()
108{ 121{
122#ifdef QWS
109 QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft]; 123 QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft];
110 QPoint tr = cd.devPoints[QWSPointerCalibrationData::TopRight]; 124 QPoint tr = cd.devPoints[QWSPointerCalibrationData::TopRight];
111 QPoint bl = cd.devPoints[QWSPointerCalibrationData::BottomLeft]; 125 QPoint bl = cd.devPoints[QWSPointerCalibrationData::BottomLeft];
@@ -146,6 +160,9 @@ bool Calibrate::sanityCheck()
146 return false; 160 return false;
147 else 161 else
148 return true; 162 return true;
163#else
164return true;
165#endif
149 } 166 }
150 167
151void Calibrate::moveCrosshair( QPoint pt ) 168void Calibrate::moveCrosshair( QPoint pt )
@@ -190,6 +207,7 @@ void Calibrate::paintEvent( QPaintEvent * )
190 207
191void Calibrate::mousePressEvent( QMouseEvent *e ) 208void Calibrate::mousePressEvent( QMouseEvent *e )
192{ 209{
210#ifdef QWS
193 // map to device coordinates 211 // map to device coordinates
194 QPoint devPos = qt_screen->mapToDevice( e->pos(), QSize( qt_screen->width(), qt_screen->height() ) ); 212 QPoint devPos = qt_screen->mapToDevice( e->pos(), QSize( qt_screen->width(), qt_screen->height() ) );
195 if ( penPos.isNull() ) 213 if ( penPos.isNull() )
@@ -197,10 +215,12 @@ void Calibrate::mousePressEvent( QMouseEvent *e )
197 else 215 else
198 penPos = QPoint( ( penPos.x() + devPos.x() ) / 2, 216 penPos = QPoint( ( penPos.x() + devPos.x() ) / 2,
199 ( penPos.y() + devPos.y() ) / 2 ); 217 ( penPos.y() + devPos.y() ) / 2 );
218#endif
200} 219}
201 220
202void Calibrate::mouseReleaseEvent( QMouseEvent * ) 221void Calibrate::mouseReleaseEvent( QMouseEvent * )
203{ 222{
223#ifdef QWS
204 if ( timer->isActive() ) 224 if ( timer->isActive() )
205 return ; 225 return ;
206 226
@@ -229,10 +249,12 @@ void Calibrate::mouseReleaseEvent( QMouseEvent * )
229 dy = ( target.y() - crossPos.y() ) / 10; 249 dy = ( target.y() - crossPos.y() ) / 10;
230 timer->start( 30 ); 250 timer->start( 30 );
231 } 251 }
252#endif
232} 253}
233 254
234void Calibrate::timeout() 255void Calibrate::timeout()
235{ 256{
257#ifdef QWS
236 QPoint target = fromDevice( cd.screenPoints[ location ] ); 258 QPoint target = fromDevice( cd.screenPoints[ location ] );
237 259
238 bool doneX = FALSE; 260 bool doneX = FALSE;
@@ -255,6 +277,7 @@ void Calibrate::timeout()
255 } 277 }
256 278
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
@@ -20,7 +20,7 @@
20 20
21#include <qwsmouse_qws.h> 21#include <qwsmouse_qws.h>
22 22
23#if defined(Q_WS_QWS) || defined(_WS_QWS_) 23//#if defined(Q_WS_QWS) || defined(_WS_QWS_)
24 24
25#include <qdialog.h> 25#include <qdialog.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
@@ -52,8 +52,10 @@ private:
52 void store(); 52 void store();
53 void reset(); 53 void reset();
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;
58 QPoint penPos; 60 QPoint penPos;
59 QPixmap saveUnder; 61 QPixmap saveUnder;
@@ -63,5 +65,5 @@ private:
63 bool showCross; 65 bool showCross;
64}; 66};
65 67
66#endif // _WS_QWS_ 68//#endif // _WS_QWS_
67 69