From 0c24d7d6bd457907765a569b0de5cc0e73ecb6e8 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sun, 6 Jul 2014 05:34:43 +0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3-70-g09d2