mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 05:38:06 -06:00
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI * Tabified Program preferences in Web UI since there will be a lot of settings soon * Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing * Added a command line parameter to change the web ui port * Fix PeerGuardian .p2b binary filter support
This commit is contained in:
@@ -4,226 +4,53 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>_(Download from URL)</title>
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
||||
<link rel="stylesheet" href="css/Tabs.css" type="text/css" />
|
||||
<script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="scripts/mootools-1.2-more.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="scripts/mocha-yc.js" charset="utf-8"></script>
|
||||
</head>
|
||||
<body style="padding: 5px;">
|
||||
<!-- preferences -->
|
||||
<fieldset>
|
||||
<legend><b>_(Global bandwidth limiting)</b></legend>
|
||||
<div style="padding-left: 30px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;"><input type="checkbox" id="up_limit_checkbox" onClick="updateUpLimitEnabled();"/></td><td style="padding-right: 3px;">_(Upload:)</td><td><input type="text" id="up_limit_value" style="width: 4em;"/> _(KiB/s)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;"><input type="checkbox" id="dl_limit_checkbox" onClick="updateDlLimitEnabled();"/></td><td style="padding-right: 3px;">_(Download:)</td><td><input type="text" id="dl_limit_value" style="width: 4em;"/> _(KiB/s)</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
<br/>
|
||||
<fieldset>
|
||||
<legend><b>_(Connections limit)</b></legend>
|
||||
<div style="padding-left: 30px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;"><input type="checkbox" id="max_connec_checkbox" onClick="updateMaxConnecEnabled();"/></td><td style="padding-right: 3px;">_(Global maximum number of connections:)</td><td><input type="text" id="max_connec_value" style="width: 4em;"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;"><input type="checkbox" id="max_connec_per_torrent_checkbox" onClick="updateMaxConnecPerTorrentEnabled();" style="margin-bottom: -2px;"/></td><td style="padding-right: 3px;">_(Maximum number of connections per torrent:)</td><td><input type="text" id="max_connec_per_torrent_value" style="width: 4em;"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;"><input type="checkbox" id="max_uploads_per_torrent_checkbox" onClick="updateMaxUploadsPerTorrentEnabled();" style="margin-bottom: -2px;"/></td><td style="padding-right: 3px;">_(Maximum number of upload slots per torrent:)</td><td><input type="text" id="max_uploads_per_torrent_value" style="width: 4em;"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
<br/>
|
||||
<fieldset>
|
||||
<legend><b>_(Bittorrent features)</b></legend>
|
||||
<div style="padding-left: 30px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;"><input type="checkbox" id="dht_checkbox"/></td><td>_(Enable DHT network (decentralized))</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
<br/>
|
||||
<center><input type="button" value="_(Apply)" onclick="applyPreferences();"/></center>
|
||||
<div class="toolbarTabs">
|
||||
<ul id="preferencesTabs" class="tab-menu">
|
||||
<li id="PrefConnectionLink" class="selected"><a>_(Connection)</a></li>
|
||||
<li id="PrefBittorrentLink"><a>_(Bittorrent)</a></li>
|
||||
<li id="PrefDownloadsLink"><a>_(Downloads)</a></li>
|
||||
<li id="PrefProxyLink"><a>_(Proxy)</a></li>
|
||||
<li id="PrefFilterLink"><a>_(IP Filter)</a></li>
|
||||
<li id="PrefWebUILink"><a>_(Web UI)</a></li>
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
applyPreferences = function() {
|
||||
// Validate form data
|
||||
var dl_limit = -1;
|
||||
if($defined($('dl_limit_checkbox').get('checked')) && $('dl_limit_checkbox').get('checked')) {
|
||||
dl_limit = $('dl_limit_value').get('value');
|
||||
if(dl_limit <= 0) {
|
||||
alert("_(Download rate limit must be greater than 0 or disabled.)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
var up_limit = -1;
|
||||
if($defined($('up_limit_checkbox').get('checked')) && $('up_limit_checkbox').get('checked')) {
|
||||
up_limit = $('up_limit_value').get('value');
|
||||
if(up_limit <= 0) {
|
||||
alert("_(Upload rate limit must be greater than 0 or disabled.)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
var max_connec = -1;
|
||||
if($defined($('max_connec_checkbox').get('checked')) && $('max_connec_checkbox').get('checked')) {
|
||||
max_connec = $('max_connec_value').get('value');
|
||||
if(max_connec <= 0) {
|
||||
alert("_(Maximum number of connections limit must be greater than 0 or disabled.)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
var max_connec_per_torrent = -1;
|
||||
if($defined($('max_connec_per_torrent_checkbox').get('checked')) && $('max_connec_per_torrent_checkbox').get('checked')) {
|
||||
max_connec_per_torrent = $('max_connec_per_torrent_value').get('value');
|
||||
if(max_connec_per_torrent <= 0) {
|
||||
alert("_(Maximum number of connections per torrent limit must be greater than 0 or disabled.)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
var max_uploads_per_torrent = -1;
|
||||
if($defined($('max_uploads_per_torrent_checkbox').get('checked')) && $('max_uploads_per_torrent_checkbox').get('checked')) {
|
||||
max_uploads_per_torrent = $('max_uploads_per_torrent_value').get('value');
|
||||
if(max_uploads_per_torrent <= 0) {
|
||||
alert("_(Maximum number of upload slots per torrent limit must be greater than 0 or disabled.)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Send it to qBT
|
||||
var dht = 0;
|
||||
if($defined($('dht_checkbox').get('checked')) && $('dht_checkbox').get('checked'))
|
||||
dht = 1;
|
||||
new Request({url: '/command/setPreferences',
|
||||
method: 'post',
|
||||
data: {'up_limit': up_limit,
|
||||
'dl_limit': dl_limit,
|
||||
'dht': dht,
|
||||
'max_connec': max_connec,
|
||||
'max_connec_per_torrent': max_connec_per_torrent,
|
||||
'max_uploads_per_torrent': max_uploads_per_torrent
|
||||
},
|
||||
onFailure: function() {
|
||||
alert("_(Unable to save program preferences, qBittorrent is probably unreachable.)");
|
||||
window.parent.closeWindows();
|
||||
},
|
||||
onSuccess: function() {
|
||||
// Close window
|
||||
window.parent.closeWindows();
|
||||
}
|
||||
}).send();
|
||||
};
|
||||
// Tabs
|
||||
MochaUI.initializeTabs('preferencesTabs');
|
||||
|
||||
updateDlLimitEnabled = function() {
|
||||
if($defined($('dl_limit_checkbox').get('checked')) && $('dl_limit_checkbox').get('checked')) {
|
||||
$('dl_limit_value').set('disabled', 'false');
|
||||
} else {
|
||||
$('dl_limit_value').set('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
updateUpLimitEnabled = function() {
|
||||
if($defined($('up_limit_checkbox').get('checked')) && $('up_limit_checkbox').get('checked')) {
|
||||
$('up_limit_value').removeProperty('disabled');
|
||||
} else {
|
||||
$('up_limit_value').set('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
updateMaxConnecEnabled = function() {
|
||||
if($defined($('max_connec_checkbox').get('checked')) && $('max_connec_checkbox').get('checked')) {
|
||||
$('max_connec_value').removeProperty('disabled');
|
||||
} else {
|
||||
$('max_connec_value').set('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
updateMaxConnecPerTorrentEnabled = function() {
|
||||
if($defined($('max_connec_per_torrent_checkbox').get('checked')) && $('max_connec_per_torrent_checkbox').get('checked')) {
|
||||
$('max_connec_per_torrent_value').removeProperty('disabled');
|
||||
} else {
|
||||
$('max_connec_per_torrent_value').set('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
updateMaxUploadsPerTorrentEnabled = function() {
|
||||
if($defined($('max_uploads_per_torrent_checkbox').get('checked')) && $('max_uploads_per_torrent_checkbox').get('checked')) {
|
||||
$('max_uploads_per_torrent_value').removeProperty('disabled');
|
||||
} else {
|
||||
$('max_uploads_per_torrent_value').set('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
loadPreferences = function() {
|
||||
var url = 'json/preferences';
|
||||
var request = new Request.JSON({
|
||||
url: url,
|
||||
method: 'get',
|
||||
noCache: true,
|
||||
onFailure: function() {
|
||||
alert("Could not contact qBittorrent");
|
||||
},
|
||||
onSuccess: function(pref) {
|
||||
if(pref){
|
||||
var dl_limit = pref.dl_limit.toInt();
|
||||
if(dl_limit <= 0) {
|
||||
$('dl_limit_checkbox').removeProperty('checked');
|
||||
} else {
|
||||
$('dl_limit_checkbox').set('checked', 'checked');
|
||||
('dl_limit_value').set('value', dl_limit);
|
||||
}
|
||||
updateDlLimitEnabled();
|
||||
var up_limit = pref.up_limit.toInt();
|
||||
if(up_limit <= 0) {
|
||||
$('up_limit_checkbox').removeProperty('checked');
|
||||
} else {
|
||||
$('up_limit_checkbox').set('checked', 'checked');
|
||||
$('up_limit_value').set('value', up_limit);
|
||||
}
|
||||
updateUpLimitEnabled();
|
||||
var dht = pref.dht; //bool
|
||||
if(dht) {
|
||||
$('dht_checkbox').set('checked', 'checked');
|
||||
} else {
|
||||
$('dht_checkbox').removeProperty('checked');
|
||||
}
|
||||
var max_connec = pref.max_connec.toInt();
|
||||
if(max_connec <= 0) {
|
||||
$('max_connec_checkbox').removeProperty('checked');
|
||||
$('max_connec_value').set('value', 500);
|
||||
} else {
|
||||
$('max_connec_checkbox').set('checked', 'checked');
|
||||
$('max_connec_value').set('value', max_connec);
|
||||
}
|
||||
updateMaxConnecEnabled();
|
||||
var max_connec_per_torrent = pref.max_connec_per_torrent.toInt();
|
||||
if(max_connec_per_torrent <= 0) {
|
||||
$('max_connec_per_torrent_checkbox').removeProperty('checked');
|
||||
$('max_connec_per_torrent_value').set('value', 100);
|
||||
} else {
|
||||
$('max_connec_per_torrent_checkbox').set('checked', 'checked');
|
||||
$('max_connec_per_torrent_value').set('value', max_connec_per_torrent);
|
||||
}
|
||||
updateMaxConnecPerTorrentEnabled();
|
||||
var max_uploads_per_torrent = pref.max_uploads_per_torrent.toInt();
|
||||
if(max_uploads_per_torrent <= 0) {
|
||||
$('max_uploads_per_torrent_checkbox').removeProperty('checked');
|
||||
$('max_uploads_per_torrent_value').set('value', 4);
|
||||
} else {
|
||||
$('max_uploads_per_torrent_checkbox').set('checked', 'checked');
|
||||
$('max_uploads_per_torrent_value').set('value', max_uploads_per_torrent);
|
||||
}
|
||||
updateMaxUploadsPerTorrentEnabled();
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
loadPreferences();
|
||||
$('PrefConnectionLink').addEvent('click', function(e){
|
||||
$$('.PrefTab').addClass('invisible');
|
||||
$('ConnectionTab').removeClass('invisible');
|
||||
});
|
||||
$('PrefBittorrentLink').addEvent('click', function(e) {
|
||||
$$('.PrefTab').addClass('invisible');
|
||||
$('BittorrentTab').removeClass('invisible');
|
||||
});
|
||||
$('PrefDownloadsLink').addEvent('click', function(e) {
|
||||
$$('.PrefTab').addClass('invisible');
|
||||
$('DownloadsTab').removeClass('invisible');
|
||||
});
|
||||
$('PrefProxyLink').addEvent('click', function(e) {
|
||||
$$('.PrefTab').addClass('invisible');
|
||||
$('ProxyTab').removeClass('invisible');
|
||||
});
|
||||
$('PrefFilterLink').addEvent('click', function(e) {
|
||||
$$('.PrefTab').addClass('invisible');
|
||||
$('FilterTab').removeClass('invisible');
|
||||
});
|
||||
$('PrefWebUILink').addEvent('click', function(e) {
|
||||
$$('.PrefTab').addClass('invisible');
|
||||
$('WebUITab').removeClass('invisible');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user