Documenting and some clean-up
[situare] / src / ui / mainwindow.h
index 1ab9cb1..f9a1a13 100644 (file)
 #define MAINWINDOW_H
 
 #include <QtGui/QMainWindow>
+#include <QSslError>
 #include <QUrl>
 
 #include "network/networkcookiejar.h"
 
+class QDialog;
 class QGraphicsScene;
 class QLabel;
 class QMessageBox;
@@ -39,7 +41,6 @@ class QNetworkReply;
 class QToolButton;
 class QWebView;
 
-class FacebookAuthentication;
 class FriendListPanel;
 class FullScreenButton;
 class GeoCoordinate;
@@ -93,10 +94,11 @@ private:
  ******************************************************************************/
 public:
     /**
-     * @brief Clears cookie jar
-     *
-     */
-    void clearCookieJar();
+      * @brief Build and show login dialog with login browser
+      *
+      * @param browser Login browser instance
+      */
+    void buildLoginDialog(QWebView *browser);
 
     /**
      * @brief
@@ -164,14 +166,14 @@ public slots:
     void buildInformationBox(const QString &message, bool modal=false);
 
     /**
-     * @brief Slot for failed login
-     */
-    void loginFailed();
+      * @brief Hides and deletes login dialog
+      */
+    void destroyLoginDialog();
 
     /**
-     * @brief Slot to intercept signal when login with cookies is requested
+     * @brief Slot for failed login
      */
-    void loginUsingCookies();
+    void loginFailed();
 
     /**
      * @brief Public slot, which open settings dialog
@@ -186,16 +188,12 @@ public slots:
     void setCrosshairVisibility(bool visible);
 
     /**
-     * @brief Sets username to member variable for login dialog
-     *
-     * @param username Username to be set
-     */
-    void setUsername(const QString &username);
-
-    /**
-     * @brief Method to show panels
-     */
-    void showPanels();
+    * @brief Shows contact dialog.
+    *
+    * Shows contact dialog with contact's information.
+    * @param guid globally unique ID of a contact
+    */
+    void showContactDialog(const QString &guid);
 
     /**
      * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
@@ -274,11 +272,6 @@ private:
     void buildUserInfoPanel();
 
     /**
-     * @brief Build webview and connect slots
-     */
-    void buildWebView();
-
-    /**
      * @brief Build zoom button panel and connect slots
      */
     void buildZoomButtonPanel();
@@ -366,18 +359,6 @@ 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
-     */
-    void loadDone(bool done);
-
-    /**
     * @brief Called when map center point horizontal shifting is changed
     *
     * @param shifting New shifting value
@@ -390,14 +371,14 @@ private slots:
     void moveCrosshair();
 
     /**
-     * @brief Slot to save cookies to settings
+     * @brief Slot for settings dialog accepted.
      */
-    void saveCookies();
+    void settingsDialogAccepted();
 
     /**
-     * @brief Slot for settings dialog accepted.
+     * @brief Ignore SSL error from the reply
      */
-    void settingsDialogAccepted();
+    void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
 
     /**
      * @brief Start location search (open search dialog)
@@ -409,13 +390,6 @@ private slots:
      */
     void toggleFullScreen();
 
-    /**
-     * @brief Slot to intercept signal from webview's networkaccessmanager
-     *
-     * @param reply Network reply (contains errors)
-     */
-    void webViewRequestFinished(QNetworkReply* reply);
-
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/
@@ -569,6 +543,13 @@ signals:
     void refreshUserData();
 
     /**
+    * @brief Requests contact dialog.
+    *
+    * @param facebookId contact's facebookId
+    */
+    void requestContactDialog(const QString &facebookId);
+
+    /**
      * @brief Signal for requesting reverseGeo from SituareEngine
      *
      */
@@ -601,13 +582,6 @@ signals:
     void routeToCursor();
 
     /**
-     * @brief Signal to save username to settings
-     *
-     * @param username Username
-     */
-    void saveUsername(const QString &username);
-
-    /**
      * @brief Signal for location search
      *
      * @param location QString location
@@ -615,6 +589,13 @@ signals:
     void searchForLocation(QString location);
 
     /**
+    * @brief Signal is emitted when search history item is clicked.
+    *
+    * @param searchString search string used
+    */
+    void searchHistoryItemClicked(const QString &searchString);
+
+    /**
      * @brief Signal for requestLocationUpdate from SituareEngine
      *
      * @param status Status message
@@ -623,13 +604,6 @@ signals:
     void statusUpdate(const QString &status, const bool &publish);
 
     /**
-     * @brief Signals when webview's urlChanged signal is emitted
-     *
-     * @param url New url
-     */
-    void updateCredentials(const QUrl &url);
-
-    /**
      * @brief Signals when updateLocationDialog's data must be cleared
      *
      */
@@ -682,9 +656,12 @@ private:
     QAction *m_loginAct;                    ///< Action to Login/Logout
     QAction *m_toSettingsAct;               ///< Action to trigger switch to settings dialog
 
+    QDialog *m_loginDialog;                 ///< Login dialog
+
     QLabel *m_crosshair;                    ///< Label for center point crosshair
     QLabel *m_osmLicense;                   ///< Label for Open Street Map license
 
+    QList<int> m_situareTabsIndexes;        ///< List of Situare tab indexes
     QList<QDialog *> m_error_queue;         ///< QList type error dialog queue
     QList<QDialog *> m_queue;               ///< QList type dialog queue
 
@@ -695,15 +672,12 @@ private:
     QString m_email;                        ///< Placeholder for email
     QString m_password;                     ///< Placeholder for password
 
-    QWebView *m_webView;                    ///< Shows facebook login page
-
     FriendListPanel *m_friendsListPanel;    ///< Instance of friends list panel
     FullScreenButton *m_fullScreenButton;   ///< Instance of the fullscreen toggle button
     IndicatorButtonPanel *m_indicatorButtonPanel;   ///< Instance of direction indicator button
     LocationSearchPanel *m_locationSearchPanel;     ///< Location search panel
     MapScale *m_mapScale;                   ///< Instance of the map scale
     MapView *m_mapView;                     ///< Instance of the map view
-    NetworkCookieJar *m_cookieJar;          ///< Placeholder for QNetworkCookies
     RoutingPanel *m_routingPanel;           ///< Instance of routing panel
     TabbedPanel *m_tabbedPanel;             ///< Widget for tabbed panels
     UserInfoPanel *m_userInfoPanel;         ///< Instance of the user information panel