mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-25 17:39:18 -04:00
Optimized call to p3Peers::getPeerCount in MainWindow::updateStatus
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3263 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dc67b88eb1
commit
9495648d16
@ -382,18 +382,19 @@ void MainWindow::updateStatus()
|
|||||||
if(RsAutoUpdatePage::eventsLocked())
|
if(RsAutoUpdatePage::eventsLocked())
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
|
unsigned int nFriendCount = 0;
|
||||||
|
unsigned int nOnlineCount = 0;
|
||||||
|
rsPeers->getPeerCount (&nFriendCount, &nOnlineCount);
|
||||||
|
|
||||||
if (ratesstatus)
|
if (ratesstatus)
|
||||||
ratesstatus->getRatesStatus();
|
ratesstatus->getRatesStatus();
|
||||||
|
|
||||||
if (peerstatus)
|
if (peerstatus)
|
||||||
peerstatus->getPeerStatus();
|
peerstatus->getPeerStatus(nFriendCount, nOnlineCount);
|
||||||
|
|
||||||
if (natstatus)
|
if (natstatus)
|
||||||
natstatus->getNATStatus();
|
natstatus->getNATStatus();
|
||||||
|
|
||||||
unsigned int online = 0;
|
|
||||||
rsPeers->getPeerCount (NULL, &online);
|
|
||||||
|
|
||||||
unsigned int newInboxCount = 0;
|
unsigned int newInboxCount = 0;
|
||||||
rsMsgs->getMessageCount (NULL, &newInboxCount, NULL, NULL, NULL, NULL);
|
rsMsgs->getMessageCount (NULL, &newInboxCount, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
@ -411,17 +412,17 @@ void MainWindow::updateStatus()
|
|||||||
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new message").arg(newInboxCount));
|
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 new message").arg(newInboxCount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (online == 0)
|
else if (nOnlineCount == 0)
|
||||||
{
|
{
|
||||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||||
trayIcon->setToolTip(tr("RetroShare"));
|
trayIcon->setToolTip(tr("RetroShare"));
|
||||||
}
|
}
|
||||||
else if (online < 2)
|
else if (nOnlineCount < 2)
|
||||||
{
|
{
|
||||||
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
|
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
|
||||||
trayIcon->setToolTip(tr("RetroShare"));
|
trayIcon->setToolTip(tr("RetroShare"));
|
||||||
}
|
}
|
||||||
else if (online < 3)
|
else if (nOnlineCount < 3)
|
||||||
{
|
{
|
||||||
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
|
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
|
||||||
trayIcon->setToolTip(tr("RetroShare"));
|
trayIcon->setToolTip(tr("RetroShare"));
|
||||||
|
@ -59,14 +59,10 @@ PeerStatus::~PeerStatus()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerStatus::getPeerStatus()
|
void PeerStatus::getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCount)
|
||||||
{
|
{
|
||||||
/* set users/friends/network */
|
/* set users/friends/network */
|
||||||
|
|
||||||
unsigned int nFriendCount = 0;
|
|
||||||
unsigned int nOnlineCount = 0;
|
|
||||||
rsPeers->getPeerCount (&nFriendCount, &nOnlineCount);
|
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << nFriendCount << " ";
|
out << nFriendCount << " ";
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
~PeerStatus();
|
~PeerStatus();
|
||||||
|
|
||||||
void getPeerStatus( );
|
void getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCount);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user