Browse Source

WebUI: Show DHT nodes in the statubar

adaptive-webui-19844
Gabriele 10 years ago
parent
commit
f1477319ef
  1. 3
      src/webui/btjson.cpp
  2. 3
      src/webui/webapplication.cpp
  3. 2
      src/webui/www/private/index.html
  4. 1
      src/webui/www/public/scripts/client.js

3
src/webui/btjson.cpp

@ -140,6 +140,7 @@ static const char KEY_TRANSFER_DLRATELIMIT[] = "dl_rate_limit"; @@ -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) @@ -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() @@ -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);
}

3
src/webui/webapplication.cpp

@ -193,7 +193,8 @@ void WebApplication::translateDocument(QString& data) @@ -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;

2
src/webui/www/private/index.html

@ -118,6 +118,8 @@ @@ -118,6 +118,8 @@
<span id="error_div"></span>
<table style="position: absolute; right: 5px;">
<tr>
<td id="DHTNodes"></td>
<td style="width: 2px;margin:0;"><img src="images/skin/toolbox-divider.gif" alt="" style="height: 18px; padding-left: 10px; padding-right: 10px; margin-bottom: -2px;"/></td>
<td style="cursor:pointer;"><img id="alternativeSpeedLimits" alt="_(Alternative speed limits)" src="images/slow_off.png" /></td>
<td style="width: 2px;margin:0;"><img src="images/skin/toolbox-divider.gif" alt="" style="height: 18px; padding-left: 10px; padding-right: 10px; margin-bottom: -2px;"/></td>
<td id="DlInfos" style="cursor:pointer;"></td>

1
src/webui/www/public/scripts/client.js

@ -264,6 +264,7 @@ window.addEvent('load', function () { @@ -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);
}

Loading…
Cancel
Save