diff options
author | Joakim Bygdell <j.bygdell@gmail.com> | 2016-02-09 17:20:17 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-09 12:11:09 -0800 |
commit | 8c9883cfcf66de99f6a563161918927ae0fb2f00 (patch) | |
tree | 98c5d25a377cf89a7d1a758b6eb91cb684d0eabf /qt-mobile/qmlmanager.cpp | |
parent | f3b35d175a381a57447b2ff33a8cd6d0db69b924 (diff) | |
download | subsurface-8c9883cfcf66de99f6a563161918927ae0fb2f00.tar.gz |
QML UI: enable edit of cylinder pressures
First cylinder only, show warning if there are more than one cylinder defined.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 76b4e7a93..a73c49fff 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -335,7 +335,8 @@ void QMLManager::refreshDiveList() // update the dive and return the notes field, stripped of the HTML junk QString QMLManager::commitChanges(QString diveId, QString date, QString location, QString gps, QString duration, QString depth, - QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes) + QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes, + QString startpressure, QString endpressure) { #define DROP_EMPTY_PLACEHOLDER(_s) if ((_s) == QLatin1Literal("--")) (_s).clear() @@ -348,6 +349,8 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location DROP_EMPTY_PLACEHOLDER(buddy); DROP_EMPTY_PLACEHOLDER(diveMaster); DROP_EMPTY_PLACEHOLDER(weight); + DROP_EMPTY_PLACEHOLDER(startpressure); + DROP_EMPTY_PLACEHOLDER(endpressure); DROP_EMPTY_PLACEHOLDER(notes); #undef DROP_EMPTY_PLACEHOLDER @@ -489,6 +492,16 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location 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); + } if (!same_string(d->suit, qPrintable(suit))) { diveChanged = true; free(d->suit); |