From 1a040134538b7733f3088ea34f101cfedecc2c64 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 1 Jun 2014 12:07:29 -0700 Subject: Encapsulate the horrid gas encoding in gas change events We should never pass permille values around as integers. And we shouldn't have to decode the stupid value in more than one place. This doesn't tackle all the places where we access O2 and He "too early" and should instead keep passing around a gaxmix. But it's a first step. Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveeventitem.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qt-ui/profile') diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp index 873c6abbe..87b57bfab 100644 --- a/qt-ui/profile/diveeventitem.cpp +++ b/qt-ui/profile/diveeventitem.cpp @@ -82,8 +82,9 @@ void DiveEventItem::setupToolTipString() int type = internalEvent->type; if (value) { if (type == SAMPLE_EVENT_GASCHANGE || type == SAMPLE_EVENT_GASCHANGE2) { - int he = value >> 16; - int o2 = value & 0xffff; + struct gasmix *g = get_gasmix_from_event(internalEvent); + int he = get_he(g); + int o2 = get_o2(g); name += ": "; if (he) -- cgit v1.2.3-70-g09d2