author | zecke <zecke> | 2002-10-17 17:03:21 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-17 17:03:21 (UTC) |
commit | d7cdf9468af510848688584caf34cb1cc03b8562 (patch) (unidiff) | |
tree | dfd7a19eec935385262ad003883dd7d384872bbd | |
parent | 0655456f68849bfad9019a7760dec961792d7519 (diff) | |
download | opie-d7cdf9468af510848688584caf34cb1cc03b8562.zip opie-d7cdf9468af510848688584caf34cb1cc03b8562.tar.gz opie-d7cdf9468af510848688584caf34cb1cc03b8562.tar.bz2 |
stupid #ifdefs around Calibrate...
tell moc to ignore them or put them inside the methods :(
-rw-r--r-- | core/apps/calibrate/calibrate.cpp | 37 | ||||
-rw-r--r-- | core/apps/calibrate/calibrate.h | 6 |
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 | |||
@@ -27,5 +27,5 @@ | |||
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> |
@@ -38,4 +38,5 @@ Calibrate::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; |
@@ -59,4 +60,5 @@ Calibrate::Calibrate( QWidget* parent, const char * name, WFlags wf ) : | |||
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 | ||
@@ -68,13 +70,17 @@ Calibrate::~Calibrate() | |||
68 | void Calibrate::show() | 70 | void 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 | ||
76 | void Calibrate::store() | 80 | void Calibrate::store() |
77 | { | 81 | { |
82 | #ifdef QWS | ||
78 | QWSServer::mouseHandler() ->calibrate( &goodcd ); | 83 | QWSServer::mouseHandler() ->calibrate( &goodcd ); |
84 | #endif | ||
79 | } | 85 | } |
80 | 86 | ||
@@ -88,5 +94,5 @@ void Calibrate::hide() | |||
88 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 94 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
89 | e << QString ( "calibrate" ); | 95 | e << QString ( "calibrate" ); |
90 | } | 96 | } |
91 | } | 97 | } |
92 | QDialog::hide(); | 98 | QDialog::hide(); |
@@ -95,16 +101,24 @@ void Calibrate::hide() | |||
95 | void Calibrate::reset() | 101 | void 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 | ||
102 | QPoint Calibrate::fromDevice( const QPoint &p ) | 110 | 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 | } |
106 | 119 | ||
107 | bool Calibrate::sanityCheck() | 120 | bool 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]; |
@@ -128,6 +142,6 @@ bool Calibrate::sanityCheck() | |||
128 | int dt = (int) ::sqrt (( dtx * dtx ) + ( dty * dty )); | 142 | int dt = (int) ::sqrt (( dtx * dtx ) + ( dty * dty )); |
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 ); |
133 | int avg1 = ( dl + dr ) / 2; | 147 | int avg1 = ( dl + dr ) / 2; |
@@ -138,5 +152,5 @@ bool Calibrate::sanityCheck() | |||
138 | // This is a check, if the rect is rotated (other then 0/90/180/270) | 152 | // This is a check, if the rect is rotated (other then 0/90/180/270) |
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; |
142 | 156 | ||
@@ -147,5 +161,8 @@ bool Calibrate::sanityCheck() | |||
147 | else | 161 | else |
148 | return true; | 162 | return true; |
149 | } | 163 | #else |
164 | return true; | ||
165 | #endif | ||
166 | } | ||
150 | 167 | ||
151 | void Calibrate::moveCrosshair( QPoint pt ) | 168 | void Calibrate::moveCrosshair( QPoint pt ) |
@@ -191,4 +208,5 @@ void Calibrate::paintEvent( QPaintEvent * ) | |||
191 | void Calibrate::mousePressEvent( QMouseEvent *e ) | 208 | void 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() ) ); |
@@ -198,8 +216,10 @@ void Calibrate::mousePressEvent( QMouseEvent *e ) | |||
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 | ||
202 | void Calibrate::mouseReleaseEvent( QMouseEvent * ) | 221 | void Calibrate::mouseReleaseEvent( QMouseEvent * ) |
203 | { | 222 | { |
223 | #ifdef QWS | ||
204 | if ( timer->isActive() ) | 224 | if ( timer->isActive() ) |
205 | return ; | 225 | return ; |
@@ -230,8 +250,10 @@ void Calibrate::mouseReleaseEvent( QMouseEvent * ) | |||
230 | timer->start( 30 ); | 250 | timer->start( 30 ); |
231 | } | 251 | } |
252 | #endif | ||
232 | } | 253 | } |
233 | 254 | ||
234 | void Calibrate::timeout() | 255 | void Calibrate::timeout() |
235 | { | 256 | { |
257 | #ifdef QWS | ||
236 | QPoint target = fromDevice( cd.screenPoints[ location ] ); | 258 | QPoint target = fromDevice( cd.screenPoints[ location ] ); |
237 | 259 | ||
@@ -256,5 +278,6 @@ void Calibrate::timeout() | |||
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 | |||
@@ -21,5 +21,5 @@ | |||
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> |
@@ -53,6 +53,8 @@ private: | |||
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; |
@@ -64,4 +66,4 @@ private: | |||
64 | }; | 66 | }; |
65 | 67 | ||
66 | #endif // _WS_QWS_ | 68 | //#endif // _WS_QWS_ |
67 | 69 | ||