From 09925c1bd58f8c5b42ce8efe213d8bdc201f37e9 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 23 Sep 2010 08:37:03 +0000 Subject: [PATCH] Some changes for groups: - Show user groups without assigned friends too, the standard groups are hidden without assigned friends - Show the standard groups in he tree first, than the user groups git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3525 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/PeersDialog.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 71d33a0cc..fed7095a8 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -675,7 +675,8 @@ void PeersDialog::insertPeers() if (groupIt != groupInfoList.end()) { groupInfo = &(*groupIt); - if (groupInfo->peerIds.size() == 0) { + if ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) && groupInfo->peerIds.size() == 0) { + // don't show empty standard groups groupIt++; continue; } @@ -804,7 +805,7 @@ void PeersDialog::insertPeers() availableCount++; gpgItem->setText(COLUMN_NAME, QString::fromStdString(detail.name)); - gpgItem->setData(COLUMN_NAME, ROLE_SORT, "1 " + QString::fromStdString(detail.name)); + gpgItem->setData(COLUMN_NAME, ROLE_SORT, "2 " + QString::fromStdString(detail.name)); // remove items that are not friends anymore int childCount = gpgItem->childCount(); @@ -1043,12 +1044,13 @@ void PeersDialog::insertPeers() } if (groupInfo && groupItem) { - if (groupItem->childCount() == 0) { + if ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) && groupItem->childCount() == 0) { // there are some dead id's assigned groupItem->setHidden(true); } else { groupItem->setText(COLUMN_NAME, QString("%1 (%2/%3)").arg(GroupDefs::name(*groupInfo)).arg(onlineCount).arg(availableCount)); - groupItem->setData(COLUMN_NAME, ROLE_SORT, "0 " + QString::fromUtf8(groupInfo->name.c_str())); + // show first the standard groups, than the user groups + groupItem->setData(COLUMN_NAME, ROLE_SORT, ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? "0 " : "1 ") + QString::fromUtf8(groupInfo->name.c_str())); } }