diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-02-20 22:00:07 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-20 22:00:07 -0800 |
commit | a550467e8b68d8d788cef056610f6dbd360f0072 (patch) | |
tree | 259dfef378a56a9607d8700731643386e5d12049 /subsurface-core/qthelper.cpp | |
parent | 8b39352d4ebae623e8956354cdbf2678fbfcb71e (diff) | |
download | subsurface-a550467e8b68d8d788cef056610f6dbd360f0072.tar.gz |
QML UI: make unit matching case insensitive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/qthelper.cpp')
-rw-r--r-- | subsurface-core/qthelper.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp index 8afb7ed74..5c48573cc 100644 --- a/subsurface-core/qthelper.cpp +++ b/subsurface-core/qthelper.cpp @@ -794,9 +794,9 @@ int parseLengthToMm(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("m"))) { + if (text.contains(QObject::tr("m"), Qt::CaseInsensitive)) { mm = number * 1000; - } else if (text.contains(QObject::tr("ft"))) { + } else if (text.contains(QObject::tr("ft"), Qt::CaseInsensitive)) { mm = feet_to_mm(number); } else { switch (prefs.units.length) { @@ -822,9 +822,9 @@ int parseTemperatureToMkelvin(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("C"))) { + if (text.contains(QObject::tr("C"), Qt::CaseInsensitive)) { mkelvin = C_to_mkelvin(number); - } else if (text.contains(QObject::tr("F"))) { + } else if (text.contains(QObject::tr("F"), Qt::CaseInsensitive)) { mkelvin = F_to_mkelvin(number); } else { switch (prefs.units.temperature) { @@ -849,9 +849,9 @@ int parseWeightToGrams(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("kg"))) { + if (text.contains(QObject::tr("kg"), Qt::CaseInsensitive)) { grams = rint(number * 1000); - } else if (text.contains(QObject::tr("lbs"))) { + } else if (text.contains(QObject::tr("lbs"), Qt::CaseInsensitive)) { grams = lbs_to_grams(number); } else { switch (prefs.units.weight) { @@ -876,9 +876,9 @@ int parsePressureToMbar(const QString &text) if (numOnly.isEmpty()) return 0; double number = numOnly.toDouble(); - if (text.contains(QObject::tr("bar"))) { + if (text.contains(QObject::tr("bar"), Qt::CaseInsensitive)) { mbar = rint(number * 1000); - } else if (text.contains(QObject::tr("psi"))) { + } else if (text.contains(QObject::tr("psi"), Qt::CaseInsensitive)) { mbar = psi_to_mbar(number); } else { switch (prefs.units.pressure) { |