Power save mode review and iteration.
[situare] / src / engine / engine.h
index 2b93fda..fd66a99 100644 (file)
@@ -39,6 +39,7 @@ class MainWindow;
 class MapEngine;
 class SituareService;
 class User;
+class MCE;
 
 class QTimer;
 
@@ -68,12 +69,6 @@ public:
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public slots:
-//    /**
-//    * @brief Slot to intercept error signal from ImageFetcher and SituareService
-//    *
-//    * @param error Error message
-//    */
-//    void error(const QString &error);
     /**
     * @brief Slot to intercept error signal from ImageFetcher and SituareService
     *
@@ -147,13 +142,6 @@ public slots:
 
 private:
     /**
-    * @brief Checks if user is moved enough for position auto update.
-    *
-    * @return true if moved engouh, false otherwise
-    */
-    bool isUserMoved();
-
-    /**
     * @brief Read settings and determine whether to use GPS and autocentering.
     * When values does not found on the settings, GPS and autocentering are enabled as a default.
     */
@@ -191,13 +179,6 @@ private:
 
 private slots:
     /**
-    * @brief Automatic update interval timer timeout.
-    *
-    * Requests update location if user has moved.
-    */
-    void automaticUpdateIntervalTimerTimeout();
-
-    /**
     * @brief Set auto centering feature enabled / disabled
     *
     * @param enabled true if enabled, false otherwise
@@ -210,6 +191,13 @@ private slots:
     void disableAutoCentering();
 
     /**
+    * @brief Slot for display state changed.
+    *
+    * @param enabled true if enabled, false otherwise
+    */
+    void displayStateChanged(bool enabled);
+
+    /**
     * @brief Slot for auto centering enabling.
     *
     * Calls gps to send last known position
@@ -234,6 +222,15 @@ private slots:
     void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs = 0);
 
     /**
+    * @brief Requests automatic update.
+    *
+    * Makes automatic location update request if user has moved enough.
+    *
+    * @param position geo coordinates
+    */
+    void requestAutomaticUpdateIfMoved(QPointF position);
+
+    /**
      * @brief Sets zoom level to default when first GPS location is received if autocentering
      * is enabled.
      *
@@ -243,13 +240,11 @@ private slots:
     void setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy);
 
     /**
-    * @brief Saves GPS position.
-    *
-    * Saves GPS position if it has changed enough and sets m_userMoved flag.
+    * @brief Automatic update interval timer timeout.
     *
-    * @param position geo coordinates
+    * Requests update location if user has moved.
     */
-    void saveGPSPosition(QPointF position);
+    void startAutomaticUpdate();
 
 /*******************************************************************************
  * SIGNALS
@@ -263,6 +258,12 @@ signals:
     void automaticLocationUpdateEnabled(bool enabled);
 
     /**
+    * @brief Signal to clear locationUpdateDialog's data
+    *
+    */
+    void clearUpdateLocationDialogData();
+
+    /**
     * @brief Signals when new friends data is ready
     *
     * @param friendList List of User instances (friends)
@@ -282,15 +283,16 @@ signals:
 private:
     bool m_autoCenteringEnabled;        ///< Auto centering flag
     bool m_automaticUpdateFirstStart;   ///< Automatic location update first start flag
-    bool m_loggedIn;                    ///< Login state
-    bool m_userMoved;                       ///< Flag for user moving
-    bool m_automaticUpdateEnabled;          ///< Automatic update enabled flag
+    bool m_automaticUpdateRequest;      ///< Flag for automatic update request
+    bool m_userMoved;                   ///< Flag for user move
+
 
     FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
     GPSPosition *m_gps;                              ///< Instance of the gps position
     MainWindow *m_ui;                                ///< Instance of the MainWindow UI
     MapEngine *m_mapEngine;                          ///< MapEngine
     SituareService *m_situareService;  ///< Instance of the situare server communication service
+    MCE *m_mce;                        ///< Instance of the MCE
 
     QTimer *m_automaticUpdateIntervalTimer; ///< Automatic update interval timer
     QPointF m_lastUpdatedGPSPosition;       ///< Last updated GPS position