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

feat: improve GTK torrent piece size picker #6840

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

simplepad
Copy link

@simplepad simplepad commented May 11, 2024

Description

Replaced GtkScale with GtkComboBox. The scale was not really working as expected, it was impossible to pick a certain piece size due to implementation issues. This PR replaces it with GtkComboBox, like in qbit.
Also, instead of hiding it until the source is selected, I made it inactive. I think it looks a bit better.

Fixes #5617.
Also, enabled support for up to 256 MiB piece sizes, fixes #5955.

Some screenshots

Before:

before

Now:

now1
now2

@Pentaphon
Copy link

Also, enabled support for up to 256 MiB piece sizes

Thank you!

@tearfur
Copy link
Member

tearfur commented May 12, 2024

Does this fix #5617?

@simplepad
Copy link
Author

@tearfur Yes, thank you for pointing this out. Updated description.

@Pentaphon
Copy link

Pentaphon commented May 12, 2024

Might have to go into 4.0.x if the GTK client is actually broken in terms of piece selection but not sure if that functionality is essential enough to warrant it.

This also begs the question: should the Qt client also go to combobox to keep things consistent?

@ckerr
Copy link
Member

ckerr commented May 25, 2024

Unless @mikedld is opposed, I'm fine with merging this for 4.1.0

gtk/MakeDialog.cc Outdated Show resolved Hide resolved
@ckerr ckerr changed the title Improve GTK torrent piece size picker feat: improve GTK torrent piece size picker May 26, 2024
@tearfur tearfur added scope:gtk type:ui needs code review needs notes PR title needs a one-sentence paragraph starting with 'Notes:' to summarize for the release notes labels May 30, 2024
@mikedld
Copy link
Member

mikedld commented Jun 1, 2024

The scale was not really working as expected, it was impossible to pick a certain piece size due to implementation issues.

Have you looked into fixing it? I'd try that first, then change the UI.

In theory I'm fine with this PR but I see piece size information is now duplicated on screen (same value displayed in both the label and the combobox) which isn't nice. And there's also that consistency concern pointed out by Pentaphon.

@ckerr
Copy link
Member

ckerr commented Jun 1, 2024

If we do keep this new UI, I think it would be a little better visually for the 4.29 GB in 1 File (2048 BitTorrent pieces @ 2.00 MiB) label to go underneath the piece size selector

@simplepad
Copy link
Author

simplepad commented Jun 1, 2024

@mikedld Yes, I did try to fix the scale ui. The problem is, with the number of possible piece sizes, the scale step becomes so small that it's not very easy to use. See the attached picture.
problem
This is also a problem in the QT client, so maybe it also should use drop down list (like qBittorrent does).

As for the duplicate information, I can remove the piece size from the label.

@mikedld
Copy link
Member

mikedld commented Jun 1, 2024

Not sure what I'm supposed to see on that picture, sorry... Does the below make it any easier for you to pick the value?

--- a/gtk/MakeDialog.cc
+++ b/gtk/MakeDialog.cc
@@ -406,6 +406,7 @@ void MakeDialog::Impl::configurePieceSizeScale(uint32_t piece_size)
     // the below lower & upper bounds would allow piece size selection between approx 1KiB - 64MiB
     auto adjustment = Gtk::Adjustment::create(log2(piece_size), 10, 26, 1.0, 1.0);
     piece_size_scale_->set_adjustment(adjustment);
+    piece_size_scale_->set_round_digits(0);
     piece_size_scale_->set_visible(true);
 }
 

@simplepad
Copy link
Author

simplepad commented Jun 2, 2024

@mikedld setting the round-digit property is what I did when I tried to "fix" the scale, the problem that I tried to show in that picture is: because the scale has 16 steps, the step is very short and it's a bit hard to set a specific value.

@mikedld
Copy link
Member

mikedld commented Jun 2, 2024

@simplepad, have you tried the exact patch I've posted above? I saw a difference between GTK 3 and 4 in handing the round-digits property when specified via the .ui file (it seemingly doesn't work with GTK 3). I find it quite easy to pick a value with it applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs code review needs notes PR title needs a one-sentence paragraph starting with 'Notes:' to summarize for the release notes scope:gtk type:ui
5 participants