mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 20:58:07 -06:00
Allow to move content files to Trash instead of deleting them
PR #20252.
This commit is contained in:
committed by
GitHub
parent
c5fa05299b
commit
4e27e88f6a
@@ -136,7 +136,7 @@ void AppController::preferencesAction()
|
||||
data[u"file_log_age"_s] = app()->fileLoggerAge();
|
||||
data[u"file_log_age_type"_s] = app()->fileLoggerAgeType();
|
||||
// Delete torrent contents files on torrent removal
|
||||
data[u"delete_torrent_content_files"_s] = pref->deleteTorrentFilesAsDefault();
|
||||
data[u"delete_torrent_content_files"_s] = pref->removeTorrentContent();
|
||||
|
||||
// Downloads
|
||||
// When adding a torrent
|
||||
@@ -350,6 +350,8 @@ void AppController::preferencesAction()
|
||||
// qBitorrent preferences
|
||||
// Resume data storage type
|
||||
data[u"resume_data_storage_type"_s] = Utils::String::fromEnum(session->resumeDataStorageType());
|
||||
// Torrent content removing mode
|
||||
data[u"torrent_content_remove_option"_s] = Utils::String::fromEnum(session->torrentContentRemoveOption());
|
||||
// Physical memory (RAM) usage limit
|
||||
data[u"memory_working_set_limit"_s] = app()->memoryWorkingSetLimit();
|
||||
// Current network interface
|
||||
@@ -519,7 +521,7 @@ void AppController::setPreferencesAction()
|
||||
app()->setFileLoggerAgeType(it.value().toInt());
|
||||
// Delete torrent content files on torrent removal
|
||||
if (hasKey(u"delete_torrent_content_files"_s))
|
||||
pref->setDeleteTorrentFilesAsDefault(it.value().toBool());
|
||||
pref->setRemoveTorrentContent(it.value().toBool());
|
||||
|
||||
// Downloads
|
||||
// When adding a torrent
|
||||
@@ -931,6 +933,9 @@ void AppController::setPreferencesAction()
|
||||
// Resume data storage type
|
||||
if (hasKey(u"resume_data_storage_type"_s))
|
||||
session->setResumeDataStorageType(Utils::String::toEnum(it.value().toString(), BitTorrent::ResumeDataStorageType::Legacy));
|
||||
// Torrent content removing mode
|
||||
if (hasKey(u"torrent_content_remove_option"_s))
|
||||
session->setTorrentContentRemoveOption(Utils::String::toEnum(it.value().toString(), BitTorrent::TorrentContentRemoveOption::MoveToTrash));
|
||||
// Physical memory (RAM) usage limit
|
||||
if (hasKey(u"memory_working_set_limit"_s))
|
||||
app()->setMemoryWorkingSetLimit(it.value().toInt());
|
||||
|
||||
@@ -1096,11 +1096,11 @@ void TorrentsController::deleteAction()
|
||||
requireParams({u"hashes"_s, u"deleteFiles"_s});
|
||||
|
||||
const QStringList hashes {params()[u"hashes"_s].split(u'|')};
|
||||
const DeleteOption deleteOption = parseBool(params()[u"deleteFiles"_s]).value_or(false)
|
||||
? DeleteTorrentAndFiles : DeleteTorrent;
|
||||
const BitTorrent::TorrentRemoveOption deleteOption = parseBool(params()[u"deleteFiles"_s]).value_or(false)
|
||||
? BitTorrent::TorrentRemoveOption::RemoveContent : BitTorrent::TorrentRemoveOption::KeepContent;
|
||||
applyToTorrents(hashes, [deleteOption](const BitTorrent::Torrent *torrent)
|
||||
{
|
||||
BitTorrent::Session::instance()->deleteTorrent(torrent->id(), deleteOption);
|
||||
BitTorrent::Session::instance()->removeTorrent(torrent->id(), deleteOption);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<p> QBT_TR(Are you sure you want to remove the selected torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]</p>
|
||||
<button id="rememberBtn" type="button" title="Remember choice" style="vertical-align: middle; padding: 4px 6px;">
|
||||
</button>
|
||||
<input type="checkbox" id="deleteFromDiskCB" /> <label for="deleteFromDiskCB"><i>QBT_TR(Also permanently delete the files)QBT_TR[CONTEXT=confirmDeletionDlg]</i></label><br /><br />
|
||||
<input type="checkbox" id="deleteFromDiskCB" /> <label for="deleteFromDiskCB"><i>QBT_TR(Also remove the content files)QBT_TR[CONTEXT=confirmDeletionDlg]</i></label><br /><br />
|
||||
<div style="text-align: right;">
|
||||
<input type="button" id="cancelBtn" value="QBT_TR(Cancel)QBT_TR[CONTEXT=MainWindow]" /> <input type="button" id="confirmBtn" value="QBT_TR(Remove)QBT_TR[CONTEXT=MainWindow]" />
|
||||
</div>
|
||||
|
||||
@@ -997,6 +997,17 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowMemoryWorkingSetLimit">
|
||||
<td>
|
||||
<label for="torrentContentRemoveOption">QBT_TR(Torrent content removing mode:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="torrentContentRemoveOption" style="width: 15em;">
|
||||
<option value="Delete">QBT_TR(Delete files permanently)QBT_TR[CONTEXT=OptionsDialog]</option>
|
||||
<option value="MoveToTrash">QBT_TR(Move files to trash (if possible))QBT_TR[CONTEXT=OptionsDialog]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="memoryWorkingSetLimit">QBT_TR(Physical memory (RAM) usage limit:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://wikipedia.org/wiki/Working_set" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
@@ -2318,6 +2329,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
// Advanced settings
|
||||
// qBittorrent section
|
||||
$("resumeDataStorageType").setProperty("value", pref.resume_data_storage_type);
|
||||
$("torrentContentRemoveOption").setProperty("value", pref.torrent_content_remove_option);
|
||||
$("memoryWorkingSetLimit").setProperty("value", pref.memory_working_set_limit);
|
||||
updateNetworkInterfaces(pref.current_network_interface, pref.current_interface_name);
|
||||
updateInterfaceAddresses(pref.current_network_interface, pref.current_interface_address);
|
||||
@@ -2764,6 +2776,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
// Update advanced settings
|
||||
// qBittorrent section
|
||||
settings["resume_data_storage_type"] = $("resumeDataStorageType").getProperty("value");
|
||||
settings["torrent_content_remove_option"] = $("torrentContentRemoveOption").getProperty("value");
|
||||
settings["memory_working_set_limit"] = Number($("memoryWorkingSetLimit").getProperty("value"));
|
||||
settings["current_network_interface"] = $("networkInterface").getProperty("value");
|
||||
settings["current_interface_address"] = $("optionalIPAddressToBind").getProperty("value");
|
||||
|
||||
Reference in New Issue
Block a user