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>
This commit is contained in:
Miika Turkia 2014-07-06 05:34:43 +03:00 committed by Dirk Hohndel
parent 9d97426e8e
commit 0c24d7d6bd

View file

@ -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 */