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:
thunder2 2010-07-06 21:17:41 +00:00
parent dc67b88eb1
commit 9495648d16
3 changed files with 10 additions and 13 deletions

View file

@ -382,18 +382,19 @@ void MainWindow::updateStatus()
if(RsAutoUpdatePage::eventsLocked())
return ;
unsigned int nFriendCount = 0;
unsigned int nOnlineCount = 0;
rsPeers->getPeerCount (&nFriendCount, &nOnlineCount);
if (ratesstatus)
ratesstatus->getRatesStatus();
if (peerstatus)
peerstatus->getPeerStatus();
peerstatus->getPeerStatus(nFriendCount, nOnlineCount);
if (natstatus)
natstatus->getNATStatus();
unsigned int online = 0;
rsPeers->getPeerCount (NULL, &online);
unsigned int newInboxCount = 0;
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));
}
}
else if (online == 0)
else if (nOnlineCount == 0)
{
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
trayIcon->setToolTip(tr("RetroShare"));
}
else if (online < 2)
else if (nOnlineCount < 2)
{
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
trayIcon->setToolTip(tr("RetroShare"));
}
else if (online < 3)
else if (nOnlineCount < 3)
{
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
trayIcon->setToolTip(tr("RetroShare"));