From df4e26c8757a81bb40ba2fd60431d5d1ecd64b11 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 17 Aug 2014 12:26:21 -0600 Subject: Start sanitizing gaschange event information Decode the gasmix data into a sane format when creating the event, and add the (currently unused) ability to specify a gas change to a particular cylinder rather than (or in addition to) the gasmix. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveeventitem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp index b9bb4482b..c1ea48544 100644 --- a/qt-ui/profile/diveeventitem.cpp +++ b/qt-ui/profile/diveeventitem.cpp @@ -66,10 +66,10 @@ void DiveEventItem::setupPixmap() setPixmap(EVENT_PIXMAP(":flag")); } else if (strcmp(internalEvent->name, "heading") == 0) { setPixmap(EVENT_PIXMAP(":flag")); - } else if (internalEvent->type == SAMPLE_EVENT_GASCHANGE || internalEvent->type == SAMPLE_EVENT_GASCHANGE2) { - if (internalEvent->value >> 16) + } else if (event_is_gaschange(internalEvent)) { + if (internalEvent->gas.mix.he.permille) setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeTrimix")); - else if (internalEvent->value == 0) + else if (gasmix_is_air(&internalEvent->gas.mix)) setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeAir")); else setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeNitrox")); @@ -86,7 +86,7 @@ void DiveEventItem::setupToolTipString() int value = internalEvent->value; int type = internalEvent->type; if (value) { - if (type == SAMPLE_EVENT_GASCHANGE || type == SAMPLE_EVENT_GASCHANGE2) { + if (event_is_gaschange(internalEvent)) { QModelIndexList result = dataModel->match(dataModel->index(0, DivePlotDataModel::TIME), Qt::DisplayRole, internalEvent->time.seconds); if (result.isEmpty()) { Q_ASSERT("can't find a spot in the dataModel"); -- cgit v1.2.3-70-g09d2