Implement fine grained priorities#23751
Implement fine grained priorities#23751HanabishiRecca wants to merge 1 commit intoqbittorrent:masterfrom
Conversation
| switch (priority) | ||
| { | ||
| case DownloadPriority::Ignored: | ||
| case DownloadPriority::Normal: | ||
| case DownloadPriority::Normal2: | ||
| case DownloadPriority::Normal3: | ||
| case DownloadPriority::Normal4: | ||
| case DownloadPriority::Normal5: | ||
| case DownloadPriority::High: | ||
| case DownloadPriority::Maximum: | ||
| case DownloadPriority::Mixed: | ||
| return true; |
There was a problem hiding this comment.
As the indexes are contiguous now, I think in such places switches can be replaced with more generalized code.
| Ignored = 0, | ||
| Normal = 1, | ||
| Normal2 = 2, | ||
| Normal3 = 3, | ||
| Normal4 = 4, | ||
| Normal5 = 5, | ||
| High = 6, | ||
| Maximum = 7, |
There was a problem hiding this comment.
I don't like the naming here, but not sure if we can change the defaults.
Probably makes more sense to shift default Normal level to 4 (as libtorrent implies internally) and then introduce low/normal/high levels.
That should not break backward compatibility in theory, files in old torrents will just appear as "low" priority, which is not a big deal.
|
Since these are internal names and they may be expanded in the future (LibTorrent's enum), can I suggest the following enums? In the UI, I'd show them as: |
|
Changing internal names in the future is not a problem. If fact I'm not sure if we even need an enum at this point. When indexes are contiguous we could store it as a plain number, define some low/normal/high consts (basically what libtorrent does) and automatically generate names in between. |
|
Yep, an int would be better and wouldn't need to be adjusted. |
|
@HanabishiRecca |
|
Yeah, idk why libtorrent has limited priorities in the first place. Looks easier to just let clients set arbitrary number. |
|
Perhaps the libtorrent max isn't actually enforced... EDIT: Never mind, yeah it is. |
|
@glassez A byte would be more than enough. |
Love this idea, but still want 15 priorities as in utorrent |
A small PoC code to close #21430.
I'm not really happy with the current implementation, it's just to give the idea.