-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 strip root folder. Closes #588, closes #5433 #5465
Allow to strip root folder. Closes #588, closes #5433 #5465
Conversation
What is this? |
@Bhaalspawn, you can see more info in referenced issues: #588, #5433 and #4081. |
d04e14d
to
4ba8ae6
Compare
PR rebased. |
Nobody with the skill is willing to test/review this pull request ? I'm asking out of curiosity because it seems to me that it is a feature a lot of people are waiting for yet it feels like it's not getting any attention. (That's not a critic ! :-)) |
@glassez please keep it open. I'll review it eventually. This week will be hard though. Also ignore @LordNyriox's requests for rebase. @LordNyriox please, stop telling people to rebase their PRs. I know that you mean well. But in case I won't review their PR for some time they will have constant nags from you for rebasing it. I suspect that this will annoy them to constantly have to update their code, even if they don't say something. If I want to review some PR and it needs rebasing, I'll tell them so myself. Thank you. |
@sledgehammer999 maybe you look in there now, apparently, you have the time? |
I am keeping this open in a tab. However, #5214 takes the most precedence. |
6e0a3fa
to
7e46618
Compare
Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the comments in the first commit: If it is too difficult to rebase+fix it, I am ok with a separate new commit that addresses those concerns.
(this is a review of all commits)
src/base/preferences.cpp
Outdated
{ | ||
setValue("Preferences/Downloads/CreateSubfolder", b); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a thought, shouldn't this be a part of session? Like we do for Session::isAddTorrentPaused()
?
src/gui/addnewtorrentdialog.ui
Outdated
@@ -192,6 +192,26 @@ | |||
</property> | |||
</spacer> | |||
</item> | |||
<item row="0" column="0"> | |||
<widget class="QCheckBox" name="start_torrent_cb"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this utilized in this commit. Also the naming scheme is wrong.
void TorrentInfo::renameFile(uint index, const QString &newPath) | ||
{ | ||
if (!isValid()) return; | ||
nativeInfo()->rename_file(index, newPath.toStdString()); | ||
nativeInfo()->rename_file(index, Utils::Fs::toNativePath(newPath).toStdString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think libtorrent generally expects paths using /
as dir separator...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, I checked that, or it was in the old code. In any case, it did not cause problems, at least.
src/base/bittorrent/torrentinfo.cpp
Outdated
m_nativeInfo->remap_files(fileStorage); | ||
if (filesCount() <= 1) return; | ||
|
||
libtorrent::file_storage files = m_nativeInfo->files(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you didn't mean orig_files() here?
In any case, what is the problem that the lines below try to solve?
if (files.name() != testName) { | ||
files.set_name(testName); | ||
for (int i = 0; i < files.num_files(); ++i) | ||
files.rename_file(i, files.file_path(i)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't "set_name" take care of the renaming too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I remember when you rename root folder in AddNewTorrentDialog the files become independent from storage (since it renamed via rename_file and storage still has its original name). We bind it together here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops... I Think I remember something... And if that's not obsession, then here is the solution to more General problems than this PR has.
@qbittorrent, can someone do the following test and confirm the problem?
- Start adding some multifile torrent via AddTorrentDialog
- Rename its root folder (in torrent content widget)
- Let torrent to download some files
- Do "Set Location"
If the problem I think about really exists then qBittorrent will show you the new torrent save path but its files stay in old place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glassez works fine for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sledgehammer999, OK, I remembered this. In this case, the files are detached only from the storage name, so they are affected by move_storage, but not affected by the storage renaming. That is why this code is here. Otherwise we will not be able to delete the root folder by renaming the storage to an empty string.
@thalieht, thank you for testing.
Damn, this PR is for many years. It is based on outdated code, so it contains the wrong names, obsolete approaches, etc. Easier to accept it as is, and then correct its shortcomings in a separate commit. If we don't do it now, it will die without being born. |
I mean I have no time for this PR, at least until I finish #6627. Although, I had already planned other important work after. |
Fix issue when you rename the "root item" in the "Add New Torrent" dialog and uncheck "Create subfolder", it will create the subfolder with the renamed name. Fix PropertiesWidget first folder is expanded after app restart. Strip root folder if torrent was added via magnet link. Fix crash when you get name of torrent without metadata.
7e46618
to
6d7d566
Compare
@sledgehammer999 I watched it again and I realized that I have no clue what it is like! After many time I'm not in the subject. Perhaps (most likely) something got mangled during rebasing... because it was made when the affected code is substantially different from the present. |
@sledgehammer999, Okay, I'm a little cold... I've addressed your review. Let's merge it. |
Just wanted to thank you guys for this PR. This 'avoid to create root folder' functionality was a big pain point for my usage style since converting from uTorrent. Thanks again. |
Thx for the followup @glassez. |
Finally! THANK YOU! |
One question: will this be in the webUI? I use qbittorrent on a headless server so hopefully it is or will be soon so I can finally be down to just one torrent client. |
I have exactly the same question as I'm a qb-nox user. Will this be available as an option on the webui Add Torrent Link popup? |
|
[Question] Will this also be implemented in the Automated RSS Downloader? |
As @sledgehammer999 has no time to maintain #4081 up to date, I offer to your attention this PR.