17 #ifndef DIRECTIONAL_DRAG_AREA_PRIV_H
18 #define DIRECTIONAL_DRAG_AREA_PRIV_H
21 struct UBUNTUGESTURESQML_EXPORT ActiveTouchInfo {
22 ActiveTouchInfo() : id(-1), startTime(-1) {}
23 bool isValid()
const {
return id != -1; }
24 void reset() {
id = -1; }
28 class UBUNTUGESTURESQML_EXPORT ActiveTouchesInfo {
30 ActiveTouchesInfo(
const UbuntuGestures::SharedTimeSource &timeSource);
31 void update(QTouchEvent *event);
32 qint64 touchStartTime(
int id);
33 bool isEmpty()
const {
return m_touchInfoPool.isEmpty(); }
34 qint64 mostRecentStartTime();
35 UbuntuGestures::SharedTimeSource m_timeSource;
37 void addTouchPoint(
int touchId);
38 void removeTouchPoint(
int touchId);
39 #if ACTIVETOUCHESINFO_DEBUG
43 Pool<ActiveTouchInfo> m_touchInfoPool;
46 class UBUNTUGESTURESQML_EXPORT DirectionalDragAreaPrivate :
public QObject {
51 DirectionalDragAreaPrivate(DirectionalDragArea *q);
54 void giveUpIfDisabledOrInvisible();
79 void touchEvent_absent(QTouchEvent *event);
80 void touchEvent_undecided(QTouchEvent *event);
81 void touchEvent_recognized(QTouchEvent *event);
82 bool movingInRightDirection()
const;
83 bool movedFarEnoughAlongGestureAxis()
const;
84 bool isPastMaxDistance()
const;
85 const QTouchEvent::TouchPoint *fetchTargetTouchPoint(QTouchEvent *event);
86 void setStatus(Status newStatus);
87 void setPublicPos(
const QPointF &point);
88 void setPublicScenePos(
const QPointF &point);
89 bool isWithinTouchCompositionWindow();
90 void updateSceneDirectionVector();
93 qreal projectOntoDirectionVector(
const QPointF &sceneVector)
const;
94 void touchOwnershipEvent(TouchOwnershipEvent *event);
95 void unownedTouchEvent(UnownedTouchEvent *event);
96 void unownedTouchEvent_undecided(UnownedTouchEvent *unownedTouchEvent);
97 void watchPressedTouchPoints(
const QList<QTouchEvent::TouchPoint> &touchPoints);
98 bool recognitionIsDisabled()
const;
99 bool sanityCheckRecognitionProperties();
100 void updateSceneDistance();
101 void setMaxTime(
int value);
102 void setDistanceThreshold(qreal value);
103 void setPixelsPerMm(qreal pixelsPerMm);
104 QString objectName()
const {
return q->objectName(); }
109 void setRecognitionTimer(UbuntuGestures::AbstractTimer *timer);
112 void setTimeSource(
const UbuntuGestures::SharedTimeSource &timeSource);
114 DirectionalDragArea *q;
120 QPointF startScenePos;
127 QPointF publicScenePos;
131 DampedPointF dampedScenePos;
132 QPointF previousDampedScenePos;
135 QPointF sceneDirectionVector;
137 Direction::Type direction;
141 qreal distanceThreshold;
142 qreal distanceThresholdSquared;
155 bool immediateRecognition;
157 UbuntuGestures::AbstractTimer *recognitionTimer;
159 UbuntuGestures::SharedTimeSource timeSource;
161 ActiveTouchesInfo activeTouches;
164 void statusChanged(Status value);
167 #endif // DIRECTIONAL_DRAG_AREA_PRIV_H