mobile: get GPS data from dive site name

When the user entered a dive site using autocompletion, it
is a known site, of which we might have a GPS location already.
Just fill the known site coordinates.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-11-22 19:22:02 +01:00 committed by Dirk Hohndel
parent 64704d6e5a
commit 806c7077f2
3 changed files with 16 additions and 0 deletions

View file

@ -112,6 +112,9 @@ Item {
diveDetailsListView.currentItem.modelData.dive.locationList : null
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
onEditingFinished: {
gpsText = manager.getGpsFromSiteName(text)
}
}
Controls.Label {

View file

@ -1536,6 +1536,18 @@ QString QMLManager::getVersion() const
return versionRe.cap(1);
}
QString QMLManager::getGpsFromSiteName(const QString& siteName)
{ uint32_t uuid;
struct dive_site *ds;
uuid = get_dive_site_uuid_by_name(qPrintable(siteName), NULL);
if (uuid) {
ds = get_dive_site_by_uuid(uuid);
return QString(printGPSCoords(ds->latitude.udeg, ds->longitude.udeg));
}
return "";
}
QString QMLManager::notificationText() const
{
return m_notificationText;

View file

@ -184,6 +184,7 @@ public slots:
QString getNumber(const QString& diveId);
QString getDate(const QString& diveId);
QString getCurrentPosition();
QString getGpsFromSiteName(const QString& siteName);
QString getVersion() const;
void deleteGpsFix(quint64 when);
void revertToNoCloudIfNeeded();