Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

READY: Add tree-based view for torrent files in download dialog #6449

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

ichorid
Copy link
Contributor

@ichorid ichorid commented Oct 12, 2021

fixes #1396
fixes #6443

I had to try at least three different ways of adding progress bars to QTreeWidget. This one is the safest, it does not trigger the dreaded "QObject deleted" error. Drawing progress bars by using setItemWidget is still slow, so it is disabled for torrents with more than 1k entries.
The proper, fast and safe way to implement this kind of stuff is to move to use the Model-View architecture. However, that would prove too much work, at least for now.

Add download dialog (Note that sorting works, and that there is a counter for total selected files size and select/deselect all buttons are removed as unnecessary. "Download exists" label is removed too - the corresponding notification is now shown in the same "Loading metainfo" label)

изображение

изображение
изображение

UPDATE2:
I've tripped at least three different QT bugs while doing this 🤦 The whole thing is built from workarounds. We really need to switch to Model-View eventually.

@ichorid ichorid force-pushed the feature/tree_downloads_files_view branch 7 times, most recently from ed9297d to 5a75e85 Compare October 12, 2021 18:50
@ichorid ichorid marked this pull request as ready for review October 12, 2021 18:57
@ichorid ichorid requested review from a team, drew2a and devos50 and removed request for a team October 12, 2021 18:57
@ichorid ichorid force-pushed the feature/tree_downloads_files_view branch from 5a75e85 to 7cffc67 Compare October 12, 2021 19:02
@devos50
Copy link
Contributor

devos50 commented Oct 13, 2021

Great addition!

I’m aware that this PR is still WIP but I took a bit of time to see how it feels and looks. Except for selecting/deselecting files in the tree view of the ‘files’ tab on the download page, it seems to be functional. I have a few (mostly stylistic) suggestions:

Tree view when starting a download:

  • Can you make the ‘Included?’ Column auto-size to the required width or would this be too much work?
  • There is no context regarding the numbers below the table (e.g., 3.3 MB / 889.0 MB). I understand that the first number is the total selected file size whereas the second number is the overall size of the download. This is not clear for users. We can add something like: Selected: 3.3 MB, Total: 889.0 MB.
  • Should we add ‘select all’ / ‘select none’ buttons?

Tree view when going to ‘files’ when downloading a torrent:

  • The QTreeView is not using the full page width.

Schermafbeelding 2021-10-13 om 10 36 42

  • I’m unable to select a bunch of files and exclude them for download. I used to be able to do so by right-clicking. The selection also seems to be a bit broken though (probably because you’re using the notorious QTreeView).
  • I would suggest adding a few pixels of margin to the top and bottom of each progress bar.

Asking for help: anyone willing to help with CSS styles for checkboxes and progress bars?

I don't think there's much work to be done there. Re-using the progress bar style of the main download list is definitely a good idea for now. I think using the default checkbox styles for now is ok. Customizing checkboxes is not really easy and requires us to make customized images for different states (e.g., checked/enabled, etc.). I would consider that an effort for a further iteration.

@ichorid
Copy link
Contributor Author

ichorid commented Oct 13, 2021

Tree view when starting a download:

* Can you make the ‘Included?’ Column auto-size to the required width or would this be too much work?

Yep, there is an option for that. I'll try it.

* There is no context regarding the numbers below the table (e.g., 3.3 MB / 889.0 MB). I understand that the first number is the total selected file size whereas the second number is the overall size of the download. This is not clear for users. We can add something like: **Selected:** 3.3 MB, **Total:** 889.0 MB.

Good point.

* Should we add ‘select all’ / ‘select none’ buttons?

Select all / unselect all buttons are unnecessary because clicking the top-level checkboxes magically 🧙‍♂️ sets/unsets checkboxes for the whole subtree.

* I’m unable to select a bunch of files and exclude them for download. I used to be able to do so by right-clicking. The selection also seems to be a bit broken though (probably because you’re using the notorious `QTreeView`).

Well, you're not supposed to, really... Just check/uncheck the checkboxes - that is it. Selection is completely unnecessary in the case of "tree+checkboxes" solution: it requires the same amount of clicks to either click the checkboxes or first select them and then open the menu, etc.

@ichorid
Copy link
Contributor Author

ichorid commented Oct 13, 2021

There is a 7-years old QT bug that forces everyone trying to customize checkboxes to use pictures instead of CSS colours:facepalm:

@ichorid ichorid force-pushed the feature/tree_downloads_files_view branch 2 times, most recently from cbe9cf8 to beb52be Compare October 14, 2021 13:08
@ichorid ichorid changed the title Add tree-based view for torrent files in download dialog READY: Add tree-based view for torrent files in download dialog Oct 14, 2021
@ichorid ichorid force-pushed the feature/tree_downloads_files_view branch 3 times, most recently from 3899e06 to 6585ec1 Compare October 14, 2021 14:43
@ichorid
Copy link
Contributor Author

ichorid commented Oct 14, 2021

retest this please

drew2a
drew2a previously approved these changes Oct 14, 2021
Copy link
Contributor

@drew2a drew2a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR improves UX, thank you for your work.

@ichorid ichorid force-pushed the feature/tree_downloads_files_view branch from 7a67a6d to 490af92 Compare October 15, 2021 14:24
@sonarcloud
Copy link

sonarcloud bot commented Oct 15, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.2% 0.2% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Trees for file selection in torrents Tree view to select files to download
3 participants