aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-gui.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp
index f8b6b8637..52b26febd 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -281,6 +281,14 @@ QString get_volume_string(volume_t volume, bool showunit, int mbar)
const char *unit;
int decimals;
double value = get_volume_units(volume.mliter, &decimals, &unit);
+ if (mbar) {
+ // we are showing a tank size
+ // fix the weird imperial way of denominating size and provide
+ // reasonable number of decimals
+ if (prefs.units.volume == units::CUFT)
+ value *= bar_to_atm(mbar / 1000.0);
+ decimals = (value > 20.0) ? 0 : (value > 2.0) ? 1 : 2;
+ }
return QString("%1%2").arg(value, 0, 'f', decimals).arg(showunit ? unit : "");
}