From 9ef81d3ed38bd2e7498242095e1655d568c61f7e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 12 Feb 2015 12:57:58 -0800 Subject: Show GPS coordinates based on dive site on MainTab Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 48d2a0034..363ab3c43 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1286,8 +1286,14 @@ void MainTab::updateGpsCoordinates() if (editMode == NONE) enableEdition(); - ui.coordinates->setText(printGPSCoords(displayed_dive.latitude.udeg, displayed_dive.longitude.udeg)); - ui.coordinates->setModified(displayed_dive.latitude.udeg || displayed_dive.longitude.udeg); + struct dive_site *ds = get_dive_site_by_uuid(displayed_dive.dive_site_uuid); + if (ds && dive_site_has_gps_location(ds)) { + ui.coordinates->setText(printGPSCoords(ds->latitude.udeg, ds->longitude.udeg)); + ui.coordinates->setModified(true); + } else if (!ui.coordinates->text().isEmpty()) { + ui.coordinates->setModified(true); + ui.coordinates->clear(); + } } void MainTab::escDetected() -- cgit v1.2.3-70-g09d2