mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 01:44:26 +00:00
FEATURE: Global transfer information are displayed in the new Web UI status bar
This commit is contained in:
parent
f7a86b5484
commit
f6bfacda2c
@ -10,6 +10,7 @@
|
||||
- FEATURE: Torrents can be automatically rechecked on completion
|
||||
- FEATURE: If 2 torrents have the same hash, add new trackers/URL seeds to the existing torrent
|
||||
- FEATURE: Trackers can be added from Web UI
|
||||
- FEATURE: Global transfer information are displayed in the new Web UI status bar
|
||||
- COSMETIC: Improved style management
|
||||
|
||||
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "preferences.h"
|
||||
#include "json.h"
|
||||
#include "bittorrent.h"
|
||||
#include "misc.h"
|
||||
#include <QTcpSocket>
|
||||
#include <QDateTime>
|
||||
#include <QStringList>
|
||||
@ -203,6 +204,10 @@ void HttpConnection::respond() {
|
||||
} else {
|
||||
if(list[1] == "preferences") {
|
||||
respondPreferencesJson();
|
||||
} else {
|
||||
if(list[1] == "transferInfo") {
|
||||
respondGlobalTransferInfoJson();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,6 +303,18 @@ void HttpConnection::respondPreferencesJson() {
|
||||
write();
|
||||
}
|
||||
|
||||
void HttpConnection::respondGlobalTransferInfoJson() {
|
||||
QVariantMap info;
|
||||
session_status sessionStatus = parent->getBTSession()->getSessionStatus();
|
||||
info["DlInfos"] = tr("D: %1/s - T: %2", "Download speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_download_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_download));
|
||||
info["UpInfos"] = tr("U: %1/s - T: %2", "Upload speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_upload_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_upload));
|
||||
QString string = json::toJson(info);
|
||||
generator.setStatusLine(200, "OK");
|
||||
generator.setContentTypeByExt("js");
|
||||
generator.setMessage(string);
|
||||
write();
|
||||
}
|
||||
|
||||
void HttpConnection::respondCommand(QString command)
|
||||
{
|
||||
if(command == "download")
|
||||
|
@ -60,6 +60,7 @@ class HttpConnection : public QObject
|
||||
void respondTrackersPropertiesJson(QString hash);
|
||||
void respondFilesPropertiesJson(QString hash);
|
||||
void respondPreferencesJson();
|
||||
void respondGlobalTransferInfoJson();
|
||||
void respondCommand(QString command);
|
||||
void respondNotFound();
|
||||
void processDownloadedFile(QString, QString);
|
||||
|
@ -60,6 +60,7 @@ class HttpServer : public QTcpServer {
|
||||
EventManager *eventManager() const;
|
||||
QString generateNonce() const;
|
||||
QHash<QString, int> client_failed_attempts;
|
||||
Bittorrent *getBTSession() const { return BTSession; }
|
||||
|
||||
private slots:
|
||||
void newHttpConnection();
|
||||
|
@ -97,5 +97,12 @@
|
||||
<li><a href="#UploadLimit" class="uploadLimit">_(Limit upload rate)</a></li>
|
||||
<li class="separator"><a href="#ForceRecheck" class="recheck">_(Force recheck)</a></li>
|
||||
</ul>
|
||||
<div id="desktopFooterWrapper">
|
||||
<div id="desktopFooter">
|
||||
<table style="position: absolute; right: 5px;">
|
||||
<tr><td id="DlInfos"></td><td style="width: 2px;margin:0;"><img src="images/skin/toolbox-divider.gif" style="height: 18px; padding-left: 10px; padding-right: 10px; margin-bottom: -2px;"/></td><td id="UpInfos"></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -106,9 +106,34 @@ window.addEvent('load', function(){
|
||||
initializeWindows();
|
||||
var r=0;
|
||||
var waiting=false;
|
||||
var waitingTrInfo = false;
|
||||
|
||||
var stateToImg = function(state){
|
||||
return 'images/skin/'+state+'.png';
|
||||
};
|
||||
var loadTransferInfo = function() {
|
||||
var url = 'json/transferInfo';
|
||||
if(!waitingTrInfo) {
|
||||
waitingTrInfo = true;
|
||||
var request = new Request.JSON({
|
||||
url: url,
|
||||
noCache: true,
|
||||
method: 'get',
|
||||
onFailure: function() {
|
||||
$('error_div').set('html', 'qBittorrent client is not reachable');
|
||||
waitingTrInfo=false;
|
||||
loadTransferInfo.delay(4000);
|
||||
},
|
||||
onSuccess: function(info) {
|
||||
if(info) {
|
||||
$("DlInfos").set('html', info.DlInfos);
|
||||
$("UpInfos").set('html', info.UpInfos);
|
||||
waitingTrInfo=false;
|
||||
loadTransferInfo.delay(3000);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
};
|
||||
var ajaxfn = function(){
|
||||
var queueing_enabled = false;
|
||||
@ -178,6 +203,7 @@ window.addEvent('load', function(){
|
||||
}
|
||||
};
|
||||
ajaxfn();
|
||||
loadTransferInfo();
|
||||
// ajaxfn.periodical(5000);
|
||||
|
||||
setFilter = function(f) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user