Changeset View
Changeset View
Standalone View
Standalone View
effects/touchpoints/touchpoints.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 66 | if (it != m_colors.constEnd()) { | |||
---|---|---|---|---|---|
67 | return it.value(); | 67 | return it.value(); | ||
68 | } | 68 | } | ||
69 | static int s_colorIndex = -1; | 69 | static int s_colorIndex = -1; | ||
70 | s_colorIndex = (s_colorIndex + 1) % 10; | 70 | s_colorIndex = (s_colorIndex + 1) % 10; | ||
71 | m_colors.insert(id, s_colors[s_colorIndex]); | 71 | m_colors.insert(id, s_colors[s_colorIndex]); | ||
72 | return s_colors[s_colorIndex]; | 72 | return s_colors[s_colorIndex]; | ||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | bool TouchPointsEffect::touchDown(quint32 id, const QPointF &pos, quint32 time) | 75 | bool TouchPointsEffect::touchDown(qint32 id, const QPointF &pos, quint32 time) | ||
76 | { | 76 | { | ||
77 | Q_UNUSED(time) | 77 | Q_UNUSED(time) | ||
78 | TouchPoint point; | 78 | TouchPoint point; | ||
79 | point.pos = pos; | 79 | point.pos = pos; | ||
80 | point.press = true; | 80 | point.press = true; | ||
81 | point.color = colorForId(id); | 81 | point.color = colorForId(id); | ||
82 | m_points << point; | 82 | m_points << point; | ||
83 | m_latestPositions.insert(id, pos); | 83 | m_latestPositions.insert(id, pos); | ||
84 | repaint(); | 84 | repaint(); | ||
85 | return false; | 85 | return false; | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | bool TouchPointsEffect::touchMotion(quint32 id, const QPointF &pos, quint32 time) | 88 | bool TouchPointsEffect::touchMotion(qint32 id, const QPointF &pos, quint32 time) | ||
89 | { | 89 | { | ||
90 | Q_UNUSED(time) | 90 | Q_UNUSED(time) | ||
91 | TouchPoint point; | 91 | TouchPoint point; | ||
92 | point.pos = pos; | 92 | point.pos = pos; | ||
93 | point.press = true; | 93 | point.press = true; | ||
94 | point.color = colorForId(id); | 94 | point.color = colorForId(id); | ||
95 | m_points << point; | 95 | m_points << point; | ||
96 | m_latestPositions.insert(id, pos); | 96 | m_latestPositions.insert(id, pos); | ||
97 | repaint(); | 97 | repaint(); | ||
98 | return false; | 98 | return false; | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | bool TouchPointsEffect::touchUp(quint32 id, quint32 time) | 101 | bool TouchPointsEffect::touchUp(qint32 id, quint32 time) | ||
102 | { | 102 | { | ||
103 | Q_UNUSED(time) | 103 | Q_UNUSED(time) | ||
104 | auto it = m_latestPositions.constFind(id); | 104 | auto it = m_latestPositions.constFind(id); | ||
105 | if (it != m_latestPositions.constEnd()) { | 105 | if (it != m_latestPositions.constEnd()) { | ||
106 | TouchPoint point; | 106 | TouchPoint point; | ||
107 | point.pos = it.value(); | 107 | point.pos = it.value(); | ||
108 | point.press = false; | 108 | point.press = false; | ||
109 | point.color = colorForId(id); | 109 | point.color = colorForId(id); | ||
▲ Show 20 Lines • Show All 216 Lines • Show Last 20 Lines |