summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/gpslocation.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index da96928ea..dccfeb3b2 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -28,7 +28,7 @@ GpsLocation::GpsLocation(void (*showMsgCB)(const char *), QObject *parent) :
showMessageCB = showMsgCB;
// create a QSettings object that's separate from the main application settings
geoSettings = new QSettings(QSettings::NativeFormat, QSettings::UserScope,
- QString("org.subsurfacedivelog"), QString("subsurfacelocation"), this);
+ QStringLiteral("org.subsurfacedivelog"), QStringLiteral("subsurfacelocation"), this);
userAgent = getUserAgent();
(void)getGpsSource();
loadFromStorage();
@@ -58,7 +58,7 @@ void GpsLocation::setGpsTimeThreshold(int seconds)
{
if (m_GpsSource) {
m_GpsSource->setUpdateInterval(seconds * 1000);
- status(QString("Set GPS service update interval to %1 s").arg(m_GpsSource->updateInterval() / 1000));
+ status(QStringLiteral("Set GPS service update interval to %1 s").arg(m_GpsSource->updateInterval() / 1000));
}
}
@@ -88,7 +88,7 @@ QGeoPositionInfoSource *GpsLocation::getGpsSource()
#ifndef SUBSURFACE_MOBILE
if (verbose)
#endif
- status(QString("Created position source %1").arg(m_GpsSource->sourceName()));
+ status(QStringLiteral("Created position source %1").arg(m_GpsSource->sourceName()));
connect(m_GpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(newPosition(QGeoPositionInfo)));
connect(m_GpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
connect(m_GpsSource, SIGNAL(error(QGeoPositionInfoSource::Error)), this, SLOT(positionSourceError(QGeoPositionInfoSource::Error)));
@@ -120,7 +120,7 @@ void GpsLocation::serviceEnable(bool toggle)
}
if (toggle) {
gpsSource->startUpdates();
- status(QString("Starting Subsurface GPS service with update interval %1").arg(gpsSource->updateInterval()));
+ status(QStringLiteral("Starting Subsurface GPS service with update interval %1").arg(gpsSource->updateInterval()));
} else {
gpsSource->stopUpdates();
status("Stopping Subsurface GPS service");
@@ -172,7 +172,7 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
int64_t delta = (int64_t)pos.timestamp().toTime_t() + gettimezoneoffset() - lastTime;
if (!nr || waitingForPosition || delta > prefs.time_threshold ||
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
- QString msg("received new position %1 after delta %2 threshold %3 (now %4 last %5)");
+ QString msg = QStringLiteral("received new position %1 after delta %2 threshold %3 (now %4 last %5)");
status(qPrintable(msg.arg(pos.coordinate().toString()).arg(delta).arg(prefs.time_threshold).arg(pos.timestamp().toString()).arg(QDateTime().fromMSecsSinceEpoch(lastTime * 1000).toString())));
waitingForPosition = false;
acquiredPosition();
@@ -329,13 +329,13 @@ QMap<qint64, gpsTracker> GpsLocation::currentGPSInfo() const
void GpsLocation::loadFromStorage()
{
- int nr = geoSettings->value(QString("count")).toInt();
+ int nr = geoSettings->value(QStringLiteral("count")).toInt();
for (int i = 0; i < nr; i++) {
struct gpsTracker gt;
- gt.when = geoSettings->value(QString("gpsFix%1_time").arg(i)).toLongLong();
- gt.location.lat.udeg = geoSettings->value(QString("gpsFix%1_lat").arg(i)).toInt();
- gt.location.lon.udeg = geoSettings->value(QString("gpsFix%1_lon").arg(i)).toInt();
- gt.name = geoSettings->value(QString("gpsFix%1_name").arg(i)).toString();
+ gt.when = geoSettings->value(QStringLiteral("gpsFix%1_time").arg(i)).toLongLong();
+ gt.location.lat.udeg = geoSettings->value(QStringLiteral("gpsFix%1_lat").arg(i)).toInt();
+ gt.location.lon.udeg = geoSettings->value(QStringLiteral("gpsFix%1_lon").arg(i)).toInt();
+ gt.name = geoSettings->value(QStringLiteral("gpsFix%1_name").arg(i)).toString();
gt.idx = i;
m_trackers.insert(gt.when, gt);
}
@@ -348,10 +348,10 @@ void GpsLocation::replaceFixToStorage(gpsTracker &gt)
return;
}
gpsTracker replacedTracker = m_trackers.value(gt.when);
- geoSettings->setValue(QString("gpsFix%1_time").arg(replacedTracker.idx), gt.when);
- geoSettings->setValue(QString("gpsFix%1_lat").arg(replacedTracker.idx), gt.location.lat.udeg);
- geoSettings->setValue(QString("gpsFix%1_lon").arg(replacedTracker.idx), gt.location.lon.udeg);
- geoSettings->setValue(QString("gpsFix%1_name").arg(replacedTracker.idx), gt.name);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_time").arg(replacedTracker.idx), gt.when);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_lat").arg(replacedTracker.idx), gt.location.lat.udeg);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_lon").arg(replacedTracker.idx), gt.location.lon.udeg);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_name").arg(replacedTracker.idx), gt.name);
replacedTracker.location = gt.location;
replacedTracker.name = gt.name;
}
@@ -360,10 +360,10 @@ void GpsLocation::addFixToStorage(gpsTracker &gt)
{
int nr = m_trackers.count();
geoSettings->setValue("count", nr + 1);
- geoSettings->setValue(QString("gpsFix%1_time").arg(nr), gt.when);
- geoSettings->setValue(QString("gpsFix%1_lat").arg(nr), gt.location.lat.udeg);
- geoSettings->setValue(QString("gpsFix%1_lon").arg(nr), gt.location.lon.udeg);
- geoSettings->setValue(QString("gpsFix%1_name").arg(nr), gt.name);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_time").arg(nr), gt.when);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_lat").arg(nr), gt.location.lat.udeg);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_lon").arg(nr), gt.location.lon.udeg);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_name").arg(nr), gt.name);
gt.idx = nr;
geoSettings->sync();
m_trackers.insert(gt.when, gt);
@@ -377,26 +377,26 @@ void GpsLocation::deleteFixFromStorage(gpsTracker &gt)
qDebug() << "no gps fix with timestamp" << when;
return;
}
- if (geoSettings->value(QString("gpsFix%1_time").arg(gt.idx)).toLongLong() != when) {
+ if (geoSettings->value(QStringLiteral("gpsFix%1_time").arg(gt.idx)).toLongLong() != when) {
qDebug() << "uh oh - index for tracker has gotten out of sync...";
return;
}
if (cnt > 1) {
// now we move the last tracker into that spot (so our settings stay consecutive)
// and delete the last settings entry
- when = geoSettings->value(QString("gpsFix%1_time").arg(cnt - 1)).toLongLong();
+ when = geoSettings->value(QStringLiteral("gpsFix%1_time").arg(cnt - 1)).toLongLong();
struct gpsTracker movedTracker = m_trackers.value(when);
movedTracker.idx = gt.idx;
m_trackers.remove(movedTracker.when);
m_trackers.insert(movedTracker.when, movedTracker);
- geoSettings->setValue(QString("gpsFix%1_time").arg(movedTracker.idx), when);
- geoSettings->setValue(QString("gpsFix%1_lat").arg(movedTracker.idx), movedTracker.location.lat.udeg);
- geoSettings->setValue(QString("gpsFix%1_lon").arg(movedTracker.idx), movedTracker.location.lon.udeg);
- geoSettings->setValue(QString("gpsFix%1_name").arg(movedTracker.idx), movedTracker.name);
- geoSettings->remove(QString("gpsFix%1_lat").arg(cnt - 1));
- geoSettings->remove(QString("gpsFix%1_lon").arg(cnt - 1));
- geoSettings->remove(QString("gpsFix%1_time").arg(cnt - 1));
- geoSettings->remove(QString("gpsFix%1_name").arg(cnt - 1));
+ geoSettings->setValue(QStringLiteral("gpsFix%1_time").arg(movedTracker.idx), when);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_lat").arg(movedTracker.idx), movedTracker.location.lat.udeg);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_lon").arg(movedTracker.idx), movedTracker.location.lon.udeg);
+ geoSettings->setValue(QStringLiteral("gpsFix%1_name").arg(movedTracker.idx), movedTracker.name);
+ geoSettings->remove(QStringLiteral("gpsFix%1_lat").arg(cnt - 1));
+ geoSettings->remove(QStringLiteral("gpsFix%1_lon").arg(cnt - 1));
+ geoSettings->remove(QStringLiteral("gpsFix%1_time").arg(cnt - 1));
+ geoSettings->remove(QStringLiteral("gpsFix%1_name").arg(cnt - 1));
}
geoSettings->setValue("count", cnt - 1);
geoSettings->sync();
@@ -426,5 +426,5 @@ void GpsLocation::clearGpsData()
void GpsLocation::postError(QNetworkReply::NetworkError)
{
- status(QString("error when sending a GPS fix: %1").arg(reply->errorString()));
+ status(QStringLiteral("error when sending a GPS fix: %1").arg(reply->errorString()));
}