summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-31 17:34:20 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-31 18:16:46 -0800
commitda5d904d34bea40eb87429c66e7378a23ea8c8b1 (patch)
treee6cd624c3d3a74a6eb321e84517231f3038d1b35 /qt-mobile/qmlmanager.cpp
parent98fb625667e664fb4ec3f20f1feaa146ebbfd023 (diff)
downloadsubsurface-da5d904d34bea40eb87429c66e7378a23ea8c8b1.tar.gz
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>
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r--qt-mobile/qmlmanager.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index 31defa005..7454dcd5d 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -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);