mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 21:52:32 -06:00
Group setting torrents upload limit
This commit is contained in:
@@ -107,7 +107,7 @@ initializeWindows = function() {
|
||||
id: 'uploadLimitPage',
|
||||
title: "QBT_TR(Global Upload Speed Limit)QBT_TR",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'uploadlimit.html?hash=global',
|
||||
contentURL: 'uploadlimit.html?hashes=global',
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
@@ -126,7 +126,7 @@ initializeWindows = function() {
|
||||
id: 'uploadLimitPage',
|
||||
title: "QBT_TR(Torrent Upload Speed Limiting)QBT_TR",
|
||||
loadMethod: 'iframe',
|
||||
contentURL: 'uploadlimit.html?hash=' + hash,
|
||||
contentURL: 'uploadlimit.html?hashes=' + h.join("|"),
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
|
||||
@@ -14,7 +14,7 @@ Requires:
|
||||
|
||||
*/
|
||||
MochaUI.extend({
|
||||
addUpLimitSlider: function(hash) {
|
||||
addUpLimitSlider: function(hashes) {
|
||||
if ($('uplimitSliderarea')) {
|
||||
var windowOptions = MochaUI.Windows.windowOptions;
|
||||
var sliderFirst = true;
|
||||
@@ -31,15 +31,15 @@ MochaUI.extend({
|
||||
maximum = tmp / 1024.
|
||||
}
|
||||
else {
|
||||
if (hash == "global")
|
||||
if (hashes[0] == "global")
|
||||
maximum = 10000;
|
||||
else
|
||||
maximum = 1000;
|
||||
}
|
||||
}
|
||||
// Get torrent upload limit
|
||||
// Get torrents upload limit
|
||||
// And create slider
|
||||
if (hash == 'global') {
|
||||
if (hashes[0] == 'global') {
|
||||
var up_limit = maximum;
|
||||
if (up_limit < 0) up_limit = 0;
|
||||
maximum = 10000;
|
||||
@@ -69,15 +69,21 @@ MochaUI.extend({
|
||||
}
|
||||
}
|
||||
else {
|
||||
var req = new Request({
|
||||
url: 'command/getTorrentUpLimit',
|
||||
var req = new Request.JSON({
|
||||
url: 'command/getTorrentsUpLimit',
|
||||
noCache : true,
|
||||
method: 'post',
|
||||
data: {
|
||||
hash: hash
|
||||
hashes: hashes.join('|')
|
||||
},
|
||||
onSuccess: function(data) {
|
||||
if (data) {
|
||||
var up_limit = data.toInt();
|
||||
var up_limit = data[hashes[0]];
|
||||
for(var key in data)
|
||||
if (up_limit != data[key]) {
|
||||
up_limit = 0;
|
||||
break;
|
||||
}
|
||||
if (up_limit < 0) up_limit = 0;
|
||||
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
||||
steps: maximum,
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var hash = new URI().getData('hash');
|
||||
var hashes = new URI().getData('hashes').split('|');
|
||||
setUpLimit = function() {
|
||||
var limit = $("uplimitUpdatevalue").value.toInt() * 1024;
|
||||
if (hash == "global") {
|
||||
if (hashes[0] == "global") {
|
||||
new Request({
|
||||
url: 'command/setGlobalUpLimit',
|
||||
method: 'post',
|
||||
@@ -38,10 +38,10 @@
|
||||
}
|
||||
else {
|
||||
new Request({
|
||||
url: 'command/setTorrentUpLimit',
|
||||
url: 'command/setTorrentsUpLimit',
|
||||
method: 'post',
|
||||
data: {
|
||||
'hash': hash,
|
||||
'hashes': hashes.join('|'),
|
||||
'limit': limit
|
||||
},
|
||||
onComplete: function() {
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
MochaUI.addUpLimitSlider(hash);
|
||||
MochaUI.addUpLimitSlider(hashes);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user