mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Add slow torrent options
This commit is contained in:
parent
2ebc6a056e
commit
402715004c
@ -188,6 +188,9 @@ void AppController::preferencesAction()
|
||||
data["max_active_torrents"] = session->maxActiveTorrents();
|
||||
data["max_active_uploads"] = session->maxActiveUploads();
|
||||
data["dont_count_slow_torrents"] = session->ignoreSlowTorrentsForQueueing();
|
||||
data["slow_torrent_dl_rate_threshold"] = session->downloadRateForSlowTorrents();
|
||||
data["slow_torrent_ul_rate_threshold"] = session->uploadRateForSlowTorrents();
|
||||
data["slow_torrent_inactive_timer"] = session->slowTorrentsInactivityTimer();
|
||||
// Share Ratio Limiting
|
||||
data["max_ratio_enabled"] = (session->globalMaxRatio() >= 0.);
|
||||
data["max_ratio"] = session->globalMaxRatio();
|
||||
@ -450,6 +453,12 @@ void AppController::setPreferencesAction()
|
||||
session->setMaxActiveUploads(m["max_active_uploads"].toInt());
|
||||
if (m.contains("dont_count_slow_torrents"))
|
||||
session->setIgnoreSlowTorrentsForQueueing(m["dont_count_slow_torrents"].toBool());
|
||||
if ((it = m.find(QLatin1String("slow_torrent_dl_rate_threshold"))) != m.constEnd())
|
||||
session->setDownloadRateForSlowTorrents(it.value().toInt());
|
||||
if ((it = m.find(QLatin1String("slow_torrent_ul_rate_threshold"))) != m.constEnd())
|
||||
session->setUploadRateForSlowTorrents(it.value().toInt());
|
||||
if ((it = m.find(QLatin1String("slow_torrent_inactive_timer"))) != m.constEnd())
|
||||
session->setSlowTorrentsInactivityTimer(it.value().toInt());
|
||||
// Share Ratio Limiting
|
||||
if (m.contains("max_ratio_enabled")) {
|
||||
if (m["max_ratio_enabled"].toBool())
|
||||
|
@ -521,10 +521,38 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="dont_count_slow_torrents_checkbox" />
|
||||
<label for="dont_count_slow_torrents_checkbox">QBT_TR(Do not count slow torrents in these limits)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
<fieldset class="settings">
|
||||
<legend>
|
||||
<input type="checkbox" id="dont_count_slow_torrents_checkbox" onclick="updateSlowTorrentsSettings();" />
|
||||
<label for="dont_count_slow_torrents_checkbox">QBT_TR(Do not count slow torrents in these limits)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="dl_rate_threshold">QBT_TR(Download rate threshold:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="dl_rate_threshold" style="width: 4em;" /> QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="ul_rate_threshold">QBT_TR(Upload rate threshold:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="ul_rate_threshold" style="width: 4em;" /> QBT_TR(KiB/s)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="torrent_inactive_timer">QBT_TR(Torrent inactivity timer:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="torrent_inactive_timer" style="width: 4em;" /> QBT_TR(seconds)QBT_TR[CONTEXT=OptionsDialog]
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="settings">
|
||||
@ -985,6 +1013,14 @@
|
||||
$('max_active_up_value').setProperty('disabled', !isQueueingEnabled);
|
||||
$('max_active_to_value').setProperty('disabled', !isQueueingEnabled);
|
||||
$('dont_count_slow_torrents_checkbox').setProperty('disabled', !isQueueingEnabled);
|
||||
updateSlowTorrentsSettings();
|
||||
};
|
||||
|
||||
updateSlowTorrentsSettings = function() {
|
||||
var isDontCountSlowTorrentsEnabled = (!$('dont_count_slow_torrents_checkbox').getProperty('disabled')) && $('dont_count_slow_torrents_checkbox').getProperty('checked');
|
||||
$('dl_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
||||
$('ul_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
||||
$('torrent_inactive_timer').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
||||
};
|
||||
|
||||
updateMaxRatioTimeEnabled = function() {
|
||||
@ -1255,6 +1291,9 @@
|
||||
$('max_active_up_value').setProperty('value', pref.max_active_uploads.toInt());
|
||||
$('max_active_to_value').setProperty('value', pref.max_active_torrents.toInt());
|
||||
$('dont_count_slow_torrents_checkbox').setProperty('checked', pref.dont_count_slow_torrents);
|
||||
$('dl_rate_threshold').setProperty('value', pref.slow_torrent_dl_rate_threshold.toInt());
|
||||
$('ul_rate_threshold').setProperty('value', pref.slow_torrent_ul_rate_threshold.toInt());
|
||||
$('torrent_inactive_timer').setProperty('value', pref.slow_torrent_inactive_timer.toInt());
|
||||
updateQueueingSystem();
|
||||
|
||||
// Share Limiting
|
||||
@ -1540,6 +1579,24 @@
|
||||
}
|
||||
settings.set('max_active_torrents', max_active_torrents);
|
||||
settings.set('dont_count_slow_torrents', $('dont_count_slow_torrents_checkbox').getProperty('checked'));
|
||||
var dl_rate_threshold = $('dl_rate_threshold').getProperty('value').toInt();
|
||||
if (isNaN(dl_rate_threshold) || (dl_rate_threshold < 1)) {
|
||||
alert("QBT_TR(Download rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings.set('slow_torrent_dl_rate_threshold', dl_rate_threshold);
|
||||
var ul_rate_threshold = $('ul_rate_threshold').getProperty('value').toInt();
|
||||
if (isNaN(ul_rate_threshold) || (ul_rate_threshold < 1)) {
|
||||
alert("QBT_TR(Upload rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings.set('slow_torrent_ul_rate_threshold', ul_rate_threshold);
|
||||
var torrent_inactive_timer = $('torrent_inactive_timer').getProperty('value').toInt();
|
||||
if (isNaN(torrent_inactive_timer) || (torrent_inactive_timer < 1)) {
|
||||
alert("QBT_TR(Torrent inactivity timer must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings.set('slow_torrent_inactive_timer', torrent_inactive_timer);
|
||||
}
|
||||
|
||||
// Share Ratio Limiting
|
||||
|
Loading…
x
Reference in New Issue
Block a user