summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-30 21:23:15 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-30 14:14:13 -0700
commit60b00162a9cc666a1af062d2610f28cfe7df09ae (patch)
tree8e1b0ff5f626af3e595c3eb1dc1ca33370691333 /desktop-widgets
parentff0438a3fd25febfd8fc3ef362bbc2c2192f0006 (diff)
downloadsubsurface-60b00162a9cc666a1af062d2610f28cfe7df09ae.tar.gz
desktop: don't replot profile when populating dive information tab
When the dive mode is changed, the profile has to be replot. This is by a function of the TabDiveInformation. However, that function was also executed when populating the tab. Thus, when changing dive, the profile was plot twice. Move the profile plotting out of the function. Ultimately, the profile should listen to the appropriate signals itself. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveInformation.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
index f787c922e..8a6739627 100644
--- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
@@ -316,6 +316,7 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &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)
@@ -326,8 +327,10 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &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)
@@ -344,6 +347,10 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi
salinity_value = current_dive->salinity;
ui->waterTypeCombo->setCurrentIndex(updateSalinityComboIndex(salinity_value));
ui->salinityText->setText(QString("%1g/ℓ").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->replot();
}
void TabDiveInformation::on_visibility_valueChanged(int value)
@@ -379,7 +386,6 @@ void TabDiveInformation::on_chill_valueChanged(int value)
void TabDiveInformation::updateMode(struct dive *d)
{
ui->diveType->setCurrentIndex(get_dive_dc(d, dc_number)->divemode);
- MainWindow::instance()->graphics->replot();
}
void TabDiveInformation::diveModeChanged(int index)