Merge branch 'master' into cookies_refactored
[situare] / src / ui / mainwindow.h
index 1ed213d..05c98eb 100644 (file)
@@ -27,6 +27,9 @@
 #include <QtGui/QMainWindow>
 #include <QUrl>
 
+#include "networkcookiejar.h"
+#include "panelsidebar.h"
+
 class QGraphicsScene;
 class QLabel;
 class QWebView;
@@ -74,7 +77,14 @@ private:
 /*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
-public:
+public:    
+    /**
+    * @brief
+    *
+    * @param logged
+    */
+    void loggedIn(bool logged);
+
     /**
     * @brief Enable / disable auto centering button.
     *
@@ -128,6 +138,12 @@ public slots:
     void loginFailed();
 
     /**
+    * @brief Slot to intercept signal when login with cookies is requested
+    *
+    */
+    void loginUsingCookies();
+
+    /**
     * @brief Public slot, which open settings dialog
     */
     void openSettingsDialog();
@@ -140,6 +156,13 @@ 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
     *
@@ -161,6 +184,12 @@ private:
     void buildFriendListPanel();
 
     /**
+    * @brief Build login dialog and connect slots
+    *
+    */
+    void buildLoginDialog();
+
+    /**
       * @brief Build manual location setting cross hair and connect slots
       */
     void buildManualLocationCrosshair();
@@ -181,11 +210,30 @@ private:
     void buildUserInfoPanel();
 
     /**
+    * @brief Build webview and connect slots
+    *
+    */
+    void buildWebView();
+
+    /**
       * @brief Build zoom button panel and connect slots
       */
     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();
@@ -208,10 +256,9 @@ private slots:
     /**
     * @brief Slot for drawing the Open Street Map license text
     *
-    * @param width Width of the viewport
-    * @param height Height of the viewport
+    * @param size Size of the screen
     */
-    void drawOsmLicense(int width, int height);
+    void drawOsmLicense(const QSize &size);
 
     /**
     * @brief Slot for drawing the own location crosshair
@@ -236,6 +283,12 @@ private slots:
     void gpsTimeout();
 
     /**
+    * @brief Slot to load cookies from settings
+    *
+    */
+    void loadCookies();
+
+    /**
     * @brief Slot to intercept signal when webview has finished loading webpage
     *
     * @param done Status of the loading
@@ -243,6 +296,12 @@ private slots:
     void loadDone(bool done);
 
     /**
+    * @brief Slot to save cookies to settings
+    *
+    */
+    void saveCookies();
+
+    /**
     * @brief Set correnct view port size to datamembers
     *
     * @param width Width of the viewport
@@ -281,6 +340,13 @@ signals:
     void fetchUsernameFromSettings();
 
     /**
+    * @brief Signal for finding user.
+    *
+    * @param coordinates user geo coordinates
+    */
+    void findUser(const QPointF &coordinates);
+
+    /**
     * @brief GPS setting changed
     *
     * @param enabled True if GPS is enabled, otherwise false
@@ -302,6 +368,19 @@ signals:
     void friendsLocationsReady(QList<User *> &friendsList);
 
     /**
+    * @brief Signal is emitted when location item is clicked.
+    *
+    * @param userIDs list of friends user IDs in the group
+    */
+    void locationItemClicked(const QList<QString> &userIDs);
+
+    /**
+    * @brief Signals when Login/Logout action is pressed
+    *
+    */
+    void loginActionPressed();
+
+    /**
     * @brief MapView has been resized
     *
     * @param size view size
@@ -392,6 +471,7 @@ signals:
 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
 
     int m_viewPortHeight;                   ///< Height of view port
@@ -399,6 +479,7 @@ private:
 
     QAction *m_autoCenteringAct;            ///< Action to auto center map using gps position
     QAction *m_gpsToggleAct;                ///< Action to trigger gps toggle
+    QAction *m_loginAct;                    ///< Action to Login/Logout
     QAction *m_toSettingsAct;               ///< Action to trigger switch to settings dialog
 
     QLabel *m_osmLicense;                   ///< Label for Open Street Map license
@@ -409,13 +490,14 @@ private:
     QString m_email;                        ///< Placeholder for email
     QString m_password;                     ///< Placeholder for password
 
-    QUrl m_loginUrl;                        ///< Placeholder for login page url
-
     QWebView *m_webView;                    ///< Shows facebook login page
 
     FriendListPanel *m_friendsListPanel;    ///< Instance of friends list panel
     LoginDialog *m_loginDialog;             ///< Login dialog
     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
 };