diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-07-06 05:34:43 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-05 22:55:52 -0700 |
commit | 0c24d7d6bd457907765a569b0de5cc0e73ecb6e8 (patch) | |
tree | 0f5c2fe4447e72fd2be055b0d2288c74123bef1d /qt-ui/maintab.cpp | |
parent | 9d97426e8e0140b8762d2dd0e018a9b708fcf7df (diff) | |
download | subsurface-0c24d7d6bd457907765a569b0de5cc0e73ecb6e8.tar.gz |
Show the gas mixing information only when needed
Recreational divers, especially ones diving with air, do not need to be
shown that their gas can be mixed with 0 liters of O2 and He. And
similarly Nitrox diver does not need to know about 0 liters of He.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 5e81272e2..0f8d885a8 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -537,7 +537,20 @@ void MainTab::updateDiveInfo(bool clear) gasUsedString.append("..."); volume_t o2_tot = {}, he_tot = {}; selected_dives_gas_parts(&o2_tot, &he_tot); - gasUsedString.append(QString("These gases could be\nmixed from Air and using:\nHe: %1 and O2: %2\n").arg(get_volume_string(he_tot, true)).arg(get_volume_string(o2_tot, true))); + + /* No need to show the gas mixing information if diving + * with pure air, and only display the he / O2 part when + * it is used. + */ + if (he_tot.mliter || o2_tot.mliter) { + gasUsedString.append(QString("These gases could be\nmixed from Air and using:\n")); + if (he_tot.mliter) + gasUsedString.append(QString("He: %1").arg(get_volume_string(he_tot, true))); + if (he_tot.mliter && o2_tot.mliter) + gasUsedString.append(QString(" and ")); + if (o2_tot.mliter) + gasUsedString.append(QString("O2: %2\n").arg(get_volume_string(o2_tot, true))); + } ui.gasConsumption->setText(gasUsedString); } else { /* clear the fields */ |