mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 23:37:59 +00:00
[Web UI] Fix alternative global rate limits.
This commit is contained in:
parent
d0b54b0797
commit
357334fb46
@ -42,8 +42,10 @@ static const char *__TRANSLATIONS__[] = {
|
|||||||
QT_TRANSLATE_NOOP("HttpServer", "Download local torrent"),
|
QT_TRANSLATE_NOOP("HttpServer", "Download local torrent"),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Download"),
|
QT_TRANSLATE_NOOP("HttpServer", "Download"),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Are you sure you want to delete the selected torrents from the transfer list?"),
|
QT_TRANSLATE_NOOP("HttpServer", "Are you sure you want to delete the selected torrents from the transfer list?"),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Download rate limit must be greater than 0 or disabled."),
|
QT_TRANSLATE_NOOP("HttpServer", "Global upload rate limit must be greater than 0 or disabled."),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Upload rate limit must be greater than 0 or disabled."),
|
QT_TRANSLATE_NOOP("HttpServer", "Global download rate limit must be greater than 0 or disabled."),
|
||||||
|
QT_TRANSLATE_NOOP("HttpServer", "Alternative upload rate limit must be greater than 0 or disabled."),
|
||||||
|
QT_TRANSLATE_NOOP("HttpServer", "Alternative download rate limit must be greater than 0 or disabled."),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Maximum number of connections limit must be greater than 0 or disabled."),
|
QT_TRANSLATE_NOOP("HttpServer", "Maximum number of connections limit must be greater than 0 or disabled."),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Maximum number of connections per torrent limit must be greater than 0 or disabled."),
|
QT_TRANSLATE_NOOP("HttpServer", "Maximum number of connections per torrent limit must be greater than 0 or disabled."),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Maximum number of upload slots per torrent limit must be greater than 0 or disabled."),
|
QT_TRANSLATE_NOOP("HttpServer", "Maximum number of upload slots per torrent limit must be greater than 0 or disabled."),
|
||||||
|
@ -196,13 +196,15 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
QBT_TR(Upload:)QBT_TR
|
<input type="checkbox" id="alt_up_limit_checkbox" onClick="updateAltUpLimitEnabled();"/>
|
||||||
|
<label for ="alt_up_limit_checkbox">QBT_TR(Upload:)QBT_TR</label>
|
||||||
</td>
|
</td>
|
||||||
<td><input type="text" id="alt_up_limit_value" style="width: 4em;"/> QBT_TR(KiB/s)QBT_TR</td>
|
<td><input type="text" id="alt_up_limit_value" style="width: 4em;"/> QBT_TR(KiB/s)QBT_TR</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
QBT_TR(Download:)QBT_TR
|
<input type="checkbox" id="alt_dl_limit_checkbox" onClick="updateAltDlLimitEnabled();"/>
|
||||||
|
<label for="alt_dl_limit_checkbox">QBT_TR(Download:)QBT_TR</label>
|
||||||
</td>
|
</td>
|
||||||
<td><input type="text" id="alt_dl_limit_value" style="width: 4em;"/> QBT_TR(KiB/s)QBT_TR</td>
|
<td><input type="text" id="alt_dl_limit_value" style="width: 4em;"/> QBT_TR(KiB/s)QBT_TR</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -394,6 +396,14 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
|
var WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
|
||||||
|
|
||||||
|
updateUpLimitEnabled = function() {
|
||||||
|
if($('up_limit_checkbox').getProperty('checked')) {
|
||||||
|
$('up_limit_value').setProperty('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('up_limit_value').setProperty('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateDlLimitEnabled = function() {
|
updateDlLimitEnabled = function() {
|
||||||
if($('dl_limit_checkbox').getProperty('checked')) {
|
if($('dl_limit_checkbox').getProperty('checked')) {
|
||||||
$('dl_limit_value').setProperty('disabled', false);
|
$('dl_limit_value').setProperty('disabled', false);
|
||||||
@ -402,6 +412,22 @@ updateDlLimitEnabled = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateAltUpLimitEnabled = function() {
|
||||||
|
if($('alt_up_limit_checkbox').getProperty('checked')) {
|
||||||
|
$('alt_up_limit_value').setProperty('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('alt_up_limit_value').setProperty('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAltDlLimitEnabled = function() {
|
||||||
|
if($('alt_dl_limit_checkbox').getProperty('checked')) {
|
||||||
|
$('alt_dl_limit_value').setProperty('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('alt_dl_limit_value').setProperty('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateSchedulingEnabled = function() {
|
updateSchedulingEnabled = function() {
|
||||||
if($('limit_sheduling_checkbox').getProperty('checked')) {
|
if($('limit_sheduling_checkbox').getProperty('checked')) {
|
||||||
$('schedule_from_hour').setProperty('disabled', false);
|
$('schedule_from_hour').setProperty('disabled', false);
|
||||||
@ -418,14 +444,6 @@ updateSchedulingEnabled = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUpLimitEnabled = function() {
|
|
||||||
if($('up_limit_checkbox').getProperty('checked')) {
|
|
||||||
$('up_limit_value').setProperty('disabled', false);
|
|
||||||
} else {
|
|
||||||
$('up_limit_value').setProperty('disabled', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setuTPSettingsVisible = function(visible) {
|
setuTPSettingsVisible = function(visible) {
|
||||||
if(visible) {
|
if(visible) {
|
||||||
$('enable_utp_checkbox').removeClass('invisible');
|
$('enable_utp_checkbox').removeClass('invisible');
|
||||||
@ -684,15 +702,7 @@ loadPreferences = function() {
|
|||||||
$('port_value').setProperty('value', pref.listen_port.toInt());
|
$('port_value').setProperty('value', pref.listen_port.toInt());
|
||||||
$('upnp_checkbox').setProperty('checked', pref.upnp);
|
$('upnp_checkbox').setProperty('checked', pref.upnp);
|
||||||
$('random_port_checkbox').setProperty('checked', pref.random_port);
|
$('random_port_checkbox').setProperty('checked', pref.random_port);
|
||||||
|
// Global rate limits
|
||||||
var dl_limit = pref.dl_limit.toInt();
|
|
||||||
if(dl_limit <= 0) {
|
|
||||||
$('dl_limit_checkbox').setProperty('checked', false);
|
|
||||||
} else {
|
|
||||||
$('dl_limit_checkbox').setProperty('checked', true);
|
|
||||||
$('dl_limit_value').setProperty('value', dl_limit);
|
|
||||||
}
|
|
||||||
updateDlLimitEnabled();
|
|
||||||
var up_limit = pref.up_limit.toInt();
|
var up_limit = pref.up_limit.toInt();
|
||||||
if(up_limit <= 0) {
|
if(up_limit <= 0) {
|
||||||
$('up_limit_checkbox').setProperty('checked', false);
|
$('up_limit_checkbox').setProperty('checked', false);
|
||||||
@ -701,9 +711,31 @@ loadPreferences = function() {
|
|||||||
$('up_limit_value').setProperty('value', up_limit);
|
$('up_limit_value').setProperty('value', up_limit);
|
||||||
}
|
}
|
||||||
updateUpLimitEnabled();
|
updateUpLimitEnabled();
|
||||||
|
var dl_limit = pref.dl_limit.toInt();
|
||||||
|
if(dl_limit <= 0) {
|
||||||
|
$('dl_limit_checkbox').setProperty('checked', false);
|
||||||
|
} else {
|
||||||
|
$('dl_limit_checkbox').setProperty('checked', true);
|
||||||
|
$('dl_limit_value').setProperty('value', dl_limit);
|
||||||
|
}
|
||||||
|
updateDlLimitEnabled();
|
||||||
// Alternative limits
|
// Alternative limits
|
||||||
$('alt_dl_limit_value').setProperty('value', pref.alt_dl_limit.toInt());
|
var alt_up_limit = pref.alt_up_limit.toInt();
|
||||||
$('alt_up_limit_value').setProperty('value', pref.alt_up_limit.toInt());
|
if(alt_up_limit <= 0) {
|
||||||
|
$('alt_up_limit_checkbox').setProperty('checked', false);
|
||||||
|
} else {
|
||||||
|
$('alt_up_limit_checkbox').setProperty('checked', true);
|
||||||
|
$('alt_up_limit_value').setProperty('value', alt_up_limit);
|
||||||
|
}
|
||||||
|
updateAltUpLimitEnabled();
|
||||||
|
var alt_dl_limit = pref.alt_dl_limit.toInt();
|
||||||
|
if(alt_dl_limit <= 0) {
|
||||||
|
$('alt_dl_limit_checkbox').setProperty('checked', false);
|
||||||
|
} else {
|
||||||
|
$('alt_dl_limit_checkbox').setProperty('checked', true);
|
||||||
|
$('alt_dl_limit_value').setProperty('value', alt_dl_limit);
|
||||||
|
}
|
||||||
|
updateAltDlLimitEnabled();
|
||||||
// Scheduling
|
// Scheduling
|
||||||
$('limit_sheduling_checkbox').setProperty('checked', pref.scheduler_enabled);
|
$('limit_sheduling_checkbox').setProperty('checked', pref.scheduler_enabled);
|
||||||
$('schedule_from_hour').setProperty('value', time_padding(pref.schedule_from_hour));
|
$('schedule_from_hour').setProperty('value', time_padding(pref.schedule_from_hour));
|
||||||
@ -712,7 +744,6 @@ loadPreferences = function() {
|
|||||||
$('schedule_to_min').setProperty('value', time_padding(pref.schedule_to_min));
|
$('schedule_to_min').setProperty('value', time_padding(pref.schedule_to_min));
|
||||||
$('schedule_freq_select').setProperty('value', pref.scheduler_days);
|
$('schedule_freq_select').setProperty('value', pref.scheduler_days);
|
||||||
updateSchedulingEnabled();
|
updateSchedulingEnabled();
|
||||||
|
|
||||||
// uTP
|
// uTP
|
||||||
utp_supported = $defined(pref.enable_utp);
|
utp_supported = $defined(pref.enable_utp);
|
||||||
setuTPSettingsVisible(utp_supported);
|
setuTPSettingsVisible(utp_supported);
|
||||||
@ -892,25 +923,45 @@ applyPreferences = function() {
|
|||||||
settings.set('upnp', $('upnp_checkbox').getProperty('checked'));
|
settings.set('upnp', $('upnp_checkbox').getProperty('checked'));
|
||||||
settings.set('random_port', $('random_port_checkbox').getProperty('checked'));
|
settings.set('random_port', $('random_port_checkbox').getProperty('checked'));
|
||||||
|
|
||||||
|
// Global rate limits
|
||||||
|
var up_limit = -1;
|
||||||
|
if($('up_limit_checkbox').getProperty('checked')) {
|
||||||
|
up_limit = $('up_limit_value').getProperty('value').toInt();
|
||||||
|
if(isNaN(up_limit) || up_limit <= 0) {
|
||||||
|
alert("QBT_TR(Global upload rate limit must be greater than 0 or disabled.)QBT_TR");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settings.set('up_limit', up_limit);
|
||||||
var dl_limit = -1;
|
var dl_limit = -1;
|
||||||
if($('dl_limit_checkbox').getProperty('checked')) {
|
if($('dl_limit_checkbox').getProperty('checked')) {
|
||||||
dl_limit = $('dl_limit_value').getProperty('value').toInt();
|
dl_limit = $('dl_limit_value').getProperty('value').toInt();
|
||||||
if(dl_limit <= 0) {
|
if(isNaN(dl_limit) || dl_limit <= 0) {
|
||||||
alert("QBT_TR(Download rate limit must be greater than 0 or disabled.)QBT_TR");
|
alert("QBT_TR(Global download rate limit must be greater than 0 or disabled.)QBT_TR");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('dl_limit', dl_limit);
|
settings.set('dl_limit', dl_limit);
|
||||||
|
|
||||||
var up_limit = -1;
|
// Alternative limits
|
||||||
if($('up_limit_checkbox').getProperty('checked')) {
|
var alt_up_limit = -1;
|
||||||
up_limit = $('up_limit_value').getProperty('value').toInt();
|
if($('alt_up_limit_checkbox').getProperty('checked')) {
|
||||||
if(up_limit <= 0) {
|
alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt();
|
||||||
alert("QBT_TR(Upload rate limit must be greater than 0 or disabled.)QBT_TR");
|
if(isNaN(alt_up_limit) || alt_up_limit <= 0) {
|
||||||
|
alert("QBT_TR(Alternative upload rate limit must be greater than 0 or disabled.)QBT_TR");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('up_limit', up_limit);
|
settings.set('alt_up_limit', alt_up_limit);
|
||||||
|
var alt_dl_limit = -1;
|
||||||
|
if($('alt_dl_limit_checkbox').getProperty('checked')) {
|
||||||
|
alt_dl_limit = $('alt_dl_limit_value').getProperty('value').toInt();
|
||||||
|
if(isNaN(alt_dl_limit) || alt_dl_limit <= 0) {
|
||||||
|
alert("QBT_TR(Alternative download rate limit must be greater than 0 or disabled.)QBT_TR");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settings.set('alt_dl_limit', alt_dl_limit);
|
||||||
|
|
||||||
if(!$('enable_utp_checkbox').hasClass('invisible')) {
|
if(!$('enable_utp_checkbox').hasClass('invisible')) {
|
||||||
settings.set('enable_utp', $('enable_utp_checkbox').getProperty('checked'));
|
settings.set('enable_utp', $('enable_utp_checkbox').getProperty('checked'));
|
||||||
@ -959,21 +1010,6 @@ applyPreferences = function() {
|
|||||||
}
|
}
|
||||||
settings.set('max_uploads_per_torrent', max_uploads_per_torrent);
|
settings.set('max_uploads_per_torrent', max_uploads_per_torrent);
|
||||||
|
|
||||||
// Alternative speed limits
|
|
||||||
var alt_dl_limit = $('alt_dl_limit_value').getProperty('value').toInt();
|
|
||||||
if(alt_dl_limit <= 0) {
|
|
||||||
alert("QBT_TR(Download rate limit must be greater than 0 or disabled.)QBT_TR");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
settings.set('alt_dl_limit', alt_dl_limit);
|
|
||||||
|
|
||||||
var alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt();
|
|
||||||
if(alt_up_limit <= 0) {
|
|
||||||
alert("QBT_TR(Upload rate limit must be greater than 0 or disabled.)QBT_TR");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
settings.set('alt_up_limit', alt_up_limit);
|
|
||||||
|
|
||||||
// Scheduler
|
// Scheduler
|
||||||
var scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');
|
var scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');
|
||||||
settings.set('scheduler_enabled', scheduling_enabled);
|
settings.set('scheduler_enabled', scheduling_enabled);
|
||||||
|
Loading…
Reference in New Issue
Block a user