Add "Apply rate limit to peers on LAN" option

This commit is contained in:
Thomas Piccirello 2018-10-21 23:19:35 -04:00
parent e499e1ba85
commit c237accf82
2 changed files with 9 additions and 0 deletions

View File

@ -164,6 +164,7 @@ void AppController::preferencesAction()
data["bittorrent_protocol"] = static_cast<int>(session->btProtocol());
data["limit_utp_rate"] = session->isUTPRateLimited();
data["limit_tcp_overhead"] = session->includeOverheadInLimits();
data["limit_lan_peers"] = !session->ignoreLimitsOnLAN();
// Scheduling
data["scheduler_enabled"] = session->isBandwidthSchedulerEnabled();
const QTime start_time = pref->getSchedulerStartTime();
@ -411,6 +412,8 @@ void AppController::setPreferencesAction()
session->setUTPRateLimited(m["limit_utp_rate"].toBool());
if (m.contains("limit_tcp_overhead"))
session->setIncludeOverheadInLimits(m["limit_tcp_overhead"].toBool());
if ((it = m.find(QLatin1String("limit_lan_peers"))) != m.constEnd())
session->setIgnoreLimitsOnLAN(!it.value().toBool());
// Scheduling
if (m.contains("scheduler_enabled"))
session->setBandwidthSchedulerEnabled(m["scheduler_enabled"].toBool());

View File

@ -454,6 +454,10 @@
<input type="checkbox" id="limit_tcp_overhead_checkbox" />
<label for="limit_tcp_overhead_checkbox">QBT_TR(Apply rate limit to transport overhead)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="limit_lan_peers_checkbox" />
<label for="limit_lan_peers_checkbox">QBT_TR(Apply rate limit to peers on LAN)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
</fieldset>
</div>
@ -1211,6 +1215,7 @@
$('enable_protocol_combobox').setProperty('value', pref.bittorrent_protocol);
$('limit_utp_rate_checkbox').setProperty('checked', pref.limit_utp_rate);
$('limit_tcp_overhead_checkbox').setProperty('checked', pref.limit_tcp_overhead);
$('limit_lan_peers_checkbox').setProperty('checked', pref.limit_lan_peers);
// Scheduling
$('limit_sheduling_checkbox').setProperty('checked', pref.scheduler_enabled);
@ -1473,6 +1478,7 @@
settings.set('bittorrent_protocol', $('enable_protocol_combobox').getProperty('value'));
settings.set('limit_utp_rate', $('limit_utp_rate_checkbox').getProperty('checked'));
settings.set('limit_tcp_overhead', $('limit_tcp_overhead_checkbox').getProperty('checked'));
settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked'));
// Scheduler
var scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');