From 4b648eff142ff93952058ecdfcf7c0dd506c5556 Mon Sep 17 00:00:00 2001 From: Olli Werwolff Date: Tue, 19 Apr 2011 12:23:18 +0200 Subject: Added missing forward declaration and fixed compile warnings --- src/other/inputfilter.cpp | 2 ++ src/other/panmodefilter.cpp | 13 ++++++++++--- src/other/pinchmodefilter.cpp | 16 ++++++++++++---- src/other/swipemodefilter.cpp | 14 ++++++++++---- src/other/widget.h | 1 + src/other/widgetmanager.cpp | 2 +- src/ui/multipointtouchui.cpp | 2 +- 7 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/other/inputfilter.cpp b/src/other/inputfilter.cpp index c36aaa6..7343541 100644 --- a/src/other/inputfilter.cpp +++ b/src/other/inputfilter.cpp @@ -80,6 +80,8 @@ QtSimulatorPrivate::TouchEventData InputFilter::createTouchEventFromMouseEvent(W touchEvent.type = static_cast(QEvent::TouchEnd); touchEvent.touchPointStates = Qt::TouchPointReleased; break; + default: + break; } touchEvent.deviceType = QTouchEvent::TouchScreen; touchEvent.modifiers = Qt::NoModifier; diff --git a/src/other/panmodefilter.cpp b/src/other/panmodefilter.cpp index 7be37f7..715e273 100644 --- a/src/other/panmodefilter.cpp +++ b/src/other/panmodefilter.cpp @@ -52,6 +52,7 @@ bool PanModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) { Widget *widget = static_cast(watched); QGraphicsSceneMouseEvent *ev = 0; + QtSimulatorPrivate::TouchEventData touchEvent; switch (event->type()) { case QEvent::GraphicsSceneMousePress: ev = static_cast(event); @@ -77,7 +78,7 @@ bool PanModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) mValuePoints[0]->setStartPos(mValuePoints[0]->center()); mValuePoints[1]->setStartPos(mValuePoints[1]->center()); mState = updateSecondPoint; - QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + touchEvent = createTouchEventFromMouseEvent(widget, ev); QtSimulatorPrivate::RemoteMetacall::call(widget->owner->socket(), QtSimulatorPrivate::NoSync, "dispatchTouchEvent", @@ -85,6 +86,8 @@ bool PanModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) touchEvent); } return true; + default: + return true; } break; case QEvent::GraphicsSceneMouseRelease: @@ -94,7 +97,7 @@ bool PanModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) mState = setSecondPoint; return true; case updateSecondPoint: - QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + touchEvent = createTouchEventFromMouseEvent(widget, ev); QtSimulatorPrivate::RemoteMetacall::call(widget->owner->socket(), QtSimulatorPrivate::NoSync, "dispatchTouchEvent", @@ -102,6 +105,8 @@ bool PanModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) touchEvent); mState = setSecondPoint; return true; + default: + return true; } break; case QEvent::GraphicsSceneMouseMove: @@ -113,13 +118,15 @@ bool PanModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) case updateSecondPoint: mValuePoints[1]->setCenter(ev->pos()); mValuePoints[0]->setCenter(mValuePoints[1]->center() - mPanDiff); - QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + touchEvent = createTouchEventFromMouseEvent(widget, ev); QtSimulatorPrivate::RemoteMetacall::call(widget->owner->socket(), QtSimulatorPrivate::NoSync, "dispatchTouchEvent", widget->widgetId, touchEvent); return true; + default: + return true; } break; default: diff --git a/src/other/pinchmodefilter.cpp b/src/other/pinchmodefilter.cpp index b4061dc..69e6f54 100644 --- a/src/other/pinchmodefilter.cpp +++ b/src/other/pinchmodefilter.cpp @@ -56,6 +56,8 @@ bool PinchModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) { Widget *widget = static_cast(watched); QGraphicsSceneMouseEvent *ev = 0; + QtSimulatorPrivate::TouchEventData touchEvent; + QPointF diff; switch (event->type()) { case QEvent::GraphicsSceneMousePress: ev = static_cast(event); @@ -76,7 +78,7 @@ bool PinchModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) mValuePoints.append(new MouseIndicator(mReferencePoint->center() - diff, widget)); mValuePoints[1]->setStartPos(mValuePoints[1]->center()); mState = updateTouchPoints; - QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + touchEvent = createTouchEventFromMouseEvent(widget, ev); QtSimulatorPrivate::RemoteMetacall::call(widget->owner->socket(), QtSimulatorPrivate::NoSync, "dispatchTouchEvent", @@ -84,6 +86,8 @@ bool PinchModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) touchEvent); } return true; + default: + return true; } break; case QEvent::GraphicsSceneMouseRelease: @@ -93,7 +97,7 @@ bool PinchModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) mState = setTouchPoints; return true; case updateTouchPoints: - QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + touchEvent = createTouchEventFromMouseEvent(widget, ev); QtSimulatorPrivate::RemoteMetacall::call(widget->owner->socket(), QtSimulatorPrivate::NoSync, "dispatchTouchEvent", @@ -101,6 +105,8 @@ bool PinchModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) touchEvent); mState = setTouchPoints; return true; + default: + return true; } break; case QEvent::GraphicsSceneMouseMove: @@ -111,15 +117,17 @@ bool PinchModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) return true; case updateTouchPoints: mValuePoints[0]->setCenter(ev->pos()); - QPointF diff = ev->pos() - mReferencePoint->center(); + diff = ev->pos() - mReferencePoint->center(); mValuePoints[1]->setCenter(mReferencePoint->center() - diff); - QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + touchEvent = createTouchEventFromMouseEvent(widget, ev); QtSimulatorPrivate::RemoteMetacall::call(widget->owner->socket(), QtSimulatorPrivate::NoSync, "dispatchTouchEvent", widget->widgetId, touchEvent); return true; + default: + return true; } break; default: diff --git a/src/other/swipemodefilter.cpp b/src/other/swipemodefilter.cpp index dbc3ae2..43d0b34 100644 --- a/src/other/swipemodefilter.cpp +++ b/src/other/swipemodefilter.cpp @@ -52,6 +52,7 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) { Widget *widget = static_cast(watched); QGraphicsSceneMouseEvent *ev = 0; + QtSimulatorPrivate::TouchEventData touchEvent; switch (event->type()) { case QEvent::GraphicsSceneMousePress: ev = static_cast(event); @@ -103,6 +104,8 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) touchEvent); } return true; + default: + return true; } break; case QEvent::GraphicsSceneMouseRelease: @@ -117,8 +120,8 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) case updateSecondPoint: mState = setThirdPoint; return true; - case 5: - QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + case updateThirdPoint: + touchEvent = createTouchEventFromMouseEvent(widget, ev); QtSimulatorPrivate::RemoteMetacall::call(widget->owner->socket(), QtSimulatorPrivate::NoSync, "dispatchTouchEvent", @@ -126,6 +129,8 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) touchEvent); mState = updateThirdPoint; return true; + default: + return true; } break; case QEvent::GraphicsSceneMouseMove: @@ -137,7 +142,7 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) case updateSecondPoint: mValuePoints[1]->setCenter(ev->pos()); return true; - case updateThirdPoint: + case updateThirdPoint: { mValuePoints[2]->setCenter(ev->pos()); mValuePoints[1]->setCenter(mValuePoints[2]->center() - mDiff1); mValuePoints[0]->setCenter(mValuePoints[2]->center() - mDiff2); @@ -148,9 +153,10 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) widget->widgetId, touchEvent); return true; + } default: + return true; } break; - default: break; } diff --git a/src/other/widget.h b/src/other/widget.h index 138efd0..782adec 100644 --- a/src/other/widget.h +++ b/src/other/widget.h @@ -44,6 +44,7 @@ class QSharedMemory; class QString; class QMenuBar; class MouseIndicator; +class WidgetManager; namespace QtSimulatorPrivate { struct TouchEventData; struct TouchPointData; diff --git a/src/other/widgetmanager.cpp b/src/other/widgetmanager.cpp index c5da7c8..51aeef2 100644 --- a/src/other/widgetmanager.cpp +++ b/src/other/widgetmanager.cpp @@ -783,7 +783,7 @@ void TouchScriptInterface::fireTouchEvent(int id, int x, int y, QEvent::Type typ QtSimulatorPrivate::TouchPointData point; int i = 0; bool found = false; - for (i; i < data.touchPoints.length(); ++i) { + for (;i < data.touchPoints.length(); ++i) { if (data.touchPoints.at(i).id == id) { found = true; point = data.touchPoints.at(i); diff --git a/src/ui/multipointtouchui.cpp b/src/ui/multipointtouchui.cpp index 8758734..4df8e76 100644 --- a/src/ui/multipointtouchui.cpp +++ b/src/ui/multipointtouchui.cpp @@ -84,7 +84,7 @@ MultiPointTouchUi::MultiPointTouchUi(QWidget *parent) : connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(emitInputModeChanged(int))); OptionsItem *item = new OptionsItem(tr(""), widget, true); optionsList << item; - setTitle(tr("Multipoint-touch mode")); + setTitle(tr("Multipoint-touch")); setOptions(optionsList); } -- cgit v1.2.3