mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
FEATURE: Global transfer information are displayed in the new Web UI status bar
This commit is contained in:
parent
f7a86b5484
commit
f6bfacda2c
6 changed files with 53 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue