Browse Source

Add "Apply rate limit to peers on LAN" option

adaptive-webui-19844
Thomas Piccirello 6 years ago
parent
commit
c237accf82
  1. 3
      src/webui/api/appcontroller.cpp
  2. 6
      src/webui/www/private/preferences_content.html

3
src/webui/api/appcontroller.cpp

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

6
src/webui/www/private/preferences_content.html

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

Loading…
Cancel
Save