diff --git a/CHANGELOG.md b/CHANGELOG.md index d98c408b2..4f001c750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +desktop: hide only events with the same severity when 'Hide similar events' is used equipment: mark gas mixes reported by the dive computer as 'inactive' as 'not used' equipment: include unused cylinders in merged dive if the preference is enabled equipment: fix bug showing the first diluent in the gas list as 'used' for CCR dives diff --git a/core/eventname.cpp b/core/eventname.cpp index 4b890ddac..4289d3d83 100644 --- a/core/eventname.cpp +++ b/core/eventname.cpp @@ -39,13 +39,6 @@ extern "C" bool is_event_hidden(const char *eventname) return it != event_names.end() && !it->plot; } -extern "C" void hide_event(const char *eventname) -{ - auto it = std::find(event_names.begin(), event_names.end(), eventname); - if (it != event_names.end()) - it->plot = false; -} - extern "C" void show_all_events() { for (event_name &en: event_names) diff --git a/core/eventname.h b/core/eventname.h index 596711c7c..beaac5c32 100644 --- a/core/eventname.h +++ b/core/eventname.h @@ -10,7 +10,6 @@ extern "C" { extern void clear_event_names(void); extern void remember_event_name(const char *eventname); extern bool is_event_hidden(const char *eventname); -extern void hide_event(const char *eventname); extern void show_all_events(); extern bool any_events_hidden(); diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 41cdcdd68..d362c462d 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -600,7 +600,8 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event) if (DiveEventItem *item = dynamic_cast(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(); } } } diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 25663eecd..1ca9dccfd 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -125,7 +125,8 @@ private: void splitDive(int seconds); void addSetpointChange(int seconds); void removeEvent(DiveEventItem *item); - void hideEvents(DiveEventItem *item); + void hideEvent(DiveEventItem *item); + void hideSimilarEvents(DiveEventItem *item); void editName(DiveEventItem *item); void unhideEvents(); void makeFirstDC();