From 254f42e3962caf7632cb7f47571d48cc32716bfa Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 5 Jan 2020 11:20:51 -0800 Subject: 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 Signed-off-by: Dirk Hohndel --- desktop-widgets/tab-widgets/TabDiveInformation.cpp | 5 +++-- 1 file 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); -- cgit v1.2.3-70-g09d2