Show ICD in gaschange icons

Add an exclamation mark in the gas change icons if
the change violates our isobaric counter diffusion
criterium.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2018-01-20 18:21:39 +01:00
parent 7b508e41cd
commit d029feb2d5
8 changed files with 31 additions and 12 deletions

BIN
icons/Air_changeICD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
icons/Nx_changeICD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
icons/Oxy_changeICD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
icons/Tmx_changeICD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
icons/gaschangeICD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -56,12 +56,12 @@ void DiveEventItem::setEvent(struct event *ev, struct gasmix *lastgasmix)
free(internalEvent); free(internalEvent);
internalEvent = clone_event(ev); internalEvent = clone_event(ev);
setupPixmap(); setupPixmap(lastgasmix);
setupToolTipString(lastgasmix); setupToolTipString(lastgasmix);
recalculatePos(true); recalculatePos(true);
} }
void DiveEventItem::setupPixmap() void DiveEventItem::setupPixmap(struct gasmix *lastgasmix)
{ {
const IconMetrics& metrics = defaultIconMetrics(); const IconMetrics& metrics = defaultIconMetrics();
#ifndef SUBSURFACE_MOBILE #ifndef SUBSURFACE_MOBILE
@ -86,14 +86,29 @@ void DiveEventItem::setupPixmap()
setPixmap(EVENT_PIXMAP(":dive-bookmark-icon")); setPixmap(EVENT_PIXMAP(":dive-bookmark-icon"));
} else if (event_is_gaschange(internalEvent)) { } else if (event_is_gaschange(internalEvent)) {
struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent); struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent);
if (mix->he.permille) struct icd_data icd_data;
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-trimix-icon")); bool icd = isobaric_counterdiffusion(lastgasmix, mix, &icd_data);
else if (gasmix_is_air(mix)) if (mix->he.permille) {
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-air-icon")); if (icd)
else if (mix->o2.permille == 1000) setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-trimix-ICD-icon"));
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-oxygen-icon")); else
else setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-trimix-icon"));
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-ean-icon")); } else if (gasmix_is_air(mix)) {
if (icd)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-air-ICD-icon"));
else
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-air-icon"));
} else if (mix->o2.permille == 1000) {
if (icd)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-oxygen-ICD-icon"));
else
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-oxygen-icon"));
} else {
if (icd)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-ean-ICD-icon"));
else
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-ean-icon"));
}
#ifdef SAMPLE_FLAGS_SEVERITY_SHIFT #ifdef SAMPLE_FLAGS_SEVERITY_SHIFT
} else if ((((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 1) || } else if ((((internalEvent->flags & SAMPLE_FLAGS_SEVERITY_MASK) >> SAMPLE_FLAGS_SEVERITY_SHIFT) == 1) ||
// those are useless internals of the dive computer // those are useless internals of the dive computer
@ -180,7 +195,6 @@ void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
name += internalEvent->flags & SAMPLE_FLAGS_BEGIN ? tr(" begin", "Starts with space!") : name += internalEvent->flags & SAMPLE_FLAGS_BEGIN ? tr(" begin", "Starts with space!") :
internalEvent->flags & SAMPLE_FLAGS_END ? tr(" end", "Starts with space!") : ""; internalEvent->flags & SAMPLE_FLAGS_END ? tr(" end", "Starts with space!") : "";
} }
// qDebug() << name;
setToolTip(name); setToolTip(name);
} }

View file

@ -26,7 +26,7 @@ slots:
private: private:
void setupToolTipString(struct gasmix *lastgasmix); void setupToolTipString(struct gasmix *lastgasmix);
void setupPixmap(); void setupPixmap(struct gasmix *lastgasmix);
DiveCartesianAxis *vAxis; DiveCartesianAxis *vAxis;
DiveCartesianAxis *hAxis; DiveCartesianAxis *hAxis;
DivePlotDataModel *dataModel; DivePlotDataModel *dataModel;

View file

@ -36,6 +36,11 @@
<file alias="gaschange-ean-icon">icons/Nx_change.png</file> <file alias="gaschange-ean-icon">icons/Nx_change.png</file>
<file alias="gaschange-trimix-icon">icons/Tmx_change.png</file> <file alias="gaschange-trimix-icon">icons/Tmx_change.png</file>
<file alias="gaschange-oxygen-icon">icons/Oxy_change.png</file> <file alias="gaschange-oxygen-icon">icons/Oxy_change.png</file>
<file alias="gaschange-ICD-icon">icons/gaschangeICD.png</file>
<file alias="gaschange-air-ICD-icon">icons/Air_changeICD.png</file>
<file alias="gaschange-ean-ICD-icon">icons/Nx_changeICD.png</file>
<file alias="gaschange-trimix-ICD-icon">icons/Tmx_changeICD.png</file>
<file alias="gaschange-oxygen-ICD-icon">icons/Oxy_changeICD.png</file>
<file alias="dive-bookmark-icon">icons/flag.png</file> <file alias="dive-bookmark-icon">icons/flag.png</file>
<file alias="scale-icon">icons/scale.png</file> <file alias="scale-icon">icons/scale.png</file>
<file alias="ruler-icon">icons/ruler.png</file> <file alias="ruler-icon">icons/ruler.png</file>