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>
This commit is contained in:
Berthold Stoeger 2020-05-05 11:55:23 +02:00 committed by Dirk Hohndel
parent 16a35a8bbe
commit 9298466037
3 changed files with 13 additions and 0 deletions

View file

@ -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

View file

@ -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;

View file

@ -19,6 +19,7 @@ public:
private slots:
void divesChanged(const QVector<dive *> &dives, DiveField field);
void cylinderChanged(dive *d);
private:
Ui::TabDiveStatistics *ui;