WebUI: Show DHT nodes in the statubar

This commit is contained in:
Gabriele 2014-12-14 10:00:00 +01:00
parent 2aa344bb0a
commit f1477319ef
4 changed files with 8 additions and 1 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -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>

View file

@ -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);
}