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

Allow to remember torrent content files deletion in WebUI #20150

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

solarfl4re
Copy link
Contributor

Add a 'remember choice' button to the WebUI Torrent deletion dialog that sets the default file deletion setting. The setting is shared with Qt UI, so if you set it in WebUI and open the Qt app, the delete files checkbox will match WebUI (checked or unchecked).

Button is disabled until user checks or unchecks the delete files checkbox:
Torrent deletion confirm dialog with a new Lock button to set default; button is disabled

When the checkbox is clicked, the user can click the lock button to remember their choice:
Torrent deletion confirm dialog with a new Lock button to set default; button is enabled

This setting was used in the Qt GUI but not in WebUI; I named it
delete_torrent_files_as_default to match other WebUI setting names.
Qt UI has a 'Remember choice' button in the confirm torrent deletion
dialog; this adds a button to the WebUI that matches the Qt dialog in
looks and functionality.

- Button's title text (not visible, but needed for accessibility)
  matches Qt UI, so existing translations for 'Remember choice' can be
  used. Do I just need to update all the .ts files and use the QBT_TR()
  helper?

- The button's script GETs api/v2/app/preferences each time the confirm
  deletion dialog opens; should we cache the deletion setting locally?

Closes qbittorrent#20073.
src/webui/www/private/confirmdeletion.html Outdated Show resolved Hide resolved
src/webui/www/private/confirmdeletion.html Outdated Show resolved Hide resolved
src/webui/www/private/confirmdeletion.html Outdated Show resolved Hide resolved
src/webui/www/private/confirmdeletion.html Outdated Show resolved Hide resolved
src/webui/www/private/confirmdeletion.html Outdated Show resolved Hide resolved
@Chocobo1 Chocobo1 added the WebUI WebUI-related issues/changes label Dec 22, 2023
@Chocobo1
Copy link
Member

Chocobo1 commented Jan 6, 2024

@solarfl4re
I have tested this PR and found some issues. I would like to correct them myself. I hope you don't mind that push some commits directly onto your git branch. Afterwards we will review/approve and squash merge it. If you agree, please leave the PR and git branch as is and I'll handle the rest.

@solarfl4re
Copy link
Contributor Author

@solarfl4re I have tested this PR and found some issues. I would like to correct them myself. I hope you don't mind that push some commits directly onto your git branch. Afterwards we will review/approve and squash merge it. If you agree, please leave the PR and git branch as is and I'll handle the rest.

Sure, that sounds good.

@Chocobo1 Chocobo1 force-pushed the webuiPermDeleteBox branch 2 times, most recently from 30bdbcc to 8a3404b Compare January 6, 2024 11:15
Chocobo1
Chocobo1 previously approved these changes Jan 6, 2024
@Chocobo1 Chocobo1 requested a review from a team January 6, 2024 11:16
@Chocobo1 Chocobo1 force-pushed the webuiPermDeleteBox branch from 8a3404b to 5c6df12 Compare January 6, 2024 11:20
Chocobo1
Chocobo1 previously approved these changes Jan 6, 2024
@Chocobo1 Chocobo1 added this to the 5.0 milestone Jan 6, 2024
@glassez
Copy link
Member

glassez commented Jan 6, 2024

Allow setting torrent-file deletion default in WebUI

Looks confusing... is it about deletion of torrent file?

@glassez
Copy link
Member

glassez commented Jan 6, 2024

@Chocobo1, @qbittorrent/bug-handlers
Shouldn't we use some terminology that allows someone to clearly distinguish which files we are talking about, the torrent metadata files (.torrent files), or the torrent content files?

P.S. this especially refers to user-visible strings.

@glassez glassez requested a review from a team January 6, 2024 12:50
@Chocobo1 Chocobo1 changed the title Allow setting torrent-file deletion default in WebUI Allow to remember torrent content deletion in WebUI Jan 6, 2024
@Chocobo1 Chocobo1 changed the title Allow to remember torrent content deletion in WebUI Allow to remember torrent content files deletion in WebUI Jan 6, 2024
* Fix wrong initialization logic for the "Delete files" checkbox.
* Revert back to use XHR to load svg icon. This is better than embedding
  svg icons.
* Revise CSS selector.
* Make the dialog resizeable and a bit larger.
@thalieht
Copy link
Contributor

thalieht commented Jan 6, 2024

Shouldn't we use some terminology that allows someone to clearly distinguish which files we are talking about, the torrent metadata files (.torrent files), or the torrent content files?

Current string looks good enough to me but i don't know if utorrent has trained its users to consider the .torrent file as part of the torrent's files.

@glassez
Copy link
Member

glassez commented Jan 6, 2024

Shouldn't we use some terminology that allows someone to clearly distinguish which files we are talking about, the torrent metadata files (.torrent files), or the torrent content files?

Current string looks good enough to me but i don't know if utorrent has trained its users to consider the .torrent file as part of the torrent's files.

It's not even about uTorrent. "torrent files" is just ambiguous in itself, isn't it?

@thalieht
Copy link
Contributor

thalieht commented Jan 6, 2024

It's not even about uTorrent. "torrent files" is just ambiguous in itself, isn't it?

I was talking about the single torrent deletion string. I just saw OP pics and multi torrent deletion string can definitely be confusing.

Copy link
Member

@glassez glassez left a comment

Choose a reason for hiding this comment

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

Didn't test.

@Chocobo1 Chocobo1 merged commit e69f857 into qbittorrent:master Jan 8, 2024
13 checks passed
@Chocobo1
Copy link
Member

Chocobo1 commented Jan 8, 2024

@solarfl4re
Thank you!

@Chocobo1
Copy link
Member

Chocobo1 commented Jan 8, 2024

I was talking about the single torrent deletion string. I just saw OP pics and multi torrent deletion string can definitely be confusing.

The dialog currently does not make use of the number of torrents being deleted. It can be counted from:

const hashes = new URI().getData('hashes').split('|');

And modify the message string accordingly:
<p>&nbsp;&nbsp;QBT_TR(Are you sure you want to remove the selected torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]</p>

Ideally it should match GUI behavior. PR welcome.

@thalieht
Copy link
Contributor

thalieht commented Jan 8, 2024

The dialog currently does not make use of the number of torrents being deleted

I don't see how that helps. I meant ...remove the selected torrents... Also permanently delete the files
"delete the files" could mistakenly be interpreted as "delete the .torrent files".
I don't have a good suggestion.

@glassez
Copy link
Member

glassez commented Jan 8, 2024

The dialog currently does not make use of the number of torrents being deleted

I don't see how that helps. I meant ...remove the selected torrents... Also permanently delete the files "delete the files" could mistakenly be interpreted as "delete the .torrent files". I don't have a good suggestion.

IMO, we should use "torrent content files" (or some other suitable alternative) in all such cases to dusambiguate it.

@solarfl4re
Copy link
Contributor Author

The dialog currently does not make use of the number of torrents being deleted

I don't see how that helps. I meant ...remove the selected torrents... Also permanently delete the files "delete the files" could mistakenly be interpreted as "delete the .torrent files". I don't have a good suggestion.

IMO, we should use "torrent content files" (or some other suitable alternative) in all such cases to dusambiguate it.

What about 'downloaded'? E.g. 'delete downloaded files' - that's clear to me as meaning the files I've downloaded.

@glassez
Copy link
Member

glassez commented Jan 28, 2024

What about 'downloaded'? E.g. 'delete downloaded files' - that's clear to me as meaning the files I've downloaded.

It removes the content referenced by torrent independently from whether it was downloaded by torrent or they are previously existing files that you share via that torrent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebUI WebUI-related issues/changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants