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 "updatelocation/updatelocationdialog.h"
37 #include "ui/logindialog.h"
42 * @brief Main Window Class
44 * @class MainWindow mainwindow.h "src/ui/mainwindow.h"
46 class MainWindow : public QMainWindow
54 * @param parent Parent
56 MainWindow(QWidget *parent = 0);
64 /*******************************************************************************
65 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
66 ******************************************************************************/
69 * @brief HW increase and decrease key presses are grabbed and used for zooming the map.
71 void keyPressEvent(QKeyEvent* event);
73 /*******************************************************************************
74 * MEMBER FUNCTIONS AND SLOTS
75 ******************************************************************************/
78 * @brief Set auto centering button enabled.
80 * @param enabled true if enabled, false otherwise
82 void setAutoCenteringButton(bool enabled);
85 * @brief Notify for auto centering enabling.
87 * @param enabled true if enabled, false otherwise
89 void autoCenteringEnabled(bool enabled);
92 * @brief Set GPS button enabled.
94 * @param enabled true if enabled, false otherwise
96 void setGPSButton(bool enabled);
100 * @brief Slot for auto centering enabling.
102 * @param checked true if button state is checked, false otherwise
104 void autoCenteringToggled(bool checked);
107 * @brief Slot for gps enabling.
109 * @param checked true if button state is checked, false otherwise
111 void gpsToggled(bool checked);
114 * @brief Slot to intercept signal when user has pressed connect button from loginDialog
116 * @param email E-mail
117 * @param password Password
119 void loginDialogDone(const QString &email, const QString &password);
122 * @brief Slot to intercept signal when login has failed (loginFailure signal)
128 * @brief Slot for map location change.
130 void mapLocationChanged();
133 * @brief Public slot, which open settings dialog
135 void openSettingsDialog();
138 * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
141 * @param url Login page url
143 void startLoginProcess(const QUrl &url);
146 * @brief Toggle progress indicator.
148 * @param state true if progress indicator should be shown, false otherwise
150 void toggleProgressIndicator(bool state);
154 * @brief Private method to create the Menu items
159 * @brief Grab or release HW increase and decrease buttons.
161 * @param grab Use true for grabbing and false for releasing the keys
163 void grabZoomKeys(bool grab);
166 * @brief Show Maemo information box with message.
168 * @brief message information message
170 void showMaemoInformationBox(const QString &message);
174 * @brief Slot for gps timeout.
176 * Called when request timeout occurs.
181 * @brief Slot for gps error.
183 * @param message error message
185 void gpsError(const QString &message);
188 * @brief Slot to intercept signal when webview has finished loading webpage
190 * @param done Status of the loading
192 void loadDone(bool done);
195 * @brief Private slot, which starts UpdateLocationDialog
198 void openLocationUpdateDialog();
200 /*******************************************************************************
202 ******************************************************************************/
205 * @brief Signal that indicates when user has cancelled login process
208 void cancelLoginProcess();
211 * @brief Signal for map auto centering
213 * @param enabled true if map should auto center to gps location
215 void autoCentering(bool enabled);
218 * @brief Signal for gps enabling.
220 * @param enabled true if gps should be enabled
222 void enableGPS(bool enabled);
225 * @brief Signal for auto centering enabling.
227 * @param enabled if auto centering should be enabled
229 void enableAutoCentering(bool enabled);
232 * @brief Signal for friend location ready.
236 void friendsLocationsReady(QList<User *> &friendsList);
239 * @brief Signal for gps position.
241 * @param position longitude and latitude values
242 * @param accuracy coordinate accuracy in metres
244 void positionReceived(QPointF position, qreal accuracy);
247 * @brief Signal for refreshing user data.
250 void refreshUserData();
253 * @brief Signal for requesting reverseGeo from SituareEngine
256 void requestReverseGeo();
259 * @brief Signals, when address data is ready
261 * @param address Street address
263 void reverseGeoReady(const QString &address);
266 * @brief Signal for requestLocationUpdate from SituareEngine
268 * @param status Status message
269 * @param publish Publish on Facebook
271 void statusUpdate(const QString &status, const bool &publish);
274 * @brief Signals when webview's urlChanged signal is emitted
278 void updateCredentials(const QUrl &url);
281 * @brief Signal for use location ready.
283 * @param user User object
285 void userLocationReady(User *user);
288 * @brief Signal for HW increase button
290 void zoomInKeyPressed();
293 * @brief Signal for HW decrease button
295 void zoomOutKeyPressed();
298 * @brief Signal from SituareEngine to MapEngine is travelling here
300 void requestOwnLocation();
303 * @brief Signal from MapEngine to SituareEngine is travelling here
305 void ownLocation(QPointF ownLatitudeLongitudeLocation);
307 /*******************************************************************************
309 ******************************************************************************/
312 QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
313 QString m_email; ///< Placeholder for email
314 QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
315 UpdateLocationDialog *m_locationDialog; ///< Message dialog
316 LoginDialog *m_loginDialog; ///< Login dialog
317 QUrl m_loginUrl; ///< Placeholder for login page url
318 MapViewScreen *m_mapViewScreen; ///< Instance of the map view
319 QString m_password; ///< Placeholder for password
320 bool m_refresh; ///< Indicates when webpage is refreshed
321 QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
322 QMenu *m_viewMenu; ///< Object that hold the view menu items
323 QWebView *m_webView; ///< Shows facebook login page
326 #endif // MAINWINDOW_H