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;
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 Read settings and determine whether to use GPS and autocentering.
130 * When values does not found on the settings, GPS and autocentering are enabled as a default.
132 void initializeGpsAndAutocentering();
135 * @brief Connect signals coming from Facdebook authenticator
137 void signalsFromFacebookAuthenticator();
140 * @brief Connect signals coming from GPS
142 void signalsFromGPS();
145 * @brief Connect signals coming from MainWindow
147 void signalsFromMainWindow();
150 * @brief Connect signals coming from MapEngine
152 void signalsFromMapEngine();
155 * @brief Connect signals coming from MapView
157 void signalsFromMapView();
160 * @brief Connect signals coming from Situare
162 void signalsFromSituareService();
166 * @brief Set auto centering feature enabled / disabled
168 void changeAutoCenteringSetting(bool enabled);
171 * @brief Slot for disabling automatic centering when map is scrolled manually
173 void disableAutoCentering();
176 * @brief Slot for auto centering enabling.
178 * Calls gps to send last known position
180 * @param enabled true if auto centering was enabled, false otherwise
182 void enableAutoCentering(bool enabled);
185 * @brief Slot for gps enabling.
187 * @param enabled true if gps should be enabled, false otherwise
189 void enableGPS(bool enabled);
192 * @brief Sets zoom level to default when first GPS location is received if autocentering
195 * @param latLonCoordinate own location
196 * @param accuracy accuracy of GPS location
198 void setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy);
200 /*******************************************************************************
202 ******************************************************************************/
205 * @brief Signals when new friends data is ready
207 * @param friendList List of User instances (friends)
209 void friendsLocationsReady(QList<User *> &friendList);
212 * @brief Signals when new user data is ready
214 * @param user Instance of User
216 void userLocationReady(User *user);
218 /*******************************************************************************
220 ******************************************************************************/
222 bool m_autoCenteringEnabled; ///< Auto centering enabled
224 FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
225 GPSPosition *m_gps; ///< Instance of the gps position
226 MainWindow *m_ui; ///< Instance of the MainWindow UI
227 MapEngine *m_mapEngine; ///< MapEngine
228 SituareService *m_situareService; ///< Instance of the situare server communication service