Undoed the parameter for user drag actions
authorSami Rämö <sami.ramo@ixonos.com>
Tue, 24 Aug 2010 12:08:55 +0000 (15:08 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Tue, 24 Aug 2010 12:08:55 +0000 (15:08 +0300)
src/engine/engine.cpp
src/map/mapengine.cpp
src/map/mapengine.h
src/map/mapscroller.cpp
src/map/mapscroller.h
src/map/mapview.cpp
src/map/mapview.h
src/ui/mainwindow.cpp
src/ui/mainwindow.h

index 3df27a3..4b7b821 100644 (file)
@@ -625,8 +625,8 @@ void SituareEngine::signalsFromMainWindow()
             m_facebookAuthenticator, SLOT(updateCredentials(QUrl)));
 
     // signals from map view
-    connect(m_ui, SIGNAL(mapViewScrolled(SceneCoordinate, bool)),
-            m_mapEngine, SLOT(setCenterPosition(SceneCoordinate, bool)));
+    connect(m_ui, SIGNAL(mapViewScrolled(SceneCoordinate)),
+            m_mapEngine, SLOT(setCenterPosition(SceneCoordinate)));
 
     connect(m_ui, SIGNAL(mapViewResized(QSize)),
             m_mapEngine, SLOT(viewResized(QSize)));
@@ -692,8 +692,8 @@ void SituareEngine::signalsFromMapEngine()
     connect(m_mapEngine, SIGNAL(error(int, int)),
             this, SLOT(error(int, int)));
 
-    connect(m_mapEngine, SIGNAL(locationChanged(SceneCoordinate, bool)),
-            m_ui, SIGNAL(centerToSceneCoordinates(SceneCoordinate, bool)));
+    connect(m_mapEngine, SIGNAL(locationChanged(SceneCoordinate)),
+            m_ui, SIGNAL(centerToSceneCoordinates(SceneCoordinate)));
 
     connect(m_mapEngine, SIGNAL(zoomLevelChanged(int)),
             m_ui, SIGNAL(zoomLevelChanged(int)));
index 2414c91..8c2a706 100644 (file)
@@ -101,8 +101,8 @@ MapEngine::MapEngine(QObject *parent)
 
     m_scroller = &MapScroller::getInstance();
 
-    connect(m_scroller, SIGNAL(coordinateUpdated(SceneCoordinate, bool)),
-            this, SLOT(setCenterPosition(SceneCoordinate, bool)));
+    connect(m_scroller, SIGNAL(coordinateUpdated(SceneCoordinate)),
+            this, SLOT(setCenterPosition(SceneCoordinate)));
 
     connect(m_scroller, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)),
             this, SLOT(scrollerStateChanged(QAbstractAnimation::State)));
@@ -423,7 +423,7 @@ void MapEngine::setAutoCentering(bool enabled)
         updateDirectionIndicator();
 }
 
