summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2014-08-17 12:26:21 -0600
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-12 07:45:37 -0400
commitdf4e26c8757a81bb40ba2fd60431d5d1ecd64b11 (patch)
treea7f46fb0a25a5131a42727ab0ca770f2fc0c8f30 /qt-ui
parentb47e0658cf5e60e18d4c9405e3b28f196ac3e2d8 (diff)
downloadsubsurface-df4e26c8757a81bb40ba2fd60431d5d1ecd64b11.tar.gz
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 <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/diveeventitem.cpp8
1 files changed, 4 insertions, 4 deletions
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");