mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-09 22:37:59 +00:00
- Allow to set up per-torrent download rate limit from Web UI too
This commit is contained in:
parent
236c0da563
commit
afaf40eee0
@ -12,6 +12,7 @@
|
|||||||
<file>webui/prop-files.html</file>
|
<file>webui/prop-files.html</file>
|
||||||
<file>webui/properties.html</file>
|
<file>webui/properties.html</file>
|
||||||
<file>webui/uploadlimit.html</file>
|
<file>webui/uploadlimit.html</file>
|
||||||
|
<file>webui/downloadlimit.html</file>
|
||||||
<file>webui/css/mocha.css</file>
|
<file>webui/css/mocha.css</file>
|
||||||
<file>webui/css/dynamicTable.css</file>
|
<file>webui/css/dynamicTable.css</file>
|
||||||
<file>webui/css/style.css</file>
|
<file>webui/css/style.css</file>
|
||||||
|
44
src/webui/downloadlimit.html
Normal file
44
src/webui/downloadlimit.html
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>_(Torrent Download Speed Limiting)</title>
|
||||||
|
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="css/mocha.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.js" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" src="scripts/parametrics.js" charset="utf-8"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="width: 100%; text-align: center; margin: 0 auto;">
|
||||||
|
<div id="dllimitSlider" class="slider">
|
||||||
|
<div id="dllimitUpdate" class="update">_(Download limit:) <span id="dllimitUpdatevalue" class="updatevalue">0</span> <span id="dlLimitUnit">_(KiB/s)</span></div>
|
||||||
|
<div class="sliderWrapper">
|
||||||
|
<div id="dllimitSliderknob" class="sliderknob"></div>
|
||||||
|
<div id="dllimitSliderarea" class="sliderarea"></div>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var hash = new URI().getData('hash');
|
||||||
|
setDlLimit = function() {
|
||||||
|
var limit = $("dllimitUpdatevalue").get('html').toInt() * 1024;
|
||||||
|
new Request({url: '/command/setTorrentDlLimit',
|
||||||
|
method: 'post',
|
||||||
|
data: {'hash': hash, 'limit': limit},
|
||||||
|
onComplete: function() {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<input type="button" value="_(Apply)" onclick="setDlLimit()"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
MochaUI.addDlLimitSlider(hash);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -34,20 +34,60 @@ MochaUI.extend({
|
|||||||
onChange: function(pos){
|
onChange: function(pos){
|
||||||
if(pos > 0) {
|
if(pos > 0) {
|
||||||
$('uplimitUpdatevalue').set('html', pos);
|
$('uplimitUpdatevalue').set('html', pos);
|
||||||
$('UpLimitUnit').set('html', "_(KiB/s)");
|
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||||
} else {
|
} else {
|
||||||
$('uplimitUpdatevalue').set('html', '∞');
|
$('uplimitUpdatevalue').set('html', '∞');
|
||||||
$('UpLimitUnit').set('html', "");
|
$('upLimitUnit').set('html', "");
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if(up_limit == 0) {
|
if(up_limit == 0) {
|
||||||
$('uplimitUpdatevalue').set('html', '∞');
|
$('uplimitUpdatevalue').set('html', '∞');
|
||||||
$('UpLimitUnit').set('html', "");
|
$('upLimitUnit').set('html', "");
|
||||||
} else {
|
} else {
|
||||||
$('uplimitUpdatevalue').set('html', (up_limit/1024.).round());
|
$('uplimitUpdatevalue').set('html', (up_limit/1024.).round());
|
||||||
$('UpLimitUnit').set('html', "_(KiB/s)");
|
$('upLimitUnit').set('html', "_(KiB/s)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
addDlLimitSlider: function(hash){
|
||||||
|
if ($('dllimitSliderarea')) {
|
||||||
|
var windowOptions = MochaUI.Windows.windowOptions;
|
||||||
|
var sliderFirst = true;
|
||||||
|
var req = new Request({
|
||||||
|
url: '/command/getTorrentDlLimit',
|
||||||
|
method: 'post',
|
||||||
|
data: {hash: hash},
|
||||||
|
onSuccess: function(data) {
|
||||||
|
if(data){
|
||||||
|
var dl_limit = data.toInt();
|
||||||
|
if(dl_limit < 0) dl_limit = 0;
|
||||||
|
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
||||||
|
steps: 500,
|
||||||
|
offset: 0,
|
||||||
|
initialStep: (dl_limit/1024.).round(),
|
||||||
|
onChange: function(pos){
|
||||||
|
if(pos > 0) {
|
||||||
|
$('dllimitUpdatevalue').set('html', pos);
|
||||||
|
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||||
|
} else {
|
||||||
|
$('dllimitUpdatevalue').set('html', '∞');
|
||||||
|
$('dlLimitUnit').set('html', "");
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
});
|
||||||
|
// Set default value
|
||||||
|
if(dl_limit == 0) {
|
||||||
|
$('dllimitUpdatevalue').set('html', '∞');
|
||||||
|
$('dlLimitUnit').set('html', "");
|
||||||
|
} else {
|
||||||
|
$('dllimitUpdatevalue').set('html', (dl_limit/1024.).round());
|
||||||
|
$('dlLimitUnit').set('html', "_(KiB/s)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<title>_(Torrent Download Speed Limiting)</title>
|
<title>_(Torrent Upload Speed Limiting)</title>
|
||||||
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="css/mocha.css" type="text/css" />
|
<link rel="stylesheet" href="css/mocha.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-core-yc.js" charset="utf-8"></script>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div style="width: 100%; text-align: center; margin: 0 auto;">
|
<div style="width: 100%; text-align: center; margin: 0 auto;">
|
||||||
<div id="uplimitSlider" class="slider">
|
<div id="uplimitSlider" class="slider">
|
||||||
<div id="uplimitUpdate" class="update">_(Upload limit:) <span id="uplimitUpdatevalue" class="updatevalue">0</span> <span id="UpLimitUnit">_(KiB/s)</span></div>
|
<div id="uplimitUpdate" class="update">_(Upload limit:) <span id="uplimitUpdatevalue" class="updatevalue">0</span> <span id="upLimitUnit">_(KiB/s)</span></div>
|
||||||
<div class="sliderWrapper">
|
<div class="sliderWrapper">
|
||||||
<div id="uplimitSliderknob" class="sliderknob"></div>
|
<div id="uplimitSliderknob" class="sliderknob"></div>
|
||||||
<div id="uplimitSliderarea" class="sliderarea"></div>
|
<div id="uplimitSliderarea" class="sliderarea"></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user