diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-01-04 16:12:59 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-01-06 07:00:34 +0900 |
commit | eac87f64817568cf38c76169fc896450f1131b37 (patch) | |
tree | b10b90b8602c3a7f0fe14b1e37265b941a32aacc /desktop-widgets/tab-widgets | |
parent | 1e4cc49f83c4af4394a0aa7deca1affa99fd64fa (diff) | |
download | subsurface-eac87f64817568cf38c76169fc896450f1131b37.tar.gz |
desktop UI: correctly show the salinity data overwritten warning
We need to show this whenever the value in the dive (which could have been
entered by the user some other time) doesn't correspond to the value in the DC.
This, btw, will point out to the user if different DCs have different values.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveInformation.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index ccc39decd..d0b66fd4d 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -66,6 +66,7 @@ TabDiveInformation::TabDiveInformation(QWidget *parent) : TabBase(parent), ui(ne ui->salinityOverWrittenIcon->setPixmap(warning); ui->salinityOverWrittenIcon->setToolTip("Water type differs from that of dc"); ui->salinityOverWrittenIcon->setToolTipDuration(2500); + ui->salinityOverWrittenIcon->setVisible(false); } TabDiveInformation::~TabDiveInformation() @@ -194,12 +195,13 @@ int TabDiveInformation::updateSalinityComboIndex(int salinity) // If dive->user_salinity != dive->salinity (i.e. dc value) then show the salinity-overwrite indicator void TabDiveInformation::checkDcSalinityOverWritten() { + if (!current_dive) + return; int dc_value = current_dive->dc.salinity; int user_value = current_dive->user_salinity; bool show_indicator = false; - if (current_dive && dc_value && user_value && (user_value != dc_value)) - if ((dc_value < 10250) || (user_value < 10250)) // Provide for libdivecomputer that defines seawater density - show_indicator = true; // as 1.025 in contrast to Subsurface's value of 1.03 + if (user_value != dc_value) + show_indicator = true; ui->salinityOverWrittenIcon->setVisible(show_indicator); } @@ -246,13 +248,14 @@ void TabDiveInformation::updateData() else ui->waterTypeText->setText(waterTypes[SALTWATER]); } - checkDcSalinityOverWritten(); // If exclamation is needed (i.e. salinity overwrite by user), then show it ui->salinityText->setText(QString("%1g/ℓ").arg(salinity_value / 10.0)); } else { ui->waterTypeCombo->setCurrentIndex(-1); ui->waterTypeText->setText(tr("unknown")); ui->salinityText->clear(); } + checkDcSalinityOverWritten(); // If exclamation is needed (i.e. salinity overwrite by user), then show it + updateMode(current_dive); ui->visibility->setCurrentStars(current_dive->visibility); ui->wavesize->setCurrentStars(current_dive->wavesize); |