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
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 #include <QtGui/QMainWindow>
32 #include <QNetworkAccessManager>
33 #include "facebookservice/facebookauthentication.h"
34 #include "situareservice/situareservice.h"
35 #include "mapviewscreen.h"
36 #include "ui/logindialog.h"
41 * @brief Main Window Class
43 * @class MainWindow mainwindow.h "src/ui/mainwindow.h"
45 class MainWindow : public QMainWindow
53 * @param parent Parent
55 MainWindow(QWidget *parent = 0);
63 /*******************************************************************************
64 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
65 ******************************************************************************/
68 * @brief HW increase and decrease key presses are grabbed and used for zooming the map.
70 void keyPressEvent(QKeyEvent* event);
72 /*******************************************************************************
73 * MEMBER FUNCTIONS AND SLOTS
74 ******************************************************************************/
77 * @brief Set auto centering button enabled.
79 * @param enabled true if enabled, false otherwise
81 void setAutoCenteringButton(bool enabled);
84 * @brief Notify for auto centering enabling.
86 * @param enabled true if enabled, false otherwise
88 void autoCenteringEnabled(bool enabled);
91 * @brief Set GPS button enabled.
93 * @param enabled true if enabled, false otherwise
95 void setGPSButton(bool enabled);
98 * @brief Gets the username from member variable for saving purposes
100 * @return QString Username
102 const QString username();
106 * @brief Slot for auto centering enabling.
108 * @param checked true if button state is checked, false otherwise
110 void autoCenteringToggled(bool checked);
113 * @brief Slot for gps enabling.
115 * @param checked true if button state is checked, false otherwise
117 void gpsToggled(bool checked);
120 * @brief Slot to intercept signal when user has pressed connect button from loginDialog
122 * @param email E-mail
123 * @param password Password
125 void loginDialogDone(const QString &email, const QString &password);
128 * @brief Slot to intercept signal when login has failed (loginFailure signal)
134 * @brief Slot for map location change.
136 void mapLocationChanged();
139 * @brief Public slot, which open settings dialog
141 void openSettingsDialog();
144 * @brief Sets username to member variable for login dialog
146 * @param username Username to be set
148 void setUsername(const QString &username);
151 * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
154 * @param url Login page url
156 void startLoginProcess(const QUrl &url);
159 * @brief Toggle progress indicator.
161 * @param state true if progress indicator should be shown, false otherwise
163 void toggleProgressIndicator(bool state);
167 * @brief Private method to create the Menu items
172 * @brief Grab or release HW increase and decrease buttons.
174 * @param grab Use true for grabbing and false for releasing the keys
176 void grabZoomKeys(bool grab);
179 * @brief Show Maemo information box with message.
181 * @brief message information message
183 void showMaemoInformationBox(const QString &message);
187 * @brief Slot for gps timeout.
189 * Called when request timeout occurs.
194 * @brief Slot for gps error.
196 * @param message error message
198 void gpsError(const QString &message);
201 * @brief Slot to intercept signal when webview has finished loading webpage
203 * @param done Status of the loading
205 void loadDone(bool done);
207 /*******************************************************************************
209 ******************************************************************************/
212 * @brief Signal for map auto centering
214 * @param enabled true if map should auto center to gps location
216 void autoCentering(bool enabled);
219 * @brief Signal that indicates when user has cancelled login process
222 void cancelLoginProcess();
225 * @brief Signal for gps enabling.
227 * @param enabled true if gps should be enabled
229 void enableGPS(bool enabled);
232 * @brief Signal for auto centering enabling.
234 * @param enabled if auto centering should be enabled
236 void enableAutoCentering(bool enabled);
239 * @brief Signal for requesting username from settings
242 void fetchUsernameFromSettings();
245 * @brief Signal for friend location ready.
249 void friendsLocationsReady(QList<User *> &friendsList);
252 * @brief Signal from MapEngine to SituareEngine is travelling here
254 void ownLocation(QPointF ownLatitudeLongitudeLocation);
257 * @brief Signal for gps position.
259 * @param position longitude and latitude values
260 * @param accuracy coordinate accuracy in metres
262 void positionReceived(QPointF position, qreal accuracy);
265 * @brief Signal for refreshing user data.
268 void refreshUserData();
271 * @brief Signal from SituareEngine to MapEngine is travelling here
273 void requestOwnLocation();
276 * @brief Signal for requesting reverseGeo from SituareEngine
279 void requestReverseGeo();
282 * @brief Signals, when address data is ready
284 * @param address Street address
286 void reverseGeoReady(const QString &address);
289 * @brief Signal for requestLocationUpdate from SituareEngine
291 * @param status Status message
292 * @param publish Publish on Facebook
294 void statusUpdate(const QString &status, const bool &publish);
297 * @brief Signals when webview's urlChanged signal is emitted
301 void updateCredentials(const QUrl &url);
304 * @brief Signal for use location ready.
306 * @param user User object
308 void userLocationReady(User *user);
311 * @brief Signal for HW increase button
313 void zoomInKeyPressed();
316 * @brief Signal for HW decrease button
318 void zoomOutKeyPressed();
320 /*******************************************************************************
322 ******************************************************************************/
325 QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
326 QString m_email; ///< Placeholder for email
327 QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
328 LoginDialog *m_loginDialog; ///< Login dialog
329 QUrl m_loginUrl; ///< Placeholder for login page url
330 MapViewScreen *m_mapViewScreen; ///< Instance of the map view
331 QString m_password; ///< Placeholder for password
332 bool m_refresh; ///< Indicates when webpage is refreshed
333 QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
334 QMenu *m_viewMenu; ///< Object that hold the view menu items
335 QWebView *m_webView; ///< Shows facebook login page
338 #endif // MAINWINDOW_H