mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Desktop: Consider Severity when Hiding Events.
When events are hidden in the profile, only hide events with the same name and the same severity (flags). From discussion in https://github.com/subsurface/libdc/pull/54. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
b324849d0c
commit
26f20b805d
5 changed files with 17 additions and 22 deletions
|
@ -600,7 +600,8 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
|
|||
|
||||
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
|
||||
m.addAction(tr("Remove event"), [this,item] { removeEvent(item); });
|
||||
m.addAction(tr("Hide similar events"), [this, item] { hideEvents(item); });
|
||||
m.addAction(tr("Hide event"), [this, item] { hideEvent(item); });
|
||||
m.addAction(tr("Hide similar events"), [this, item] { hideSimilarEvents(item); });
|
||||
const struct event *dcEvent = item->getEvent();
|
||||
if (dcEvent->type == SAMPLE_EVENT_BOOKMARK)
|
||||
m.addAction(tr("Edit name"), [this, item] { editName(item); });
|
||||
|
@ -682,21 +683,21 @@ void ProfileWidget2::renameCurrentDC()
|
|||
Command::editDeviceNickname(currentdc, newName);
|
||||
}
|
||||
|
||||
void ProfileWidget2::hideEvents(DiveEventItem *item)
|
||||
void ProfileWidget2::hideEvent(DiveEventItem *item)
|
||||
{
|
||||
item->hide();
|
||||
}
|
||||
|
||||
void ProfileWidget2::hideSimilarEvents(DiveEventItem *item)
|
||||
{
|
||||
const struct event *event = item->getEvent();
|
||||
|
||||
if (QMessageBox::question(this,
|
||||
TITLE_OR_TEXT(tr("Hide events"), tr("Hide all %1 events?").arg(event->name)),
|
||||
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
|
||||
if (!empty_string(event->name)) {
|
||||
hide_event(event->name);
|
||||
for (DiveEventItem *evItem: profileScene->eventItems) {
|
||||
if (same_string(evItem->getEvent()->name, event->name))
|
||||
evItem->hide();
|
||||
}
|
||||
} else {
|
||||
item->hide();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue