core: let pressure_to_altitude return a depth_t

Also un-inline it. There seems no reason for exporting the
implementation details in the header file.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-12-14 21:03:23 +01:00 committed by Michael Keller
parent 4237cb9999
commit 1d14b03935
5 changed files with 13 additions and 11 deletions

View file

@ -442,12 +442,12 @@ void TabDiveInformation::updateTextBox(int event) // Either the text box has bee
} else { // i.e. event == COMBO_CHANGED, that is, "m" or "ft" was selected from combobox
// Show estimated altitude
bool ok;
double convertVal = 0.0010; // Metric conversion fro mm to m
pressure_t pressure = { .mbar = ui->atmPressVal->text().toInt(&ok,10) };
if (ok && ui->atmPressVal->text().length()) { // Show existing atm press as an altitude:
if (prefs.units.length == units::FEET) // For imperial units
convertVal = mm_to_feet(1); // convert from mm to ft
ui->atmPressVal->setText(QString::number((int)(pressure_to_altitude(pressure) * convertVal)));
double convertVal = (prefs.units.length == units::FEET) ?
mm_to_feet(1) : // convert from mm to ft
0.001; // Metric conversion fro mm to m
ui->atmPressVal->setText(QString::number((int)(pressure_to_altitude(pressure).mm * convertVal)));
}
}
break;