Show the user count of DHT in an userfriendly format.

Hide user count when DHT is off.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3761 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-11-08 12:25:49 +00:00
parent a98367f188
commit f3ec123b88
4 changed files with 87 additions and 16 deletions

View file

@ -28,6 +28,8 @@
#include "retroshare/rsiface.h"
#include "retroshare/rspeers.h"
#include "util/misc.h"
#include <sstream>
#include <iomanip>
@ -46,13 +48,16 @@ DHTStatus::DHTStatus(QWidget *parent)
hbox->addWidget(dhtstatusLabel);
spaceLabel = new QLabel( " | ", this );
spaceLabel->setVisible(false);
hbox->addWidget(spaceLabel);
dhtnetworkLabel = new QLabel( this );
dhtnetworkLabel->setVisible(false);
dhtnetworkLabel->setPixmap(QPixmap(":/images/dht16.png"));
hbox->addWidget(dhtnetworkLabel);
dhtnetworksizeLabel = new QLabel( "0 (0) ",this );
dhtnetworksizeLabel->setVisible(false);
hbox->addWidget(dhtnetworksizeLabel);
hbox->addSpacing(2);
@ -71,22 +76,26 @@ void DHTStatus::getDHTStatus()
{
dhtstatusLabel->setPixmap(QPixmap(":/images/greenled.png"));
dhtstatusLabel->setToolTip(tr("DHT On"));
spaceLabel->setVisible(true);
dhtnetworkLabel->setVisible(true);
dhtnetworksizeLabel->setVisible(true);
dhtnetworksizeLabel->setText(QString("%1 (%2)").arg(misc::userFriendlyUnit(config.netDhtRsNetSize, 1)).arg(misc::userFriendlyUnit(config.netDhtNetSize, 1)));
dhtnetworksizeLabel->setToolTip(tr("RetroShare users in DHT (Total DHT users)") );
}
else
{
dhtstatusLabel->setPixmap(QPixmap(":/images/redled.png"));
dhtstatusLabel->setToolTip(tr("DHT Off"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
dhtnetworksizeLabel->setVisible(false);
dhtnetworksizeLabel->setText("");
dhtnetworksizeLabel->setToolTip("");
}
QString dhtsize;
{
std::ostringstream out;
out << (int) config.netDhtRsNetSize << " ( " << (int) config.netDhtNetSize << " )";
dhtsize = QString::fromStdString(out.str());
}
dhtnetworksizeLabel->setText(dhtsize);
dhtnetworksizeLabel->setToolTip(tr("RetroShare users in DHT (Total DHT users)") );
rsiface->unlockData(); /* UnLock Interface */
}