From 08b51fc86971144eb5ade421e227562eed1b88e7 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sat, 2 Nov 2024 16:40:27 +0300 Subject: [PATCH] Remove trackers from previous category when moved to new one PR #21717. Closes #21637. --- src/gui/transferlistfilters/trackersfilterwidget.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gui/transferlistfilters/trackersfilterwidget.cpp b/src/gui/transferlistfilters/trackersfilterwidget.cpp index f28711bfd..3379b48bd 100644 --- a/src/gui/transferlistfilters/trackersfilterwidget.cpp +++ b/src/gui/transferlistfilters/trackersfilterwidget.cpp @@ -394,15 +394,11 @@ void TrackersFilterWidget::handleTrackerStatusesUpdated(const BitTorrent::Torren { if (trackerEntryStatus.state == BitTorrent::TrackerEndpointState::Working) { + // remove tracker from "error" and "tracker error" categories if (errorHashesIt != m_errors.end()) - { errorHashesIt->remove(trackerEntryStatus.url); - } - if (trackerErrorHashesIt != m_trackerErrors.end()) - { trackerErrorHashesIt->remove(trackerEntryStatus.url); - } const bool hasNoWarningMessages = std::all_of(trackerEntryStatus.endpoints.cbegin(), trackerEntryStatus.endpoints.cend() , [](const BitTorrent::TrackerEndpointStatus &endpointEntry) @@ -426,12 +422,24 @@ void TrackersFilterWidget::handleTrackerStatusesUpdated(const BitTorrent::Torren else if ((trackerEntryStatus.state == BitTorrent::TrackerEndpointState::NotWorking) || (trackerEntryStatus.state == BitTorrent::TrackerEndpointState::Unreachable)) { + // remove tracker from "tracker error" and "warning" categories + if (warningHashesIt != m_warnings.end()) + warningHashesIt->remove(trackerEntryStatus.url); + if (trackerErrorHashesIt != m_trackerErrors.end()) + trackerErrorHashesIt->remove(trackerEntryStatus.url); + if (errorHashesIt == m_errors.end()) errorHashesIt = m_errors.insert(id, {}); errorHashesIt->insert(trackerEntryStatus.url); } else if (trackerEntryStatus.state == BitTorrent::TrackerEndpointState::TrackerError) { + // remove tracker from "error" and "warning" categories + if (warningHashesIt != m_warnings.end()) + warningHashesIt->remove(trackerEntryStatus.url); + if (errorHashesIt != m_errors.end()) + errorHashesIt->remove(trackerEntryStatus.url); + if (trackerErrorHashesIt == m_trackerErrors.end()) trackerErrorHashesIt = m_trackerErrors.insert(id, {}); trackerErrorHashesIt->insert(trackerEntryStatus.url); -- 2.11.4.GIT