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;
45 * @brief Engine class for Situare Application
47 * This class handles all the underlaying login of the Situare
50 class SituareEngine : public QObject
59 SituareEngine(QMainWindow *parent = 0);
66 /*******************************************************************************
67 * MEMBER FUNCTIONS AND SLOTS
68 ******************************************************************************/
71 * @brief Slot to intercept error signal from ImageFetcher and SituareService
73 * @param error Error message
75 void error(const QString &error);
78 * @brief Slot to intercept signal when username is fetched from settings
81 void fetchUsernameFromSettings();
84 * @brief Slot to intercept signal when Login/Logout action is pressed
87 void loginActionPressed();
90 * @brief Slot to intercept signal from successful login
92 * @param freshLogin Was login done via login dialog
93 * @param credentials Facebook credentials
95 void loginOk(bool freshLogin, const FacebookCredentials &credentials);
98 * @brief Slot to intercept signal when user has cancelled login process
100 void loginProcessCancelled();
103 * @brief Changes application state when logged out
109 * @brief Calls reverseGeo from SituareService to translate coordinates to street address
112 void requestAddress();
115 * @brief Calls updateLocation from SituareService to send the location update to
118 * @param status Status message
119 * @param publish Publish on Facebook
121 void requestUpdateLocation(const QString &status = QString(), bool publish = false);
124 * @brief Slot to refresh user data
126 void refreshUserData();
129 * @brief Slot to intercept signal from successful location update
132 void updateWasSuccessful();
135 * @brief Slot to intercept signal when new user data is available.
136 * Splits User and friendsList data and emits them as two different signals.
138 * @param user instance of User
139 * @param friendsList list of User instances (friends)
141 void userDataChanged(User *user, QList<User *> &friendsList);
145 * @brief Connect signals coming from Facdebook authenticator
147 void signalsFromFacebookAuthenticator();
150 * @brief Connect signals coming from GPS
152 void signalsFromGPS();
155 * @brief Connect signals coming from MainWindow
157 void signalsFromMainWindow();
160 * @brief Connect signals coming from MapEngine
162 void signalsFromMapEngine();
165 * @brief Connect signals coming from MapView
167 void signalsFromMapView();
170 * @brief Connect signals coming from Situare
172 void signalsFromSituareService();
176 void automaticLocationUpdateIntervalSet(int updateIntervalMsecs);
178 void automaticUpdateIntervalTimerTimeout();
181 * @brief Set auto centering feature enabled / disabled
183 void changeAutoCenteringSetting(bool enabled);
186 * @brief Slot for disabling automatic centering when map is scrolled manually
188 void disableAutoCentering();
191 * @brief Slot for auto centering enabling.
193 * Calls gps to send last known position
195 * @param enabled true if auto centering was enabled, false otherwise
197 void enableAutoCentering(bool enabled);
200 * @brief Slot for gps enabling.
202 * @param enabled true if gps should be enabled, false otherwise
204 void enableGPS(bool enabled);
207 * @brief Slot for intercepting signal when credentials are invalid
210 void invalidCredentials();
212 /*******************************************************************************
214 ******************************************************************************/
217 * @brief Signals when new friends data is ready
219 * @param friendList List of User instances (friends)
221 void friendsLocationsReady(QList<User *> &friendList);
224 * @brief Signals when new user data is ready
226 * @param user Instance of User
228 void userLocationReady(User *user);
230 /*******************************************************************************
232 ******************************************************************************/
234 bool m_autoCenteringEnabled; ///< Auto centering enabled
235 bool m_loggedIn; ///< Login state
237 FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
238 GPSPosition *m_gps; ///< Instance of the gps position
239 MainWindow *m_ui; ///< Instance of the MainWindow UI
240 MapEngine *m_mapEngine; ///< MapEngine
241 SituareService *m_situareService; ///< Instance of the situare server communication service
243 QTimer *m_automaticUpdateIntervalTimer;