Updated error handling, added error contexts. Fixed fullscreen button
[situare] / src / ui / mainwindow.h
index 90b08dd..a0829ed 100644 (file)
@@ -36,6 +36,7 @@ class QWebView;
 class QNetworkReply;
 
 class FacebookAuthentication;
+class FullScreenButton;
 class FriendListPanel;
 class MapScale;
 class MapScene;
@@ -83,14 +84,6 @@ private:
  ******************************************************************************/
 public:
     /**
-    * @brief Builds information box with message.
-    *
-    * @param message Information message
-    * @param modal Modal = true, non-modal false
-    */
-    void buildInformationBox(const QString &message, bool modal=false);
-
-    /**
     * @brief Clears cookie jar
     *
     */
@@ -104,10 +97,16 @@ public:
     void loggedIn(bool logged);
 
     /**
-    * @brief Requests automatic location update settings.
+    * @brief Gets the login state (logged in/logged out)
+    *
+    * @return bool Login state
     */
-    void requestAutomaticLocationUpdateSettings();
+    bool loginState();
 
+    /**
+    * @brief Reads automatic location update settings.
+    */
+    void readAutomaticLocationUpdateSettings();
 
     /**
     * @brief Enable / disable auto centering button.
@@ -148,7 +147,15 @@ public:
 
 public slots:
     /**
-    * @brief Slot to intercept signal when login has failed (loginFailure signal)
+    * @brief Builds information box with message.
+    *
+    * @param message Information message
+    * @param modal Modal = true, non-modal false
+    */
+    void buildInformationBox(const QString &message, bool modal=false);
+
+    /**
+    * @brief Slot for failed login
     *
     */
     void loginFailed();
@@ -165,6 +172,13 @@ public slots:
     void openSettingsDialog();
 
     /**
+      * @brief Set own location crosshair visibility
+      *
+      * @param visible
+      */
+    void setOwnLocationCrosshairVisibility(bool visible);
+
+    /**
     * @brief Sets username to member variable for login dialog
     *
     * @param username Username to be set
@@ -172,6 +186,12 @@ public slots:
     void setUsername(const QString &username);
 
     /**
+    * @brief Method to show panels
+    *
+    */
+    void showPanels();
+
+    /**
     * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
     *        doesn't exist yet
     *
@@ -188,9 +208,8 @@ public slots:
     /**
     * @brief Shows / hides Situare related UI items
     *
-    * @param show
     */
-    void updateItemVisibility(bool show);
+    void updateItemVisibility();
 
 private:
     /**
@@ -259,13 +278,6 @@ private:
     void queueDialog(QDialog *dialog);
 
     /**
-      * @brief Set own location crosshair visibility
-      *
-      * @param visible
-      */
-    void setOwnLocationCrosshairVisibility(bool visible);
-
-    /**
     * @brief Shows queued error information box
     *
     */
@@ -355,6 +367,11 @@ private slots:
     void saveCookies();
 
     /**
+    * @brief Slot for settings dialog accepted.
+    */
+    void settingsDialogAccepted();
+
+    /**
     * @brief Set correnct view port size to datamembers
     *
     * @param size Size of the screen
@@ -403,7 +420,15 @@ signals:
     * @param enabled true if enabled, false otherwise
     * @param updateIntervalMsecs update interval in milliseconds
     */
-    void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs);
+    void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs = 0);
+
+    /**
+    * @brief Signals error
+    *
+    * @param context error context
+    * @param error error code
+    */
+    void error(const int context, const int error);
 
     /**
     * @brief Signal for requesting username from settings
@@ -475,8 +500,10 @@ signals:
     * @brief Signal that informs that user's message/location failed to update on Situare server
     *        This signal is originally sended from SituareService with name error
     *        Signal is renamed on MainWindow
+    *
+    * @param error error code
     */
-    void messageSendingFailed(const QString &error);
+    void messageSendingFailed(const int error);
 
     /**
       * @brief Forwarding signal from MapEngine to MapView
@@ -484,13 +511,6 @@ signals:
     void minZoomLevelReached();
 
     /**
-    * @brief Signal that used to inform user that his message/location update tp Situare server
-    *        was failed.
-    *        This signal is originally sended from UserInfo
-    */
-    void notificateUpdateFailing(const QString &message);
-
-    /**
      * @brief Forwarding signal from MapEngine to MapScale
      */
     void newMapResolution(qreal scale);
@@ -537,10 +557,10 @@ signals:
     void updateCredentials(const QUrl &url);
 
     /**
-    * @brief Signals when updateLocation request finished successfully
+    * @brief Signals when updateLocationDialog's data must be cleared
     *
     */
-    void updateWasSuccessful();
+    void clearUpdateLocationDialogData();
 
     /**
     * @brief MapView has finished zooming
@@ -578,8 +598,7 @@ private:
     bool m_loggedIn;                        ///< Indicates login state
     bool m_refresh;                         ///< Indicates when webpage is refreshed
 
-    int m_viewPortHeight;                   ///< Height of view port
-    int m_viewPortWidth;                    ///< Width of view port
+    int m_progressIndicatorCount;           ///< Indicates the number of progress indicator calls
 
     QAction *m_autoCenteringAct;            ///< Action to auto center map using gps position
     QAction *m_gpsToggleAct;                ///< Action to trigger gps toggle
@@ -596,10 +615,12 @@ private:
 
     QMessageBox *m_automaticUpdateLocationDialog;   ///< Automatic update location dialog
 
+    QSize m_viewPortSize;                 ///< Size of the viewport
+
     QString m_email;                        ///< Placeholder for email
     QString m_password;                     ///< Placeholder for password
 
-    QToolButton *m_fullScreenButton;        ///< Instance of the fullscreen toggle button
+    FullScreenButton *m_fullScreenButton;   ///< Instance of the fullscreen toggle button
 
     QWebView *m_webView;                    ///< Shows facebook login page
 
@@ -611,8 +632,6 @@ private:
     PanelSideBar *m_friendsListPanelSidebar;///< Friends panel side bar
     UserInfoPanel *m_userPanel;             ///< Instance of the user information panel
     ZoomButtonPanel *m_zoomButtonPanel;     ///< Instance of zoom button panel
-
-    SettingsDialog *m_settingsDialog;       ///< Settings dialog
 };
 
 #endif // MAINWINDOW_H