Fix imperial cylinder sizes in equipment tab

The imperial cylinder sizes are not just in cubic feet: they are in
cubic feet of gas at STP. So the imperial/metric difference is not
just about converting blindly from liters to cubic feet, you also have
to take the working pressure of the cylinder into account.

This was broken by commit f9b7c5dfe9 ("Make units in cells
consistant in CylindersModel"), because those poor sheltered Swedish
people have never had to work with the wondrous imperial cylinder
sizing, and think that units should make _sense_. Hah.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2014-01-02 21:36:01 -08:00 committed by Dirk Hohndel
parent c49d3885f5
commit 4cce5df7e2
3 changed files with 6 additions and 7 deletions

View file

@ -322,13 +322,15 @@ QString get_temp_unit()
return QString(UTF8_DEGREE "F");
}
QString get_volume_string(volume_t volume, bool showunit)
QString get_volume_string(volume_t volume, bool showunit, unsigned int mbar)
{
if (prefs.units.volume == units::LITER) {
double liter = volume.mliter / 1000.0;
return QString("%1%2").arg(liter, 0, 'f', liter >= 40.0 ? 0 : 1 ).arg(showunit ? translate("gettextFromC","l") : "");
} else {
double cuft = ml_to_cuft(volume.mliter);
if (mbar)
cuft *= bar_to_atm(mbar / 1000.0);
return QString("%1%2").arg(cuft, 0, 'f', cuft >= 20.0 ? 0 : (cuft >= 2.0 ? 1 : 2)).arg(showunit ? translate("gettextFromC","cuft") : "");
}
}