Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.73k stars 445 forks source link

Add setting to remember download columns width #8020

Closed heldersepu closed 1 month ago

heldersepu commented 1 month ago

Are you tired of having to resize the columns in the download page all the time? me too...

This PR adds a couple of setting to set column width, for now i prefer to just have it as a "hidden" config option and in future versions we can add it in the UI, and more fancy stuff


This is how it looks like with my favorite options, I like the name to be the widest and the progress a bit wider than the default

Screenshot from 2024-05-06 13-17-44


Here is the new setting:

Screenshot from 2024-05-07 19-55-30


My goal is to make small changes as I get myself familiar with the code base, then I would be able to take on some more challenging issues

github-actions[bot] commented 1 month ago

Hi @heldersepu, thank you for contributing to Tribler! 🚀

This PR was created by an outside collaborator, so some checks were not run for security reasons. To trigger the full set of checks, any member of the Tribler team can add the label PR: safe to check to the current PR.

egbertbouman commented 1 month ago

Thanks for your PR! Saving the column settings seems like a nice feature to have. However, I don't think these settinge belongs in the core. We normally store GUI settings in self.window().gui_settings. Could you try storing it there?

heldersepu commented 1 month ago

@egbertbouman correction applied... thanks for the tip, code looks simpler that way! I also rebased and squashed my commits.

egbertbouman commented 1 month ago

Thanks, looks good! I'm fine with merging this PR as-is, but I just noticed that the header also has saveState/restoreState functionality.

If you're up for it, you could save/restore the entire state of the downloads list in TriblerWindow.onClose/TriblerWindow.restore_window_geometry. We're already doing this for the position and size of the window. For instance, saving would be:

self.gui_settings.setValue("download_columns", self.downloads_list.header().saveState())
heldersepu commented 1 month ago

Let me experiment with that self.downloads_list.header().saveState() will let you know more tomorrow

heldersepu commented 1 month ago

@egbertbouman I made the following changes:

only disagreement with your suggestion I'm not saving onclose or restore_window_geometry instead doing it on:

just in case if we get a crash, the state is not affected because it saved immediately after change

egbertbouman commented 1 month ago

Nice, it's running smoothly and there's even a checkbox for it now 👍 Thanks again!

heldersepu commented 1 month ago

it was fun! ... thanks @egbertbouman for pushing me in the right direction ... if you can, take a look at an issue I opened a few days ago: https://github.com/Tribler/tribler/issues/8007 would love more eyes on that