diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-27 06:29:14 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-27 10:16:25 -0800 |
commit | 4abe73ff2af49431d131f0d42fd10aa6f61b0125 (patch) | |
tree | 28e27f5c20c73d077db8c104694d2f11d88e6533 | |
parent | a74175324a141a519f6d11bf998f08e835bc1bb7 (diff) | |
download | subsurface-4abe73ff2af49431d131f0d42fd10aa6f61b0125.tar.gz |
QML UI: on edit only request location if user checks the box
The code inexplicably always checked for a gps location. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 5cff8f7d4..fb3c6de51 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -374,25 +374,27 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location ds = get_dive_site_by_uuid(create_dive_site(qPrintable(location), d->when)); d->dive_site_uuid = ds->uuid; } - QString gpsString = getCurrentPosition(); - if (gpsString != QString("waiting for the next gps location")) { - qDebug() << "from commitChanges call to getCurrentPosition returns" << gpsString; - double lat, lon; - if (parseGpsText(qPrintable(gpsString), &lat, &lon)) { - struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid); - if (ds) { - ds->latitude.udeg = lat * 1000000; - ds->longitude.udeg = lon * 1000000; - } else { - degrees_t latData, lonData; - latData.udeg = lat; - lonData.udeg = lon; - d->dive_site_uuid = create_dive_site_with_gps("new site", latData, lonData, d->when); + if (!gps.isEmpty()) { + QString gpsString = getCurrentPosition(); + if (gpsString != QString("waiting for the next gps location")) { + qDebug() << "from commitChanges call to getCurrentPosition returns" << gpsString; + double lat, lon; + if (parseGpsText(qPrintable(gpsString), &lat, &lon)) { + struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid); + if (ds) { + ds->latitude.udeg = lat * 1000000; + ds->longitude.udeg = lon * 1000000; + } else { + degrees_t latData, lonData; + latData.udeg = lat; + lonData.udeg = lon; + d->dive_site_uuid = create_dive_site_with_gps("new site", latData, lonData, d->when); + } + qDebug() << "set up dive site with new GPS data"; } - qDebug() << "set up dive site with new GPS data"; + } else { + qDebug() << "still don't have a position - will need to implement some sort of callback"; } - } else { - qDebug() << "still don't have a position - will need to implement some sort of callback"; } if (get_dive_duration_string(d->duration.seconds, tr("h:"), tr("min")) != duration) { diveChanged = true; |