Desktop: Fix Inconsistencies in Handling of Salinity.

- add correct setting of the water type drop down for the dive shown
  initially after program start;
- change salinity to have 3 decimals in planner, to make it consistency
  with the log.

Fixes #4240.

Reported-by: @ccsieh
Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-06-09 08:13:44 +12:00
parent 10fc3bfd47
commit b126fccb1b
3 changed files with 9 additions and 9 deletions

View file

@ -224,11 +224,8 @@ void TabDiveInformation::updateData(const std::vector<dive *> &, dive *currentDi
setIndexNoSignal(ui->atmPressType, 0); // Set the atmospheric pressure combo box to mbar
salinity_value = get_dive_salinity(currentDive);
if (salinity_value) { // Set water type indicator (EN13319 = 1.020 g/l)
if (ui->waterTypeCombo->isVisible()) { // If water salinity is editable then set correct water type in combobox:
setIndexNoSignal(ui->waterTypeCombo, updateSalinityComboIndex(salinity_value));
} else { // If water salinity is not editable: show water type as a text label
ui->waterTypeText->setText(get_water_type_string(salinity_value));
}
setIndexNoSignal(ui->waterTypeCombo, updateSalinityComboIndex(salinity_value));
ui->waterTypeText->setText(get_water_type_string(salinity_value));
ui->salinityText->setText(get_salinity_string(salinity_value));
} else {
setIndexNoSignal(ui->waterTypeCombo, -1);
@ -349,6 +346,7 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi
else
salinity_value = currentDive->salinity;
setIndexNoSignal(ui->waterTypeCombo, updateSalinityComboIndex(salinity_value));
ui->waterTypeText->setText(get_water_type_string(salinity_value));
ui->salinityText->setText(QString("%L1g/").arg(salinity_value / 10.0));
}