diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-25 20:46:12 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-29 00:09:31 +0000 |
commit | 75b5d61522f3721adb1761141ce1aeb79c3761c1 (patch) | |
tree | b9cb8f62df1d7fa2210b4b2c34ef8afb879bc5c1 /mobile-widgets/qml | |
parent | 872d56de0122036e1b9d37348d758b40dcd142d9 (diff) | |
download | subsurface-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 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 2 | ||||
-rw-r--r-- | mobile-widgets/qml/DiveDetailsView.qml | 4 | ||||
-rw-r--r-- | mobile-widgets/qml/MapPage.qml | 12 |
3 files changed, 9 insertions, 9 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index ea236dfaf..fbffa5303 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -180,7 +180,7 @@ Kirigami.Page { } onTriggered: { showMap() - mapPage.centerOnDiveSiteUUID(currentItem.modelData.dive.dive_site_uuid) + mapPage.centerOnDiveSite(currentItem.modelData.dive.dive_site) } } diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml index f80e4ce78..1060f5246 100644 --- a/mobile-widgets/qml/DiveDetailsView.qml +++ b/mobile-widgets/qml/DiveDetailsView.qml @@ -52,7 +52,7 @@ Item { enabled: dive.gps_decimal !== "" onClicked: { showMap() - mapPage.centerOnDiveSiteUUID(dive.dive_site_uuid) + mapPage.centerOnDiveSite(dive.dive_site) } } } @@ -63,7 +63,7 @@ Item { text: qsTr("Map it") onClicked: { showMap() - mapPage.centerOnDiveSiteUUID(dive.dive_site_uuid) + mapPage.centerOnDiveSite(dive.dive_site) } } Row { diff --git a/mobile-widgets/qml/MapPage.qml b/mobile-widgets/qml/MapPage.qml index 9497ca7fc..f000c2020 100644 --- a/mobile-widgets/qml/MapPage.qml +++ b/mobile-widgets/qml/MapPage.qml @@ -40,19 +40,19 @@ Kirigami.Page { mapWidget.mapHelper.reloadMapLocations() } - function centerOnDiveSiteUUID(uuid) { - if (!uuid) { - console.warn("main.qml: centerOnDiveSiteUUI(): uuid is undefined!") + function centerOnDiveSite(ds) { + if (!ds) { + console.warn("main.qml: centerOnDiveSite(): dive site is undefined!") return } // on firstRun, hard pan/center the map to the desired location so that // we don't start at an arbitrary location such as [0,0] or London. if (firstRun) { - var coord = mapWidget.mapHelper.getCoordinatesForUUID(uuid) + var coord = mapWidget.mapHelper.getCoordinates(ds) centerOnLocationHard(coord.latitude, coord.longitude) firstRun = false - } // continue here as centerOnDiveSiteUUID() also does marker selection. - mapWidget.mapHelper.centerOnDiveSiteUUID(uuid) + } // continue here as centerOnDiveSite() also does marker selection. + mapWidget.mapHelper.centerOnDiveSite(ds) } function centerOnLocation(lat, lon) { |