[PATCH 2/2] Show both the nominal and "real" size for an imperial cylinder

Linus Torvalds torvalds at linux-foundation.org
Wed Feb 24 15:02:15 PST 2016


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Wed, 24 Feb 2016 14:51:21 -0800
Subject: [PATCH 2/2] Show both the nominal and "real" size for an imperial cylinder

This is questionable, but perhaps useful.

When showing imperial cylinder sizes, show both the nominal value (with
no compensation for compressibility of the gas) and the "actual" amount
of gas the cylinder contains.

So an AL80 will show as a size of "80 (77)cuft", because while 80 is the
nominal size, the actual amount of gas that will fit is just 77 cuft.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 qt-models/cylindermodel.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index cfeabd557ace..60308cd98e90 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -36,9 +36,10 @@ static QString get_cylinder_string(cylinder_t *cyl)
 	// liters: if we don't have a working pressure, we cannot
 	// convert the cylinder size to cuft.
 	if (wp.mbar && prefs.units.volume == units::CUFT) {
+		double real_value = ml_to_cuft(gas_volume(cyl, wp));
 		value = ml_to_cuft(ml) * bar_to_atm(wp.mbar / 1000.0);
 		decimals = (value > 20.0) ? 0 : (value > 2.0) ? 1 : 2;
-		unit = "cuft";
+		unit = QString(" (%1)cuft").arg(real_value, 0, 'f', 0);
 	} else {
 		value = ml / 1000.0;
 		decimals = 1;
-- 
2.7.2.334.g7c0da37



More information about the subsurface mailing list