mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
events: make event severity explicit
Currently the event type code uses libdivecomputer's flags to differentiate between events. Make this explicit and extract the event severity. The reason is that later we want to be more explicit about showing/ hiding events and thereto we must format the name of events. Moreover, this encapsulates the complexities of extracting the severity in the event code (that used to be in the profile code). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fdbd076e0d
commit
b98c35ab52
4 changed files with 32 additions and 14 deletions
14
core/event.c
14
core/event.c
|
@ -102,3 +102,17 @@ bool same_event(const struct event *a, const struct event *b)
|
|||
return 0;
|
||||
return !strcmp(a->name, b->name);
|
||||
}
|
||||
|
||||
extern enum event_severity get_event_severity(const struct event *ev)
|
||||
{
|
||||
switch (ev->flags & SAMPLE_FLAGS_SEVERITY_MASK) {
|
||||
case SAMPLE_FLAGS_SEVERITY_INFO:
|
||||
return EVENT_SEVERITY_INFO;
|
||||
case SAMPLE_FLAGS_SEVERITY_WARN:
|
||||
return EVENT_SEVERITY_WARN;
|
||||
case SAMPLE_FLAGS_SEVERITY_ALARM:
|
||||
return EVENT_SEVERITY_ALARM;
|
||||
default:
|
||||
return EVENT_SEVERITY_NONE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue