author | kergoth <kergoth> | 2002-03-18 21:26:21 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-03-18 21:26:21 (UTC) |
commit | e6d3c651634eee7ff54675cc060ae94bd3ef41bd (patch) (unidiff) | |
tree | e11c8c4f4728dc3d93a2439cf92aa8972c6d9d4e /core/apps/calibrate | |
parent | 0a553fa7c46beb00d2a852ecf61233569b5a5e4e (diff) | |
download | opie-e6d3c651634eee7ff54675cc060ae94bd3ef41bd.zip opie-e6d3c651634eee7ff54675cc060ae94bd3ef41bd.tar.gz opie-e6d3c651634eee7ff54675cc060ae94bd3ef41bd.tar.bz2 |
Fixing package conflicts.
-rw-r--r-- | core/apps/calibrate/calibrate.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/apps/calibrate/calibrate.cpp b/core/apps/calibrate/calibrate.cpp index c0ec933..945749b 100644 --- a/core/apps/calibrate/calibrate.cpp +++ b/core/apps/calibrate/calibrate.cpp | |||
@@ -1,142 +1,142 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "calibrate.h" | 21 | #include "calibrate.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | 26 | ||
27 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 27 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
28 | 28 | ||
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qwindowsystem_qws.h> | 31 | #include <qwindowsystem_qws.h> |
32 | #include <qgfx_qws.h> | 32 | #include <qgfx_qws.h> |
33 | 33 | ||
34 | 34 | ||
35 | Calibrate::Calibrate(QWidget* parent, const char * name, WFlags wf) : | 35 | Calibrate::Calibrate(QWidget* parent, const char * name, WFlags wf) : |
36 | QDialog( parent, name, TRUE, wf | WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop ) | 36 | QDialog( parent, name, TRUE, wf | WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop ) |
37 | { | 37 | { |
38 | showCross = TRUE; | 38 | showCross = TRUE; |
39 | const int offset = 30; | 39 | const int offset = 30; |
40 | QRect desk = qApp->desktop()->geometry(); | 40 | QRect desk = qApp->desktop()->geometry(); |
41 | setGeometry( 0, 0, desk.width(), desk.height() ); | 41 | setGeometry( 0, 0, desk.width(), desk.height() ); |
42 | if ( desk.height() < 250 ) { | 42 | if ( desk.height() < 250 ) { |
43 | int w = desk.height()/3; | 43 | int w = desk.height()/3; |
44 | logo.convertFromImage(Resource::loadImage("opielogo").smoothScale(w,w)); | 44 | logo.convertFromImage(Resource::loadImage("launcher/launcher/opielogo").smoothScale(w,w)); |
45 | } else { | 45 | } else { |
46 | logo = Resource::loadPixmap( "opielogo" ); | 46 | logo = Resource::loadPixmap( "launcher/launcher/opielogo" ); |
47 | } | 47 | } |
48 | cd.screenPoints[QWSPointerCalibrationData::TopLeft] = QPoint( offset, offset ); | 48 | cd.screenPoints[QWSPointerCalibrationData::TopLeft] = QPoint( offset, offset ); |
49 | cd.screenPoints[QWSPointerCalibrationData::BottomLeft] = QPoint( offset, qt_screen->deviceHeight() - offset ); | 49 | cd.screenPoints[QWSPointerCalibrationData::BottomLeft] = QPoint( offset, qt_screen->deviceHeight() - offset ); |
50 | cd.screenPoints[QWSPointerCalibrationData::BottomRight] = QPoint( qt_screen->deviceWidth() - offset, qt_screen->deviceHeight() - offset ); | 50 | cd.screenPoints[QWSPointerCalibrationData::BottomRight] = QPoint( qt_screen->deviceWidth() - offset, qt_screen->deviceHeight() - offset ); |
51 | cd.screenPoints[QWSPointerCalibrationData::TopRight] = QPoint( qt_screen->deviceWidth() - offset, offset ); | 51 | cd.screenPoints[QWSPointerCalibrationData::TopRight] = QPoint( qt_screen->deviceWidth() - offset, offset ); |
52 | cd.screenPoints[QWSPointerCalibrationData::Center] = QPoint( qt_screen->deviceWidth()/2, qt_screen->deviceHeight()/2 ); | 52 | cd.screenPoints[QWSPointerCalibrationData::Center] = QPoint( qt_screen->deviceWidth()/2, qt_screen->deviceHeight()/2 ); |
53 | goodcd = cd; | 53 | goodcd = cd; |
54 | reset(); | 54 | reset(); |
55 | 55 | ||
56 | timer = new QTimer( this ); | 56 | timer = new QTimer( this ); |
57 | connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) ); | 57 | connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) ); |
58 | } | 58 | } |
59 | 59 | ||
60 | Calibrate::~Calibrate() | 60 | Calibrate::~Calibrate() |
61 | { | 61 | { |
62 | store(); | 62 | store(); |
63 | } | 63 | } |
64 | 64 | ||
65 | void Calibrate::show() | 65 | void Calibrate::show() |
66 | { | 66 | { |
67 | grabMouse(); | 67 | grabMouse(); |
68 | QWSServer::mouseHandler()->getCalibration(&goodcd); | 68 | QWSServer::mouseHandler()->getCalibration(&goodcd); |
69 | QWSServer::mouseHandler()->clearCalibration(); | 69 | QWSServer::mouseHandler()->clearCalibration(); |
70 | QDialog::show(); | 70 | QDialog::show(); |
71 | } | 71 | } |
72 | 72 | ||
73 | void Calibrate::store() | 73 | void Calibrate::store() |
74 | { | 74 | { |
75 | QWSServer::mouseHandler()->calibrate( &goodcd ); | 75 | QWSServer::mouseHandler()->calibrate( &goodcd ); |
76 | } | 76 | } |
77 | 77 | ||
78 | void Calibrate::hide() | 78 | void Calibrate::hide() |
79 | { | 79 | { |
80 | if ( isVisible() ) | 80 | if ( isVisible() ) |
81 | store(); | 81 | store(); |
82 | QDialog::hide(); | 82 | QDialog::hide(); |
83 | } | 83 | } |
84 | 84 | ||
85 | void Calibrate::reset() | 85 | void Calibrate::reset() |
86 | { | 86 | { |
87 | penPos = QPoint(); | 87 | penPos = QPoint(); |
88 | location = QWSPointerCalibrationData::TopLeft; | 88 | location = QWSPointerCalibrationData::TopLeft; |
89 | crossPos = fromDevice( cd.screenPoints[location] ); | 89 | crossPos = fromDevice( cd.screenPoints[location] ); |
90 | } | 90 | } |
91 | 91 | ||
92 | QPoint Calibrate::fromDevice( const QPoint &p ) | 92 | QPoint Calibrate::fromDevice( const QPoint &p ) |
93 | { | 93 | { |
94 | return qt_screen->mapFromDevice( p, | 94 | return qt_screen->mapFromDevice( p, |
95 | QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight()) ); | 95 | QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight()) ); |
96 | } | 96 | } |
97 | 97 | ||
98 | bool Calibrate::sanityCheck() | 98 | bool Calibrate::sanityCheck() |
99 | { | 99 | { |
100 | QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft]; | 100 | QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft]; |
101 | QPoint tr = cd.devPoints[QWSPointerCalibrationData::TopRight]; | 101 | QPoint tr = cd.devPoints[QWSPointerCalibrationData::TopRight]; |
102 | QPoint bl = cd.devPoints[QWSPointerCalibrationData::BottomLeft]; | 102 | QPoint bl = cd.devPoints[QWSPointerCalibrationData::BottomLeft]; |
103 | QPoint br = cd.devPoints[QWSPointerCalibrationData::BottomRight]; | 103 | QPoint br = cd.devPoints[QWSPointerCalibrationData::BottomRight]; |
104 | 104 | ||
105 | int vl = QABS( tl.y() - bl.y() ); | 105 | int vl = QABS( tl.y() - bl.y() ); |
106 | int vr = QABS( tr.y() - br.y() ); | 106 | int vr = QABS( tr.y() - br.y() ); |
107 | int diff = QABS( vl - vr ); | 107 | int diff = QABS( vl - vr ); |
108 | int avg = ( vl + vr ) / 2; | 108 | int avg = ( vl + vr ) / 2; |
109 | if ( diff > avg / 20 ) // 5% leeway | 109 | if ( diff > avg / 20 ) // 5% leeway |
110 | return FALSE; | 110 | return FALSE; |
111 | 111 | ||
112 | int ht = QABS( tl.x() - tr.x() ); | 112 | int ht = QABS( tl.x() - tr.x() ); |
113 | int hb = QABS( br.x() - bl.x() ); | 113 | int hb = QABS( br.x() - bl.x() ); |
114 | diff = QABS( ht - hb ); | 114 | diff = QABS( ht - hb ); |
115 | avg = ( ht + hb ) / 2; | 115 | avg = ( ht + hb ) / 2; |
116 | if ( diff > avg / 20 ) // 5% leeway | 116 | if ( diff > avg / 20 ) // 5% leeway |
117 | return FALSE; | 117 | return FALSE; |
118 | 118 | ||
119 | return TRUE; | 119 | return TRUE; |
120 | } | 120 | } |
121 | 121 | ||
122 | void Calibrate::moveCrosshair( QPoint pt ) | 122 | void Calibrate::moveCrosshair( QPoint pt ) |
123 | { | 123 | { |
124 | /* | 124 | /* |
125 | QPainter p( this ); | 125 | QPainter p( this ); |
126 | p.drawPixmap( crossPos.x()-8, crossPos.y()-8, saveUnder ); | 126 | p.drawPixmap( crossPos.x()-8, crossPos.y()-8, saveUnder ); |
127 | saveUnder = QPixmap::grabWindow( winId(), pt.x()-8, pt.y()-8, 16, 16 ); | 127 | saveUnder = QPixmap::grabWindow( winId(), pt.x()-8, pt.y()-8, 16, 16 ); |
128 | p.drawRect( pt.x()-1, pt.y()-8, 2, 7 ); | 128 | p.drawRect( pt.x()-1, pt.y()-8, 2, 7 ); |
129 | p.drawRect( pt.x()-1, pt.y()+1, 2, 7 ); | 129 | p.drawRect( pt.x()-1, pt.y()+1, 2, 7 ); |
130 | p.drawRect( pt.x()-8, pt.y()-1, 7, 2 ); | 130 | p.drawRect( pt.x()-8, pt.y()-1, 7, 2 ); |
131 | p.drawRect( pt.x()+1, pt.y()-1, 7, 2 ); | 131 | p.drawRect( pt.x()+1, pt.y()-1, 7, 2 ); |
132 | */ | 132 | */ |
133 | showCross = FALSE; | 133 | showCross = FALSE; |
134 | repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 ); | 134 | repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 ); |
135 | showCross = TRUE; | 135 | showCross = TRUE; |
136 | crossPos = pt; | 136 | crossPos = pt; |
137 | repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 ); | 137 | repaint( crossPos.x()-8, crossPos.y()-8, 16, 16 ); |
138 | } | 138 | } |
139 | 139 | ||
140 | void Calibrate::paintEvent( QPaintEvent * ) | 140 | void Calibrate::paintEvent( QPaintEvent * ) |
141 | { | 141 | { |
142 | QPainter p( this ); | 142 | QPainter p( this ); |