[PATCH] Cleanup and bugfix gaschange event printing

Anton Lundin glance at acc.umu.se
Thu Nov 21 15:09:26 UTC 2013


When a gaschange to air happened, the code did
name += name=+ tr("air") which probably was due to the block being just
confusing with all the ?:
Unrolls to proper if statements, and fixes the bug.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 qt-ui/profilegraphics.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 834d7bd..f2d8e74 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -954,9 +954,12 @@ void ProfileGraphicsView::plot_one_event(struct event *ev)
 			int o2 = get_o2(&dive->cylinder[entry->cylinderindex].gasmix);
 
 			name += ": ";
-			name += (he) ? QString("%1/%2").arg((o2 + 5) / 10).arg((he + 5) / 10)
-				  : is_air(o2, he) ? name += tr("air")
-				  : QString(tr("EAN%1")).arg((o2 + 5) / 10);
+			if (he)
+				name += QString("%1/%2").arg((o2 + 5) / 10).arg((he + 5) / 10);
+			else if(is_air(o2, he))
+				name += tr("air");
+			else
+				name += QString(tr("EAN%1")).arg((o2 + 5) / 10);
 
 		} else if (ev->name && !strcmp(ev->name, "SP change")) {
 			name += QString(":%1").arg((double) ev->value / 1000);
-- 
1.8.3.2



More information about the subsurface mailing list