summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile.c8
-rw-r--r--qt-gui.cpp7
-rw-r--r--qt-ui/models.cpp9
3 files changed, 12 insertions, 12 deletions
diff --git a/profile.c b/profile.c
index 38e19a07d..db7a101f6 100644
--- a/profile.c
+++ b/profile.c
@@ -1230,7 +1230,9 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me
{
int pressurevalue, mod, ead, end, eadd;
const char *depth_unit, *pressure_unit, *temp_unit, *vertical_speed_unit;
- double depthvalue, tempvalue, speedvalue;
+ double depthvalue, tempvalue, speedvalue, sacvalue;
+ int decimals;
+ const char *unit;
depthvalue = get_depth_units(entry->depth, NULL, &depth_unit);
put_format(b, translate("gettextFromC", "@: %d:%02d\nD: %.1f%s\n"), FRACTION(entry->sec, 60), depthvalue, depth_unit);
@@ -1247,9 +1249,9 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me
if (entry->speed > 0)
speedvalue *= -1;
put_format(b, translate("gettextFromC", "V: %.1f%s\n"), speedvalue, vertical_speed_unit);
-
+ sacvalue = get_volume_units(entry->sac, &decimals, &unit);
if (entry->sac && prefs.show_sac)
- put_format(b, translate("gettextFromC", "SAC: %2.1fl/min\n"), entry->sac / 1000.0);
+ put_format(b, translate("gettextFromC", "SAC: %.*f%s/min\n"), sacvalue, decimals, unit);
if (entry->cns)
put_format(b, translate("gettextFromC", "CNS: %u%%\n"), entry->cns);
if (prefs.pp_graphs.po2)
diff --git a/qt-gui.cpp b/qt-gui.cpp
index 41b2e5f12..70acd0463 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -307,10 +307,9 @@ QString get_volume_string(volume_t volume, bool showunit, int mbar)
QString get_volume_unit()
{
- if (prefs.units.volume == units::LITER)
- return "l";
- else
- return "cuft";
+ const char *unit;
+ (void) get_volume_units(0, NULL, &unit);
+ return QString(unit);
}
QString get_pressure_string(pressure_t pressure, bool showunit)
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 496c32cdb..09b737179 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1258,11 +1258,10 @@ QString DiveItem::displaySac() const
{
QString str;
struct dive *dive = get_dive_by_uniq_id(diveId);
- if (get_units()->volume == units::LITER)
- str = QString::number(dive->sac / 1000.0, 'f', 1).append(tr(" l/min"));
- else
- str = QString::number(ml_to_cuft(dive->sac), 'f', 2).append(tr(" cuft/min"));
- return str;
+ const char *unit;
+ int decimal;
+ double value = get_volume_units(dive->sac, &decimal, &unit);
+ return QString::number(value, 'f', decimal).append(unit).append(tr("/min"));
}
QString DiveItem::displayWeight() const