Henri Lampela - henri.lampela@ixonos.com
Kaj Wallin - kaj.wallin@ixonos.com
+ Sami Rämö - sami.ramo@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
USA.
*/
-
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
-#include <QWidget>
-#include <QtWebKit>
-#include <QDebug>
-#include <QObject>
-#include <QNetworkAccessManager>
-#include "facebookservice/facebookauthentication.h"
-#include "situareservice/situareservice.h"
-#include "mapviewscreen.h"
-#include "updatelocation/updatelocationdialog.h"
-#include "ui/logindialog.h"
+#include <QUrl>
+
+#include "network/networkcookiejar.h"
+#include "panelsidebar.h"
+class QGraphicsScene;
class QLabel;
+class QWebView;
+
+class FacebookAuthentication;
+class FriendListPanel;
+class MapScale;
+class MapScene;
+class MapView;
+class SituareService;
+class User;
+class UserInfoPanel;
+class ZoomButtonPanel;
+class SettingsDialog;
+class QToolButton;
/**
* @brief Main Window Class
-*
-* @class MainWindow mainwindow.h "src/ui/mainwindow.h"
*/
class MainWindow : public QMainWindow
{
******************************************************************************/
public:
/**
- * @brief Set auto centering button enabled.
+ * @brief Clears cookie jar
*
- * @param enabled true if enabled, false otherwise
*/
- void setAutoCenteringButton(bool enabled);
+ void clearCookieJar();
/**
- * @brief Notify for auto centering enabling.
+ * @brief
*
- * @param enabled true if enabled, false otherwise
+ * @param logged
*/
- void autoCenteringEnabled(bool enabled);
+ void loggedIn(bool logged);
/**
- * @brief Set GPS button enabled.
+ * @brief Enable / disable auto centering button.
*
- * @param enabled true if enabled, false otherwise
+ * @param enabled true if shoud be enabled, false otherwise
*/
- void setGPSButton(bool enabled);
+ void setAutoCenteringButtonEnabled(bool enabled);
-public slots:
/**
- * @brief Slot for auto centering enabling.
+ * @brief Enable / disable GPS button.
+ *
+ * Does set visibilities for manual location cursor and auto centering menu button.
*
- * @param checked true if button state is checked, false otherwise
+ * @param enabled true if enabled, false otherwise
*/
- void autoCenteringToggled(bool checked);
+ void setGPSButtonEnabled(bool enabled);
+
+ /**
+ * @brief Set scene for MapView
+ *
+ * @param scene Scene to be set
+ */
+ void setMapViewScene(QGraphicsScene *scene);
- /**
- * @brief Slot for gps enabling.
+ /**
+ * @brief Show Maemo information box with message.
*
- * @param checked true if button state is checked, false otherwise
+ * @param message Information message
+ * @param modal Modal = true, non-modal false
*/
- void gpsToggled(bool checked);
+ void showMaemoInformationBox(const QString &message, bool modal=false);
/**
- * @brief Slot to intercept signal when user has pressed connect button from loginDialog
+ * @brief Gets the username from member variable for saving purposes
*
- * @param email E-mail
- * @param password Password
+ * @return QString Username
*/
- void loginDialogDone(const QString &email, const QString &password);
+ const QString username();
+public slots:
/**
* @brief Slot to intercept signal when login has failed (loginFailure signal)
*
*/
void loginFailed();
- /**
- * @brief Slot for map location change.
+ /**
+ * @brief Slot to intercept signal when login with cookies is requested
+ *
*/
- void mapLocationChanged();
+ void loginUsingCookies();
/**
* @brief Public slot, which open settings dialog
void openSettingsDialog();
/**
+ * @brief Sets username to member variable for login dialog
+ *
+ * @param username Username to be set
+ */
+ void setUsername(const QString &username);
+
+ /**
* @brief Public slot to intercept signal when old cerdentials are invalid or credentials
* doesn't exist yet
*
*/
void toggleProgressIndicator(bool state);
+ /**
+ * @brief Shows / hides Situare related UI items
+ *
+ * @param show
+ */
+ void updateItemVisibility(bool show);
+
private:
/**
+ * @brief Build fullscreen toggle button and connect slots
+ */
+ void buildFullScreenButton();
+
+ /**
+ * @brief Build friend list panel and connect slots
+ */
+ void buildFriendListPanel();
+
+ /**
+ * @brief Build manual location setting cross hair and connect slots
+ */
+ void buildManualLocationCrosshair();
+
+ /**
+ * @brief Build map and connect slots
+ */
+ void buildMap();
+
+ /**
+ * @brief Build map scale and connect slots
+ */
+ void buildMapScale();
+
+ /**
+ * @brief Build OSM license and connect slots
+ */
+ void buildOsmLicense();
+
+ /**
+ * @brief Build user info panel and connect slots
+ */
+ void buildUserInfoPanel();
+
+ /**
+ * @brief Build webview and connect slots
+ *
+ */
+ void buildWebView();
+
+ /**
+ * @brief Build zoom button panel and connect slots
+ */
+ void buildZoomButtonPanel();
+
+ /**
* @brief Private method to create the Menu items
*/
void createMenus();
void grabZoomKeys(bool grab);
/**
- * @brief Show Maemo information box with message.
+ * @brief Set own location crosshair visibility
+ *
+ * @param visible
+ */
+ void setOwnLocationCrosshairVisibility(bool visible);
+
+private slots:
+ /**
+ * @brief Slot for drawing the fullscreen toggle button
*
- * @brief message information message
+ * @param size Size of the screen
*/
- void showMaemoInformationBox(const QString &message);
+ 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
+ */
+ void drawOsmLicense(const QSize &size);
+
+ /**
+ * @brief Slot for drawing the own location crosshair
+ *
+ * @param width Width of the viewport
+ * @param height Height of the viewport
+ */
+ void drawOwnLocationCrosshair(int width, int height);
-private slots:
/**
* @brief Slot for gps timeout.
*
void gpsTimeout();
/**
- * @brief Slot for gps error.
+ * @brief Slot to load cookies from settings
*
- * @param message error message
*/
- void gpsError(const QString &message);
+ void loadCookies();
/**
* @brief Slot to intercept signal when webview has finished loading webpage
*/
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
+ * @param height Height of the viewport
+ */
+ void setViewPortSize(const int width, const int height);
+
+ /**
+ * @brief Toggle between fullscreen and normal window mode
+ */
+ void toggleFullScreen();
+
/*******************************************************************************
* SIGNALS
******************************************************************************/
signals:
/**
+ * @brief Automatic centering setting changed by user
+ *
+ * @param enabled True if automatic centering is enabled, otherwise false
+ */
+ void autoCenteringTriggered(bool enabled);
+
+ /**
* @brief Signal that indicates when user has cancelled login process
*
*/
void cancelLoginProcess();
/**
- * @brief Signal for map auto centering
+ * @brief View should be centered to new location
*
- * @param enabled true if map should auto center to gps location
+ * @param sceneCoordinate Scene coordinates of the new center point
*/
- void autoCentering(bool enabled);
+ void centerToSceneCoordinates(QPoint sceneCoordinate);
/**
- * @brief Signal for gps enabling.
+ * @brief Signal for enabling automatic location update.
*
- * @param enabled true if gps should be enabled
+ * @param enabled true if enabled, false otherwise
+ * @param updateIntervalMsecs update interval in milliseconds
*/
- void enableGPS(bool enabled);
+ void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs);
- /**
- * @brief Signal for auto centering enabling.
+ /**
+ * @brief Signal for requesting username from settings
*
- * @param enabled if auto centering should be enabled
*/
- void enableAutoCentering(bool enabled);
+ 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
+ */
+ void gpsTriggered(bool enabled);
+
+ /**
+ * @brief Signal for finding friend.
+ *
+ * @param coordinates friend's geo coordinates
+ */
+ void findFriend(const QPointF &coordinates);
/**
* @brief Signal for friend location ready.
void friendsLocationsReady(QList<User *> &friendsList);
/**
- * @brief Signal for gps position.
+ * @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 position longitude and latitude values
- * @param accuracy coordinate accuracy in metres
+ * @param size view size
*/
- void positionReceived(QPointF position, qreal accuracy);
+ void mapViewResized(const QSize &size);
+
+ /**
+ * @brief Forwarding signal from MapView to MapEngine
+ *
+ * @param sceneCoordinate
+ */
+ void mapViewScrolled(QPoint sceneCoordinate);
+
+ /**
+ * @brief Forwarding signal from MapEngine to MapView
+ */
+ void maxZoomLevelReached();
+
+ /**
+ * @brief Forwarding signal from MapEngine to MapView
+ */
+ void minZoomLevelReached();
+
+ /**
+ * @brief Forwarding signal from MapEngine to MapScale
+ */
+ void newMapResolution(qreal scale);
/**
* @brief Signal for refreshing user data.
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
void updateCredentials(const QUrl &url);
/**
+ * @brief MapView has finished zooming
+ */
+ void viewZoomFinished();
+
+ /**
* @brief Signal for use location ready.
*
* @param user User object
void userLocationReady(User *user);
/**
- * @brief Signal for HW increase button
- */
- void zoomInKeyPressed();
+ * @brief Map zoom in request
+ */
+ void zoomIn();
/**
- * @brief Signal for HW decrease button
+ * @brief Forwarding signal from MapEngine to MapView
*/
- void zoomOutKeyPressed();
+ void zoomLevelChanged(int zoomLevel);
+
+ /**
+ * @brief Map zoom out request
+ */
+ void zoomOut();
/*******************************************************************************
* 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
+
+ int m_viewPortHeight; ///< Height of view port
+ int m_viewPortWidth; ///< Width of view port
+
+ 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
+ QLabel *m_ownLocationCrosshair; ///< Label that show ownLocationCrosshair
+
+ QMenu *m_viewMenu; ///< Object that hold the view menu items
+
+ 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
+ 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
- QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
- QString m_email; ///< Placeholder for email
- QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
- UpdateLocationDialog *m_locationDialog; ///< Message dialog
- LoginDialog *m_loginDialog; ///< Login dialog
- QUrl m_loginUrl; ///< Placeholder for login page url
- MapViewScreen *m_mapViewScreen; ///< Instance of the map view
- QString m_password; ///< Placeholder for password
- bool m_refresh; ///< Indicates when webpage is refreshed
- QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
- QMenu *m_viewMenu; ///< Object that hold the view menu items
- QWebView *m_webView; ///< Shows facebook login page
+ SettingsDialog *m_settingsDialog; ///< Settings dialog
};
#endif // MAINWINDOW_H