diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-05-05 11:55:23 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-05-06 11:44:22 -0700 |
commit | 9298466037dd7ac80e65407eac93bfe62705f1ac (patch) | |
tree | d67e375d2d2aa285615c6cdc91ef3b1094841eb2 | |
parent | 16a35a8bbe2bd16398667795fe3f5c4a41beaf3e (diff) | |
download | subsurface-9298466037dd7ac80e65407eac93bfe62705f1ac.tar.gz |
desktop: update statistics tab when cylinders changed
The cylinder-based statistics where not updated when an undo
command edited cylinder data. Do so.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveStatistics.cpp | 11 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveStatistics.h | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 132dc2835..34478da64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +Desktop: update SAC fields and other statistics when editing cylinders Desktop: Reconnect the variations checkbox in planner Desktop: add support for dive mode on CSV import and export Desktop: fix profile display of planned dives with surface segments diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp index ffc2ad79e..83df3ab2c 100644 --- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp @@ -22,6 +22,9 @@ TabDiveStatistics::TabDiveStatistics(QWidget *parent) : TabBase(parent), ui(new ui->timeLimits->overrideAvgToolTipText(tr("Average length of all selected dives")); connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &TabDiveStatistics::divesChanged); + connect(&diveListNotifier, &DiveListNotifier::cylinderAdded, this, &TabDiveStatistics::cylinderChanged); + connect(&diveListNotifier, &DiveListNotifier::cylinderRemoved, this, &TabDiveStatistics::cylinderChanged); + connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &TabDiveStatistics::cylinderChanged); const auto l = findChildren<QLabel *>(QString(), Qt::FindDirectChildrenOnly); for (QLabel *label: l) { @@ -57,6 +60,14 @@ void TabDiveStatistics::divesChanged(const QVector<dive *> &dives, DiveField fie updateData(); } +void TabDiveStatistics::cylinderChanged(dive *d) +{ + // If the changed dive is not selected, do nothing + if (!d->selected) + return; + updateData(); +} + void TabDiveStatistics::updateData() { stats_t stats_selection; diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.h b/desktop-widgets/tab-widgets/TabDiveStatistics.h index 781478367..8d764d4ed 100644 --- a/desktop-widgets/tab-widgets/TabDiveStatistics.h +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.h @@ -19,6 +19,7 @@ public: private slots: void divesChanged(const QVector<dive *> &dives, DiveField field); + void cylinderChanged(dive *d); private: Ui::TabDiveStatistics *ui; |