Cleaning out old login code ongoing
[situare] / src / ui / mainwindow.h
index f440048..70070e5 100644 (file)
@@ -4,7 +4,9 @@
 
         Henri Lampela - henri.lampela@ixonos.com
         Kaj Wallin - kaj.wallin@ixonos.com
+        Jussi Laitinen - jussi.laitinen@ixonos.com
         Sami Rämö - sami.ramo@ixonos.com
+        Ville Tiensuu - ville.tiensuu@ixonos.com
         Katri Kaikkonen - katri.kaikkonen@ixonos.com
 
     Situare is free software; you can redistribute it and/or
@@ -29,7 +31,6 @@
 #include <QUrl>
 
 #include "network/networkcookiejar.h"
-#include "panelsidebar.h"
 
 class QGraphicsScene;
 class QLabel;
@@ -39,24 +40,29 @@ class QToolButton;
 class QWebView;
 
 class FacebookAuthentication;
-class FullScreenButton;
+class FacebookLoginBrowser;
 class FriendListPanel;
-class IndicatorButton;
+class FullScreenButton;
 class GeoCoordinate;
+class IndicatorButtonPanel;
+class Location;
+class LocationSearchPanel;
 class MapScale;
 class MapScene;
 class MapView;
-class SettingsDialog;
+class Route;
+class RoutingPanel;
 class SceneCoordinate;
+class SettingsDialog;
 class SituareService;
+class TabbedPanel;
 class User;
 class UserInfoPanel;
 class ZoomButtonPanel;
 
