summaryrefslogtreecommitdiffstats
path: root/qt-ui/globe.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2015-06-05 10:52:52 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-07 08:04:32 -0700
commit6b81fb49d099f62c30fe52668c3a9bc74e46506f (patch)
treeb5d4a7d79ea8ed29b1eda9f4e774475bb21be83c /qt-ui/globe.cpp
parent218ad95d7de4da07262ad1244178ca6c8c3b30cf (diff)
downloadsubsurface-6b81fb49d099f62c30fe52668c3a9bc74e46506f.tar.gz
Always send the UUID of the coordinates to the globe
We were relying in the current_dive to display the globe coordinates correctly - but this is not always the case: you can be inserting a new dive site and it isn't yet inside of the dive until the user presses accept. So always pass the uuid of the dive site that we want to display. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/globe.cpp')
-rw-r--r--qt-ui/globe.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index f8bf1828a..1546a8bb5 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -235,25 +235,21 @@ void GlobeGPS::reload()
repopulateLabels();
}
-void GlobeGPS::centerOnCurrentDive()
+void GlobeGPS::centerOnDiveSite(uint32_t uuid)
{
- struct dive_site *ds = get_dive_site_for_dive(current_dive);
- // dive has changed, if we had the 'editingDive', hide it.
- if (messageWidget->isVisible() && (!ds || dive_site_has_gps_location(ds) || amount_selected != 1))
- messageWidget->hide();
-
- editingDiveLocation = false;
- if (!ds)
+ if (uuid == 0)
return;
- qreal longitude = ds->longitude.udeg / 1000000.0;
- qreal latitude = ds->latitude.udeg / 1000000.0;
+ struct dive_site *ds = get_dive_site_by_uuid(uuid);
if (!dive_site_has_gps_location(ds)) {
zoomOutForNoGPS();
return;
}
+ qreal longitude = ds->longitude.udeg / 1000000.0;
+ qreal latitude = ds->latitude.udeg / 1000000.0;
+
// if no zoom is set up, set the zoom as seen from 3km above
// if we come back from a dive without GPS data, reset to the last zoom value
// otherwise check to make sure we aren't still running an animation and then remember