aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-27 23:46:54 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commitff4924f650361695587e750fc4c3713107b94cfa (patch)
tree313454c793e7be163c95700380d44f4fc28855fb /mobile-widgets
parentf6e269c07a163c7c53e7d1cb405e39b51322b062 (diff)
downloadsubsurface-ff4924f650361695587e750fc4c3713107b94cfa.tar.gz
mapwidgethelper: change centerOnDiveSite()
Call setSelectedUuid() from C++ also center on coodinates instead on a MapLocation, as there is no point to pass the MapLocation object back to QML. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/MapWidget.qml5
-rw-r--r--mobile-widgets/qmlmapwidgethelper.cpp8
2 files changed, 8 insertions, 5 deletions
diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml
index 128423285..685bc0dc6 100644
--- a/mobile-widgets/qml/MapWidget.qml
+++ b/mobile-widgets/qml/MapWidget.qml
@@ -153,9 +153,8 @@ Item {
mapAnimationZoomOut.restart()
}
- function centerOnMapLocation(mapLocation) {
- mapHelper.model.setSelectedUuid(mapLocation.uuid, false)
- animateMapZoomIn(mapLocation.coordinate)
+ function centerOnCoordinate(coord) {
+ animateMapZoomIn(coord)
}
function deselectMapLocation() {
diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp
index f0855e52d..7a17feaa0 100644
--- a/mobile-widgets/qmlmapwidgethelper.cpp
+++ b/mobile-widgets/qmlmapwidgethelper.cpp
@@ -22,11 +22,15 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
{
if (!dive_site_has_gps_location(ds)) {
+ m_mapLocationModel->setSelectedUuid(ds ? ds->uuid : 0, false);
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
return;
}
- MapLocation *location = m_mapLocationModel->getMapLocationForUuid(ds->uuid);
- QMetaObject::invokeMethod(m_map, "centerOnMapLocation", Q_ARG(QVariant, QVariant::fromValue(location)));
+ m_mapLocationModel->setSelectedUuid(ds->uuid, false);
+ const qreal latitude = ds->latitude.udeg * 0.000001;
+ const qreal longitude = ds->longitude.udeg * 0.000001;
+ QGeoCoordinate dsCoord(latitude, longitude);
+ QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, QVariant::fromValue(dsCoord)));
}
void MapWidgetHelper::reloadMapLocations()