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>
34 class FacebookAuthentication;
35 class FriendListPanel;
42 class ZoomButtonPanel;
45 * @brief Main Window Class
47 class MainWindow : public QMainWindow
55 * @param parent Parent
57 MainWindow(QWidget *parent = 0);
65 /*******************************************************************************
66 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
67 ******************************************************************************/
70 * @brief HW increase and decrease key presses are grabbed and used for zooming the map.
72 void keyPressEvent(QKeyEvent* event);
74 /*******************************************************************************
75 * MEMBER FUNCTIONS AND SLOTS
76 ******************************************************************************/
79 * @brief Enable / disable auto centering button.
81 * @param enabled true if shoud be enabled, false otherwise
83 void setAutoCenteringButtonEnabled(bool enabled);
86 * @brief Enable / disable GPS button.
88 * Does set visibilities for manual location cursor and auto centering menu button.
90 * @param enabled true if enabled, false otherwise
92 void setGPSButtonEnabled(bool enabled);
95 * @brief Set scene for MapView
97 * @param scene Scene to be set
99 void setMapViewScene(QGraphicsScene *scene);
102 * @brief Show Maemo information box with message.
104 * @brief message information message
106 void showMaemoInformationBox(const QString &message);
109 * @brief Gets the username from member variable for saving purposes
111 * @return QString Username
113 const QString username();
117 * @brief Slot to intercept signal when user has pressed connect button from loginDialog
119 * @param email E-mail
120 * @param password Password
122 void loginDialogDone(const QString &email, const QString &password);
125 * @brief Slot to intercept signal when login has failed (loginFailure signal)
131 * @brief Public slot, which open settings dialog
133 void openSettingsDialog();
136 * @brief Sets username to member variable for login dialog
138 * @param username Username to be set
140 void setUsername(const QString &username);
143 * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
146 * @param url Login page url
148 void startLoginProcess(const QUrl &url);
151 * @brief Toggle progress indicator.
153 * @param state true if progress indicator should be shown, false otherwise
155 void toggleProgressIndicator(bool state);
159 * @brief Build friend list panel and connect slots
161 void buildFriendListPanel();
164 * @brief Build manual location setting cross hair and connect slots
166 void buildManualLocationCrosshair();
169 * @brief Build map and connect slots
174 * @brief Build OSM license and connect slots
176 void buildOsmLicense();
179 * @brief Build user info panel and connect slots
181 void buildUserInfoPanel();
184 * @brief Build zoom button panel and connect slots
186 void buildZoomButtonPanel();
189 * @brief Private method to create the Menu items
194 * @brief Grab or release HW increase and decrease buttons.
196 * @param grab Use true for grabbing and false for releasing the keys
198 void grabZoomKeys(bool grab);
201 * @brief Set own location crosshair visibility
205 void setOwnLocationCrosshairVisibility(bool visible);
209 * @brief Slot for drawing the Open Street Map license text
211 * @param size Size of the screen
213 void drawOsmLicense(const QSize &size);
216 * @brief Slot for drawing the own location crosshair
218 * @param width Width of the viewport
219 * @param height Height of the viewport
221 void drawOwnLocationCrosshair(int width, int height);
224 * @brief Slot for gps error.
226 * @param message error message
228 void gpsError(const QString &message);
231 * @brief Slot for gps timeout.
233 * Called when request timeout occurs.
238 * @brief Slot to intercept signal when webview has finished loading webpage
240 * @param done Status of the loading
242 void loadDone(bool done);
245 * @brief Set correnct view port size to datamembers
247 * @param width Width of the viewport
248 * @param height Height of the viewport
250 void setViewPortSize(const int width, const int height);
252 /*******************************************************************************
254 ******************************************************************************/
257 * @brief Automatic centering setting changed by user
259 * @param enabled True if automatic centering is enabled, otherwise false
261 void autoCenteringTriggered(bool enabled);
264 * @brief Signal that indicates when user has cancelled login process
267 void cancelLoginProcess();
270 * @brief View should be centered to new location
272 * @param sceneCoordinate Scene coordinates of the new center point
274 void centerToSceneCoordinates(QPoint sceneCoordinate);
277 * @brief Signal for requesting username from settings
280 void fetchUsernameFromSettings();
283 * @brief GPS setting changed
285 * @param enabled True if GPS is enabled, otherwise false
287 void gpsTriggered(bool enabled);
290 * @brief Signal for finding friend.
292 * @param coordinates friend's geo coordinates
294 void findFriend(const QPointF &coordinates);
297 * @brief Signal for friend location ready.
301 void friendsLocationsReady(QList<User *> &friendsList);
304 * @brief MapView has been resized
306 * @param size view size
308 void mapViewResized(const QSize &size);
311 * @brief Forwarding signal from MapView to MapEngine
313 * @param sceneCoordinate
315 void mapViewScrolled(QPoint sceneCoordinate);
318 * @brief Forwarding signal from MapEngine to MapView
320 void maxZoomLevelReached();
323 * @brief Forwarding signal from MapEngine to MapView
325 void minZoomLevelReached();
328 * @brief Signal for refreshing user data.
331 void refreshUserData();
334 * @brief Signal for requesting reverseGeo from SituareEngine
337 void requestReverseGeo();
340 * @brief Signals, when address data is ready
342 * @param address Street address
344 void reverseGeoReady(const QString &address);
347 * @brief Signal for requestLocationUpdate from SituareEngine
349 * @param status Status message
350 * @param publish Publish on Facebook
352 void statusUpdate(const QString &status, const bool &publish);
355 * @brief Signals when webview's urlChanged signal is emitted
359 void updateCredentials(const QUrl &url);
362 * @brief MapView has finished zooming
364 void viewZoomFinished();
367 * @brief Signal for use location ready.
369 * @param user User object
371 void userLocationReady(User *user);
374 * @brief Map zoom in request
379 * @brief Forwarding signal from MapEngine to MapView
381 void zoomLevelChanged(int zoomLevel);
384 * @brief Map zoom out request
388 /*******************************************************************************
390 ******************************************************************************/
393 bool m_drawOwnLocationCrosshair; ///< Flag for making ownLocationCrosshair visible or not
394 bool m_refresh; ///< Indicates when webpage is refreshed
396 int m_viewPortHeight; ///< Height of view port
397 int m_viewPortWidth; ///< Width of view port
399 QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
400 QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
401 QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
403 QLabel *m_osmLicense; ///< Label for Open Street Map license
404 QLabel *m_ownLocationCrosshair; ///< Label that show ownLocationCrosshair
406 QMenu *m_viewMenu; ///< Object that hold the view menu items
408 QString m_email; ///< Placeholder for email
409 QString m_password; ///< Placeholder for password
411 QUrl m_loginUrl; ///< Placeholder for login page url
413 QWebView *m_webView; ///< Shows facebook login page
415 FriendListPanel *m_friendsListPanel; ///< Instance of friends list panel
416 LoginDialog *m_loginDialog; ///< Login dialog
417 MapView *m_mapView; ///< Instance of the map view
418 UserInfoPanel *m_userPanel; ///< Instance of the user information panel
419 ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
422 #endif // MAINWINDOW_H