mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
- Added priority actions in Web UI
This commit is contained in:
parent
4c6359276c
commit
330905da5e
@ -81,6 +81,11 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
|
|||||||
if(!h.is_seed()) {
|
if(!h.is_seed()) {
|
||||||
event["progress"] = QVariant(h.progress());
|
event["progress"] = QVariant(h.progress());
|
||||||
event["dlspeed"] = QVariant(h.download_payload_rate());
|
event["dlspeed"] = QVariant(h.download_payload_rate());
|
||||||
|
if(BTSession->isQueueingEnabled()) {
|
||||||
|
event["priority"] = QVariant(h.queue_position());
|
||||||
|
} else {
|
||||||
|
event["priority"] = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
event["upspeed"] = QVariant(h.upload_payload_rate());
|
event["upspeed"] = QVariant(h.upload_payload_rate());
|
||||||
event["seed"] = QVariant(h.is_seed());
|
event["seed"] = QVariant(h.is_seed());
|
||||||
|
@ -202,34 +202,36 @@ void HttpConnection::respondCommand(QString command)
|
|||||||
emit torrentReadyToBeDownloaded(filePath, false, QString(), false);
|
emit torrentReadyToBeDownloaded(filePath, false, QString(), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(command == "resumeall")
|
if(command == "resumeall") {
|
||||||
{
|
|
||||||
emit resumeAllTorrents();
|
emit resumeAllTorrents();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(command == "pauseall")
|
if(command == "pauseall") {
|
||||||
{
|
|
||||||
emit pauseAllTorrents();
|
emit pauseAllTorrents();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(command == "resume")
|
if(command == "resume") {
|
||||||
{
|
|
||||||
emit resumeTorrent(parser.post("hash"));
|
emit resumeTorrent(parser.post("hash"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(command == "pause")
|
if(command == "pause") {
|
||||||
{
|
|
||||||
emit pauseTorrent(parser.post("hash"));
|
emit pauseTorrent(parser.post("hash"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(command == "delete")
|
if(command == "delete") {
|
||||||
{
|
|
||||||
emit deleteTorrent(parser.post("hash"), false);
|
emit deleteTorrent(parser.post("hash"), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(command == "deletePerm")
|
if(command == "deletePerm") {
|
||||||
{
|
|
||||||
emit deleteTorrent(parser.post("hash"), true);
|
emit deleteTorrent(parser.post("hash"), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(command == "increasePrio") {
|
||||||
|
emit increasePrioTorrent(parser.post("hash"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(command == "decreasePrio") {
|
||||||
|
emit decreasePrioTorrent(parser.post("hash"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,8 @@ class HttpConnection : public QObject
|
|||||||
void deleteTorrent(QString hash, bool permanently);
|
void deleteTorrent(QString hash, bool permanently);
|
||||||
void resumeTorrent(QString hash);
|
void resumeTorrent(QString hash);
|
||||||
void pauseTorrent(QString hash);
|
void pauseTorrent(QString hash);
|
||||||
|
void increasePrioTorrent(QString hash);
|
||||||
|
void decreasePrioTorrent(QString hash);
|
||||||
void resumeAllTorrents();
|
void resumeAllTorrents();
|
||||||
void pauseAllTorrents();
|
void pauseAllTorrents();
|
||||||
};
|
};
|
||||||
|
@ -68,6 +68,8 @@ void HttpServer::newHttpConnection()
|
|||||||
connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString)));
|
connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString)));
|
||||||
connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents()));
|
connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents()));
|
||||||
connect(connection, SIGNAL(resumeAllTorrents()), BTSession, SLOT(resumeAllTorrents()));
|
connect(connection, SIGNAL(resumeAllTorrents()), BTSession, SLOT(resumeAllTorrents()));
|
||||||
|
connect(connection, SIGNAL(increasePrioTorrent(QString)), BTSession, SLOT(increaseDlTorrentPriority(QString)));
|
||||||
|
connect(connection, SIGNAL(decreasePrioTorrent(QString)), BTSession, SLOT(decreaseDlTorrentPriority(QString)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,10 @@ body {
|
|||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invisible {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Typography */
|
/* Typography */
|
||||||
|
|
||||||
h2, h3, h4 {
|
h2, h3, h4 {
|
||||||
|
@ -64,6 +64,10 @@
|
|||||||
<a id="pauseButton"><img class="mochaToolButton" title="Pause" src="images/skin/pause.png"/></a>
|
<a id="pauseButton"><img class="mochaToolButton" title="Pause" src="images/skin/pause.png"/></a>
|
||||||
<a id="resumeAllButton"><img class="mochaToolButton" title="Resume all" src="images/skin/play_all.png"/></a>
|
<a id="resumeAllButton"><img class="mochaToolButton" title="Resume all" src="images/skin/play_all.png"/></a>
|
||||||
<a id="pauseAllButton"><img class="mochaToolButton" title="Pause All" src="images/skin/pause_all.png"/></a>
|
<a id="pauseAllButton"><img class="mochaToolButton" title="Pause All" src="images/skin/pause_all.png"/></a>
|
||||||
|
<span id="queueingButtons">
|
||||||
|
<a id="decreasePrioButton"><img class="mochaToolButton" title="Decrease priority" src="images/skin/decrease.png"/></a>
|
||||||
|
<a id="increasePrioButton"><img class="mochaToolButton" title="Increase priority" src="images/skin/increase.png"/></a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="pageWrapper"> <span id="error_div"></span>
|
<div id="pageWrapper"> <span id="error_div"></span>
|
||||||
@ -82,6 +86,7 @@
|
|||||||
<th>Progress</th>
|
<th>Progress</th>
|
||||||
<th>DL Speed</th>
|
<th>DL Speed</th>
|
||||||
<th>UP Speed</th>
|
<th>UP Speed</th>
|
||||||
|
<th>Priority</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="myTable"></tbody>
|
<tbody id="myTable"></tbody>
|
||||||
|
@ -72,6 +72,7 @@ window.addEvent('domready', function(){
|
|||||||
return round1(val) + ' TiB';
|
return round1(val) + ' TiB';
|
||||||
};
|
};
|
||||||
var ajaxfn = function(){
|
var ajaxfn = function(){
|
||||||
|
var queueing_enabled = false;
|
||||||
var url = 'json/events';
|
var url = 'json/events';
|
||||||
if (!waiting){
|
if (!waiting){
|
||||||
waiting=true;
|
waiting=true;
|
||||||
@ -122,6 +123,9 @@ window.addEvent('domready', function(){
|
|||||||
row[3] = round1(event.progress*100) + ' %';
|
row[3] = round1(event.progress*100) + ' %';
|
||||||
row[4] = fspeed(event.dlspeed);
|
row[4] = fspeed(event.dlspeed);
|
||||||
row[5] = fspeed(event.upspeed);
|
row[5] = fspeed(event.upspeed);
|
||||||
|
row[6] = event.priority
|
||||||
|
if(row[6] != -1)
|
||||||
|
queueing_enabled = true;
|
||||||
if(!unfinished_hashes.contains(event.hash)) {
|
if(!unfinished_hashes.contains(event.hash)) {
|
||||||
// New unfinished torrent
|
// New unfinished torrent
|
||||||
unfinished_hashes[unfinished_hashes.length] = event.hash;
|
unfinished_hashes[unfinished_hashes.length] = event.hash;
|
||||||
@ -149,6 +153,10 @@ window.addEvent('domready', function(){
|
|||||||
myTableUP.removeRow(hash);
|
myTableUP.removeRow(hash);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if(queueing_enabled)
|
||||||
|
$('queueingButtons').removeClass('invisible');
|
||||||
|
else
|
||||||
|
$('queueingButtons').addClass('invisible');
|
||||||
}
|
}
|
||||||
waiting=false;
|
waiting=false;
|
||||||
ajaxfn.delay(1000);
|
ajaxfn.delay(1000);
|
||||||
|
@ -82,12 +82,14 @@ initializeWindows = function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
['pause','resume'].each(function(item) {
|
['pause','resume','decreasePrio','increasePrio'].each(function(item) {
|
||||||
addClickEvent(item, function(e){
|
addClickEvent(item, function(e){
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
if($("Tab1").hasClass('active')) {
|
if($("Tab1").hasClass('active')) {
|
||||||
var h = myTable.selectedIds();
|
var h = myTable.selectedIds();
|
||||||
} else {
|
} else {
|
||||||
|
if(item=='decreasePrio' || item=='increasePrio')
|
||||||
|
return;
|
||||||
var h = myTableUP.selectedIds();
|
var h = myTableUP.selectedIds();
|
||||||
}
|
}
|
||||||
if(h.length){
|
if(h.length){
|
||||||
|
Loading…
Reference in New Issue
Block a user