2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
6 Henri Lampela - henri.lampela@ixonos.com
7 Jussi Laitinen - jussi.laitinen@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,
30 #include "facebookservice/facebookauthentication.h"
31 #include "situareservice/situareservice.h"
32 #include "ui/mainwindow.h"
34 class GPSPositionInterface;
37 * @brief Engine class for Situare Application
39 * This class handles all the underlaying login of the Situare
42 * @class SituareEngine engine.h "engine/engine.h"
44 class SituareEngine : public QObject
53 SituareEngine(QMainWindow *parent = 0);
60 /*******************************************************************************
61 * MEMBER FUNCTIONS AND SLOTS
62 ******************************************************************************/
65 void receiveOwnLocation(QPointF ownLocation);
68 * @brief Slot to intercept error signal from ImageFetcher and SituareService
70 * @param error Error message
72 void error(const QString &error);
75 * @brief Slot to intercept signal from successful login
80 * @brief Calls reverseGeo from SituareService to translate coordinates to street address
83 void requestAddress();
86 * @brief Calls updateLocation from SituareService to send the location update to
89 * @param status Status message
90 * @param publish Publish on Facebook
92 void requestUpdateLocation(const QString &status, bool publish);
95 * @brief Slot to refresh user data
97 void refreshUserData();
100 * @brief Slot to intercept signal from successful location update
103 void updateWasSuccessful();
106 * @brief Slot to intercept signal when new user data is available.
107 * Splits User and friendsList data and emits them as two different signals.
109 * @param user instance of User
110 * @param friendsList list of User instances (friends)
112 void userDataChanged(User *user, QList<User *> &friendsList);
115 * @brief Slot for auto centering enabling.
117 * Calls gps to send last known position
118 * @param enabled true if auto centering was enabled, false otherwise
120 void enableAutoCentering(bool enabled);
123 * @brief Slot for gps enabling.
125 * @param enabled true if gps should be enabled, false otherwise
127 void enableGPS(bool enabled);
130 * @brief Slot to intercept signal when user has cancelled login process
132 void loginProcessCancelled();
134 /*******************************************************************************
136 ******************************************************************************/
140 * @brief Signals when new user data is ready
142 * @param user Instance of User
144 void userLocationReady(User *user);
147 * @brief Signals when new friends data is ready
149 * @param friendList List of User instances (friends)
151 void friendsLocationsReady(QList<User *> &friendList);
152 void requestOwnLocation();
154 /*******************************************************************************
156 ******************************************************************************/
158 bool m_autoCenteringEnabled; ///< Auto centering enabled
159 bool m_gpsEnabled; ///< GPS enabled
160 FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
161 GPSPositionInterface *m_gps; ///< Instance of the gps position
162 MainWindow *m_ui; ///< Instance of the MainWindow UI
163 SituareService *m_situareService; ///< Instance of the situare server communication service