-
 /**
-* @brief Main Window Class
-*/
+ * @brief Main Window Class
+ */
 class MainWindow : public QMainWindow
 {
     Q_OBJECT
@@ -71,7 +77,6 @@ public:
 
     /**
      * @brief Destructor
-     *
      */
     ~MainWindow();
 
@@ -88,12 +93,16 @@ private:
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public:
+    FacebookLoginBrowser* buildFacebookLoginBrowser();
+
     /**
      * @brief Clears cookie jar
      *
      */
     void clearCookieJar();
 
+    void destroyFacebookLoginBrowser();
+
     /**
      * @brief
      *
@@ -151,12 +160,6 @@ public:
     const QString username();
 
 public slots:
-
-    /**
-     * @brief Build direction indicator button and connect slots
-     */
-    void buildIndicatorButton();
-
     /**
      * @brief Builds information box with message.
      *
@@ -185,24 +188,19 @@ public slots:
      *
      * @param visible
      */
-    void setOwnLocationCrosshairVisibility(bool visible);
+    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
      *        doesn't exist yet
-     *
      */
     void startLoginProcess();
 
@@ -221,9 +219,9 @@ public slots:
 
 private:
     /**
-     * @brief Build fullscreen toggle button and connect slots
+     * @brief Build manual location setting cross hair and connect slots
      */
-    void buildFullScreenButton();
+    void buildCrosshair();
 
     /**
      * @brief Build friend list panel and connect slots
@@ -231,9 +229,20 @@ private:
     void buildFriendListPanel();
 
     /**
-     * @brief Build manual location setting cross hair and connect slots
+     * @brief Build fullscreen toggle button and connect slots
      */
-    void buildManualLocationCrosshair();
+    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
@@ -251,6 +260,16 @@ private:
     void buildOsmLicense();
 
     /**
+     * @brief Build application panels
+     */
+    void buildPanels();
+
+    /**
+     * @brief Build routing panel and connect slots
+     */
+    void buildRoutingPanel();
+
+    /**
      * @brief Build user info panel and connect slots
      */
     void buildUserInfoPanel();
@@ -334,13 +353,6 @@ private slots:
     void drawOsmLicense(const QSize &size);
 
     /**
-     * @brief Slot for drawing the own location crosshair
-     *
-     * @param size Size of the screen
-     */
-    void drawOwnLocationCrosshair(const QSize &size);
-
-    /**
      * @brief Slot to intercept signal when error dialog/information note is processed
      *
      * @param status Status of the dialog
@@ -367,6 +379,18 @@ private slots:
     void loadDone(bool done);
 
     /**
+    * @brief Called when map center point horizontal shifting is changed
+    *
+    * @param shifting New shifting value
+    */
+    void mapCenterHorizontalShiftingChanged(int shifting);
+
+    /**
+     * @brief Move the crosshair
+     */
+    void moveCrosshair();
+
+    /**
      * @brief Slot to save cookies to settings
      */
     void saveCookies();
@@ -377,13 +401,6 @@ private slots:
     void settingsDialogAccepted();
 
     /**
-     * @brief Set correnct view port size to datamembers
-     *
-     * @param size Size of the screen
-     */
-    void setViewPortSize(const QSize &size);
-
-    /**
      * @brief Start location search (open search dialog)
      */
     void startLocationSearch();
@@ -418,6 +435,13 @@ signals:
     void cancelLoginProcess();
 
     /**
+     * @brief Signal for centering to coordinates.
+     *
+     * @param coordinates geo coordinates to center to.
+     */
+    void centerToCoordinates(const GeoCoordinate &coordinates);
+
+    /**
      * @brief View should be centered to new location
      *
      * @param coordinate Scene coordinates of the new center point
@@ -425,11 +449,16 @@ signals:
     void centerToSceneCoordinates(const SceneCoordinate &coordinate);
 
     /**
+    * @brief Emitted when route is cleared
+    */
+    void clearRoute();
+
+    /**
     * @brief Signal when direction and distance from current map center point to current GPS
     *        location is changed
     *
     * @param direction Direction in degrees
-    * @param distance Distance in kilometers
+    * @param distance Distance in meters
     * @param draw Should the indicator triangle be drawn or not
     */
     void directionIndicatorValuesUpdate(qreal direction, qreal distance, bool draw);
@@ -457,13 +486,6 @@ signals:
     void fetchUsernameFromSettings();
 
     /**
-     * @brief Signal for finding user.
-     *
-     * @param coordinates user geo coordinates
-     */
-    void findUser(const GeoCoordinate &coordinates);
-
-    /**
      * @brief Signals when friend's profile image is ready
      *
      * @param user Friend
@@ -478,13 +500,6 @@ signals:
     void gpsTriggered(bool enabled);
 
     /**
-     * @brief Signal for finding friend.
-     *
-     * @param coordinates friend's geo coordinates
-     */
-    void findFriend(const GeoCoordinate &coordinates);
-
-    /**
      * @brief Signal for friend location ready.
      *
      * @param friendsList
@@ -492,13 +507,28 @@ signals:
     void friendsLocationsReady(QList<User *> &friendsList);
 
     /**
-     * @brief Signal is emitted when location item is clicked.
+    * @brief Emited when location request is parsed and is ready for further processing
+    *
+    * @param result List of Location items
+    */
+    void locationDataParsed(const QList<Location> &result);
+
+    /**
+     * @brief Signal is emitted when location item is clicked on map.
      *
      * @param userIDs list of friends user IDs in the group
      */
     void locationItemClicked(const QList<QString> &userIDs);
 
     /**
+     * @brief Signal is emitted when location item is clicked in list.
+     *
+     * @param swBound south-west bound in GeoCoorinate
+     * @param neBound north-east bound in GeoCoordinate
+     */
+    void locationItemClicked(const GeoCoordinate &swBound, const GeoCoordinate &neBound);
+
+    /**
      * @brief Signals when Login/Logout action is pressed
      *
      */
@@ -514,7 +544,7 @@ signals:
     /**
      * @brief Forwarding signal from MapView to MapEngine
      *
-     * @param coordinate
+     * @param coordinate New center point coordinate
      */
     void mapViewScrolled(const SceneCoordinate &coordinate);
 
@@ -540,6 +570,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
      *
      */
@@ -553,6 +590,25 @@ signals:
     void reverseGeoReady(const QString &address);
 
     /**
+    * @brief Emited when route is parsed and is ready for further processing
+    *
+    * @param route Route item containing parsed route details
+    */
+    void routeParsed(Route &route);
+
+    /**
+    * @brief Signal for routing to geo coordinates.
+    *
+    * @param coordinates destination geo coordinates
+    */
+    void routeTo(const GeoCoordinate &coordinates);
+
+    /**
+    * @brief Request routing to current cursor position
+    */
+    void routeToCursor();
+
+    /**
      * @brief Signal to save username to settings
      *
      * @param username Username
@@ -567,6 +623,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
@@ -588,6 +651,11 @@ signals:
     void clearUpdateLocationDialogData();
 
     /**
+    * @brief Dragging mode triggered.
+    */
+    void draggingModeTriggered();
+
+    /**
      * @brief MapView has finished zooming
      */
     void viewZoomFinished();
@@ -622,16 +690,17 @@ private:
     bool m_loggedIn;                        ///< Indicates login state
     bool m_refresh;                         ///< Indicates when webpage is refreshed
 
+    int m_mapCenterHorizontalShifting;      ///< Amount of map center point horizontal shifting
     int m_progressIndicatorCount;           ///< Indicates the number of progress indicator calls
 
     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
-    QAction *m_searchLocationAct;           /// @todo this is temporary, remove when not needed!
 
+    QLabel *m_crosshair;                    ///< Label for center point crosshair
     QLabel *m_osmLicense;                   ///< Label for Open Street Map license
-    QLabel *m_ownLocationCrosshair;         ///< Label that show ownLocationCrosshair
 
+    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
 
@@ -639,22 +708,22 @@ 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
 
     QWebView *m_webView;                    ///< Shows facebook login page
 
+    FacebookLoginBrowser *m_facebookLoginBrowser;
     FriendListPanel *m_friendsListPanel;    ///< Instance of friends list panel
     FullScreenButton *m_fullScreenButton;   ///< Instance of the fullscreen toggle button
-    IndicatorButton *m_indicatorButton;     ///< 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
-    PanelSideBar *m_userPanelSidebar;       ///< User panel side bar
-    PanelSideBar *m_friendsListPanelSidebar;///< Friends panel side bar
-    UserInfoPanel *m_userPanel;             ///< Instance of the user information panel
+    RoutingPanel *m_routingPanel;           ///< Instance of routing panel
+    TabbedPanel *m_tabbedPanel;             ///< Widget for tabbed panels
+    UserInfoPanel *m_userInfoPanel;         ///< Instance of the user information panel
     ZoomButtonPanel *m_zoomButtonPanel;     ///< Instance of zoom button panel
 };