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
8 Sami Rämö - sami.ramo@ixonos.com
10 Situare is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 version 2 as published by the Free Software Foundation.
14 Situare is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Situare; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
33 class FacebookAuthentication;
42 * @brief Engine class for Situare Application
44 * This class handles all the underlaying login of the Situare
47 class SituareEngine : public QObject
56 SituareEngine(QMainWindow *parent = 0);
63 /*******************************************************************************
64 * MEMBER FUNCTIONS AND SLOTS
65 ******************************************************************************/
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 when username is fetched from settings
78 void fetchUsernameFromSettings();
81 * @brief Slot to intercept signal from successful login
83 * @param freshLogin Was login done via login dialog
85 void loginOk(bool freshLogin);
88 * @brief Slot to intercept signal when user has cancelled login process
90 void loginProcessCancelled();
93 * @brief Calls reverseGeo from SituareService to translate coordinates to street address
96 void requestAddress();
99 * @brief Calls updateLocation from SituareService to send the location update to
102 * @param status Status message
103 * @param publish Publish on Facebook
105 void requestUpdateLocation(const QString &status, bool publish);
108 * @brief Slot to refresh user data
110 void refreshUserData();
113 * @brief Slot to intercept signal from successful location update
116 void updateWasSuccessful();
119 * @brief Slot to intercept signal when new user data is available.
120 * Splits User and friendsList data and emits them as two different signals.
122 * @param user instance of User
123 * @param friendsList list of User instances (friends)
125 void userDataChanged(User *user, QList<User *> &friendsList);
129 * @brief Connect signals coming from Facdebook authenticator
131 void signalsFromFacebookAuthenticator();
134 * @brief Connect signals coming from GPS
136 void signalsFromGPS();
139 * @brief Connect signals coming from MainWindow
141 void signalsFromMainWindow();
144 * @brief Connect signals coming from MapEngine
146 void signalsFromMapEngine();
149 * @brief Connect signals coming from MapView
151 void signalsFromMapView();
154 * @brief Connect signals coming from NetworkHandler.
156 void signalsFromNetworkHandler();
159 * @brief Connect signals coming from Situare
161 void signalsFromSituareService();
165 * @brief Set auto centering feature enabled / disabled
167 void changeAutoCenteringSetting(bool enabled);
170 * @brief Slot for connected to network.
172 * Starts network requests.
174 void connectedToNetwork();
177 * @brief Slot for disabling automatic centering when map is scrolled manually
179 void disableAutoCentering();
182 * @brief Slot for disconnecting from network.
184 * Stops all network requests.
186 void disconnectedFromNetwork();
189 * @brief Slot for auto centering enabling.
191 * Calls gps to send last known position
193 * @param enabled true if auto centering was enabled, false otherwise
195 void enableAutoCentering(bool enabled);
198 * @brief Slot for gps enabling.
200 * @param enabled true if gps should be enabled, false otherwise
202 void enableGPS(bool enabled);
204 /*******************************************************************************
206 ******************************************************************************/
210 * @brief Signals when new friends data is ready
212 * @param friendList List of User instances (friends)
214 void friendsLocationsReady(QList<User *> &friendList);
217 * @brief Signals when new user data is ready
219 * @param user Instance of User
221 void userLocationReady(User *user);
223 /*******************************************************************************
225 ******************************************************************************/
227 bool m_autoCenteringEnabled; ///< Auto centering enabled
229 FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
230 GPSPosition *m_gps; ///< Instance of the gps position
231 MainWindow *m_ui; ///< Instance of the MainWindow UI
232 MapEngine *m_mapEngine; ///< MapEngine
233 SituareService *m_situareService; ///< Instance of the situare server communication service
234 NetworkHandler *m_networkHandler; ///< Instance of NetworkHandler