mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
While parsing weight and pressure we should not change the users settings.
Now it is possible to enter a specific unit that is different from the unit stored in the preferences. If only numbers are inputed the unit will be the same as specified by the users preferences. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a91d4164b4
commit
6252d0cd3b
2 changed files with 28 additions and 22 deletions
|
@ -505,20 +505,12 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location
|
|||
if (weightsystem_none((void *)&d->weightsystem[1])) {
|
||||
if (get_weight_string(d->weightsystem[0].weight, true) != weight) {
|
||||
diveChanged = true;
|
||||
if (weight.contains(tr("kg")))
|
||||
prefs.units.weight = units::KG;
|
||||
else if (weight.contains(tr("lbs")))
|
||||
prefs.units.weight = units::LBS;
|
||||
d->weightsystem[0].weight.grams = parseWeightToGrams(weight);
|
||||
}
|
||||
}
|
||||
// start and end pressures for first cylinder only
|
||||
if (get_pressure_string(d->cylinder[0].start, true) != startpressure || get_pressure_string(d->cylinder[0].end, true) != endpressure) {
|
||||
diveChanged = true;
|
||||
if (startpressure.contains(tr("bar")) || endpressure.contains(tr("bar")))
|
||||
prefs.units.pressure = units::BAR;
|
||||
else if (startpressure.contains(tr("psi")) || endpressure.contains(tr("psi")))
|
||||
prefs.units.pressure = units::PSI;
|
||||
d->cylinder[0].start.mbar = parsePressureToMbar(startpressure);
|
||||
d->cylinder[0].end.mbar = parsePressureToMbar(endpressure);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue