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,
27 #include <QMessageBox>
28 #include <QNetworkReply>
31 #include "application.h"
35 #include "facebookservice/facebookauthentication.h"
36 #include "gps/gpsposition.h"
37 #include "map/mapengine.h"
38 #include "routing/routingservice.h"
40 #include "network/networkaccessmanager.h"
41 #include "situareservice/situareservice.h"
42 #include "ui/mainwindow.h"
46 const QString SETTINGS_GPS_ENABLED = "GPS_ENABLED"; ///< GPS setting
47 const QString SETTINGS_AUTO_CENTERING_ENABLED = "AUTO_CENTERING_ENABLED";///< Auto centering setting
48 const int DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE = 12; ///< Default zoom level when GPS available
49 const qreal USER_MOVEMENT_MINIMUM_LONGITUDE_DIFFERENCE = 0.003;///< Min value for user move latitude
50 const qreal USER_MOVEMENT_MINIMUM_LATITUDE_DIFFERENCE = 0.001;///< Min value for user move longitude
51 const int MIN_UPDATE_INTERVAL_MSECS = 5*60*1000;
53 SituareEngine::SituareEngine()
54 : //m_autoCenteringEnabled(false),
55 m_automaticUpdateFirstStart(true),
56 m_automaticUpdateRequest(false),
58 m_automaticUpdateIntervalTimer(0),
59 m_lastUpdatedGPSPosition(GeoCoordinate())
61 qDebug() << __PRETTY_FUNCTION__;
63 m_ui = new MainWindow;
64 m_ui->updateItemVisibility();
67 m_app = static_cast<Application *>(qApp);
68 m_app->registerWindow(m_ui->winId());
70 connect(m_app, SIGNAL(topmostChanged(bool)),
71 this, SLOT(enablePowerSave(bool)));
74 m_networkAccessManager = new NetworkAccessManager(this);
77 m_mapEngine = new MapEngine(this);
78 m_ui->setMapViewScene(m_mapEngine->scene());
81 m_gps = new GPSPosition(this);
83 // build SituareService
84 m_situareService = new SituareService(this);
86 // build FacebookAuthenticator
87 m_facebookAuthenticator = new FacebookAuthentication(this);
89 // build routing service
90 m_routingService = new RoutingService(this); // create this when needed, not in constructor!
91 connect(m_routingService, SIGNAL(routeParsed(Route&)),
92 m_mapEngine, SLOT(setRoute(Route&)));
95 signalsFromMapEngine();
97 signalsFromSituareService();
98 signalsFromMainWindow();
99 signalsFromFacebookAuthenticator();
101 connect(this, SIGNAL(userLocationReady(User*)),
102 m_ui, SIGNAL(userLocationReady(User*)));
104 connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
105 m_ui, SIGNAL(friendsLocationsReady(QList<User*>&)));
107 connect(this, SIGNAL(userLocationReady(User*)),
108 m_mapEngine, SLOT(receiveOwnLocation(User*)));
110 connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
111 m_mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
113 connect(this, SIGNAL(friendImageReady(User*)),
114 m_ui, SIGNAL(friendImageReady(User*)));
116 connect(this, SIGNAL(friendImageReady(User*)),
117 m_mapEngine, SIGNAL(friendImageReady(User*)));
119 m_automaticUpdateIntervalTimer = new QTimer(this);
120 connect(m_automaticUpdateIntervalTimer, SIGNAL(timeout()),
121 this, SLOT(startAutomaticUpdate()));
123 // signals connected, now it's time to show the main window
124 // but init the MapEngine before so starting location is set
128 m_facebookAuthenticator->start();
130 m_gps->setMode(GPSPosition::Default);
131 initializeGpsAndAutocentering();
133 m_mce = new MCE(this);
134 connect(m_mce, SIGNAL(displayOff(bool)), this, SLOT(enablePowerSave(bool)));
136 /// @todo for testing, remove after real route start and end points are available
137 //m_routingService->requestRoute(QPointF(65.010193,25.509859), QPointF(65.015152, 25.46645));
140 SituareEngine::~SituareEngine()
142 qDebug() << __PRETTY_FUNCTION__;
146 QSettings settings(DIRECTORY_NAME, FILE_NAME);
147 settings.setValue(SETTINGS_GPS_ENABLED, m_gps->isRunning());
148 // settings.setValue(SETTINGS_AUTO_CENTERING_ENABLED, m_autoCenteringEnabled);
151 //void SituareEngine::changeAutoCenteringSetting(bool enabled)
153 // qDebug() << __PRETTY_FUNCTION__;
155 // m_autoCenteringEnabled = enabled;
156 // enableAutoCentering(enabled);
159 //void SituareEngine::disableAutoCentering()
161 // qDebug() << __PRETTY_FUNCTION__;
163 // changeAutoCenteringSetting(false);
164 // m_ui->buildInformationBox(tr("Auto centering disabled"));
167 //void SituareEngine::enableAutoCentering(bool enabled)
169 // qDebug() << __PRETTY_FUNCTION__;
171 // m_ui->setAutoCenteringButtonEnabled(enabled);
172 // m_mapEngine->setAutoCentering(enabled);
175 // m_gps->requestLastPosition();
178 void SituareEngine::enableGPS(bool enabled)
180 qDebug() << __PRETTY_FUNCTION__;
182 m_ui->setOwnLocationCrosshairVisibility(!enabled);
184 if (m_gps->isInitialized()) {
185 m_ui->setGPSButtonEnabled(enabled);
186 m_mapEngine->setGPSEnabled(enabled);
188 if (enabled && !m_gps->isRunning()) {
190 // enableAutoCentering(m_autoCenteringEnabled);
191 m_gps->requestLastPosition();
193 if(m_ui->loginState())
194 m_ui->readAutomaticLocationUpdateSettings();
196 else if (!enabled && m_gps->isRunning()) {
198 // enableAutoCentering(false);
199 enableAutomaticLocationUpdate(false);
204 m_ui->buildInformationBox(tr("Unable to start GPS"));
205 m_ui->setGPSButtonEnabled(false);
206 m_mapEngine->setGPSEnabled(false);
210 void SituareEngine::enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs)
212 qDebug() << __PRETTY_FUNCTION__;
214 //Show automatic update confirmation dialog
215 if (m_automaticUpdateFirstStart && m_gps->isRunning() && enabled) {
216 m_ui->showEnableAutomaticUpdateLocationDialog(
217 tr("Do you want to enable automatic location update with %1 min update interval?")
218 .arg(updateIntervalMsecs/1000/60));
219 m_automaticUpdateFirstStart = false;
221 if (enabled && m_gps->isRunning()) {
222 m_ui->buildInformationBox(tr("Automatic location update enabled"));
223 if (updateIntervalMsecs < MIN_UPDATE_INTERVAL_MSECS)
224 m_automaticUpdateIntervalTimer->setInterval(MIN_UPDATE_INTERVAL_MSECS);
226 m_automaticUpdateIntervalTimer->setInterval(updateIntervalMsecs);
228 connect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
229 this, SLOT(requestAutomaticUpdateIfMoved(GeoCoordinate)));
231 m_automaticUpdateIntervalTimer->start();
234 disconnect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
235 this, SLOT(requestAutomaticUpdateIfMoved(GeoCoordinate)));
237 m_automaticUpdateIntervalTimer->stop();
242 void SituareEngine::enablePowerSave(bool enabled)
244 qDebug() << __PRETTY_FUNCTION__;
246 m_gps->enablePowerSave(enabled);
248 // if(m_autoCenteringEnabled)
249 // m_mapEngine->setAutoCentering(!enabled);
252 void SituareEngine::error(const int context, const int error)
254 qDebug() << __PRETTY_FUNCTION__;
258 case SituareError::ERROR_GENERAL:
259 if(context == ErrorContext::SITUARE) {
260 m_ui->toggleProgressIndicator(false);
261 m_ui->buildInformationBox(tr("Unknown server error"), true);
264 case 1: //errors: SituareError::ERROR_MISSING_ARGUMENT and QNetworkReply::ConnectionRefusedError
265 m_ui->toggleProgressIndicator(false);
266 if(context == ErrorContext::SITUARE) {
267 m_ui->buildInformationBox(tr("Missing parameter from request"), true);
268 } else if(context == ErrorContext::NETWORK) {
269 m_ui->buildInformationBox(tr("Connection refused by the server"), true);
272 case QNetworkReply::RemoteHostClosedError:
273 if(context == ErrorContext::NETWORK) {
274 m_ui->toggleProgressIndicator(false);
275 m_ui->buildInformationBox(tr("Connection closed by the server"), true);
278 case QNetworkReply::HostNotFoundError:
279 if(context == ErrorContext::NETWORK) {
280 m_ui->toggleProgressIndicator(false);
281 m_ui->buildInformationBox(tr("Remote server not found"), true);
284 case QNetworkReply::TimeoutError:
285 if(context == ErrorContext::NETWORK) {
286 m_ui->toggleProgressIndicator(false);
287 m_ui->buildInformationBox(tr("Connection timed out"), true);
290 case QNetworkReply::UnknownNetworkError:
291 if(context == ErrorContext::NETWORK) {
292 m_ui->toggleProgressIndicator(false);
293 m_ui->buildInformationBox(tr("No network connection"), true);
296 case SituareError::SESSION_EXPIRED:
297 m_ui->buildInformationBox(tr("Session expired. Please login again"), true);
298 m_facebookAuthenticator->clearAccountInformation(true); // keep username = true
299 m_situareService->clearUserData();
300 m_ui->loggedIn(false);
303 case SituareError::LOGIN_FAILED:
304 m_ui->toggleProgressIndicator(false);
305 m_ui->buildInformationBox(tr("Invalid E-mail address or password"), true);
308 case SituareError::UPDATE_FAILED:
309 m_ui->toggleProgressIndicator(false);
310 m_ui->buildInformationBox(tr("Update failed, please try again"), true);
312 case SituareError::DATA_RETRIEVAL_FAILED:
313 m_ui->toggleProgressIndicator(false);
314 m_ui->buildInformationBox(tr("Data retrieval failed, please try again"), true);
316 case SituareError::ADDRESS_RETRIEVAL_FAILED:
317 case SituareError::ERROR_GEOLOCATION_REQUEST_FAIL:
318 case SituareError::ERROR_GEOLOCATION_LONLAT_INVALID:
319 m_ui->toggleProgressIndicator(false);
320 m_ui->buildInformationBox(tr("Address retrieval failed"), true);
322 case SituareError::IMAGE_DOWNLOAD_FAILED:
323 m_ui->buildInformationBox(tr("Image download failed"), true);
325 case SituareError::MAP_IMAGE_DOWNLOAD_FAILED:
326 m_ui->buildInformationBox(tr("Map image download failed"), true);
328 case SituareError::GPS_INITIALIZATION_FAILED:
330 m_ui->buildInformationBox(tr("GPS initialization failed"), true);
332 case SituareError::INVALID_JSON:
333 m_ui->buildInformationBox(tr("Malformatted reply from server"), true);
334 m_ui->loggedIn(false);
335 m_facebookAuthenticator->clearAccountInformation(false); // clean all
337 case SituareError::ERROR_GEOLOCATION_SERVER_UNAVAILABLE:
338 m_ui->toggleProgressIndicator(false);
339 m_ui->buildInformationBox(tr("Address server not responding"), true);
342 m_ui->toggleProgressIndicator(false);
343 if(context == ErrorContext::NETWORK)
344 qCritical() << "QNetworkReply::NetworkError: " << error;
346 qCritical() << "Unknown error: " << error;
352 void SituareEngine::fetchUsernameFromSettings()
354 qDebug() << __PRETTY_FUNCTION__;
356 m_ui->setUsername(m_facebookAuthenticator->loadUsername());
359 void SituareEngine::imageReady(User *user)
361 qDebug() << __PRETTY_FUNCTION__;
364 emit userLocationReady(user);
366 emit friendImageReady(user);
369 void SituareEngine::initializeGpsAndAutocentering()
371 qDebug() << __PRETTY_FUNCTION__;
373 QSettings settings(DIRECTORY_NAME, FILE_NAME);
374 QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
375 // QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
377 if (m_gps->isInitialized()) {
379 if (gpsEnabled.toString().isEmpty()) { // First start. Situare.conf file does not exists
381 connect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
382 this, SLOT(setFirstStartZoomLevel()));
384 // changeAutoCenteringSetting(true);
387 m_ui->buildInformationBox(tr("GPS enabled"));
388 m_ui->buildInformationBox(tr("Auto centering enabled"));
390 } else { // Normal start
391 // changeAutoCenteringSetting(autoCenteringEnabled.toBool());
392 enableGPS(gpsEnabled.toBool());
394 if (gpsEnabled.toBool())
395 m_ui->buildInformationBox(tr("GPS enabled"));
397 if (gpsEnabled.toBool()) /*&& autoCenteringEnabled.toBool())*/
398 m_ui->buildInformationBox(tr("Auto centering enabled"));
405 void SituareEngine::loginActionPressed()
407 qDebug() << __PRETTY_FUNCTION__;
409 if (m_networkAccessManager->isConnected()) {
410 if(m_ui->loginState()) {
412 m_situareService->clearUserData();
414 m_facebookAuthenticator->start();
418 error(ErrorContext::NETWORK, QNetworkReply::UnknownNetworkError);
422 void SituareEngine::loginOk()
424 qDebug() << __PRETTY_FUNCTION__;
426 m_ui->loggedIn(true);
429 m_situareService->fetchLocations(); // request user locations
431 if (m_gps->isRunning())
432 m_ui->readAutomaticLocationUpdateSettings();
435 void SituareEngine::loginProcessCancelled()
437 qDebug() << __PRETTY_FUNCTION__;
439 m_ui->toggleProgressIndicator(false);
440 m_ui->updateItemVisibility();
443 void SituareEngine::logout()
445 qDebug() << __PRETTY_FUNCTION__;
447 m_ui->loggedIn(false);
449 // signal to clear locationUpdateDialog's data
450 connect(this, SIGNAL(clearUpdateLocationDialogData()),
451 m_ui, SIGNAL(clearUpdateLocationDialogData()));
452 emit clearUpdateLocationDialogData();
454 m_facebookAuthenticator->clearAccountInformation(); // clear all
455 m_automaticUpdateFirstStart = true;
458 void SituareEngine::refreshUserData()
460 qDebug() << __PRETTY_FUNCTION__;
462 if (m_networkAccessManager->isConnected()) {
463 m_ui->toggleProgressIndicator(true);
464 m_situareService->fetchLocations();
467 error(ErrorContext::NETWORK, QNetworkReply::UnknownNetworkError);
471 void SituareEngine::requestAddress()
473 qDebug() << __PRETTY_FUNCTION__;
475 if (m_networkAccessManager->isConnected()) {
476 if (m_gps->isRunning())
477 m_situareService->reverseGeo(m_gps->lastPosition());
479 m_situareService->reverseGeo(m_mapEngine->centerGeoCoordinate());
482 error(ErrorContext::NETWORK, QNetworkReply::UnknownNetworkError);
486 void SituareEngine::requestUpdateLocation(const QString &status, bool publish)
488 qDebug() << __PRETTY_FUNCTION__;
490 if (m_networkAccessManager->isConnected()) {
491 m_ui->toggleProgressIndicator(true);
493 if (m_gps->isRunning())
494 m_situareService->updateLocation(m_gps->lastPosition(), status, publish);
496 m_situareService->updateLocation(m_mapEngine->centerGeoCoordinate(), status, publish);
499 error(ErrorContext::NETWORK, QNetworkReply::UnknownNetworkError);
503 void SituareEngine::requestAutomaticUpdateIfMoved(GeoCoordinate position)
505 qDebug() << __PRETTY_FUNCTION__;
507 if ((fabs(m_lastUpdatedGPSPosition.longitude() - position.longitude()) >
508 USER_MOVEMENT_MINIMUM_LONGITUDE_DIFFERENCE) ||
509 (fabs(m_lastUpdatedGPSPosition.latitude() - position.latitude()) >
510 USER_MOVEMENT_MINIMUM_LATITUDE_DIFFERENCE)) {
512 m_lastUpdatedGPSPosition = position;
516 if (m_automaticUpdateRequest && m_userMoved) {
517 requestUpdateLocation(tr("Automatic location update"));
518 m_automaticUpdateRequest = false;
523 void SituareEngine::setFirstStartZoomLevel()
525 qDebug() << __PRETTY_FUNCTION__;
527 // if (m_autoCenteringEnabled) // autocentering is disabled when map is scrolled
528 // m_mapEngine->setZoomLevel(DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE);
530 disconnect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
531 this, SLOT(setFirstStartZoomLevel()));
534 void SituareEngine::signalsFromFacebookAuthenticator()
536 qDebug() << __PRETTY_FUNCTION__;
538 connect(m_facebookAuthenticator, SIGNAL(error(int, int)),
539 this, SLOT(error(int, int)));
541 connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
542 m_situareService, SLOT(credentialsReady(FacebookCredentials)));
544 connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
545 this, SLOT(loginOk()));
547 connect(m_facebookAuthenticator, SIGNAL(newLoginRequest()),
548 m_ui, SLOT(startLoginProcess()));
550 connect(m_facebookAuthenticator, SIGNAL(saveCookiesRequest()),
551 m_ui, SLOT(saveCookies()));
553 connect(m_facebookAuthenticator, SIGNAL(loginUsingCookies()),
554 m_ui, SLOT(loginUsingCookies()));
557 void SituareEngine::signalsFromGPS()
559 qDebug() << __PRETTY_FUNCTION__;
561 connect(m_gps, SIGNAL(position(GeoCoordinate, qreal)),
562 m_mapEngine, SLOT(gpsPositionUpdate(GeoCoordinate, qreal)));
564 connect(m_gps, SIGNAL(timeout()),
565 m_ui, SLOT(gpsTimeout()));
567 connect(m_gps, SIGNAL(error(int, int)),
568 this, SLOT(error(int, int)));
571 void SituareEngine::signalsFromMainWindow()
573 qDebug() << __PRETTY_FUNCTION__;
575 connect(m_ui, SIGNAL(error(int, int)),
576 this, SLOT(error(int, int)));
578 connect(m_ui, SIGNAL(fetchUsernameFromSettings()),
579 this, SLOT(fetchUsernameFromSettings()));
581 connect(m_ui, SIGNAL(loginActionPressed()),
582 this, SLOT(loginActionPressed()));
584 connect(m_ui, SIGNAL(saveUsername(QString)),
585 m_facebookAuthenticator, SLOT(saveUsername(QString)));
587 connect(m_ui, SIGNAL(updateCredentials(QUrl)),
588 m_facebookAuthenticator, SLOT(updateCredentials(QUrl)));
590 // signals from map view
591 connect(m_ui, SIGNAL(mapViewScrolled(SceneCoordinate)),
592 m_mapEngine, SLOT(setCenterPosition(SceneCoordinate)));
594 connect(m_ui, SIGNAL(mapViewResized(QSize)),
595 m_mapEngine, SLOT(viewResized(QSize)));
597 connect(m_ui, SIGNAL(viewZoomFinished()),
598 m_mapEngine, SLOT(viewZoomFinished()));
600 // signals from zoom buttons (zoom panel and volume buttons)
601 connect(m_ui, SIGNAL(zoomIn()),
602 m_mapEngine, SLOT(zoomIn()));
604 connect(m_ui, SIGNAL(zoomOut()),
605 m_mapEngine, SLOT(zoomOut()));
607 // signals from menu buttons
608 // connect(m_ui, SIGNAL(autoCenteringTriggered(bool)),
609 // this, SLOT(changeAutoCenteringSetting(bool)));
611 connect(m_ui, SIGNAL(gpsTriggered(bool)),
612 this, SLOT(enableGPS(bool)));
614 //signals from dialogs
615 connect(m_ui, SIGNAL(cancelLoginProcess()),
616 this, SLOT(loginProcessCancelled()));
618 connect(m_ui, SIGNAL(requestReverseGeo()),
619 this, SLOT(requestAddress()));
621 connect(m_ui, SIGNAL(statusUpdate(QString,bool)),
622 this, SLOT(requestUpdateLocation(QString,bool)));
624 connect(m_ui, SIGNAL(enableAutomaticLocationUpdate(bool, int)),
625 this, SLOT(enableAutomaticLocationUpdate(bool, int)));
627 // signals from user info tab
628 connect(m_ui, SIGNAL(refreshUserData()),
629 this, SLOT(refreshUserData()));
631 connect(m_ui, SIGNAL(findUser(GeoCoordinate)),
632 m_mapEngine, SLOT(centerToCoordinates(GeoCoordinate)));
634 // signals from friend list tab
635 connect(m_ui, SIGNAL(findFriend(GeoCoordinate)),
636 m_mapEngine, SLOT(centerToCoordinates(GeoCoordinate)));
639 void SituareEngine::signalsFromMapEngine()
641 qDebug() << __PRETTY_FUNCTION__;
643 connect(m_mapEngine, SIGNAL(error(int, int)),
644 this, SLOT(error(int, int)));
646 connect(m_mapEngine, SIGNAL(locationChanged(SceneCoordinate)),
647 m_ui, SIGNAL(centerToSceneCoordinates(SceneCoordinate)));
649 connect(m_mapEngine, SIGNAL(zoomLevelChanged(int)),
650 m_ui, SIGNAL(zoomLevelChanged(int)));
652 // connect(m_mapEngine, SIGNAL(mapScrolledManually()),
653 // this, SLOT(disableAutoCentering()));
655 connect(m_mapEngine, SIGNAL(maxZoomLevelReached()),
656 m_ui, SIGNAL(maxZoomLevelReached()));
658 connect(m_mapEngine, SIGNAL(minZoomLevelReached()),
659 m_ui, SIGNAL(minZoomLevelReached()));
661 connect(m_mapEngine, SIGNAL(locationItemClicked(QList<QString>)),
662 m_ui, SIGNAL(locationItemClicked(QList<QString>)));
664 connect(m_mapEngine, SIGNAL(newMapResolution(qreal)),
665 m_ui, SIGNAL(newMapResolution(qreal)));
668 void SituareEngine::signalsFromSituareService()
670 qDebug() << __PRETTY_FUNCTION__;
672 connect(m_situareService, SIGNAL(error(int, int)),
673 this, SLOT(error(int, int)));
675 connect(m_situareService, SIGNAL(imageReady(User*)),
676 this, SLOT(imageReady(User*)));
678 connect(m_situareService, SIGNAL(reverseGeoReady(QString)),
679 m_ui, SIGNAL(reverseGeoReady(QString)));
681 connect(m_situareService, SIGNAL(userDataChanged(User*, QList<User*>&)),
682 this, SLOT(userDataChanged(User*, QList<User*>&)));
684 connect(m_situareService, SIGNAL(updateWasSuccessful()),
685 this, SLOT(updateWasSuccessful()));
687 connect(m_situareService, SIGNAL(updateWasSuccessful()),
688 m_ui, SIGNAL(clearUpdateLocationDialogData()));
691 void SituareEngine::startAutomaticUpdate()
693 qDebug() << __PRETTY_FUNCTION__;
695 m_gps->requestUpdate();
696 m_automaticUpdateRequest = true;
699 void SituareEngine::updateWasSuccessful()
701 qDebug() << __PRETTY_FUNCTION__;
703 if (m_networkAccessManager->isConnected())
704 m_situareService->fetchLocations();
706 error(ErrorContext::NETWORK, QNetworkReply::UnknownNetworkError);
709 void SituareEngine::userDataChanged(User *user, QList<User *> &friendsList)
711 qDebug() << __PRETTY_FUNCTION__;
713 m_ui->toggleProgressIndicator(false);
716 emit userLocationReady(user);
717 emit friendsLocationsReady(friendsList);