-void MapEngine::setCenterPosition(SceneCoordinate coordinate, bool isUserDragAction)
+void MapEngine::setCenterPosition(SceneCoordinate coordinate)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -439,7 +439,7 @@ void MapEngine::setCenterPosition(SceneCoordinate coordinate, bool isUserDragAct
         disableAutoCenteringIfRequired(coordinate);
 
     m_sceneCoordinate = coordinate;
-    emit locationChanged(m_sceneCoordinate, isUserDragAction);
+    emit locationChanged(m_sceneCoordinate);
 
     if (isCenterTileChanged(coordinate)) {
         getTiles(coordinate);
@@ -566,7 +566,7 @@ void MapEngine::viewResized(const QSize &size)
     m_viewSize = size;
     setTilesGridSize(m_viewSize);
 
-    emit locationChanged(m_sceneCoordinate, false);
+    emit locationChanged(m_sceneCoordinate);
     getTiles(m_sceneCoordinate);
     m_mapScene->removeOutOfViewTiles(m_viewTilesGrid, m_zoomLevel);
     m_mapScene->setSceneVerticalOverlap(m_viewSize.height(), m_zoomLevel);
index 774f795..07db7b9 100644 (file)
@@ -321,9 +321,8 @@ private slots:
      *
      * Does emit locationChanged signal.
      * @param coordinate Scene coordinates for new position
-     * @param isUserDragAction True if caused by user dragging action
      */
-    void setCenterPosition(SceneCoordinate coordinate, bool isUserDragAction = false);
+    void setCenterPosition(SceneCoordinate coordinate);
 
     /**
      * @brief Builds and sets route, also centers it
@@ -407,9 +406,8 @@ signals:
      * @brief Request view centering to new locaiton
      *
      * @param coordinate New scene coordinates
-     * @param isUserDragAction True if caused by user dragging action
      */
-    void locationChanged(SceneCoordinate coordinate, bool isUserDragAction);
+    void locationChanged(SceneCoordinate coordinate);
 
     /**
      * @brief Signal is emitted when location item is clicked.
index ff18a11..f068b74 100644 (file)
@@ -33,12 +33,6 @@ QVariant sceneCoordinateInterpolator(const SceneCoordinate &start,
                                      const SceneCoordinate &end,
                                      qreal progress);
 
-MapScroller::MapScroller()
-    : m_isKineticScroll(false)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-}
-
 MapScroller& MapScroller::getInstance()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -49,24 +43,12 @@ MapScroller& MapScroller::getInstance()
     return instance;
 }
 
-void MapScroller::setKineticScrollFlag(bool isKineticScroll)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_isKineticScroll = isKineticScroll;
-}
-
 void MapScroller::updateCurrentValue(const QVariant &value)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
     if ((state() == QAbstractAnimation::Running) && (value.canConvert<SceneCoordinate>()))
-        emit coordinateUpdated(value.value<SceneCoordinate>(), m_isKineticScroll);
-    else
-        m_isKineticScroll = false;
-
-    // NOTE: m_isKineticScroll is cleared when new animation values are set, because this method is
-    //       called then and state() is QAbstractAnimation::Stopped
+        emit coordinateUpdated(value.value<SceneCoordinate>());
 }
 
 /////////////////////////////////////////////////////////////////////////////
index d12923d..8f666f1 100644 (file)
@@ -45,7 +45,7 @@ private:
     /**
     * @brief Constructor in not accessible because class is using singleton design pattern.
     */
-    MapScroller();
+    MapScroller() {}
 
     /**
     * @brief Destructor in not accessible because class is using singleton design pattern.
@@ -89,13 +89,6 @@ public:
     */
     static MapScroller &getInstance();
 
-    /**
-    * @brief Set flag for kinetic scroll
-    *
-    * @param isKineticScroll Set to true if starting a kinetic scroll
-    */
-    void setKineticScrollFlag(bool isKineticScroll);
-
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/
@@ -104,15 +97,8 @@ signals:
     * @brief Signal if emitted when coordinate value is updated
     *
     * @param coordinate New coordinate value
-    * @param isKineticScroll True if currently running a kinetic scroll animation
     */
-    void coordinateUpdated(SceneCoordinate coordinate, bool isKineticScroll);
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
-    bool m_isKineticScroll;     ///< Is the current animation a kinetic scroll animation?
+    void coordinateUpdated(SceneCoordinate coordinate);
 };
 
 #endif // MAPSCROLLER_H
index 56307da..2858739 100644 (file)
@@ -86,15 +86,14 @@ QPointF MapView::center()
     return mapToScene(m_viewCenterPoint) - m_centerHorizontalShiftPoint;
 }
 
-void MapView::centerToSceneCoordinates(const SceneCoordinate &coordinate, bool isUserDragAction)
+void MapView::centerToSceneCoordinates(const SceneCoordinate &coordinate)
 {
     qDebug() << __PRETTY_FUNCTION__ << "coordinate" << coordinate;
 
     QPointF target = coordinate.toPointF();
     m_lastSetScenePosition = coordinate;
 
-//    if (!isUserDragAction)
-        target += m_centerHorizontalShiftPoint;
+    target += m_centerHorizontalShiftPoint;
 
     centerOn(target);
 }
