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>
This commit is contained in:
Dirk Hohndel 2016-07-23 16:08:41 +09:00
parent f718fdab80
commit c1f9cfe9a8
8 changed files with 274 additions and 3 deletions

BIN
icons/info-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

78
icons/info-icon.svg Normal file
View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="185mm"
height="185mm"
viewBox="0 0 655.51181 655.51181"
id="svg6853"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="info-icon.svg"
inkscape:export-filename="/home/hohndel/subsurface/icons/info-icon.png"
inkscape:export-xdpi="100.05881"
inkscape:export-ydpi="100.05881">
<defs
id="defs6855" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="211.09793"
inkscape:cy="520"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1680"
inkscape:window-height="979"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata6858">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-396.85039)">
<circle
style="opacity:1;fill:#ffffff;fill-opacity:0.87978145;stroke:#000000;stroke-width:31.20143127;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path7484"
cx="327.85715"
cy="740.21936"
r="245.1136" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:488.47024536px;line-height:125%;font-family:Clean;-inkscape-font-specification:Clean;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="209.97577"
y="1082.0583"
id="text7492"
sodipodi:linespacing="125%"
transform="scale(1.1822941,0.84581324)"><tspan
sodipodi:role="line"
id="tspan7494"
x="209.97577"
y="1082.0583">i</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
icons/violation-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

89
icons/violation-icon.svg Normal file
View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="185mm"
viewBox="0 0 744.09449 655.51181"
id="svg6853"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="violation-icon.svg"
inkscape:export-filename="/home/hohndel/subsurface/icons/violation-icon.png"
inkscape:export-xdpi="99.999161"
inkscape:export-ydpi="99.999161">
<defs
id="defs6855" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="-294.28571"
inkscape:cy="520"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1680"
inkscape:window-height="979"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata6858">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-396.85039)">
<g
id="g7432"
transform="matrix(1.008908,0,0,0.87587402,-3.3214254,127.71722)">
<path
inkscape:connector-curvature="0"
id="path7401"
d="M 51.927312,1005.8974 373.69904,361.41847 693.78694,1003.3058 Z"
style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:95.36560822;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<path
inkscape:connector-curvature="0"
id="path7401-4"
d="M 76.83791,993.97416 372.20138,405.03077 666.01923,991.60591 Z"
style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#fe0000;stroke-width:41.99768829;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<text
transform="scale(1.0554913,0.9474261)"
sodipodi:linespacing="125%"
id="text7403"
y="928.6485"
x="291.1716"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:92.38998413px;line-height:125%;font-family:'Bookman URW';-inkscape-font-specification:'Bookman URW';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:415.75488281px;font-family:'Bookman URW';-inkscape-font-specification:'Bookman URW'"
y="928.6485"
x="291.1716"
id="tspan7405"
sodipodi:role="line">!</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
icons/warning-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

85
icons/warning-icon.svg Normal file
View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="185mm"
viewBox="0 0 744.09449 655.51181"
id="svg6853"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="warning-icon.svg"
inkscape:export-filename="/home/hohndel/subsurface/icons/warning-icon.png"
inkscape:export-xdpi="73.25"
inkscape:export-ydpi="73.25">
<defs
id="defs6855" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="-294.28571"
inkscape:cy="520"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1680"
inkscape:window-height="979"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata6858">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-396.85039)">
<path
sodipodi:nodetypes="cccc"
style="fill:#ffd42a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:89.64754486;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 49.068455,1008.7566 373.70653,444.27427 696.64577,1006.4867 Z"
id="path7401"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccc"
style="fill:#ffd42a;fill-opacity:1;fill-rule:evenodd;stroke:#ffd42a;stroke-width:39.47953033;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 74.200957,998.31336 372.19552,482.47315 668.6307,996.23907 Z"
id="path7401-4"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:86.85033417px;line-height:125%;font-family:'Bookman URW';-inkscape-font-specification:'Bookman URW';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="270.78113"
y="1017.6475"
id="text7403"
sodipodi:linespacing="125%"
transform="scale(1.1328166,0.88275541)"><tspan
sodipodi:role="line"
id="tspan7405"
x="270.78113"
y="1017.6475"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:390.82647705px;font-family:'Bookman URW';-inkscape-font-specification:'Bookman URW'">!</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -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

View file

@ -14,6 +14,9 @@
<file alias="maximum">icons/maximum.png</file>
<file alias="average">icons/average.png</file>
<file alias="warning">icons/warning.png</file>
<file alias="warning-icon">icons/warning-icon.png</file>
<file alias="violation-icon">icons/violation-icon.png</file>
<file alias="info-icon">icons/info-icon.png</file>
<file alias="gaschange">icons/gaschange.png</file>
<file alias="gaschangeAir">icons/Air_change.png</file>
<file alias="gaschangeNitrox">icons/Nx_change.png</file>