diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index 410499ec9..8e23949c2 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -111,6 +111,7 @@ void AppController::preferencesAction() // When adding a torrent data[u"torrent_content_layout"_qs] = Utils::String::fromEnum(session->torrentContentLayout()); data[u"start_paused_enabled"_qs] = session->isAddTorrentPaused(); + data[u"torrent_stop_condition"_qs] = Utils::String::fromEnum(session->torrentStopCondition()); data[u"auto_delete_mode"_qs] = static_cast(TorrentFileGuard::autoDeleteMode()); data[u"preallocate_all"_qs] = session->isPreallocationEnabled(); data[u"incomplete_files_ext"_qs] = session->isAppendExtensionEnabled(); @@ -411,6 +412,8 @@ void AppController::setPreferencesAction() session->setTorrentContentLayout(Utils::String::toEnum(it.value().toString(), BitTorrent::TorrentContentLayout::Original)); if (hasKey(u"start_paused_enabled"_qs)) session->setAddTorrentPaused(it.value().toBool()); + if (hasKey(u"torrent_stop_condition"_qs)) + session->setTorrentStopCondition(Utils::String::toEnum(it.value().toString(), BitTorrent::Torrent::StopCondition::None)); if (hasKey(u"auto_delete_mode"_qs)) TorrentFileGuard::setAutoDeleteMode(static_cast(it.value().toInt())); diff --git a/src/webui/www/private/download.html b/src/webui/www/private/download.html index a101a9a9f..3cf9034f5 100644 --- a/src/webui/www/private/download.html +++ b/src/webui/www/private/download.html @@ -79,6 +79,18 @@ + + + + + + + + diff --git a/src/webui/www/private/scripts/download.js b/src/webui/www/private/scripts/download.js index f1a44e67e..eec18e0e3 100644 --- a/src/webui/www/private/scripts/download.js +++ b/src/webui/www/private/scripts/download.js @@ -82,6 +82,16 @@ window.qBittorrent.Download = (function() { $('autoTMM').selectedIndex = 0; } + if (pref.torrent_stop_condition === "MetadataReceived") { + $('stopCondition').selectedIndex = 1; + } + else if (pref.torrent_stop_condition === "FilesChecked") { + $('stopCondition').selectedIndex = 2; + } + else { + $('stopCondition').selectedIndex = 0; + } + if (pref.torrent_content_layout === "Subfolder") { $('contentLayout').selectedIndex = 1; } diff --git a/src/webui/www/private/upload.html b/src/webui/www/private/upload.html index a656d07df..e63a99569 100644 --- a/src/webui/www/private/upload.html +++ b/src/webui/www/private/upload.html @@ -67,6 +67,18 @@ + + + + + + + + diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 25e81b610..3b126cda5 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -13,6 +13,14 @@ +
+ + +
@@ -1740,6 +1748,18 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD } $('contentlayout_select').getChildren('option')[index].setAttribute('selected', ''); $('dontstartdownloads_checkbox').setProperty('checked', pref.start_paused_enabled); + switch (pref.torrent_stop_condition) { + case "None": + index = 0; + break; + case "MetadataReceived": + index = 1; + break; + case "FilesChecked": + index = 2; + break; + } + $('stopConditionSelect').getChildren('option')[index].setAttribute('selected', ''); $('deletetorrentfileafter_checkbox').setProperty('checked', pref.auto_delete_mode); $('preallocateall_checkbox').setProperty('checked', pref.preallocate_all); @@ -2093,6 +2113,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD // When adding a torrent settings.set('torrent_content_layout', $('contentlayout_select').getSelected()[0].getProperty('value')); settings.set('start_paused_enabled', $('dontstartdownloads_checkbox').getProperty('checked')); + settings.set('torrent_stop_condition', $('stopConditionSelect').getSelected()[0].getProperty('value')); settings.set('auto_delete_mode', $('deletetorrentfileafter_checkbox').getProperty('checked')); settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked'));