summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/cylindermodel.cpp6
-rw-r--r--qt-models/divetripmodel.cpp22
2 files changed, 9 insertions, 19 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index a5b1b53c0..e81a127a9 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -57,7 +57,7 @@ static QString get_cylinder_string(cylinder_t *cyl)
unit = CylindersModel::tr("ℓ");
}
- return QString("%1").arg(value, 0, 'f', decimals) + unit;
+ return QString("%L1").arg(value, 0, 'f', decimals) + unit;
}
static QString gas_volume_string(int ml, const char *tail)
@@ -69,7 +69,7 @@ static QString gas_volume_string(int ml, const char *tail)
vol = get_volume_units(ml, NULL, &unit);
decimals = (vol > 20.0) ? 0 : (vol > 2.0) ? 1 : 2;
- return QString("%1 %2 %3").arg(vol, 0, 'f', decimals).arg(unit).arg(tail);
+ return QString("%L1 %2 %3").arg(vol, 0, 'f', decimals).arg(unit).arg(tail);
}
static QVariant gas_wp_tooltip(cylinder_t *cyl);
@@ -126,7 +126,7 @@ static QVariant percent_string(fraction_t fraction)
if (!permille)
return QVariant();
- return QString("%1%").arg(permille / 10.0, 0, 'f', 1);
+ return QString("%L1%").arg(permille / 10.0, 0, 'f', 1);
}
QVariant CylindersModel::data(const QModelIndex &index, int role) const
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