QML UI: handle editing of depth

Getting closer to being able to really edit / add dives in the mobile UI.
This works for manually added dives - needs a bit more thought for dives
downloaded from dive computers as we don't necessarily want to change the
maxdepth in conflict with the samples.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-01-01 00:32:30 -08:00
parent 2c28b16b26
commit a0aa27e864
6 changed files with 45 additions and 1 deletions

View file

@ -1119,6 +1119,28 @@ int gettimezoneoffset(timestamp_t when)
return dt2.secsTo(dt1);
}
int parseLengthToMm(const QString &text)
{
int mm;
QString numOnly = text;
numOnly.replace(",", ".").remove(QRegExp("[^-0-9.]"));
if (numOnly.isEmpty())
return 0;
double number = numOnly.toDouble();
switch (prefs.units.length) {
case units::FEET:
mm = feet_to_mm(number);
break;
case units::METERS:
mm = number * 1000;
break;
default:
mm = 0;
}
return mm;
}
int parseTemperatureToMkelvin(const QString &text)
{
int mkelvin;