diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-06-19 14:36:48 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-19 14:36:48 -0700 |
commit | 77725ecfe94e47cedabb2cc19afed402df8e1f40 (patch) | |
tree | c87b4d70219f15c75c7debc69ccd8652c2993ba0 /qt-ui/models.cpp | |
parent | 88f0f604392a354c18cba5d2959519b176b0d919 (diff) | |
download | subsurface-77725ecfe94e47cedabb2cc19afed402df8e1f40.tar.gz |
Replace wet_volume calculation with straight forward pressure formula
Since no one else approximates gas volumes at higher pressures, we
shouldn't do that either when converting imperial tank names (cuft @
working pressure) into wet volumes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r-- | qt-ui/models.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 3b2940a6c..1b882f3bf 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -678,22 +678,17 @@ QVariant TankInfoModel::data(const QModelIndex& index, int role) const if (role == Qt::FontRole){ return defaultModelFont(); } + if (role == Qt::DisplayRole || role == Qt::EditRole) { + struct tank_info *info = &tank_info[index.row()]; + int ml = info->ml; + double bar = (info->psi) ? psi_to_bar(info->psi) : info->bar; - struct tank_info *info = &tank_info[index.row()]; - - int ml = info->ml; - - int bar = ((info->psi) ? psi_to_bar(info->psi) : info->bar) * 1000 + 0.5; + if (info->cuft && info->psi) + ml = cuft_to_l(info->cuft) * 1000 / bar_to_atm(bar); - if (info->cuft && info->psi) { - pressure_t p; - p.mbar = psi_to_mbar(info->psi); - ml = wet_volume(info->cuft, p); - } - if (role == Qt::DisplayRole || role == Qt::EditRole) { switch(index.column()) { case BAR: - ret = bar; + ret = bar * 1000; break; case ML: ret = ml; |