aboutsummaryrefslogtreecommitdiffstats
path: root/map-widget/qmlmapwidgethelper.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-25 20:46:12 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commit75b5d61522f3721adb1761141ce1aeb79c3761c1 (patch)
treeb9cb8f62df1d7fa2210b4b2c34ef8afb879bc5c1 /map-widget/qmlmapwidgethelper.cpp
parent872d56de0122036e1b9d37348d758b40dcd142d9 (diff)
downloadsubsurface-75b5d61522f3721adb1761141ce1aeb79c3761c1.tar.gz
Dive site: replace UUID by pointer in mobile code
Replace UUIDs by pointers to dive-site in mobile code. In both cases, the value is transported via a QVariant. The function getCoordinatesForUUID(), which was only used from mobile, can be replaced by a getCoordinatesFor() function taking a variant supposed to contain a dive-site pointer. Likewise, the variant of the centerOnDiveSite function is now supposed to wrap a pointer-to-divesite. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'map-widget/qmlmapwidgethelper.cpp')
-rw-r--r--map-widget/qmlmapwidgethelper.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp
index e4311cf83..a4960608a 100644
--- a/map-widget/qmlmapwidgethelper.cpp
+++ b/map-widget/qmlmapwidgethelper.cpp
@@ -22,19 +22,17 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
this, SLOT(selectedLocationChanged(MapLocation *)));
}
-QGeoCoordinate MapWidgetHelper::getCoordinatesForUUID(QVariant dive_site_uuid)
+QGeoCoordinate MapWidgetHelper::getCoordinates(QVariant dive_site)
{
- const uint32_t uuid = qvariant_cast<uint32_t>(dive_site_uuid);
- struct dive_site *ds = get_dive_site_by_uuid(uuid);
+ struct dive_site *ds = (struct dive_site *)dive_site.value<uintptr_t>();
if (!ds || !dive_site_has_gps_location(ds))
return QGeoCoordinate(0.0, 0.0);
return QGeoCoordinate(ds->location.lat.udeg * 0.000001, ds->location.lon.udeg * 0.000001);
}
-void MapWidgetHelper::centerOnDiveSiteUUID(QVariant dive_site_uuid)
+void MapWidgetHelper::centerOnDiveSite(QVariant dive_site)
{
- const uint32_t uuid = qvariant_cast<uint32_t>(dive_site_uuid);
- struct dive_site *ds = get_dive_site_by_uuid(uuid);
+ struct dive_site *ds = (struct dive_site *)dive_site.value<uintptr_t>();
if (ds)
centerOnDiveSite(ds);
}