diff options
Diffstat (limited to 'subsurface-core/qthelper.cpp')
-rw-r--r-- | subsurface-core/qthelper.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp index 25d5b4233..bddfd7608 100644 --- a/subsurface-core/qthelper.cpp +++ b/subsurface-core/qthelper.cpp @@ -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; |