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,
34 class FacebookAuthentication;
35 class FacebookCredentials;
43 * @brief Engine class for Situare Application
45 * This class handles all the underlaying login of the Situare
48 class SituareEngine : public QObject
57 SituareEngine(QMainWindow *parent = 0);
64 /*******************************************************************************
65 * MEMBER FUNCTIONS AND SLOTS
66 ******************************************************************************/
69 * @brief Slot to intercept error signal from ImageFetcher and SituareService
71 * @param error Error message
73 void error(const QString &error);
76 * @brief Slot to intercept signal when username is fetched from settings
79 void fetchUsernameFromSettings();
82 * @brief Slot to intercept signal when Login/Logout action is pressed
85 void loginActionPressed();
88 * @brief Slot to intercept signal from successful login
90 * @param freshLogin Was login done via login dialog
91 * @param credentials Facebook credentials
93 void loginOk(bool freshLogin, const FacebookCredentials &credentials);
96 * @brief Slot to intercept signal when user has cancelled login process
98 void loginProcessCancelled();
101 * @brief Changes application state when logged out
107 * @brief Calls reverseGeo from SituareService to translate coordinates to street address
110 void requestAddress();
113 * @brief Calls updateLocation from SituareService to send the location update to
116 * @param status Status message
117 * @param publish Publish on Facebook
119 void requestUpdateLocation(const QString &status, bool publish);
122 * @brief Slot to refresh user data
124 void refreshUserData();
127 * @brief Slot to intercept signal from successful location update
130 void updateWasSuccessful();
133 * @brief Slot to intercept signal when new user data is available.
134 * Splits User and friendsList data and emits them as two different signals.
136 * @param user instance of User
137 * @param friendsList list of User instances (friends)
139 void userDataChanged(User *user, QList<User *> &friendsList);
143 * @brief Read settings and determine whether to use GPS and autocentering.
144 * When values does not found on the settings, GPS and autocentering are enabled as a default.
146 void initializeGpsAndAutocentering();
149 * @brief Connect signals coming from Facdebook authenticator
151 void signalsFromFacebookAuthenticator();
154 * @brief Connect signals coming from GPS
156 void signalsFromGPS();
159 * @brief Connect signals coming from MainWindow
161 void signalsFromMainWindow();
164 * @brief Connect signals coming from MapEngine
166 void signalsFromMapEngine();
169 * @brief Connect signals coming from MapView
171 void signalsFromMapView();
174 * @brief Connect signals coming from Situare
176 void signalsFromSituareService();
180 * @brief Set auto centering feature enabled / disabled
182 void changeAutoCenteringSetting(bool enabled);
185 * @brief Slot for disabling automatic centering when map is scrolled manually
187 void disableAutoCentering();
190 * @brief Slot for auto centering enabling.
192 * Calls gps to send last known position
194 * @param enabled true if auto centering was enabled, false otherwise
196 void enableAutoCentering(bool enabled);
199 * @brief Slot for gps enabling.
201 * @param enabled true if gps should be enabled, false otherwise
203 void enableGPS(bool enabled);
206 * @brief Sets zoom level to default when first GPS location is received if autocentering
209 * @param latLonCoordinate own location
210 * @param accuracy accuracy of GPS location
212 void setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy);
215 * @brief Slot for intercepting signal when credentials are invalid
218 void invalidCredentials();
220 /*******************************************************************************
222 ******************************************************************************/
225 * @brief Signals when new friends data is ready
227 * @param friendList List of User instances (friends)
229 void friendsLocationsReady(QList<User *> &friendList);
232 * @brief Signals when new user data is ready
234 * @param user Instance of User
236 void userLocationReady(User *user);
238 /*******************************************************************************
240 ******************************************************************************/
242 bool m_autoCenteringEnabled; ///< Auto centering enabled
243 bool m_loggedIn; ///< Login state
245 FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
246 GPSPosition *m_gps; ///< Instance of the gps position
247 MainWindow *m_ui; ///< Instance of the MainWindow UI
248 MapEngine *m_mapEngine; ///< MapEngine
249 SituareService *m_situareService; ///< Instance of the situare server communication service