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;
34 class FacebookCredentials;
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 when Login/Logout action is pressed
84 void loginActionPressed();
87 * @brief Slot to intercept signal from successful login
93 * @brief Slot to intercept signal when user has cancelled login process
95 void loginProcessCancelled();
98 * @brief Changes application state when logged out
104 * @brief Calls reverseGeo from SituareService to translate coordinates to street address
107 void requestAddress();
110 * @brief Calls updateLocation from SituareService to send the location update to
113 * @param status Status message
114 * @param publish Publish on Facebook
116 void requestUpdateLocation(const QString &status, bool publish);
119 * @brief Slot to refresh user data
121 void refreshUserData();
124 * @brief Slot to intercept signal from successful location update
127 void updateWasSuccessful();
130 * @brief Slot to intercept signal when new user data is available.
131 * Splits User and friendsList data and emits them as two different signals.
133 * @param user instance of User
134 * @param friendsList list of User instances (friends)
136 void userDataChanged(User *user, QList<User *> &friendsList);
140 * @brief Connect signals coming from Facdebook authenticator
142 void signalsFromFacebookAuthenticator();
145 * @brief Connect signals coming from GPS
147 void signalsFromGPS();
150 * @brief Connect signals coming from MainWindow
152 void signalsFromMainWindow();
155 * @brief Connect signals coming from MapEngine
157 void signalsFromMapEngine();
160 * @brief Connect signals coming from MapView
162 void signalsFromMapView();
165 * @brief Connect signals coming from Situare
167 void signalsFromSituareService();
171 * @brief Set auto centering feature enabled / disabled
173 void changeAutoCenteringSetting(bool enabled);
176 * @brief Slot for disabling automatic centering when map is scrolled manually
178 void disableAutoCentering();
181 * @brief Slot for auto centering enabling.
183 * Calls gps to send last known position
185 * @param enabled true if auto centering was enabled, false otherwise
187 void enableAutoCentering(bool enabled);
190 * @brief Slot for gps enabling.
192 * @param enabled true if gps should be enabled, false otherwise
194 void enableGPS(bool enabled);
197 * @brief Slot for intercepting signal when credentials are invalid
200 void invalidCredentials();
202 /*******************************************************************************
204 ******************************************************************************/
207 * @brief Signals when new friends data is ready
209 * @param friendList List of User instances (friends)
211 void friendsLocationsReady(QList<User *> &friendList);
214 * @brief Signals when new user data is ready
216 * @param user Instance of User
218 void userLocationReady(User *user);
220 /*******************************************************************************
222 ******************************************************************************/
224 bool m_autoCenteringEnabled; ///< Auto centering enabled
225 bool m_loggedIn; ///< Login state
227 FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
228 GPSPosition *m_gps; ///< Instance of the gps position
229 MainWindow *m_ui; ///< Instance of the MainWindow UI
230 MapEngine *m_mapEngine; ///< MapEngine
231 SituareService *m_situareService; ///< Instance of the situare server communication service