diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-31 11:56:35 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-06-01 13:08:45 -0700 |
commit | 36a3f649c5896b660ba3640a30b4ffc56d6ad679 (patch) | |
tree | 02d9c704d4af896be5dd76ba11ae645d0c153bf5 /profile-widget/diveeventitem.cpp | |
parent | 5ea16c0bab2ab1e1d674078a2db2794f4325f156 (diff) | |
download | subsurface-36a3f649c5896b660ba3640a30b4ffc56d6ad679.tar.gz |
Don't show surface events at the beginning or end of the dive
That's just annoying and pointless. So we arbitrarily say that surface
events within the first and last 30s of the dive are suppressed.
But we now do show them in the middle, in case the sampling rate is too
low, and the profile itself doesn't show that we got to the surface.
These heuristics still needs tweaking - if the profile already shows
that we're at the surface, then we should probably suppress the event
triangle.
But in the meantime this at least gets rid of the truly pointless cases.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/diveeventitem.cpp')
-rw-r--r-- | profile-widget/diveeventitem.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 876c56e16..de3c8fb31 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -150,17 +150,29 @@ void DiveEventItem::eventVisibilityChanged(const QString &eventName, bool visibl bool DiveEventItem::shouldBeHidden() { struct event *event = internalEvent; + struct dive *dive = &displayed_dive; + struct divecomputer *dc = get_dive_dc(dive, dc_number); /* * Some gas change events are special. Some dive computers just tell us the initial gas this way. * Don't bother showing those */ - struct sample *first_sample = &get_dive_dc(&displayed_dive, dc_number)->sample[0]; + struct sample *first_sample = &dc->sample[0]; if (!strcmp(event->name, "gaschange") && (event->time.seconds == 0 || (first_sample && event->time.seconds == first_sample->time.seconds))) return true; + /* + * Some divecomputers give "surface" events that just aren't interesting. + * Like at the beginning or very end of a dive. Well, duh. + */ + if (!strcmp(event->name, "surface")) { + int time = event->time.seconds; + if (time <= 30 || time + 30 >= dc->duration.seconds) + return true; + } + for (int i = 0; i < evn_used; i++) { if (!strcmp(event->name, ev_namelist[i].ev_name) && ev_namelist[i].plot_ev == false) return true; |