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