From b342730ec958a6127cfef4e5459cfea96477ac42 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 22 May 2015 11:56:03 -0700 Subject: Location management: actually parse the GPS coordinates We still don't respond correctly to a user changing them (i.e., the map doesn't change), but at least once they change the dive to a different dive and back to this one things get done correctly. Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 18f780983..d20a6efc6 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -207,10 +207,18 @@ void LocationInformationWidget::enableEdition() ui.diveSiteMessage->setCloseButtonVisible(false); } +extern bool parseGpsText(const QString &gps_text, double *latitude, double *longitude); + void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString& text) { - if (!same_string(qPrintable(text), printGPSCoords(currentDs->latitude.udeg, currentDs->longitude.udeg))) - markChangedWidget(ui.diveSiteCoordinates); + if (!same_string(qPrintable(text), printGPSCoords(currentDs->latitude.udeg, currentDs->longitude.udeg))) { + double latitude, longitude; + if (parseGpsText(text, &latitude, &longitude)) { + displayed_dive_site.latitude.udeg = latitude * 1000000; + displayed_dive_site.longitude.udeg = longitude * 1000000; + markChangedWidget(ui.diveSiteCoordinates); + } + } } void LocationInformationWidget::on_diveSiteDescription_textChanged(const QString& text) -- cgit v1.2.3-70-g09d2