aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-05 11:20:51 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-06 07:00:34 +0900
commit254f42e3962caf7632cb7f47571d48cc32716bfa (patch)
tree323e98d32eb35158e816021deaaf6c7b4b47eae0
parentc03731b2207a4bb1461fbe782c1c7bc1b9cd340e (diff)
downloadsubsurface-254f42e3962caf7632cb7f47571d48cc32716bfa.tar.gz
desktop UI: only show salinity warning when DC salinity is different
There were two cases that were handled incorrectly: - if the user hasn't entered a salinity, obviously there shouldn't be a warning - if this is a manually entered dive, there is no salinity downloaded from a dive computer, so equally, no warning Suggested-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--desktop-widgets/tab-widgets/TabDiveInformation.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
index b1e3fb226..68e4933b1 100644
--- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
@@ -200,7 +200,7 @@ void TabDiveInformation::checkDcSalinityOverWritten()
int dc_value = current_dc->salinity;
int user_value = current_dive->user_salinity;
bool show_indicator = false;
- if (user_value != dc_value)
+ if (!manualDive && user_value != 0 && user_value != dc_value)
show_indicator = true;
ui->salinityOverWrittenIcon->setVisible(show_indicator);
}
@@ -301,7 +301,8 @@ void TabDiveInformation::on_waterTypeCombo_activated(int index) {
else
ui->salinityText->clear();
divesEdited(Command::editWaterTypeUser(combobox_salinity, false));
- if (dc_salinity == combobox_salinity) // If salinity differs from that of dc, then save it
+ // If salinity differs from that downloaded from dc, show warning
+ if (manualDive || dc_salinity == combobox_salinity)
ui->salinityOverWrittenIcon->setVisible(false);
else
ui->salinityOverWrittenIcon->setVisible(true);