26 #include "qstmfilelogger.h" |
26 #include "qstmfilelogger.h" |
27 |
27 |
28 using namespace qstmGesture ; |
28 using namespace qstmGesture ; |
29 |
29 |
30 QStm_UpdownGestureRecogniser::QStm_UpdownGestureRecogniser(QStm_GestureListenerIf* listener) : |
30 QStm_UpdownGestureRecogniser::QStm_UpdownGestureRecogniser(QStm_GestureListenerIf* listener) : |
31 QStm_GestureRecogniser(listener) |
31 QStm_GestureRecogniser(listener), m_axisLock(0.5) |
32 { |
32 { |
33 } |
33 } |
34 |
34 |
35 |
35 |
36 QStm_UpdownGestureRecogniser::~QStm_UpdownGestureRecogniser() |
36 QStm_UpdownGestureRecogniser::~QStm_UpdownGestureRecogniser() |
63 } |
63 } |
64 // Is it leftright gesture in our window? |
64 // Is it leftright gesture in our window? |
65 const QPoint& p = puie->currentXY() ; |
65 const QPoint& p = puie->currentXY() ; |
66 QPoint dp = p - puie->previousXY() ; |
66 QPoint dp = p - puie->previousXY() ; |
67 // check that the Y movement is bigger |
67 // check that the Y movement is bigger |
68 if (ABS(dp.x()) < ABS(dp.y())) { |
68 //double dist; |
|
69 //SQRT(dist, ((qreal)(dp.x() * dp.x() + dp.y() * dp.y()))); |
|
70 if ( (qAbs(dp.x()) < qAbs(dp.y())) && |
|
71 ((qreal)qAbs(dp.x()) / (qreal)qAbs(dp.y()) < m_axisLock) ) { |
69 state = EGestureActive; |
72 state = EGestureActive; |
70 qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.y(), puie) ; |
73 //qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.y(), puie) ; |
|
74 QPoint curPos(0, puie->currentXY().y()); |
|
75 QPoint prevPos(0, puie->previousXY().y()); |
|
76 qstmGesture::QStm_DirectionalGesture pgest( |
|
77 KUid, |
|
78 puie->currentXY(), |
|
79 puie->previousXY(), |
|
80 puie->timestamp(), |
|
81 puie, |
|
82 m_loggingenabled); |
|
83 |
71 // Give the gesture a name |
84 // Give the gesture a name |
72 pgest.setName(QString("Updown")) ; |
85 pgest.setName(QString("Updown")) ; |
73 pgest.setTarget(puie->target()); |
86 pgest.setTarget(puie->target()); |
74 // Call the listener to inform that a UpDown has occurred... |
87 // Call the listener to inform that a UpDown has occurred... |
75 m_listener->gestureEnter(pgest) ; |
88 m_listener->gestureEnter(pgest) ; |
85 { |
98 { |
86 const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0); |
99 const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0); |
87 using qstmUiEventEngine::QStm_UiEventSpeed; |
100 using qstmUiEventEngine::QStm_UiEventSpeed; |
88 const QPoint& p = puie->currentXY() ; |
101 const QPoint& p = puie->currentXY() ; |
89 QPoint dp = p - puie->previousXY() ; |
102 QPoint dp = p - puie->previousXY() ; |
90 qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, dp.y(), puie) ; |
103 qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, puie->timestamp(), dp.y(), puie) ; |
91 pgest.setTarget(puie->target()); |
104 pgest.setTarget(puie->target()); |
92 m_listener->gestureExit(pgest) ; |
105 m_listener->gestureExit(pgest) ; |
93 m_state = ENotMyGesture; |
106 m_state = ENotMyGesture; |
94 } |
107 } |
95 |
108 |