QML UI: process air and water temp when edited

This is a little hacky as it changes the units based on user input - a little
crude but works in the typical cases.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-12-31 17:34:20 -08:00
parent 98fb625667
commit da5d904d34

View file

@ -328,13 +328,28 @@ void QMLManager::commitChanges(QString diveId, QString location, QString gps, QS
ds = get_dive_site_by_uuid(create_dive_site(qPrintable(location), d->when));
d->dive_site_uuid = ds->uuid;
}
// now we need to handle the string representations of duration, depth, airtemp and watertemp
// now we need to handle the string representations of duration, depth
// and do something useful...
//
// FIXME
//
// TODO
if (get_temperature_string(d->airtemp) != airtemp) {
diveChanged = true;
if (airtemp.contains(tr("C")))
prefs.units.temperature = units::CELSIUS;
else if (airtemp.contains(tr("F")))
prefs.units.temperature = units::FAHRENHEIT;
d->airtemp.mkelvin = parseTemperatureToMkelvin(airtemp);
}
if (get_temperature_string(d->watertemp) != watertemp) {
diveChanged = true;
if (watertemp.contains(tr("C")))
prefs.units.temperature = units::CELSIUS;
else if (watertemp.contains(tr("F")))
prefs.units.temperature = units::FAHRENHEIT;
d->watertemp.mkelvin = parseTemperatureToMkelvin(watertemp);
}
if (!same_string(d->suit, qPrintable(suit))) {
diveChanged = true;
free(d->suit);