mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-28 18:42:20 -04:00
New methods for calculating the count of peers and messages. It should be faster than getting all data in std::list.
Now used in MainWindow.cpp, MessagesDialog.cpp and peerstatus.cpp void p3Peers::getPeerCount (unsigned int *pnFriendCount, unsigned int *pnOnlineCount); void p3Msgs::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox); git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2898 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e5667a915d
commit
84a87fa11b
15 changed files with 99 additions and 61 deletions
|
@ -63,25 +63,21 @@ void PeerStatus::getPeerStatus()
|
|||
{
|
||||
/* set users/friends/network */
|
||||
|
||||
std::list<std::string> ids;
|
||||
rsPeers->getOnlineList(ids);
|
||||
int online = ids.size();
|
||||
|
||||
ids.clear();
|
||||
rsPeers->getFriendList(ids);
|
||||
int friends = ids.size();
|
||||
unsigned int nFriendCount = 0;
|
||||
unsigned int nOnlineCount = 0;
|
||||
rsPeers->getPeerCount (&nFriendCount, &nOnlineCount);
|
||||
|
||||
std::ostringstream out;
|
||||
out << friends << " ";
|
||||
out << nFriendCount << " ";
|
||||
|
||||
std::ostringstream out2;
|
||||
out2 << online << " ";
|
||||
out2 << nOnlineCount << " ";
|
||||
|
||||
|
||||
if (statusPeers)
|
||||
statusPeers -> setText( tr("<span style=\"color:#000000\"><strong>Friends:</strong></span>") + " " + QString::fromStdString(out.str()) + " | " + tr("<span style=\"color:#0000FF\"><strong>Online:</strong></span>") + " " + QString::fromStdString(out2.str()) );
|
||||
|
||||
if (online > 0)
|
||||
if (nOnlineCount > 0)
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap::QPixmap(":/images/user/identity16.png"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue