Removed FacebookLoginBrowser class, replaced with QWebView.
[situare] / src / ui / mainwindow.h
index 68b623a..14f5402 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,25 +41,24 @@ class QNetworkReply;
 class QToolButton;
 class QWebView;
 
-class FacebookAuthentication;
-class FullScreenButton;
 class FriendListPanel;
-class IndicatorButtonPanel;
+class FullScreenButton;
 class GeoCoordinate;
+class IndicatorButtonPanel;
+class Location;
+class LocationSearchPanel;
 class MapScale;
 class MapScene;
 class MapView;
 class Route;
 class RoutingPanel;
-class TabbedPanel;
-class SettingsDialog;
 class SceneCoordinate;
+class SettingsDialog;
 class SituareService;
 class TabbedPanel;
 class User;
 class UserInfoPanel;
 class ZoomButtonPanel;
-class Location;
 
 /**
  * @brief Main Window Class
@@ -92,11 +93,7 @@ private:
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public:
-    /**
-     * @brief Clears cookie jar
-     *
-     */
-    void clearCookieJar();
+    void buildLoginDialog(QWebView *browser);
 
     /**
      * @brief
@@ -156,11 +153,6 @@ public:
 
 public slots:
     /**
-     * @brief Build direction indicator button panel and connect signals
-     */
-    void buildIndicatorButtonPanel();
-
-    /**
      * @brief Builds information box with message.
      *
      * @param message Information message
@@ -168,17 +160,14 @@ public slots:
      */
     void buildInformationBox(const QString &message, bool modal=false);
 
+    void destroyLoginDialog();
+
     /**
      * @brief Slot for failed login
      */
     void loginFailed();
 
     /**
-     * @brief Slot to intercept signal when login with cookies is requested
-     */
-    void loginUsingCookies();
-
-    /**
      * @brief Public slot, which open settings dialog
      */
     void openSettingsDialog();
@@ -191,13 +180,6 @@ 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 Shows contact dialog.
     *
     * Shows contact dialog with contact's information.
@@ -206,11 +188,6 @@ public slots:
     void showContactDialog(const QString &guid);
 
     /**
-     * @brief Method to show panels
-     */
-    void showPanels();
-
-    /**
      * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
      *        doesn't exist yet
      */
@@ -246,6 +223,17 @@ private:
     void buildFullScreenButton();
 
     /**
+     * @brief Build direction indicator button panel and connect signals
+     */
+    void buildIndicatorButtonPanel();
+
+
+    /**
+     * @brief Build location search panel and connect signals
+     */
+    void buildLocationSearchPanel();
+
+    /**
      * @brief Build map and connect slots
      */
     void buildMap();
@@ -276,11 +264,6 @@ private:
     void buildUserInfoPanel();
 
     /**
-     * @brief Build webview and connect slots
-     */
-    void buildWebView();
-
-    /**
      * @brief Build zoom button panel and connect slots
      */
     void buildZoomButtonPanel();
@@ -368,18 +351,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
@@ -392,14 +363,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)
@@ -411,13 +382,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
  ******************************************************************************/
@@ -450,13 +414,9 @@ signals:
     void centerToSceneCoordinates(const SceneCoordinate &coordinate);
 
     /**
-    * @brief Signal for contacts guids added.
-    *
-    * Contact guids has Facebook ID as key and Guid as value. Guid is a globally
-    * unique ID of a contact, which can be used with other datastores.
-    * @param contactGuids list of contact guids
+    * @brief Emitted when route is cleared
     */
-    void contactsGuidsAdded(const QHash<QString, QString> &contactGuids);
+    void clearRoute();
 
     /**
     * @brief Signal when direction and distance from current map center point to current GPS
@@ -609,11 +569,9 @@ signals:
     void routeTo(const GeoCoordinate &coordinates);
 
     /**
-     * @brief Signal to save username to settings
-     *
-     * @param username Username
-     */
-    void saveUsername(const QString &username);
+    * @brief Request routing to current cursor position
+    */
+    void routeToCursor();
 
     /**
      * @brief Signal for location search
@@ -623,6 +581,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
@@ -631,13 +596,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
      *
      */
@@ -690,9 +648,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
 
@@ -703,14 +664,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
+    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