qBittorrent icon indicating copy to clipboard operation
qBittorrent copied to clipboard

WebUI: Improve pieces bar by adapting GUI algorithm

Open janka102 opened this issue 1 year ago • 2 comments

This improves upon the first version of the pieces bar from #15418. I was able to adapt the GUI pieces bar code to work in the WebUI, and simplified it a bit. Original GUI code here https://github.com/qbittorrent/qBittorrent/blob/25b3f2d1a6b14f0fe098fb79a3d034607e52deae/src/gui/properties/downloadedpiecesbar.cpp#L54-L129

This fixes an issue in Firefox when there are more than ~30,000 pieces and also generally is more accurate. Previously a vertical line was drawn for each piece and relied on the browser to scale down the image to fit in the page. Instead now it does the scaling in code and only draws the exact needed number of pixels. This has another added benefit that when resizing the window the bar looks better now too.

Here are some examples of what the new bar looks like, it's similar to the previous, but more accurate:

p0-00 p0-40 p2-10 p2-30 p2-60 p3-00 p3-10

Closes #16667

janka102 avatar Jul 07 '22 23:07 janka102

Should be resolved all current suggestions

janka102 avatar Jul 09 '22 22:07 janka102

I noticed some typos, I'll push a quick change for those

janka102 avatar Aug 09 '22 22:08 janka102

@qbittorrent/bug-handlers Please take a quick look to ensure it is working as intended.

Chocobo1 avatar Aug 14 '22 05:08 Chocobo1

@janka102 Thank you!

Chocobo1 avatar Aug 15 '22 04:08 Chocobo1