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 width Width of the viewport
212 * @param height Height of the viewport
214 void drawOsmLicense(int width, int height);
217 * @brief Slot for drawing the own location crosshair
219 * @param width Width of the viewport
220 * @param height Height of the viewport
222 void drawOwnLocationCrosshair(int width, int height);
225 * @brief Slot for gps error.
227 * @param message error message
229 void gpsError(const QString &message);
232 * @brief Slot for gps timeout.
234 * Called when request timeout occurs.
239 * @brief Slot to intercept signal when webview has finished loading webpage
241 * @param done Status of the loading
243 void loadDone(bool done);
246 * @brief Set correnct view port size to datamembers
248 * @param width Width of the viewport
249 * @param height Height of the viewport
251 void setViewPortSize(const int width, const int height);
253 /*******************************************************************************
255 ******************************************************************************/
258 * @brief Automatic centering setting changed by user
260 * @param enabled True if automatic centering is enabled, otherwise false
262 void autoCenteringTriggered(bool enabled);
265 * @brief Signal that indicates when user has cancelled login process
268 void cancelLoginProcess();
271 * @brief View should be centered to new location
273 * @param sceneCoordinate Scene coordinates of the new center point
275 void centerToSceneCoordinates(QPoint sceneCoordinate);
278 * @brief Signal for requesting username from settings
281 void fetchUsernameFromSettings();
284 * @brief GPS setting changed
286 * @param enabled True if GPS is enabled, otherwise false
288 void gpsTriggered(bool enabled);
291 * @brief Signal for finding friend.
293 * @param coordinates friend's geo coordinates
295 void findFriend(const QPointF &coordinates);
298 * @brief Signal for friend location ready.
302 void friendsLocationsReady(QList<User *> &friendsList);
305 * @brief MapView has been resized
307 * @param size view size
309 void mapViewResized(const QSize &size);
312 * @brief Forwarding signal from MapView to MapEngine
314 * @param sceneCoordinate
316 void mapViewScrolled(QPoint sceneCoordinate);
319 * @brief Forwarding signal from MapEngine to MapView
321 void maxZoomLevelReached();
324 * @brief Forwarding signal from MapEngine to MapView
326 void minZoomLevelReached();
329 * @brief Signal for refreshing user data.
332 void refreshUserData();
335 * @brief Signal for requesting reverseGeo from SituareEngine
338 void requestReverseGeo();
341 * @brief Signals, when address data is ready
343 * @param address Street address
345 void reverseGeoReady(const QString &address);
348 * @brief Signal for requestLocationUpdate from SituareEngine
350 * @param status Status message
351 * @param publish Publish on Facebook
353 void statusUpdate(const QString &status, const bool &publish);
356 * @brief Signals when webview's urlChanged signal is emitted
360 void updateCredentials(const QUrl &url);
363 * @brief MapView has finished zooming
365 void viewZoomFinished();
368 * @brief Signal for use location ready.
370 * @param user User object
372 void userLocationReady(User *user);
375 * @brief Map zoom in request
380 * @brief Forwarding signal from MapEngine to MapView
382 void zoomLevelChanged(int zoomLevel);
385 * @brief Map zoom out request
389 /*******************************************************************************
391 ******************************************************************************/
394 bool m_drawOwnLocationCrosshair; ///< Flag for making ownLocationCrosshair visible or not
395 bool m_refresh; ///< Indicates when webpage is refreshed
397 int m_viewPortHeight; ///< Height of view port
398 int m_viewPortWidth; ///< Width of view port
400 QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
401 QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
402 QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
404 QLabel *m_osmLicense; ///< Label for Open Street Map license
405 QLabel *m_ownLocationCrosshair; ///< Label that show ownLocationCrosshair
407 QMenu *m_viewMenu; ///< Object that hold the view menu items
409 QString m_email; ///< Placeholder for email
410 QString m_password; ///< Placeholder for password
412 QUrl m_loginUrl; ///< Placeholder for login page url
414 QWebView *m_webView; ///< Shows facebook login page
416 FriendListPanel *m_friendsListPanel; ///< Instance of friends list panel
417 LoginDialog *m_loginDialog; ///< Login dialog
418 MapView *m_mapView; ///< Instance of the map view
419 UserInfoPanel *m_userPanel; ///< Instance of the user information panel
420 ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
423 #endif // MAINWINDOW_H