@@ -173,7 +172,7 @@ void MapView::mouseMoveEvent(QMouseEvent *event)
 
     QPointF viewCenterPoint = m_internalScenePosition - m_centerHorizontalShiftPoint;
 
-    emit viewScrolled(SceneCoordinate(viewCenterPoint.x(), viewCenterPoint.y()), true);
+    emit viewScrolled(SceneCoordinate(viewCenterPoint.x(), viewCenterPoint.y()));
 
     m_lastMouseEventScenePosition = mapToScene(event->pos()).toPoint();
     m_lastMouseEventViewPosition = event->pos();
@@ -245,7 +244,6 @@ void MapView::mouseReleaseEvent(QMouseEvent *event)
             m_scroller->setStartValue(SceneCoordinate(centerPoint.x(), centerPoint.y()));
             QPointF endValue = centerPoint + effectSceneDistance;
             m_scroller->setEndValue(SceneCoordinate(endValue.x(), endValue.y()));
-            m_scroller->setKineticScrollFlag(true);
             m_scroller->start();
         }
     }
index 2cd627a..520a369 100644 (file)
@@ -142,10 +142,8 @@ public slots:
     * Does also shift the center point horizontally, if required.
     *
     * @param coordinate Scene coordinates of the new center point
-    * @param isUserDragAction True if caused by user dragging action. Does not shift the center
-    *                         point if true.
     */
-    void centerToSceneCoordinates(const SceneCoordinate &coordinate, bool isUserDragAction = false);
+    void centerToSceneCoordinates(const SceneCoordinate &coordinate);
 
     /**
     * @brief Set zoom level of the view
@@ -239,9 +237,8 @@ signals:
     *
     * Signal is emitted when view is scrolled.
     * @param coordinate Scene coordinates of the new center point of the view
-    * @param isUserDragAction True if caused by user dragging action
     */
-    void viewScrolled(const SceneCoordinate &coordinate, bool isUserDragAction);
+    void viewScrolled(const SceneCoordinate &coordinate);
 
     /**
     * @brief Signal for informing that zooming animation is finished
index 515cb3b..b8b5093 100644 (file)
@@ -262,11 +262,11 @@ void MainWindow::buildMap()
     buildIndicatorButtonPanel();
     buildMapScale();
 
-    connect(m_mapView, SIGNAL(viewScrolled(SceneCoordinate, bool)),
-            this, SIGNAL(mapViewScrolled(SceneCoordinate, bool)));
+    connect(m_mapView, SIGNAL(viewScrolled(SceneCoordinate)),
+            this, SIGNAL(mapViewScrolled(SceneCoordinate)));
 
-    connect(this, SIGNAL(centerToSceneCoordinates(SceneCoordinate, bool)),
-            m_mapView, SLOT(centerToSceneCoordinates(SceneCoordinate, bool)));
+    connect(this, SIGNAL(centerToSceneCoordinates(SceneCoordinate)),
+            m_mapView, SLOT(centerToSceneCoordinates(SceneCoordinate)));
 
     connect(m_mapView, SIGNAL(viewResized(QSize)),
             this, SIGNAL(mapViewResized(QSize)));
index c36342b..5c2776f 100644 (file)
@@ -438,9 +438,8 @@ signals:
      * @brief View should be centered to new location
      *
      * @param coordinate Scene coordinates of the new center point
-     * @param isUserDragAction True if caused by user dragging action
      */
-    void centerToSceneCoordinates(const SceneCoordinate &coordinate, bool isUserDragAction);
+    void centerToSceneCoordinates(const SceneCoordinate &coordinate);
 
     /**
     * @brief Signal when direction and distance from current map center point to current GPS
@@ -534,9 +533,8 @@ signals:
      * @brief Forwarding signal from MapView to MapEngine
      *
      * @param coordinate New center point coordinate
-     * @param isUserDragAction True if caused by user dragging action
      */
-    void mapViewScrolled(const SceneCoordinate &coordinate, bool isUserDragAction);
+    void mapViewScrolled(const SceneCoordinate &coordinate);
 
     /**
      * @brief Forwarding signal from MapEngine to MapView