67 { |
59 { |
68 delete m_gestures; |
60 delete m_gestures; |
69 m_gestures = NULL; |
61 m_gestures = NULL; |
70 delete m_gestureEngine; |
62 delete m_gestureEngine; |
71 QGestureRecognizer::unregisterRecognizer(m_qstmGestureType); |
63 QGestureRecognizer::unregisterRecognizer(m_qstmGestureType); |
72 delete m_dummyRecognizer; |
64 //delete m_dummyRecognizer; |
73 |
65 |
74 } |
66 } |
75 |
67 |
76 |
68 |
77 void WebGestureHelper::setupGestureEngine(QWidget* ctrl) |
69 void WebGestureHelper::setupGestureEngine(QWidget* ctrl) |
78 { |
70 { |
79 m_gestures = m_gestureEngine->createContext(qptrdiff(ctrl)); |
71 m_gestures = m_gestureEngine->createContext(qptrdiff(ctrl)); |
80 #if defined(_DEBUG) |
|
81 m_gestures->setLogging(0); |
|
82 #endif |
|
83 QStm_GestureParameters& param = m_gestures->config(); |
72 QStm_GestureParameters& param = m_gestures->config(); |
84 param.setEnabled(qstmGesture::EGestureUidTap, true); |
73 |
85 param[qstmGesture::EDoubleTapTimeout] = 300; |
74 // Get settings from provisioning |
86 |
75 BEDROCK_PROVISIONING::BedrockProvisioning * settings = |
87 param.setEnabled(qstmGesture::EGestureUidPan, true); |
76 BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning(); |
88 param[qstmGesture::EPanSpeedLow] = 0; |
77 |
89 param[qstmGesture::EPanSpeedHigh] = 100; |
78 int logEnabled = settings->valueAsInt("GesturesEnableLogging"); |
90 param[qstmGesture::EPanDisabledWhileHovering] = false; |
79 qstmEnableDebug((logEnabled != 0)); |
91 param[qstmGesture::EMoveTolerance] = 2; |
80 m_gestures->setLogging(logEnabled); |
92 |
81 |
93 param.setEnabled(qstmGesture::EGestureUidHover, false); |
82 param.setEnabled(qstmGesture::EGestureUidTap, settings->valueAsInt("GesturesEnableTap") != 0); |
94 param[qstmGesture::EHoverSpeed] = 0; |
83 param[qstmGesture::EDoubleTapTimeout] = settings->valueAsInt("GesturesDoubleTapTimeout"); // 300 7x = 400 |
95 param[qstmGesture::EHoverDisabledWhilePanning] = false; |
84 |
96 |
85 param.setEnabled(qstmGesture::EGestureUidPan, settings->valueAsInt("GesturesEnablePan") != 0); |
97 param.setEnabled(qstmGesture::EGestureUidLeftRight, false); |
86 param[qstmGesture::EPanSpeedLow] = settings->valueAsInt("GesturesPanSpeedLow"); |
98 param.setEnabled(qstmGesture::EGestureUidUpDown, false); |
87 param[qstmGesture::EPanSpeedHigh] = settings->valueAsInt("GesturesPanSpeedHigh"); // 100 7x = 400 |
99 |
88 param[qstmGesture::EPanDisabledWhileHovering] = settings->valueAsInt("GesturesPanDisabledWhileHovering") != 0; // !7x |
100 param.setEnabled(qstmGesture::EGestureUidFlick, true); |
89 param[qstmGesture::EMoveTolerance] = settings->valueAsInt("GesturesMoveTolerance"); // !7x |
101 param[qstmGesture::EFlickSpeed] = 25; /*param[stmGesture::EPanSpeedHigh];*/ |
90 |
102 |
91 param.setEnabled(qstmGesture::EGestureUidHover, settings->valueAsInt("GesturesEnableHover") != 0); |
103 param.setEnabled(qstmGesture::EGestureUidRelease, true); |
92 param[qstmGesture::EHoverSpeed] = settings->valueAsInt("GesturesHoverSpeed"); // !7x |
104 param.setEnabled(qstmGesture::EGestureUidTouch, true); |
93 param[qstmGesture::EHoverDisabledWhilePanning] = settings->valueAsInt("GesturesHoverDisabledWhilePanning") != 0; // !7x |
105 |
94 |
106 param.setEnabled(qstmGesture::EGestureUidEdgeScroll, false); |
95 param.setEnabled(qstmGesture::EGestureUidLeftRight, settings->valueAsInt("GesturesEnableLeftRight") != 0); |
107 param[qstmGesture::EEdgeScrollRange] = 20; |
96 param.setEnabled(qstmGesture::EGestureUidUpDown, settings->valueAsInt("GesturesEnableUpDown") != 0); |
108 |
97 param[qstmGesture::EAxisLockThreshold] = (int)(100 * settings->value("GesturesAxisLockThreshold").toDouble()); |
109 param.setEnabled(qstmGesture::EGestureUidCornerZoom, false); |
98 |
110 param[qstmGesture::EZoomCornerSize] = 7; |
99 param.setEnabled(qstmGesture::EGestureUidFlick, settings->valueAsInt("GesturesEnableFlick") != 0); |
111 |
100 param[qstmGesture::EFlickSpeed] = settings->valueAsInt("GesturesFlickSpeed", 25); /*param[stmGesture::EPanSpeedHigh];*/ // !7x |
112 param.setEnabled(qstmGesture::EGestureUidPinch, true); |
101 |
113 param.setEnabled(qstmGesture::EGestureUidLongPress, true); |
102 param.setEnabled(qstmGesture::EGestureUidRelease, settings->valueAsInt("GesturesEnableRelease") != 0); |
114 |
103 param.setEnabled(qstmGesture::EGestureUidTouch, settings->valueAsInt("GesturesEnableTouch") != 0); |
115 param.setEnabled(qstmGesture::EGestureUidUnknown, true); |
104 |
116 |
105 param.setEnabled(qstmGesture::EGestureUidEdgeScroll, settings->valueAsInt("GesturesEnableEdgeScroll") != 0); |
|
106 param[qstmGesture::EEdgeScrollRange] = settings->valueAsInt("GesturesEdgeScrollRange"); // !7x |
|
107 |
|
108 param.setEnabled(qstmGesture::EGestureUidCornerZoom, settings->valueAsInt("GesturesEnableCornerZoom") != 0); |
|
109 param[qstmGesture::EZoomCornerSize] = settings->valueAsInt("GesturesZoomCornerSize"); // 7 !7x |
|
110 |
|
111 param.setEnabled(qstmGesture::EGestureUidPinch, settings->valueAsInt("GesturesEnablePinch") != 0); |
|
112 param.setEnabled(qstmGesture::EGestureUidLongPress, settings->valueAsInt("GesturesEnableLongPress") != 0); |
|
113 |
|
114 param.setEnabled(qstmGesture::EGestureUidUnknown, settings->valueAsInt("GesturesEnableUnknown") != 0); |
|
115 |
117 QStm_GestureArea& touchArea = *param.area(qstmGesture::ETouchArea); |
116 QStm_GestureArea& touchArea = *param.area(qstmGesture::ETouchArea); |
118 QStm_GestureArea& tTimeArea = *param.area(qstmGesture::ETouchTimeArea); |
117 QStm_GestureArea& tTimeArea = *param.area(qstmGesture::ETouchTimeArea); |
119 QStm_GestureArea& holdArea = *param.area(qstmGesture::EHoldArea); |
118 QStm_GestureArea& holdArea = *param.area(qstmGesture::EHoldArea); |
120 |
119 |
121 touchArea.m_shape = QStm_GestureArea::QStm_Shape(1); |
120 touchArea.m_shape = QStm_GestureArea::QStm_Shape(settings->valueAsInt("GesturesTouchAreaShape")); |
122 touchArea.m_timeout = 150; |
121 touchArea.m_timeout = settings->valueAsInt("GesturesTouchAreaTimeout"); // 150 7x = 0 |
123 touchArea.m_size = QSize(7, 0); |
122 touchArea.m_size = QSize(settings->valueAsInt("GesturesTouchAreaWidth"), |
124 |
123 settings->valueAsInt("GesturesTouchAreaHeight")); // 7 7x = 4 |
125 tTimeArea.m_shape = QStm_GestureArea::QStm_Shape(1); |
124 |
126 tTimeArea.m_timeout = 150; |
125 tTimeArea.m_shape = QStm_GestureArea::QStm_Shape(settings->valueAsInt("GesturesTimeAreaShape")); |
127 tTimeArea.m_size = QSize(7, 0); |
126 tTimeArea.m_timeout = settings->valueAsInt("GesturesTimeAreaTimeout"); // 150 7x = 200 |
128 |
127 tTimeArea.m_size = QSize(settings->valueAsInt("GesturesTimeAreaWidth"), |
129 holdArea.m_shape = QStm_GestureArea::QStm_Shape(1); |
128 settings->valueAsInt("GesturesTimeAreaHeight")); // 7 7x = 4 |
130 holdArea.m_timeout = 1500; |
129 |
131 holdArea.m_size = QSize(7, 0); |
130 holdArea.m_shape = QStm_GestureArea::QStm_Shape(settings->valueAsInt("GesturesHoldAreaShape")); |
132 |
131 holdArea.m_timeout = settings->valueAsInt("GesturesHoldAreaTimeout"); // 7x = 1500 |
133 param[ qstmGesture::ESuppressTimeout ] = 0; |
132 holdArea.m_size = QSize(settings->valueAsInt("GesturesHoldAreaWidth"), |
134 param[ qstmGesture::EMoveSuppressTimeout ] = 0; |
133 settings->valueAsInt("GesturesHoldAreaHeight")); // 7 7x = 4 |
135 param[ qstmGesture::ECapacitiveUpUsed ] = false; |
134 |
136 param[ qstmGesture::EAdjustYPos ] = false; |
135 param[ qstmGesture::ESuppressTimeout ] = settings->valueAsInt("GesturesSuppressTimeout"); |
137 param[ qstmGesture::EEnableFiltering ] = 1; |
136 param[ qstmGesture::EMoveSuppressTimeout ] = settings->valueAsInt("GesturesMoveSuppressTimeout"); |
138 param[ qstmGesture::EWServMessageInterception ] = false; |
137 param[ qstmGesture::ECapacitiveUpUsed ] = settings->valueAsInt("GesturesCapacitiveUpUsed") != 0; |
139 |
138 param[ qstmGesture::EAdjustYPos ] = settings->valueAsInt("GesturesAdjustYPos") != 0; // 7x = true ifndef WINSCW |
|
139 param[ qstmGesture::EEnableFiltering ] = settings->valueAsInt("GesturesEnableFiltering") != 0; // 7x = true |
|
140 param[ qstmGesture::EWServMessageInterception ] = (settings->valueAsInt("GesturesWServMessageInterception") != 0); |
|
141 // Wonder Twin powers, Activate! Form of an ice "pan"! Shape of a "pinch"-nose pug! |
140 m_gestures->activate(ctrl); |
142 m_gestures->activate(ctrl); |
141 |
143 |
142 /* |
144 /* |
143 * Only one instance of dummy recognizer is needed. |
145 * Only one instance of dummy recognizer is needed. |
144 * First context will have none-null pointer to it. |
146 * First context will have none-null pointer to it. |
145 */ |
147 */ |
146 if (QStm_Gesture::assignedType() == Qt::CustomGesture) { |
148 //if (QStm_Gesture::assignedType() == Qt::CustomGesture) { |
147 m_dummyRecognizer = new QStm_QtDummyGestureRecognizer(m_gestures); |
149 m_dummyRecognizer = new QStm_QtDummyGestureRecognizer(m_gestures); |
148 m_gestures->addListener(m_dummyRecognizer); |
150 m_gestures->addListener(m_dummyRecognizer); |
149 m_qstmGestureType = QGestureRecognizer::registerRecognizer(m_dummyRecognizer); |
151 m_qstmGestureType = QGestureRecognizer::registerRecognizer(m_dummyRecognizer); |
150 QStm_Gesture::setAssignedGestureType(m_qstmGestureType); |
152 QStm_Gesture::setAssignedGestureType(m_qstmGestureType); |
151 } |
153 //} |
152 } |
154 //QObject::connect(m_gestures, SIGNAL(uiEvent(const qstmUiEventEngine::QStm_UiEventIf&)), |
|
155 // m_dummyRecognizer, SLOT(handleQStmUiEvent(const qstmUiEventEngine::QStm_UiEventIf&))); |
|
156 |
|
157 // HACK!!! Disable this if you need Double Tap gesture. !!! |
|
158 //m_gestures->enableDblClick(true); |
|
159 } |
|
160 |
|
161 |
|
162 bool WebGestureHelper::shouldHandleGesture() |
|
163 { |
|
164 bool shouldHandle = (BedrockSettings->value("EnableGestures").toInt() != 0); |
|
165 #ifdef Q_OS_SYMBIAN |
|
166 shouldHandle = !CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog(); |
|
167 #endif |
|
168 |
|
169 QWidget* modal = QApplication::activeModalWidget(); |
|
170 shouldHandle = shouldHandle && (modal == NULL); |
|
171 return shouldHandle; |
|
172 } |
|
173 |
153 |
174 |
154 |
175 |
155 bool WebGestureHelper::symbianEventFilter(const QSymbianEvent *event) |
176 bool WebGestureHelper::symbianEventFilter(const QSymbianEvent *event) |
156 { |
177 { |
157 return m_gestures->handleSymbianPlatformEvent(event); |
178 return m_gestures->handleSymbianPlatformEvent(event); |
158 |
179 |
159 } |
180 } |
160 |
181 |
161 |
|
162 bool WebGestureHelper::x11EventFilter (XEvent* event) |
182 bool WebGestureHelper::x11EventFilter (XEvent* event) |
163 { |
183 { |
164 return m_gestures->handleX11PlatformEvent(event); |
184 return m_gestures->handleX11PlatformEvent(event); |
165 } |
185 } |
166 |
186 |
167 |
187 bool WebGestureHelper::winEventFilter(void* event) |
168 BrowserApp::BrowserApp(int argc, char** argv) : QApplication(argc, argv) |
188 { |
169 { |
189 return m_gestures->handleWinPlatformEvent(event); |
|
190 } |
|
191 |
|
192 bool WebGestureHelper::isFilteredByGestureEngine() |
|
193 { |
|
194 bool wasFiltered = false; |
|
195 |
|
196 QStm_GestureEngineApi* gestEng = gestureEngine(); |
|
197 if (gestEng) { |
|
198 qstmUiEventEngine::QStm_StateMachine* sm = gestEng->getStateMachine(); |
|
199 if (sm) { |
|
200 //for (int i = 0; i < qstmUiEventEngine::KMaxNumberOfPointers && !wasFiltered; i++) { |
|
201 wasFiltered = sm->wasLastMessageFiltered(); |
|
202 //} |
|
203 } |
|
204 } |
|
205 return wasFiltered; |
|
206 } |
|
207 |
|
208 |
|
209 #if defined(ORBIT_UI) |
|
210 BrowserApp::BrowserApp(QS60MainApplicationFactory appfactory, int & argc, char** argv) : ParentApp(appfactory, argc, argv) |
|
211 { |
|
212 m_gestureHelper = 0; |
|
213 m_mainWindow = 0; |
170 m_gestureEngine = new QStm_GestureEngineApi(); |
214 m_gestureEngine = new QStm_GestureEngineApi(); |
171 } |
215 } |
|
216 #endif // ORBIT_UI |
|
217 |
|
218 BrowserApp::BrowserApp(int & argc, char** argv) : ParentApp(argc, argv) |
|
219 { |
|
220 m_gestureHelper = 0; |
|
221 m_mainWindow = 0; |
|
222 m_gestureEngine = new QStm_GestureEngineApi(); |
|
223 } |
172 |
224 |
173 void BrowserApp::setGestureHelper(WebGestureHelper* gh) |
225 void BrowserApp::setGestureHelper(WebGestureHelper* gh) |
174 { |
226 { |
175 m_gestureHelper = gh; |
227 m_gestureHelper = gh; |
176 } |
228 /* if (mainWindow()) { |
|
229 qDebug() << __PRETTY_FUNCTION__ << " - grabbing gestures"; |
|
230 mainWindow()->ungrabGesture(Qt::PanGesture); |
|
231 mainWindow()->ungrabGesture(Qt::TapGesture); |
|
232 mainWindow()->ungrabGesture(Qt::TapAndHoldGesture); |
|
233 mainWindow()->ungrabGesture(Qt::PinchGesture); |
|
234 mainWindow()->ungrabGesture(Qt::SwipeGesture); |
|
235 mainWindow()->grabGesture(QStm_Gesture::assignedType()); |
|
236 } |
|
237 */ |
|
238 } |
|
239 |
177 |
240 |
178 bool BrowserApp::symbianEventFilter(const QSymbianEvent *event) |
241 bool BrowserApp::symbianEventFilter(const QSymbianEvent *event) |
179 { |
242 { |
180 #if(ENABLE_GESTURE_LIB) |
243 #if(ENABLE_GESTURE_LIB) |
181 return m_gestureHelper->symbianEventFilter(event); |
244 bool wasFiltered = false; |
182 #else |
245 if (m_gestureHelper && m_gestureHelper->shouldHandleGesture()) { |
|
246 m_gestureHelper->symbianEventFilter(event); |
|
247 wasFiltered = m_gestureHelper->isFilteredByGestureEngine(); |
|
248 } |
183 return false; |
249 return false; |
184 #endif |
250 #endif |
|
251 return false; |
185 } |
252 } |
186 |
253 |
187 |
254 |
188 bool BrowserApp::x11EventFilter ( XEvent* event ) |
255 bool BrowserApp::x11EventFilter ( XEvent* event ) |
189 { |
256 { |
190 #if (ENABLE_GESTURE_LIB) |
257 #if (ENABLE_GESTURE_LIB) |
191 return m_gestureHelper->x11EventFilter(event); |
258 bool wasFiltered = false; |
192 #else |
259 if (m_gestureHelper && m_gestureHelper->shouldHandleGesture()) { |
|
260 wasFiltered = m_gestureHelper->isFilteredByGestureEngine(); |
|
261 m_gestureHelper->x11EventFilter(event); |
|
262 } |
193 return false; |
263 return false; |
194 #endif |
264 #endif |
195 } |
265 return false; |
196 |
266 } |
|
267 |
|
268 bool BrowserApp::winEventFilter(MSG* message, long* result) |
|
269 { |
|
270 #if (ENABLE_GESTURE_LIB) |
|
271 bool wasFiltered = false; |
|
272 if (m_gestureHelper && m_gestureHelper->shouldHandleGesture()) { |
|
273 if(m_gestureHelper->winEventFilter(message)) |
|
274 wasFiltered = m_gestureHelper->isFilteredByGestureEngine(); |
|
275 if(wasFiltered) *result = 0; |
|
276 } |
|
277 return false; |
|
278 #endif |
|
279 return false; |
|
280 } |
|
281 |
|
282 /* |
|
283 // For now, treat gesture touch / release as mouse events |
|
284 bool BrowserApp::event(QEvent* event) |
|
285 { |
|
286 if (event->type() == QEvent::Gesture) { |
|
287 qDebug() << __PRETTY_FUNCTION__ << " - got a gesture"; |
|
288 QStm_Gesture* gesture = getQStmGesture(event); |
|
289 if (gesture) { |
|
290 // QStm_GestureType gtype = gesture->getGestureStmType(); |
|
291 // if (gtype == QStmTouchGestureType || gtype == QStmReleaseGestureType) { |
|
292 qDebug() << __PRETTY_FUNCTION__ << " - sending mouse events"; |
|
293 gesture->sendMouseEvents(); |
|
294 return true; |
|
295 // } |
|
296 } |
|
297 } |
|
298 return QApplication::event(event); |
|
299 } |
|
300 */ |
197 QStm_QtDummyGestureRecognizer::QStm_QtDummyGestureRecognizer(QStm_GestureContext* ctx) : |
301 QStm_QtDummyGestureRecognizer::QStm_QtDummyGestureRecognizer(QStm_GestureContext* ctx) : |
198 QGestureRecognizer(), |
302 QGestureRecognizer(), |
199 m_context(ctx), |
303 m_context(ctx), |
200 m_currentGesture(NULL) |
304 m_currentGesture(NULL) |
201 { |
305 { |
217 { |
321 { |
218 QGestureRecognizer::Result ret = QGestureRecognizer::Ignore; |
322 QGestureRecognizer::Result ret = QGestureRecognizer::Ignore; |
219 if (event->type() == QStm_GestureEvent::stmGestureEventType()) { |
323 if (event->type() == QStm_GestureEvent::stmGestureEventType()) { |
220 QStm_Gesture* gesture = static_cast<QStm_Gesture*>(state); |
324 QStm_Gesture* gesture = static_cast<QStm_Gesture*>(state); |
221 *gesture = *m_currentGesture; |
325 *gesture = *m_currentGesture; |
222 ret = (m_currentGesture->gestureState() == Qt::GestureFinished) ? QGestureRecognizer::FinishGesture : |
326 if (m_currentGesture->gestureState() == Qt::GestureFinished || |
223 QGestureRecognizer::TriggerGesture; |
327 m_currentGesture->isGestureEnded()) { |
|
328 ret = QGestureRecognizer::FinishGesture; |
|
329 } |
|
330 else { |
|
331 ret = QGestureRecognizer::TriggerGesture; |
|
332 } |
|
333 event->accept(); |
224 } |
334 } |
225 return ret; |
335 return ret; |
226 } |
336 } |
227 |
337 |
228 void QStm_QtDummyGestureRecognizer::reset(QGesture */*state*/) |
338 void QStm_QtDummyGestureRecognizer::reset(QGesture */*state*/) |
229 { |
339 { |
230 |
340 |
231 } |
341 } |
232 |
342 |
|
343 |
|
344 |
|
345 void QStm_QtDummyGestureRecognizer::handleQStmUiEvent(const qstmUiEventEngine::QStm_UiEventIf& uiEvent) |
|
346 { |
|
347 } |
233 |
348 |
234 |
349 |
235 QStm_GestureListenerApiIf::QStm_ProcessingResult QStm_QtDummyGestureRecognizer::handleGestureEvent( |
350 QStm_GestureListenerApiIf::QStm_ProcessingResult QStm_QtDummyGestureRecognizer::handleGestureEvent( |
236 QStm_GestureUid uid, QStm_GestureIf* gesture) |
351 QStm_GestureUid uid, QStm_GestureIf* gesture) |
237 { |
352 { |
238 if (!m_currentGesture) { |
353 if (!m_currentGesture) { |
239 Q_ASSERT(gesture); |
354 Q_ASSERT(gesture); |
240 m_currentGesture = new QStm_Gesture(); |
355 m_currentGesture = new QStm_Gesture(); |
241 } |
356 } |
242 |
357 |
243 int stmGestType = gesture ? gesture->getType() : -1; |
358 int stmGestType = gesture ? gesture->getType() : -1; |
244 |
359 |
245 switch (uid) { |
360 m_currentGesture->setGestureStmType(m_currentGesture->gestureUidToStmType(uid, stmGestType)); |
246 case EGestureUidTap: |
361 |
247 { |
|
248 QStm_TapType type = qstmGesture::QStm_TapType(stmGestType); |
|
249 if (type == qstmGesture::ETapTypeDouble) { |
|
250 m_currentGesture->setGestureStmType(QStmDoubleTapGestureType); |
|
251 } |
|
252 else { |
|
253 m_currentGesture->setGestureStmType(QStmTapGestureType); |
|
254 } |
|
255 break; |
|
256 } |
|
257 |
|
258 case EGestureUidTouch: |
|
259 { |
|
260 m_currentGesture->setGestureStmType(QStmTouchGestureType); |
|
261 break; |
|
262 } |
|
263 |
|
264 case EGestureUidRelease: |
|
265 { |
|
266 m_currentGesture->setGestureStmType(QStmReleaseGestureType); |
|
267 break; |
|
268 } |
|
269 |
|
270 case EGestureUidFlick: |
|
271 { |
|
272 m_currentGesture->setGestureStmType(QStmFlickGestureType); |
|
273 break; |
|
274 } |
|
275 |
|
276 case EGestureUidLeftRight: |
|
277 { |
|
278 m_currentGesture->setGestureStmType(QStmLeftRightGestureType); |
|
279 break; |
|
280 } |
|
281 |
|
282 case EGestureUidUpDown: |
|
283 { |
|
284 m_currentGesture->setGestureStmType(QStmUpDownGestureType); |
|
285 break; |
|
286 } |
|
287 |
|
288 case EGestureUidPan: |
|
289 { |
|
290 m_currentGesture->setGestureStmType(QStmPanGestureType); |
|
291 break; |
|
292 } |
|
293 |
|
294 case EGestureUidHover: |
|
295 { |
|
296 m_currentGesture->setGestureStmType(QStmHoverGestureType); |
|
297 break; |
|
298 } |
|
299 |
|
300 case EGestureUidLongPress: |
|
301 { |
|
302 m_currentGesture->setGestureStmType(QStmLongPressGestureType); |
|
303 break; |
|
304 } |
|
305 |
|
306 case EGestureUidEdgeScroll: |
|
307 { |
|
308 m_currentGesture->setGestureStmType(QStmEdgeScrollGestureType); |
|
309 break; |
|
310 } |
|
311 |
|
312 case EGestureUidCornerZoom: |
|
313 { |
|
314 m_currentGesture->setGestureStmType(QStmCornerZoomGestureType); |
|
315 break; |
|
316 } |
|
317 |
|
318 case EGestureUidPinch: |
|
319 { |
|
320 m_currentGesture->setGestureStmType(QStmPinchGestureType); |
|
321 break; |
|
322 } |
|
323 case EGestureUidUnknown: |
|
324 { |
|
325 m_currentGesture->setGestureStmType(QStmUknownGestureType); |
|
326 break; |
|
327 } |
|
328 } |
|
329 |
|
330 if (gesture) { //gesture enter |
362 if (gesture) { //gesture enter |
331 m_currentGesture->setGestureSubType(gesture->getType()); |
363 m_currentGesture->setGestureSubType(gesture->getType()); |
332 m_currentGesture->setDirection(gesture->getDirection()); |
364 m_currentGesture->setDirection(gesture->getDirection()); |
333 QPoint vec = gesture->getLengthAndDirection(); |
365 QPoint vec = gesture->getLengthAndDirection(); |
|
366 switch (m_currentGesture->getGestureStmType()) { |
|
367 case QStmLeftRightGestureType: |
|
368 vec.ry() = 0; |
|
369 m_currentGesture->setGestureStmType(QStmPanGestureType); |
|
370 break; |
|
371 case QStmUpDownGestureType: |
|
372 vec.rx() = 0; |
|
373 m_currentGesture->setGestureStmType(QStmPanGestureType); |
|
374 break; |
|
375 } |
|
376 |
334 m_currentGesture->setLengthAndDirection(vec); |
377 m_currentGesture->setLengthAndDirection(vec); |
335 m_currentGesture->setSpeed(gesture->getSpeed()); |
378 m_currentGesture->setSpeed(gesture->getSpeed()); |
336 QPoint pos = gesture->getLocation(); |
379 QPoint pos = gesture->getLocation(); |
337 m_currentGesture->setPosition(pos); |
380 m_currentGesture->setPosition(pos); |
|
381 QPoint pos2 = gesture->getLocation2(); |
|
382 m_currentGesture->setPosition2(pos2); |
338 m_currentGesture->setDetails(gesture->getDetails()); |
383 m_currentGesture->setDetails(gesture->getDetails()); |
339 m_currentGesture->setSpeedVec(gesture->getSpeedVec()); |
384 m_currentGesture->setSpeedVec(gesture->getSpeedVec()); |
340 QWidget* w = static_cast<QWidget*>(gesture->target()); |
385 QWidget* w = static_cast<QWidget*>(gesture->target()); |
341 m_currentGesture->setTarget(w); |
386 m_currentGesture->setTarget(w); |
342 m_currentGesture->setGestureState(Qt::NoGesture); |
387 m_currentGesture->setGestureState(Qt::NoGesture); |
|
388 m_currentGesture->setTimestamp(gesture->timestamp()); |
|
389 m_currentGesture->setHotSpot(pos); |
|
390 |
|
391 QStm_GestureEvent dummy; |
|
392 m_currentGesture->sendEvent(&dummy); |
|
393 |
343 } |
394 } |
344 else { |
395 else { |
345 m_currentGesture->setGestureState(Qt::GestureFinished); |
396 m_currentGesture->setGestureState(Qt::GestureFinished); |
346 } |
397 } |
347 |
398 |
348 QStm_GestureEvent dummy; |
|
349 m_currentGesture->sendEvent(&dummy); |
|
350 |
|
351 return QStm_GestureListenerApiIf::EContinue; |
399 return QStm_GestureListenerApiIf::EContinue; |
352 } |
400 } |
353 |
401 |
354 |
402 |
355 |
403 |