[PATCH] Show the gas mixing information only when needed

Miika Turkia miika.turkia at gmail.com
Sat Jul 5 19:34:43 PDT 2014


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 at gmail.com>
---
 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 5e81272..0f8d885 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 */
-- 
1.9.1



More information about the subsurface mailing list