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;
47 * @brief Main Window Class
49 class MainWindow : public QMainWindow
57 * @param parent Parent
59 MainWindow(QWidget *parent = 0);
67 /*******************************************************************************
68 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
69 ******************************************************************************/
72 * @brief HW increase and decrease key presses are grabbed and used for zooming the map.
74 void keyPressEvent(QKeyEvent* event);
76 /*******************************************************************************
77 * MEMBER FUNCTIONS AND SLOTS
78 ******************************************************************************/
85 void loggedIn(bool logged);
88 * @brief Enable / disable auto centering button.
90 * @param enabled true if shoud be enabled, false otherwise
92 void setAutoCenteringButtonEnabled(bool enabled);
95 * @brief Enable / disable GPS button.
97 * Does set visibilities for manual location cursor and auto centering menu button.
99 * @param enabled true if enabled, false otherwise
101 void setGPSButtonEnabled(bool enabled);
104 * @brief Set scene for MapView
106 * @param scene Scene to be set
108 void setMapViewScene(QGraphicsScene *scene);
111 * @brief Show Maemo information box with message.
113 * @brief message information message
115 void showMaemoInformationBox(const QString &message);
118 * @brief Gets the username from member variable for saving purposes
120 * @return QString Username
122 const QString username();
126 * @brief Slot to intercept signal when user has pressed connect button from loginDialog
128 * @param email E-mail
129 * @param password Password
131 void loginDialogDone(const QString &email, const QString &password);
134 * @brief Slot to intercept signal when login has failed (loginFailure signal)
140 * @brief Public slot, which open settings dialog
142 void openSettingsDialog();
145 * @brief Sets username to member variable for login dialog
147 * @param username Username to be set
149 void setUsername(const QString &username);
156 void showPanels(bool show);
159 * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
162 * @param url Login page url
164 void startLoginProcess(const QUrl &url);
167 * @brief Toggle progress indicator.
169 * @param state true if progress indicator should be shown, false otherwise
171 void toggleProgressIndicator(bool state);
175 * @brief Build friend list panel and connect slots
177 void buildFriendListPanel();
180 * @brief Build manual location setting cross hair and connect slots
182 void buildManualLocationCrosshair();
185 * @brief Build map and connect slots
190 * @brief Build OSM license and connect slots
192 void buildOsmLicense();
195 * @brief Build user info panel and connect slots
197 void buildUserInfoPanel();
200 * @brief Build zoom button panel and connect slots
202 void buildZoomButtonPanel();
205 * @brief Private method to create the Menu items
210 * @brief Grab or release HW increase and decrease buttons.
212 * @param grab Use true for grabbing and false for releasing the keys
214 void grabZoomKeys(bool grab);
217 * @brief Set own location crosshair visibility
221 void setOwnLocationCrosshairVisibility(bool visible);
225 * @brief Slot for drawing the Open Street Map license text
227 * @param size Size of the screen
229 void drawOsmLicense(const QSize &size);
232 * @brief Slot for drawing the own location crosshair
234 * @param width Width of the viewport
235 * @param height Height of the viewport
237 void drawOwnLocationCrosshair(int width, int height);
240 * @brief Slot for gps error.
242 * @param message error message
244 void gpsError(const QString &message);
247 * @brief Slot for gps timeout.
249 * Called when request timeout occurs.
254 * @brief Slot to intercept signal when webview has finished loading webpage
256 * @param done Status of the loading
258 void loadDone(bool done);
261 * @brief Set correnct view port size to datamembers
263 * @param width Width of the viewport
264 * @param height Height of the viewport
266 void setViewPortSize(const int width, const int height);
268 /*******************************************************************************
270 ******************************************************************************/
273 * @brief Automatic centering setting changed by user
275 * @param enabled True if automatic centering is enabled, otherwise false
277 void autoCenteringTriggered(bool enabled);
280 * @brief Signal that indicates when user has cancelled login process
283 void cancelLoginProcess();
286 * @brief View should be centered to new location
288 * @param sceneCoordinate Scene coordinates of the new center point
290 void centerToSceneCoordinates(QPoint sceneCoordinate);
293 * @brief Signal for requesting username from settings
296 void fetchUsernameFromSettings();
299 * @brief Signal for finding user.
301 * @param coordinates user geo coordinates
303 void findUser(const QPointF &coordinates);
306 * @brief GPS setting changed
308 * @param enabled True if GPS is enabled, otherwise false
310 void gpsTriggered(bool enabled);
313 * @brief Signal for finding friend.
315 * @param coordinates friend's geo coordinates
317 void findFriend(const QPointF &coordinates);
320 * @brief Signal for friend location ready.
324 void friendsLocationsReady(QList<User *> &friendsList);
327 * @brief Signal is emitted when location item is clicked.
329 * @param userIDs list of friends user IDs in the group
331 void locationItemClicked(const QList<QString> &userIDs);
334 * @brief Signals when Login/Logout action is pressed
337 void loginActionPressed();
340 * @brief MapView has been resized
342 * @param size view size
344 void mapViewResized(const QSize &size);
347 * @brief Forwarding signal from MapView to MapEngine
349 * @param sceneCoordinate
351 void mapViewScrolled(QPoint sceneCoordinate);
354 * @brief Forwarding signal from MapEngine to MapView
356 void maxZoomLevelReached();
359 * @brief Forwarding signal from MapEngine to MapView
361 void minZoomLevelReached();
364 * @brief Signal for refreshing user data.
367 void refreshUserData();
370 * @brief Signal for requesting reverseGeo from SituareEngine
373 void requestReverseGeo();
376 * @brief Signals, when address data is ready
378 * @param address Street address
380 void reverseGeoReady(const QString &address);
383 * @brief Signal for requestLocationUpdate from SituareEngine
385 * @param status Status message
386 * @param publish Publish on Facebook
388 void statusUpdate(const QString &status, const bool &publish);
391 * @brief Signals when webview's urlChanged signal is emitted
395 void updateCredentials(const QUrl &url);
398 * @brief MapView has finished zooming
400 void viewZoomFinished();
403 * @brief Signal for use location ready.
405 * @param user User object
407 void userLocationReady(User *user);
410 * @brief Map zoom in request
415 * @brief Forwarding signal from MapEngine to MapView
417 void zoomLevelChanged(int zoomLevel);
420 * @brief Map zoom out request
424 /*******************************************************************************
426 ******************************************************************************/
429 bool m_drawOwnLocationCrosshair; ///< Flag for making ownLocationCrosshair visible or not
430 bool m_loggedIn; ///< Indicates login state
431 bool m_refresh; ///< Indicates when webpage is refreshed
433 int m_viewPortHeight; ///< Height of view port
434 int m_viewPortWidth; ///< Width of view port
436 QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
437 QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
438 QAction *m_loginAct; ///< Action to Login/Logout
439 QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
441 QLabel *m_osmLicense; ///< Label for Open Street Map license
442 QLabel *m_ownLocationCrosshair; ///< Label that show ownLocationCrosshair
444 QMenu *m_viewMenu; ///< Object that hold the view menu items
446 QString m_email; ///< Placeholder for email
447 QString m_password; ///< Placeholder for password
449 QUrl m_loginUrl; ///< Placeholder for login page url
451 QWebView *m_webView; ///< Shows facebook login page
453 FriendListPanel *m_friendsListPanel; ///< Instance of friends list panel
454 LoginDialog *m_loginDialog; ///< Login dialog
455 MapView *m_mapView; ///< Instance of the map view
456 PanelSideBar *m_userPanelSidebar; ///< User panel side bar
457 PanelSideBar *m_friendsListPanelSidebar;///< Friends panel side bar
458 UserInfoPanel *m_userPanel; ///< Instance of the user information panel
459 ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
462 #endif // MAINWINDOW_H