Allow to move content files to Trash instead of deleting them

PR #20252.
This commit is contained in:
Vladimir Golovnev 2024-06-29 08:21:35 +03:00 committed by GitHub
parent c5fa05299b
commit 4e27e88f6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 383 additions and 116 deletions

View file

@ -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());