Profile: Reinstate Hiding of Events by Type across Dives.

Reinstate the hiding of events by event type across
all dives in the log. This was unintentionally removed in #3948.
Also change the event type to be specific to name and severity, and fix
bug causing 'Unhide all events' to not show when only individual events
were hidden.

This still leaves the inconsistency that hiding of similar events is
persisted across the switch between dives, but hiding of individual
events is lost when switching dives, which is mildly confusing.

Follow-up to #4092.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-02-12 23:04:36 +13:00 committed by bstoeger
parent 8181048611
commit 1309064873
5 changed files with 24 additions and 18 deletions

View file

@ -656,7 +656,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
}
#endif
}
if (any_events_hidden())
if (any_events_hidden() || std::any_of(profileScene->eventItems.begin(), profileScene->eventItems.end(), [] (const DiveEventItem *item) { return !item->isVisible(); }))
m.addAction(tr("Unhide all events"), this, &ProfileWidget2::unhideEvents);
m.exec(event->globalPos());
}
@ -701,13 +701,10 @@ void ProfileWidget2::hideSimilarEvents(DiveEventItem *item)
{
const struct event *event = item->getEvent();
hideEvent(item);
if (!empty_string(event->name)) {
for (DiveEventItem *evItem: profileScene->eventItems) {
if (same_string(evItem->getEvent()->name, event->name) && evItem->getEvent()->flags == event->flags)
evItem->hide();
}
hide_similar_events(event->name, event->flags);
replot();
}
}