summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/locationinformation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/locationinformation.cpp')
-rw-r--r--desktop-widgets/locationinformation.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index ea52dd8c6..d827f5006 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -8,6 +8,7 @@
#include "qt-models/filtermodels.h"
#include "core/divesitehelpers.h"
#include "desktop-widgets/modeldelegates.h"
+#include "core/subsurface-qt/DiveListNotifier.h"
#include <QDebug>
#include <QShowEvent>
@@ -38,6 +39,8 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
connect(ui.diveSiteCoordinates, SIGNAL(returnPressed()), this, SLOT(updateLocationOnMap()));
ui.diveSiteCoordinates->installEventFilter(this);
+ connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &LocationInformationWidget::diveSiteChanged);
+
ui.diveSiteListView->setModel(&filter_model);
ui.diveSiteListView->setModelColumn(LocationInformationModel::NAME);
ui.diveSiteListView->installEventFilter(this);
@@ -121,6 +124,18 @@ void LocationInformationWidget::updateLabels()
ui.locationTags->setText(constructLocationTags(&taxonomy, false));
}
+void LocationInformationWidget::diveSiteChanged(struct dive_site *ds, int field)
+{
+ if (diveSite != ds)
+ return; // A different dive site was changed -> do nothing.
+ switch (field) {
+ case LocationInformationModel::NAME:
+ ui.diveSiteName->setText(diveSite->name);
+ default:
+ return;
+ }
+}
+
void LocationInformationWidget::clearLabels()
{
ui.diveSiteName->clear();