mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
units: replace SURFACE_PRESSURE by 1_atm
Moreover, convert diveplan::surface_pressure from int to pressure_t. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ae81b42fe2
commit
dd5def35f5
11 changed files with 56 additions and 64 deletions
|
@ -439,18 +439,18 @@ void TabDiveInformation::updateTextBox(int event) // Either the text box has bee
|
|||
altitudeVal = feet_to_mm(altitudeVal); // imperial: convert altitude from feet to mm
|
||||
else
|
||||
altitudeVal = altitudeVal * 1000; // metric: convert altitude from meters to mm
|
||||
atmpress.mbar = altitude_to_pressure((int32_t) altitudeVal); // convert altitude (mm) to pressure (mbar)
|
||||
atmpress = altitude_to_pressure((int32_t) altitudeVal); // convert altitude (mm) to pressure (mbar)
|
||||
ui->atmPressVal->setText(QString::number(atmpress.mbar));
|
||||
setIndexNoSignal(ui->atmPressType, 0); // reset combobox to mbar
|
||||
} 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
|
||||
int pressure_as_integer = ui->atmPressVal->text().toInt(&ok,10);
|
||||
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_as_integer) * convertVal)));
|
||||
ui->atmPressVal->setText(QString::number((int)(pressure_to_altitude(pressure) * convertVal)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue