diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2018-02-19 21:55:18 +0100 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2018-03-05 16:28:18 +0100 |
commit | aacc6886705e720809d253d22e0f6f49444993e0 (patch) | |
tree | 4d8026cae13f8706d2bb904f7115089d60a7d603 /qt-models/divetripmodel.cpp | |
parent | 18c034ea37f830880e4cbf3636819c6be43d0464 (diff) | |
download | subsurface-aacc6886705e720809d253d22e0f6f49444993e0.tar.gz |
Use correct numeric format based on selected locale (Qt domain part)
This changes the numeric format of many values printed to the UI to
reflect the correct numeric format of the selected locale:
- dot or comma as decimal separator
- comma or dot as thousands separator
In the Qt domain the `L` flag is used case specific mostly
in qthelper.cpp.
Then the helper functions get_xxx_string() are used more consistently.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r-- | qt-models/divetripmodel.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 63e5f6afd..2e9058d6e 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -387,28 +387,18 @@ QString DiveItem::displayTemperatureWithUnit() const QString DiveItem::displaySac() const { - QString str; struct dive *dive = get_dive_by_uniq_id(diveId); - if (dive->sac) { - const char *unit; - int decimal; - double value = get_volume_units(dive->sac, &decimal, &unit); - return QString::number(value, 'f', decimal); - } - return QString(""); + if (!dive->sac) + return QString(); + return get_volume_string(dive->sac, false); } QString DiveItem::displaySacWithUnit() const { - QString str; struct dive *dive = get_dive_by_uniq_id(diveId); - if (dive->sac) { - const char *unit; - int decimal; - double value = get_volume_units(dive->sac, &decimal, &unit); - return QString::number(value, 'f', decimal) + QString(unit).append(tr("/min")); - } - return QString(""); + if (!dive->sac) + return QString(); + return get_volume_string(dive->sac, true).append(tr("/min")); } QString DiveItem::displayWeight() const |