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);
194 /*******************************************************************************
196 ******************************************************************************/
199 * @brief Signal that indicates when user has cancelled login process
202 void cancelLoginProcess();
205 * @brief Signal for map auto centering
207 * @param enabled true if map should auto center to gps location
209 void autoCentering(bool enabled);
212 * @brief Signal for gps enabling.
214 * @param enabled true if gps should be enabled
216 void enableGPS(bool enabled);
219 * @brief Signal for auto centering enabling.
221 * @param enabled if auto centering should be enabled
223 void enableAutoCentering(bool enabled);
226 * @brief Signal for friend location ready.
230 void friendsLocationsReady(QList<User *> &friendsList);
233 * @brief Signal for gps position.
235 * @param position longitude and latitude values
236 * @param accuracy coordinate accuracy in metres
238 void positionReceived(QPointF position, qreal accuracy);
241 * @brief Signal for refreshing user data.
244 void refreshUserData();
247 * @brief Signal for requesting reverseGeo from SituareEngine
250 void requestReverseGeo();
253 * @brief Signals, when address data is ready
255 * @param address Street address
257 void reverseGeoReady(const QString &address);
260 * @brief Signal for requestLocationUpdate from SituareEngine
262 * @param status Status message
263 * @param publish Publish on Facebook
265 void statusUpdate(const QString &status, const bool &publish);
268 * @brief Signals when webview's urlChanged signal is emitted
272 void updateCredentials(const QUrl &url);
275 * @brief Signal for use location ready.
277 * @param user User object
279 void userLocationReady(User *user);
282 * @brief Signal for HW increase button
284 void zoomInKeyPressed();
287 * @brief Signal for HW decrease button
289 void zoomOutKeyPressed();
291 /*******************************************************************************
293 ******************************************************************************/
296 QAction *m_autoCenteringAct; ///< Action to auto center map using gps position
297 QString m_email; ///< Placeholder for email
298 QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
299 UpdateLocationDialog *m_locationDialog; ///< Message dialog
300 LoginDialog *m_loginDialog; ///< Login dialog
301 QUrl m_loginUrl; ///< Placeholder for login page url
302 MapViewScreen *m_mapViewScreen; ///< Instance of the map view
303 QString m_password; ///< Placeholder for password
304 bool m_refresh; ///< Indicates when webpage is refreshed
305 QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
306 QMenu *m_viewMenu; ///< Object that hold the view menu items
307 QWebView *m_webView; ///< Shows facebook login page
310 #endif // MAINWINDOW_H