diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-07-23 16:08:41 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-07-24 09:53:24 +0900 |
commit | c1f9cfe9a865eaa288becd1caabe048d9b060fea (patch) | |
tree | 2efabf96035bd886d2b5a5f891fed1ae30b7fd06 /profile-widget/diveeventitem.cpp | |
parent | f718fdab80ccbc718e76f5f8e39bdfe3964ce1a6 (diff) | |
download | subsurface-c1f9cfe9a865eaa288becd1caabe048d9b060fea.tar.gz |
Show different icons based on event severity
So far this is only supported in the Suunto EON Steel backend, but we
should try to add this to others where we have such a distinction (and
maybe assign different values to the predefined libdivecomputer events).
This also adds three new icons for info, warning, and violation. The
warning icon we had already, but I drew a new one from scratch to have it
match the violation icon.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/diveeventitem.cpp')
-rw-r--r-- | profile-widget/diveeventitem.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 9acc643ad..5215ff81f 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -78,10 +78,16 @@ void DiveEventItem::setupPixmap() #define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation) #define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(sz_bigger, sz_bigger, Qt::KeepAspectRatio, Qt::SmoothTransformation) if (same_string(internalEvent->name, "")) { - setPixmap(EVENT_PIXMAP(":warning")); + setPixmap(EVENT_PIXMAP(":warning-icon")); } else if (internalEvent->type == SAMPLE_EVENT_BOOKMARK) { setPixmap(EVENT_PIXMAP(":flag")); - } else if (strcmp(internalEvent->name, "heading") == 0 || +#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 +#else + } else if ( +#endif + strcmp(internalEvent->name, "heading") == 0 || (same_string(internalEvent->name, "SP change") && internalEvent->time.seconds == 0)) { // 2 cases: // a) some dive computers have heading in every sample @@ -101,8 +107,18 @@ void DiveEventItem::setupPixmap() setPixmap(EVENT_PIXMAP_BIGGER(":gaschangeAir")); 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")); + } else if (((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 3) { + setPixmap(EVENT_PIXMAP(":warning-icon")); + } else if (((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 4) { + setPixmap(EVENT_PIXMAP(":violation-icon")); +#endif } else { - setPixmap(EVENT_PIXMAP(":warning")); + // we should do some guessing based on the type / name of the event; + // for now they all get the warning icon + setPixmap(EVENT_PIXMAP(":warning-icon")); } #undef EVENT_PIXMAP #undef EVENT_PIXMAP_BIGGER |