2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Henri Lampela - henri.lampela@ixonos.com
6 Kaj Wallin - kaj.wallin@ixonos.com
7 Sami Rämö - sami.ramo@ixonos.com
9 Situare is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 version 2 as published by the Free Software Foundation.
13 Situare is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Situare; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 #include <QtGui/QMainWindow>
30 #include "panelsidebar.h"
36 class FacebookAuthentication;
37 class FriendListPanel;
44 class ZoomButtonPanel;
48 * @brief Main Window Class
50 class MainWindow : public QMainWindow
58 * @param parent Parent
60 MainWindow(QWidget *parent = 0);
68 /*******************************************************************************
69 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
70 ******************************************************************************/
73 * @brief HW increase and decrease key presses are grabbed and used for zooming the map.
75 void keyPressEvent(QKeyEvent* event);
77 /*******************************************************************************
78 * MEMBER FUNCTIONS AND SLOTS
79 ******************************************************************************/
86 void loggedIn(bool logged);
89 * @brief Enable / disable auto centering button.
91 * @param enabled true if shoud be enabled, false otherwise
93 void setAutoCenteringButtonEnabled(bool enabled);
96 * @brief Enable / disable GPS button.
98 * Does set visibilities for manual location cursor and auto centering menu button.
100 * @param enabled true if enabled, false otherwise
102 void setGPSButtonEnabled(bool enabled);
105 * @brief Set scene for MapView
107 * @param scene Scene to be set
109 void setMapViewScene(QGraphicsScene *scene);
112 * @brief Show Maemo information box with message.
114 * @brief message information message
116 void showMaemoInformationBox(const QString &message);
119 * @brief Gets the username from member variable for saving purposes
121 * @return QString Username
123 const QString username();
127 * @brief Slot to intercept signal when user has pressed connect button from loginDialog
129 * @param email E-mail
130 * @param password Password
132 void loginDialogDone(const QString &email, const QString &password);
135 * @brief Slot to intercept signal when login has failed (loginFailure signal)
141 * @brief Public slot, which open settings dialog
143 void openSettingsDialog();
146 * @brief Sets username to member variable for login dialog
148 * @param username Username to be set
150 void setUsername(const QString &username);
157 void showPanels(bool show);
160 * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
163 * @param url Login page url
165 void startLoginProcess(const QUrl &url);
168 * @brief Toggle progress indicator.
170 * @param state true if progress indicator should be shown, false otherwise
172 void toggleProgressIndicator(bool state);
176 * @brief Build friend list panel and connect slots
178 void buildFriendListPanel();
181 * @brief Build manual location setting cross hair and connect slots
183 void buildManualLocationCrosshair();
186 * @brief Build map and connect slots
191 * @brief Build OSM license and connect slots
193 void buildOsmLicense();
196 * @brief Build user info panel and connect slots
198 void buildUserInfoPanel();
201 * @brief Build zoom button panel and connect slots
203 void buildZoomButtonPanel();
206 * @brief Private method to create the Menu items
211 * @brief Grab or release HW increase and decrease buttons.
213 * @param grab Use true for grabbing and false for releasing the keys
215 void grabZoomKeys(bool grab);
218 * @brief Set own location crosshair visibility
222 void setOwnLocationCrosshairVisibility(bool visible);
226 * @brief Slot for drawing the Open Street Map license text
228 * @param size Size of the screen
230 void drawOsmLicense(const QSize &size);
233 * @brief Slot for drawing the own location crosshair
235 * @param width Width of the viewport
236 * @param height Height of the viewport
238 void drawOwnLocationCrosshair(int width, int height);
241 * @brief Slot for gps error.
243 * @param message error message
245 void gpsError(const QString &message);
248 * @brief Slot for gps timeout.
250 * Called when request timeout occurs.
255 * @brief Slot to intercept signal when webview has finished loading webpage
257 * @param done Status of the loading
259 void loadDone(bool done);
262 * @brief Set correnct view port size to datamembers
264 * @param width Width of the viewport
265 * @param height Height of the viewport
267 void setViewPortSize(const int width, const int height);
269 /*******************************************************************************
271 ******************************************************************************/
274 * @brief Automatic centering setting changed by user
276 * @param enabled True if automatic centering is enabled, otherwise false
278 void autoCenteringTriggered(bool enabled);
281 * @brief Signal that indicates when user has cancelled login process
284 void cancelLoginProcess();
287 * @brief View should be centered to new location
289 * @param sceneCoordinate Scene coordinates of the new center point
291 void centerToSceneCoordinates(QPoint sceneCoordinate);
294 * @brief Signal for enabling automatic location update.
296 * @param enabled true if enabled, false otherwise
297 * @param updateIntervalMsecs update interval in milliseconds
299 void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs);
302 * @brief Signal for requesting username from settings
305 void fetchUsernameFromSettings();
308 * @brief Signal for finding user.
310 * @param coordinates user geo coordinates
312 void findUser(const QPointF &coordinates);
315 * @brief GPS setting changed
317 * @param enabled True if GPS is enabled, otherwise false
319 void gpsTriggered(bool enabled);
322 * @brief Signal for finding friend.
324 * @param coordinates friend's geo coordinates
326 void findFriend(const QPointF &coordinates);
329 * @brief Signal for friend location ready.
333 void friendsLocationsReady(QList<User *> &friendsList);
336 * @brief Signal is emitted when location item is clicked.
338 * @param userIDs list of friends user IDs in the group
340 void locationItemClicked(const QList<QString> &userIDs);
343 * @brief Signals when Login/Logout action is pressed
346 void loginActionPressed();
349 * @brief MapView has been resized
351 * @param size view size
353 void mapViewResized(const QSize &size);
356 * @brief Forwarding signal from MapView to MapEngine
358 * @param sceneCoordinate
360 void mapViewScrolled(QPoint sceneCoordinate);
363 * @brief Forwarding signal from MapEngine to MapView
365 void maxZoomLevelReached();
368 * @brief Forwarding signal from MapEngine to MapView
370 void minZoomLevelReached();
373 * @brief Signal for refreshing user data.
376 void refreshUserData();
379 * @brief Signal for requesting reverseGeo from SituareEngine
382 void requestReverseGeo();
385 * @brief Signals, when address data is ready
387 * @param address Street address
389 void reverseGeoReady(const QString &address);
392 * @brief Signal for requestLocationUpdate from SituareEngine
394 * @param status Status message
395 * @param publish Publish on Facebook
397 void statusUpdate(const QString &status, const bool &publish);
400 * @brief Signals when webview's urlChanged signal is emitted
404 void updateCredentials(const QUrl &url);
407 * @brief MapView has finished zooming
409 void viewZoomFinished();
412 * @brief Signal for use location ready.
414 * @param user User object
416 void userLocationReady(User *user);
419 * @brief Map zoom in request
424 * @brief Forwarding signal from MapEngine to MapView
426 void zoomLevelChanged(int zoomLevel);
429 * @brief Map zoom out request
433 /*******************************************************************************
435 ******************************************************************************/
438 bool m_drawOwnLocationCrosshair; ///< Flag for making ownLocationCrosshair visible or not
439 bool m_loggedIn; ///< Indicates login state
440 bool m_refresh; ///< Indicates when webpage is refreshed
442 int m_viewPortHeight; ///< Height of view port
443 int m_viewPortWidth; ///< Width of view port
445 QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
446 QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
447 QAction *m_loginAct; ///< Action to Login/Logout
448 QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
450 QLabel *m_osmLicense; ///< Label for Open Street Map license
451 QLabel *m_ownLocationCrosshair; ///< Label that show ownLocationCrosshair
453 QMenu *m_viewMenu; ///< Object that hold the view menu items
455 QString m_email; ///< Placeholder for email
456 QString m_password; ///< Placeholder for password
458 QUrl m_loginUrl; ///< Placeholder for login page url
460 QWebView *m_webView; ///< Shows facebook login page
462 FriendListPanel *m_friendsListPanel; ///< Instance of friends list panel
463 LoginDialog *m_loginDialog; ///< Login dialog
464 MapView *m_mapView; ///< Instance of the map view
465 PanelSideBar *m_userPanelSidebar; ///< User panel side bar
466 PanelSideBar *m_friendsListPanelSidebar;///< Friends panel side bar
467 UserInfoPanel *m_userPanel; ///< Instance of the user information panel
468 ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
470 SettingsDialog *m_settingsDialog; ///< Settings dialog
473 #endif // MAINWINDOW_H