Skip to content

fix(filter): extract TorrentFilterStrategy, fix active filter, align with qBittorrent 5.2.0#128

Merged
Michael-128 merged 5 commits into
mainfrom
fix/pause-bug
Jul 14, 2026
Merged

fix(filter): extract TorrentFilterStrategy, fix active filter, align with qBittorrent 5.2.0#128
Michael-128 merged 5 commits into
mainfrom
fix/pause-bug

Conversation

@Michael-128

Copy link
Copy Markdown
Owner

Closes #127

Summary

Fixes the pause-bug where pausing a torrent from the details view left it visible under the Active filter. Along the way, extracted a portable filter strategy, aligned filter names and ordering with qBittorrent 5.2.0 WebUI, and added per-filter counts.

Key Changes

  • TorrentFilterStrategy: New protocol + QBitTorrentFilterStrategy implementation. Extracted filter logic from getProcessedTorrents into a standalone, injectable strategy. Transmission-ready.
  • Single source of truth: Torrent now has applyPause(), applyResume(), applyForceStart(), applyRecheck() methods — both ViewModels call the same transition logic, eliminating the drift that caused [BUG] If you add a torrent and pause it while selecting to show "Active" torrents in the filters the torrent doesn't disappear as it should #127.
  • Filter alignment: Removed fake filters (Resumed, Active Downloading, Active Seeding). Renamed Paused→Stopped, added Running/Moving. Order matches qBittorrent 5.2.0 WebUI.
  • Per-filter counts: Each filter row shows a greyed-out count of matching torrents via a custom Button/checkmark layout. Counts reactively update from the cache manager.
  • Real state strings: Removed fake states (seeding, completed) from strategy and test fixtures. Active filter reverted to speed-based (dlspeed>0 || upspeed>0) matching qBittorrent's actual behavior. Supports both stoppedDL/pausedDL variants for v4/v5 compatibility.

Technical Notes

  • UserDefaults saves filter via rawValue — old resumed/paused values gracefully fall back to All.
  • PickerStyle.inline replaced with Section+Button for filter list to get checkmark/count alignment control.

…h qBittorrent isActive() definition

- Extract filter logic into TorrentFilterStrategy protocol + QBitTorrentFilterStrategy
- Fix active filter from speed-based to state-based, matching qBittorrent's isActive()
- Add transition methods (applyPause/Resume/ForceStart/Recheck) to Torrent as single source of truth
- Replace duplicated inline transition closures in both ViewModels with Torrent methods
- Rename paused→stopped, resumed→running to match WebUI terminology
- Add moving filter
- Fix swapped Seeding/Downloading tags (were mapped to stalled variants)
- Remove app-only Active Downloading/Active Seeding labels
- Add missing Stalled Uploading, Stalled Downloading, Checking, Moving entries
…ted, revert active to speed-based

- Split .seeding and .completed: seeding = active upload states; completed = seeding + pausedUP/stoppedUP
- Revert .active to speed-based (dlspeed>0 || upspeed>0) to match qBittorrent WebUI
- Keep .running as state-based (not paused, not errored)
- Add queuedDL to .downloading
- Remove fake state strings from strategy (seeding, completed)
- Fix test fixtures: seeding → uploading (real qBittorrent state)
@Michael-128
Michael-128 merged commit 457fe14 into main Jul 14, 2026
@Michael-128
Michael-128 deleted the fix/pause-bug branch July 16, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] If you add a torrent and pause it while selecting to show "Active" torrents in the filters the torrent doesn't disappear as it should

1 participant