mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-03-02 22:57:32 -05:00
Refactor Utils::Gui::openFolderSelect to use switch-case #16910
Labels
No labels
Accessibility
AppImage
Bounty
Build system
CI
Can't reproduce
Code cleanup
Confirmed bug
Confirmed bug
Core
Crash
Data loss
Discussion
Docker
Documentation
Duplicate
Feature
Feature request
Feature request
Feature request
Filters
Flatpak
GUI
Has workaround
I2P
Invalid
Libtorrent
Look and feel
Meta
NSIS
Network
Not an issue
OS: *BSD
OS: Linux
OS: Windows
OS: macOS
PPA
Performance
Project management
Proxy/VPN
Qt bugs
Qt6 compat
RSS
Search engine
Security
Temp folder
Themes
Translations
Triggers
Waiting diagnosis
Waiting info
Waiting upstream
Waiting web implementation
Watched folders
WebAPI
WebUI
autoCloseOldIssue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/qBittorrent#16910
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fkobi on GitHub (May 25, 2025).
Suggestion
Right now the title's function uses 5
ifs and one default behaviour:github.com/qbittorrent/qBittorrent@6418033cc8/src/gui/utils.cpp (L182-L210)Maybe it just grew overtime.
I think it is worth it to rewrite it using
switch-case.It improves readability (and efficiency).
Extra info
I am not sure if this is a feature but this is not a bug.
I would call it an improvement idea.
I came upon this by reading commit
github.com/qbittorrent/qBittorrent@6418033cc8from patch notes.@HanabishiRecca commented on GitHub (May 26, 2025):
PRs are welcome.
@glassez commented on GitHub (May 26, 2025):
What are you guys talking about? It's C++.
switchsupports only integral types and enumerations.@HanabishiRecca commented on GitHub (May 26, 2025):
That's why I said to send a PR. For the reporter to just try to implement it, instead of weird suggestions.
And maybe would come up with a better idea in process, who knows.
@fkobi commented on GitHub (May 26, 2025):
We are comparing
outputto a compile-time-known UTF strings -- I thinkenumcan be used.When I finally get some spare time I'll make a PR but it does not seem like that will happen soon.