From f1477319efc9f67d30c372b86a7cd10bb42d0066 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sun, 14 Dec 2014 10:00:00 +0100 Subject: [PATCH] WebUI: Show DHT nodes in the statubar --- src/webui/btjson.cpp | 3 +++ src/webui/webapplication.cpp | 3 ++- src/webui/www/private/index.html | 2 ++ src/webui/www/public/scripts/client.js | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index 4ef420914..17afe7b43 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -140,6 +140,7 @@ static const char KEY_TRANSFER_DLRATELIMIT[] = "dl_rate_limit"; static const char KEY_TRANSFER_UPSPEED[] = "up_info_speed"; static const char KEY_TRANSFER_UPDATA[] = "up_info_data"; static const char KEY_TRANSFER_UPRATELIMIT[] = "up_rate_limit"; +static const char KEY_TRANSFER_DHT_NODES[] = "dht_nodes"; class QTorrentCompare { @@ -450,6 +451,7 @@ QByteArray btjson::getFilesForTorrent(const QString& hash) * - "up_info_data": Data uploaded this session * - "dl_rate_limit": Download rate limit * - "up_rate_limit": Upload rate limit + * - "dht_nodes": DHT nodes connected to */ QByteArray btjson::getTransferInfo() { @@ -464,5 +466,6 @@ QByteArray btjson::getTransferInfo() info[KEY_TRANSFER_DLRATELIMIT] = sessionSettings.download_rate_limit; if (sessionSettings.upload_rate_limit) info[KEY_TRANSFER_UPRATELIMIT] = sessionSettings.upload_rate_limit; + info[KEY_TRANSFER_DHT_NODES] = sessionStatus.dht_nodes; return json::toJson(info); } diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 2ada7817c..0eb163a4f 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -193,7 +193,8 @@ void WebApplication::translateDocument(QString& data) "TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "HttpServer", "confirmDeletionDlg", "TrackerList", "TorrentFilesModel", "options_imp", "Preferences", "TrackersAdditionDlg", "ScanFoldersModel", - "PropTabBar", "TorrentModel", "downloadFromURL", "MainWindow", "misc" + "PropTabBar", "TorrentModel", "downloadFromURL", "MainWindow", "misc", + "StatusBar" }; const size_t context_count = sizeof(contexts) / sizeof(contexts[0]); int i = 0; diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index fa60de0de..b6d9713d4 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -118,6 +118,8 @@ + + diff --git a/src/webui/www/public/scripts/client.js b/src/webui/www/public/scripts/client.js index 9f5c33445..62bc23eb7 100644 --- a/src/webui/www/public/scripts/client.js +++ b/src/webui/www/public/scripts/client.js @@ -264,6 +264,7 @@ window.addEvent('load', function () { document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true)); else document.title = "_(qBittorrent web User Interface)"; + $('DHTNodes').set('html', '_(DHT: %1 nodes)'.replace("%1", info.dht_nodes)); clearTimeout(loadTransferInfoTimer); loadTransferInfoTimer = loadTransferInfo.delay(3000); }
_(Alternative speed limits)