From c1f9cfe9a865eaa288becd1caabe048d9b060fea Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 23 Jul 2016 16:08:41 +0900 Subject: 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 --- icons/info-icon.png | Bin 0 -> 20919 bytes icons/info-icon.svg | 78 ++++++++++++++++++++++++++++++++++ icons/violation-icon.png | Bin 0 -> 28923 bytes icons/violation-icon.svg | 89 +++++++++++++++++++++++++++++++++++++++ icons/warning-icon.png | Bin 0 -> 22977 bytes icons/warning-icon.svg | 85 +++++++++++++++++++++++++++++++++++++ profile-widget/diveeventitem.cpp | 22 ++++++++-- subsurface.qrc | 3 ++ 8 files changed, 274 insertions(+), 3 deletions(-) create mode 100644 icons/info-icon.png create mode 100644 icons/info-icon.svg create mode 100644 icons/violation-icon.png create mode 100644 icons/violation-icon.svg create mode 100644 icons/warning-icon.png create mode 100644 icons/warning-icon.svg diff --git a/icons/info-icon.png b/icons/info-icon.png new file mode 100644 index 000000000..2c229d41a Binary files /dev/null and b/icons/info-icon.png differ diff --git a/icons/info-icon.svg b/icons/info-icon.svg new file mode 100644 index 000000000..e3b660bc7 --- /dev/null +++ b/icons/info-icon.svg @@ -0,0 +1,78 @@ + + + + + + + + + + image/svg+xml + + + + + + + + i + + diff --git a/icons/violation-icon.png b/icons/violation-icon.png new file mode 100644 index 000000000..36cfd004b Binary files /dev/null and b/icons/violation-icon.png differ diff --git a/icons/violation-icon.svg b/icons/violation-icon.svg new file mode 100644 index 000000000..5409ddc7d --- /dev/null +++ b/icons/violation-icon.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + ! + + + diff --git a/icons/warning-icon.png b/icons/warning-icon.png new file mode 100644 index 000000000..4f24b3093 Binary files /dev/null and b/icons/warning-icon.png differ diff --git a/icons/warning-icon.svg b/icons/warning-icon.svg new file mode 100644 index 000000000..d38cee68e --- /dev/null +++ b/icons/warning-icon.svg @@ -0,0 +1,85 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + ! + + 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 diff --git a/subsurface.qrc b/subsurface.qrc index 3fc219dcc..930b88890 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -14,6 +14,9 @@ icons/maximum.png icons/average.png icons/warning.png + icons/warning-icon.png + icons/violation-icon.png + icons/info-icon.png icons/gaschange.png icons/Air_change.png icons/Nx_change.png -- cgit v1.2.3-70-g09d2