When selecting icons for events don't misinterpret a gaschange

Don't misinterpret a gaschange as "useless internal of the dive computer"
when it has a higher flag value.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-10-19 21:55:46 +02:00 committed by Dirk Hohndel
parent a422957cd6
commit c3274b0b9f

View file

@ -82,6 +82,16 @@ void DiveEventItem::setupPixmap()
setPixmap(EVENT_PIXMAP(":warning-icon"));
} else if (internalEvent->type == SAMPLE_EVENT_BOOKMARK) {
setPixmap(EVENT_PIXMAP(":flag"));
} else if (event_is_gaschange(internalEvent)) {
struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent);
if (mix->he.permille)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeTrimix"));
else if (gasmix_is_air(mix))
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeAir"));
else if (mix->o2.permille == 1000)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeOxy"));
else
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeNitrox"));
#ifdef SAMPLE_FLAGS_SEVERITY_SHIFT
} else if ((((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 1) ||
// those are useless internals of the dive computer
@ -100,16 +110,6 @@ void DiveEventItem::setupPixmap()
QPixmap transparentPixmap(4, 20);
transparentPixmap.fill(QColor::fromRgbF(1.0, 1.0, 1.0, 0.01));
setPixmap(transparentPixmap);
} else if (event_is_gaschange(internalEvent)) {
struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent);
if (mix->he.permille)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeTrimix"));
else if (gasmix_is_air(mix))
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeAir"));
else if (mix->o2.permille == 1000)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeOxy"));
else
setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeNitrox"));
#ifdef SAMPLE_FLAGS_SEVERITY_SHIFT
} else if (((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 2) {
setPixmap(EVENT_PIXMAP(":info-icon"));