From 0b0e6672d5622238c2fb583dad6b51813b9338b3 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 27 Jan 2021 23:41:51 +0100 Subject: profile: detect dive-mode change in profile The profile must be replotted when the dive mode changes. Weirdly, this was routed via the dive-information tab (making it inherently non-mobile compatible). Detect such a change directly in the profile. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/TabDiveInformation.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'desktop-widgets/tab-widgets/TabDiveInformation.cpp') diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index 46d5c4f8b..c8112b2cd 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -316,7 +316,6 @@ void TabDiveInformation::divesChanged(const QVector &dives, DiveField fi if (!current_dive || !dives.contains(current_dive)) return; - bool replot = false; if (field.visibility) ui->visibility->setCurrentStars(current_dive->visibility); if (field.wavesize) @@ -327,10 +326,8 @@ void TabDiveInformation::divesChanged(const QVector &dives, DiveField fi ui->surge->setCurrentStars(current_dive->surge); if (field.chill) ui->chill->setCurrentStars(current_dive->chill); - if (field.mode) { + if (field.mode) updateMode(current_dive); - replot = true; - } if (field.duration || field.depth || field.mode) updateProfile(); if (field.air_temp) @@ -347,10 +344,6 @@ void TabDiveInformation::divesChanged(const QVector &dives, DiveField fi salinity_value = current_dive->salinity; ui->waterTypeCombo->setCurrentIndex(updateSalinityComboIndex(salinity_value)); ui->salinityText->setText(QString("%L1g/ℓ").arg(salinity_value / 10.0)); - // TODO: The profile should recognize itself when the dive mode changed. - // It seem awkward to route this via the dive-information tab. - if (replot) - MainWindow::instance()->graphics->plotDive(current_dive, true); } void TabDiveInformation::on_visibility_valueChanged(int value) -- cgit v1.2.3-70-g09d2