mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Add "When adding a torrent" options
This commit is contained in:
parent
d05cf47169
commit
19ccd8c7d3
@ -52,6 +52,7 @@
|
||||
#include "base/rss/rss_autodownloader.h"
|
||||
#include "base/rss/rss_session.h"
|
||||
#include "base/scanfoldersmodel.h"
|
||||
#include "base/torrentfileguard.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/net.h"
|
||||
#include "base/utils/password.h"
|
||||
@ -84,6 +85,10 @@ void AppController::preferencesAction()
|
||||
QVariantMap data;
|
||||
|
||||
// Downloads
|
||||
// When adding a torrent
|
||||
data["create_subfolder_enabled"] = session->isCreateTorrentSubfolder();
|
||||
data["start_paused_enabled"] = session->isAddTorrentPaused();
|
||||
data["auto_delete_mode"] = static_cast<int>(TorrentFileGuard::autoDeleteMode());
|
||||
data["preallocate_all"] = session->isPreallocationEnabled();
|
||||
data["incomplete_files_ext"] = session->isAppendExtensionEnabled();
|
||||
// Saving Management
|
||||
@ -240,6 +245,14 @@ void AppController::setPreferencesAction()
|
||||
QVariantMap::ConstIterator it;
|
||||
|
||||
// Downloads
|
||||
// When adding a torrent
|
||||
if ((it = m.find(QLatin1String("create_subfolder_enabled"))) != m.constEnd())
|
||||
session->setCreateTorrentSubfolder(it.value().toBool());
|
||||
if ((it = m.find(QLatin1String("start_paused_enabled"))) != m.constEnd())
|
||||
session->setAddTorrentPaused(it.value().toBool());
|
||||
if ((it = m.find(QLatin1String("auto_delete_mode"))) != m.constEnd())
|
||||
TorrentFileGuard::setAutoDeleteMode(static_cast<TorrentFileGuard::AutoDeleteMode>(it.value().toInt()));
|
||||
|
||||
if ((it = m.find(QLatin1String("preallocate_all"))) != m.constEnd())
|
||||
session->setPreallocationEnabled(it.value().toBool());
|
||||
if ((it = m.find(QLatin1String("incomplete_files_ext"))) != m.constEnd())
|
||||
|
@ -1,4 +1,20 @@
|
||||
<div id="DownloadsTab" class="PrefTab">
|
||||
<fieldset class="settings">
|
||||
<legend>QBT_TR(When adding a torrent)QBT_TR[CONTEXT=OptionsDialog]</legend>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="createsubfolder_checkbox" />
|
||||
<label for="createsubfolder_checkbox">QBT_TR(Create subfolder for torrents with multiple files)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="dontstartdownloads_checkbox" />
|
||||
<label for="dontstartauto_checkbox">QBT_TR(Do not start the download automatically)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="deletetorrentfileafter_checkbox" />
|
||||
<label for="deletetorrentafter_checkbox">QBT_TR(Delete .torrent files afterwards)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="preallocateall_checkbox" />
|
||||
<label for="preallocateall_checkbox">QBT_TR(Pre-allocate disk space for all files)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
@ -1026,6 +1042,11 @@
|
||||
onSuccess: function(pref) {
|
||||
if (pref) {
|
||||
// Downloads tab
|
||||
// When adding a torrent
|
||||
$('createsubfolder_checkbox').setProperty('checked', pref.create_subfolder_enabled);
|
||||
$('dontstartdownloads_checkbox').setProperty('checked', pref.start_paused_enabled);
|
||||
$('deletetorrentfileafter_checkbox').setProperty('checked', pref.auto_delete_mode);
|
||||
|
||||
$('preallocateall_checkbox').setProperty('checked', pref.preallocate_all);
|
||||
$('appendext_checkbox').setProperty('checked', pref.incomplete_files_ext);
|
||||
|
||||
@ -1274,6 +1295,11 @@
|
||||
var settings = new Hash();
|
||||
// Validate form data
|
||||
// Downloads tab
|
||||
// When adding a torrent
|
||||
settings.set('create_subfolder_enabled', $('createsubfolder_checkbox').getProperty('checked'));
|
||||
settings.set('start_paused_enabled', $('dontstartdownloads_checkbox').getProperty('checked'));
|
||||
settings.set('auto_delete_mode', $('deletetorrentfileafter_checkbox').getProperty('checked'));
|
||||
|
||||
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked'));
|
||||
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user