Finished basic map scale feature
[situare] / src / ui / mainwindow.h
index 05c98eb..d703912 100644 (file)
@@ -27,7 +27,7 @@
 #include <QtGui/QMainWindow>
 #include <QUrl>
 
-#include "networkcookiejar.h"
+#include "network/networkcookiejar.h"
 #include "panelsidebar.h"
 
 class QGraphicsScene;
@@ -36,13 +36,15 @@ class QWebView;
 
 class FacebookAuthentication;
 class FriendListPanel;
-class LoginDialog;
+class MapScale;
 class MapScene;
 class MapView;
 class SituareService;
 class User;
 class UserInfoPanel;
 class ZoomButtonPanel;
+class SettingsDialog;
+class QToolButton;
 
 /**
 * @brief Main Window Class
@@ -77,7 +79,13 @@ private:
 /*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
-public:    
+public:
+    /**
+    * @brief Clears cookie jar
+    *
+    */
+    void clearCookieJar();
+
     /**
     * @brief
     *
@@ -111,9 +119,10 @@ public:
     /**
     * @brief Show Maemo information box with message.
     *
-    * @brief message information message
+    * @param message Information message
+    * @param modal Modal = true, non-modal false
     */
-    void showMaemoInformationBox(const QString &message);
+    void showMaemoInformationBox(const QString &message, bool modal=false);
 
     /**
     * @brief Gets the username from member variable for saving purposes
@@ -124,14 +133,6 @@ public:
 
 public slots:
     /**
-    * @brief Slot to intercept signal when user has pressed connect button from loginDialog
-    *
-    * @param email E-mail
-    * @param password Password
-    */
-    void loginDialogDone(const QString &email, const QString &password);
-
-    /**
     * @brief Slot to intercept signal when login has failed (loginFailure signal)
     *
     */
@@ -156,13 +157,6 @@ public slots:
     void setUsername(const QString &username);
 
     /**
-    * @brief
-    *
-    * @param show
-    */
-    void showPanels(bool show);
-
-    /**
     * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
     *        doesn't exist yet
     *
@@ -177,17 +171,23 @@ public slots:
     */
     void toggleProgressIndicator(bool state);
 
+    /**
+    * @brief Shows / hides Situare related UI items
+    *
+    * @param show
+    */
+    void updateItemVisibility(bool show);
+
 private:
     /**
-      * @brief Build friend list panel and connect slots
+      * @brief Build fullscreen toggle button and connect slots
       */
-    void buildFriendListPanel();
+    void buildFullScreenButton();
 
     /**
-    * @brief Build login dialog and connect slots
-    *
-    */
-    void buildLoginDialog();
+      * @brief Build friend list panel and connect slots
+      */
+    void buildFriendListPanel();
 
     /**
       * @brief Build manual location setting cross hair and connect slots
@@ -200,6 +200,11 @@ private:
     void buildMap();
 
     /**
+     * @brief Build map scale and connect slots
+     */
+    void buildMapScale();
+
+    /**
       * @brief Build OSM license and connect slots
       */
     void buildOsmLicense();
@@ -221,19 +226,6 @@ private:
     void buildZoomButtonPanel();
 
     /**
-    * @brief Clears cookie jar
-    *
-    */
-    void clearCookieJar();
-
-    /**
-    * @brief connect/disconnect webview signals
-    *
-    * @param connectSignals true = connect, false = disconnect
-    */
-    void connectWebViewSignals(bool connectSignals);
-
-    /**
     * @brief Private method to create the Menu items
     */
     void createMenus();
@@ -254,6 +246,20 @@ private:
 
 private slots:
     /**
+    * @brief Slot for drawing the fullscreen toggle button
+    *
+    * @param size Size of the screen
+    */
+    void drawFullScreenButton(const QSize &size);
+
+    /**
+    * @brief Slot for drawing the map distance scale
+    *
+    * @param size Size of the screen
+    */
+    void drawMapScale(const QSize &size);
+
+    /**
     * @brief Slot for drawing the Open Street Map license text
     *
     * @param size Size of the screen
@@ -269,13 +275,6 @@ private slots:
     void drawOwnLocationCrosshair(int width, int height);
 
     /**
-    * @brief Slot for gps error.
-    *
-    * @param message error message
-    */
-    void gpsError(const QString &message);
-
-    /**
     * @brief Slot for gps timeout.
     *
     * Called when request timeout occurs.
@@ -309,6 +308,11 @@ private slots:
     */
     void setViewPortSize(const int width, const int height);
 
+    /**
+    * @brief Toggle between fullscreen and normal window mode
+    */
+    void toggleFullScreen();
+
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/
@@ -334,6 +338,14 @@ signals:
     void centerToSceneCoordinates(QPoint sceneCoordinate);
 
     /**
+    * @brief Signal for enabling automatic location update.
+    *
+    * @param enabled true if enabled, false otherwise
+    * @param updateIntervalMsecs update interval in milliseconds
+    */
+    void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs);
+
+    /**
     * @brief Signal for requesting username from settings
     *
     */
@@ -405,6 +417,11 @@ signals:
     void minZoomLevelReached();
 
     /**
+     * @brief Forwarding signal from MapEngine to MapScale
+     */
+    void newMapResolution(qreal scale);
+
+    /**
     * @brief Signal for refreshing user data.
     *
     */
@@ -424,6 +441,13 @@ signals:
     void reverseGeoReady(const QString &address);
 
     /**
+    * @brief Signal to save username to settings
+    *
+    * @param username Username
+    */
+    void saveUsername(const QString &username);
+
+    /**
     * @brief Signal for requestLocationUpdate from SituareEngine
     *
     * @param status Status message
@@ -469,7 +493,6 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-
     bool m_drawOwnLocationCrosshair;        ///< Flag for making ownLocationCrosshair visible or not
     bool m_loggedIn;                        ///< Indicates login state
     bool m_refresh;                         ///< Indicates when webpage is refreshed
@@ -490,16 +513,20 @@ private:
     QString m_email;                        ///< Placeholder for email
     QString m_password;                     ///< Placeholder for password
 
+    QToolButton *m_fullScreenButton;        ///< Instance of the fullscreen toggle button
+
     QWebView *m_webView;                    ///< Shows facebook login page
 
     FriendListPanel *m_friendsListPanel;    ///< Instance of friends list panel
-    LoginDialog *m_loginDialog;             ///< Login dialog
+    MapScale *m_mapScale;                   ///< Instance of the map scale
     MapView *m_mapView;                     ///< Instance of the map view
     NetworkCookieJar *m_cookieJar;          ///< Placeholder for QNetworkCookies
     PanelSideBar *m_userPanelSidebar;       ///< User panel side bar
     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