USA.
*/
+#include "situarecommon.h"
#include "engine.h"
#include "ui/mainwindow.h"
#include "gps/gpspositioninterface.h"
#else
m_gps = new GPSPositionMockup(this);
#endif
+ m_gps->setMode(GPSPositionInterface::Default);
connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
m_situareService, SLOT(credentialsReady(FacebookCredentials)));
m_ui, SLOT(gpsError(QString)));
connect(m_ui, SIGNAL(enableGPS(bool)),
this, SLOT(enableGPS(bool)));
- connect(m_gps, SIGNAL(position(QPointF)),
- m_ui, SIGNAL(positionReceived(QPointF)));
+ connect(m_gps, SIGNAL(position(QPointF, qreal)),
+ m_ui, SIGNAL(positionReceived(QPointF, qreal)));
+ connect(m_ui, SIGNAL(enableAutoCentering(bool)),
+ this, SLOT(enableAutoCentering(bool)));
connect(m_facebookAuthenticator, SIGNAL(newLoginRequest(QUrl)),
m_ui, SLOT(startLoginProcess(QUrl)));
connect(m_facebookAuthenticator, SIGNAL(loginFailure()),
m_ui, SLOT(loginFailed()));
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+ QVariant gpsEnabled = settings.value(GPS_ENABLED);
+ QVariant autoCenteringEnabled = settings.value(AUTO_CENTERING_ENABLED);
+
+ enableGPS(gpsEnabled.toBool());
+ enableAutoCentering(autoCenteringEnabled.toBool());
+
m_facebookAuthenticator->start();
}
SituareEngine::~SituareEngine()
{
qDebug() << __PRETTY_FUNCTION__;
+
delete m_ui;
}
m_ui->show();
m_situareService->fetchLocations(); // request user locations
-
- //Debug, use settings instead
- enableGPS(true);
- m_ui->autoCenteringToggled(true);
}
void SituareEngine::requestAddress()
{
qDebug() << __PRETTY_FUNCTION__;
- if (enabled)
+ if (enabled) {
+ m_gps->lastPosition();
m_gps->start();
- else
+ m_ui->setGPSButton(true);
+ }
+ else {
m_gps->stop();
+ m_ui->setGPSButton(false);
+ }
+}
+
+void SituareEngine::enableAutoCentering(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (enabled) {
+ m_ui->setAutoCenteringButton(true);
+ m_ui->autoCenteringEnabled(true);
+ m_gps->lastPosition();
+ }
+ else {
+ m_ui->setAutoCenteringButton(false);
+ m_ui->autoCenteringEnabled(false);
+ }
}