summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-29 17:48:08 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commitbfb6a55707ffe1ffc36fddf2c98b9d5f91721317 (patch)
tree2d7e9bb954308f584bb3cd5c056c8695ca2706e3 /desktop-widgets/tab-widgets
parent4a3ffeba05fb90a1c9c29d939599bf770db5f0ce (diff)
downloadsubsurface-bfb6a55707ffe1ffc36fddf2c98b9d5f91721317.tar.gz
Undo: inform maintab if dive site changed
If a dive site was edited, the location field should be updated. Do this by hooking into the diveSiteChanged signal of DiveListNotifier. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp7
-rw-r--r--desktop-widgets/tab-widgets/maintab.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 37a42c2d3..9a5405583 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -82,6 +82,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &MainTab::divesChanged);
connect(&diveListNotifier, &DiveListNotifier::tripChanged, this, &MainTab::tripChanged);
+ connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &MainTab::diveSiteEdited);
connect(ui.editDiveSiteButton, &QToolButton::clicked, MainWindow::instance(), &MainWindow::startDiveSiteEdit);
connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex);
@@ -381,6 +382,12 @@ void MainTab::divesChanged(dive_trip *trip, const QVector<dive *> &dives, DiveFi
}
}
+void MainTab::diveSiteEdited(dive_site *ds, int)
+{
+ if (current_dive && current_dive->dive_site == ds)
+ updateDiveSite(current_dive);
+}
+
// This function gets called if a trip-field gets updated by an undo command.
// Refresh the corresponding UI field.
void MainTab::tripChanged(dive_trip *trip, TripField field)
diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h
index 6ae263332..67657fe8d 100644
--- a/desktop-widgets/tab-widgets/maintab.h
+++ b/desktop-widgets/tab-widgets/maintab.h
@@ -59,6 +59,7 @@ signals:
public
slots:
void divesChanged(dive_trip *trip, const QVector<dive *> &dives, DiveField field);
+ void diveSiteEdited(dive_site *ds, int field);
void tripChanged(dive_trip *trip, TripField field);
void addCylinder_clicked();
void addWeight_clicked();