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;
41 * @brief Engine class for Situare Application
43 * This class handles all the underlaying login of the Situare
46 class SituareEngine : public QObject
55 SituareEngine(QMainWindow *parent = 0);
62 /*******************************************************************************
63 * MEMBER FUNCTIONS AND SLOTS
64 ******************************************************************************/
67 * @brief Slot to intercept error signal from ImageFetcher and SituareService
69 * @param error Error message
71 void error(const QString &error);
74 * @brief Slot to intercept signal when username is fetched from settings
77 void fetchUsernameFromSettings();
80 * @brief Slot to intercept signal from successful login
82 * @param freshLogin Was login done via login dialog
84 void loginOk(bool freshLogin);
87 * @brief Slot to intercept signal when user has cancelled login process
89 void loginProcessCancelled();
92 * @brief Calls reverseGeo from SituareService to translate coordinates to street address
95 void requestAddress();
98 * @brief Calls updateLocation from SituareService to send the location update to
101 * @param status Status message
102 * @param publish Publish on Facebook
104 void requestUpdateLocation(const QString &status, bool publish);
107 * @brief Slot to refresh user data
109 void refreshUserData();
112 * @brief Slot to intercept signal from successful location update
115 void updateWasSuccessful();
118 * @brief Slot to intercept signal when new user data is available.
119 * Splits User and friendsList data and emits them as two different signals.
121 * @param user instance of User
122 * @param friendsList list of User instances (friends)
124 void userDataChanged(User *user, QList<User *> &friendsList);
128 * @brief Connect signals coming from Facdebook authenticator
130 void signalsFromFacebookAuthenticator();
133 * @brief Connect signals coming from GPS
135 void signalsFromGPS();
138 * @brief Connect signals coming from MainWindow
140 void signalsFromMainWindow();
143 * @brief Connect signals coming from MapEngine
145 void signalsFromMapEngine();
148 * @brief Connect signals coming from MapView
150 void signalsFromMapView();
153 * @brief Connect signals coming from Situare
155 void signalsFromSituareService();
159 * @brief Set auto centering feature enabled / disabled
161 void changeAutoCenteringSetting(bool enabled);
164 * @brief Slot for disabling automatic centering when map is scrolled manually
166 void disableAutoCentering();
169 * @brief Slot for auto centering enabling.
171 * Calls gps to send last known position
173 * @param enabled true if auto centering was enabled, false otherwise
175 void enableAutoCentering(bool enabled);
178 * @brief Slot for gps enabling.
180 * @param enabled true if gps should be enabled, false otherwise
182 void enableGPS(bool enabled);
184 /*******************************************************************************
186 ******************************************************************************/
189 * @brief Signals when new friends data is ready
191 * @param friendList List of User instances (friends)
193 void friendsLocationsReady(QList<User *> &friendList);
196 * @brief Signals when new user data is ready
198 * @param user Instance of User
200 void userLocationReady(User *user);
202 /*******************************************************************************
204 ******************************************************************************/
206 bool m_autoCenteringEnabled; ///< Auto centering enabled
208 FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
209 GPSPosition *m_gps; ///< Instance of the gps position
210 MainWindow *m_ui; ///< Instance of the MainWindow UI
211 MapEngine *m_mapEngine; ///< MapEngine
212 SituareService *m_situareService; ///< Instance of the situare server communication service