summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mapwidget.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-14 22:48:03 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit0b851d723e1b57fd2065c268977e023cfb364066 (patch)
tree332265f1cb2fcc9adeab29936ad50ebb9cecaaa5 /desktop-widgets/mapwidget.cpp
parentfa4fedbb488eacff72d5d8691b4da8b34634a71e (diff)
downloadsubsurface-0b851d723e1b57fd2065c268977e023cfb364066.tar.gz
Undo: update map when dive site location is changed by undo command
Simply hook into the appropriate signal. Thus, the "update dive site location" button can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mapwidget.cpp')
-rw-r--r--desktop-widgets/mapwidget.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp
index 3d2abf0b2..c7b4a08ad 100644
--- a/desktop-widgets/mapwidget.cpp
+++ b/desktop-widgets/mapwidget.cpp
@@ -6,6 +6,7 @@
#include "mapwidget.h"
#include "core/divesite.h"
+#include "core/subsurface-qt/DiveListNotifier.h"
#include "map-widget/qmlmapwidgethelper.h"
#include "qt-models/maplocationmodel.h"
#include "qt-models/divelocationmodel.h"
@@ -28,6 +29,7 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
m_mapHelper = nullptr;
setResizeMode(QQuickWidget::SizeRootObjectToView);
connect(this, &QQuickWidget::statusChanged, this, &MapWidget::doneLoading);
+ connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &MapWidget::diveSiteChanged);
setSource(urlMapWidget);
}
@@ -116,10 +118,11 @@ void MapWidget::coordinatesChangedLocal(const location_t &location)
emit coordinatesChanged(location);
}
-void MapWidget::updateDiveSiteCoordinates(struct dive_site *ds, const location_t &location)
+void MapWidget::diveSiteChanged(struct dive_site *ds, int field)
{
CHECK_IS_READY_RETURN_VOID();
- m_mapHelper->updateDiveSiteCoordinates(ds, location);
+ if (field == LocationInformationModel::LOCATION)
+ m_mapHelper->updateDiveSiteCoordinates(ds, ds->location);
}
MapWidget::~MapWidget()