Fixing problems and a bug, review, cleanup
[situare] / src / map / mapengine.h
index ba505f0..70f4d93 100644 (file)
@@ -236,12 +236,11 @@ private:
     QRect calculateTileGrid(QPoint sceneCoordinate);
 
     /**
-     * @brief Check if auto centering should be disabled.
+     * @brief Request disabling of auto centering if centered too far from the real location.
      *
      * @param sceneCoordinate scene's center coordinate
-     * @return bool true if auto centering should be disabled
      */
-    bool disableAutoCentering(QPoint sceneCoordinate);
+    void disableAutoCenteringIfRequired(QPoint sceneCoordinate);
 
     /**
      * @brief Get new tiles.
@@ -331,6 +330,16 @@ private slots:
     void mapImageReceived(int zoomLevel, int x, int y, const QPixmap &image);
 
     /**
+    * @brief Called when MapScroller state is changed
+    *
+    * Does check if the smooth scroll effect was interrupted and should the auto centering
+    * feature to be disabled.
+    *
+    * @param newState New state
+    */
+    void scrollerStateChanged(QAbstractAnimation::State newState);
+
+    /**
     * @brief Scroll smoothly to given scene position
     *
     * @param scenePosition Target position in the scene
@@ -434,19 +443,21 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    bool m_autoCenteringEnabled;   ///< Auto centering enabled
-    bool m_zoomedIn;               ///< Flag for checking if zoomed in when zoom is finished
+    bool m_autoCenteringEnabled;    ///< Auto centering enabled
+    bool m_scrollStartedByGps;      ///< Smooth scroll is started by GPS?
+    bool m_smoothScrollRunning;     ///< Smooth scroll is running?
+    bool m_zoomedIn;                ///< Flag for checking if zoomed in when zoom is finished
 
-    int m_zoomLevel;               ///< Current zoom level
+    int m_zoomLevel;                ///< Current zoom level
 
-    QPoint m_centerTile;           ///< Current center tile
-    QPoint m_lastManualPosition;   ///< Last manually set position in scene coordinate
-    QPoint m_sceneCoordinate;      ///< Current center coordinate
+    QPoint m_centerTile;            ///< Current center tile
+    QPoint m_lastAutomaticPosition; ///< Last automatically set position in scene coordinate
+    QPoint m_sceneCoordinate;       ///< Current center coordinate
 
-    QRect m_viewTilesGrid;         ///< Current grid of tiles in view (includes margin)
+    QRect m_viewTilesGrid;          ///< Current grid of tiles in view (includes margin)
 
-    QSize m_tilesGridSize;         ///< Current size of the tiles grid
-    QSize m_viewSize;              ///< Current view size
+    QSize m_tilesGridSize;          ///< Current size of the tiles grid
+    QSize m_viewSize;               ///< Current view size
 
     FriendItemsHandler *m_friendItemsHandler;   ///< Handler for friend and group items
     GPSLocationItem *m_gpsLocationItem;         ///< Item pointing current location from GPS