--- a/qstmgesturelib/qstmgenericsimplegesture.cpp Thu Sep 23 15:32:11 2010 -0400
+++ b/qstmgesturelib/qstmgenericsimplegesture.cpp Fri Oct 15 17:30:59 2010 -0400
@@ -28,8 +28,9 @@
QStm_GenericSimpleGesture::QStm_GenericSimpleGesture(
- QStm_GestureUid uid, const QPoint& loc, int type, const QStm_UiEventSpeedIf* speedIf) :
- m_location(loc), m_uid(uid), m_type(type), m_details(0), m_speed(speedIf), m_target(0)
+ QStm_GestureUid uid, const QPoint& loc, QTime timestamp, int type, const QStm_UiEventSpeedIf* speedIf) :
+ m_location(loc), m_uid(uid), m_type(type), m_details(0), m_speed(speedIf), m_target(0),
+ m_timestamp(timestamp)
{
}
@@ -38,6 +39,11 @@
return m_location ;
}
+QPoint QStm_GenericSimpleGesture::getLocation2() const
+{
+ return m_location2 ;
+}
+
int QStm_GenericSimpleGesture::getType() const
{
return m_type ;
@@ -59,9 +65,9 @@
}
QStm_DirectionalGesture::QStm_DirectionalGesture(
- QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc,
+ QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc, QTime timestamp,
const QStm_UiEventSpeedIf* speedIf, bool logging) :
- QStm_GenericSimpleGesture(uid, loc, 0, speedIf), m_loggingEnabled(logging)
+ QStm_GenericSimpleGesture(uid, loc, timestamp, 0, speedIf), m_loggingEnabled(logging)
{
setVector(loc, prevLoc);
}
@@ -69,21 +75,21 @@
void QStm_DirectionalGesture::setVector(const QPoint& last, const QPoint& previous)
{
m_vector = QPoint(last.x()-previous.x(), previous.y()-last.y()) ; // x > 0 => east, y > 0 => north
- if (m_loggingEnabled) {
- LOGARG("CHoveringGesture: x: %d , %d prev: %d, %d", last.x(), last.y(), previous.x(), previous.y()) ;
- }
}
QStm_GestureDirection QStm_DirectionalGesture::getDirection() const
{
QStm_GestureDirection dir = ENorth ;
int x = ABS(m_vector.x()) ;
- int y = ABS(m_vector.x()) ;
+ int y = ABS(m_vector.y()) ;
- if (y <= x/2) {
+ if (y == 0 && x == 0) {
+ dir = ENoDirection;
+ }
+ else if (y <= x/2) {
if (m_vector.x() < 0)
dir = EWest ;
- else
+ else
dir = EEast ;
}
else if (y > x/2 && y <= (x+x/2)) {
@@ -107,17 +113,14 @@
dir = ENorth ;
}
- if (m_loggingEnabled) {
- LOGARG("CHoveringGesture: x: %d y: %d direction: %d", m_vector.x(), m_vector.y(), dir) ;
- }
-
return dir ;
}
-QStm_TwoPointGesture::QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& loc, const QPoint& prevLoc) :
- QStm_DirectionalGesture(uid, loc, prevLoc, NULL),
- m_location2(prevLoc)
+QStm_TwoPointGesture::QStm_TwoPointGesture(QStm_GestureUid uid, const QPoint& loc,
+ const QPoint& prevLoc, QTime timestamp) :
+ QStm_DirectionalGesture(uid, loc, prevLoc, timestamp, NULL)
{
+ m_location2 = prevLoc;
}