diff --git a/retroshare-gui/src/gui/common/FriendListModel.cpp b/retroshare-gui/src/gui/common/FriendListModel.cpp index eb587f39d..f0c541ee5 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.cpp +++ b/retroshare-gui/src/gui/common/FriendListModel.cpp @@ -700,13 +700,25 @@ void RsFriendListModel::updateInternalData() mLocations.clear(); mProfiles.clear(); + mHG.clear(); + mHL.clear(); + mHP.clear(); + + // create a map of profiles and groups + std::map pgp_indexes; + std::map ssl_indexes; + std::map grp_indexes; + // groups std::list groupInfoList; rsPeers->getGroupInfoList(groupInfoList) ; for(auto it(groupInfoList.begin());it!=groupInfoList.end();++it) + { + grp_indexes[it->group_id] = mGroups.size(); mGroups.push_back(*it); + } // profiles @@ -720,6 +732,7 @@ void RsFriendListModel::updateInternalData() if(!rsPeers->getGPGDetails(*it,det)) continue; + pgp_indexes[det.gpg_id] = mProfiles.size(); mProfiles.push_back(det); } @@ -735,9 +748,32 @@ void RsFriendListModel::updateInternalData() if(!rsPeers->getPeerDetails(*it,det)) continue; + ssl_indexes[det.id] = mLocations.size(); mLocations.push_back(det); } + // now build the hierarchy information for the model + + for(uint32_t i=0;isecond); + } + + mHG.push_back(inf); + } + +#warning Missing code here !!! + postMods(); } diff --git a/retroshare-gui/src/gui/common/FriendListModel.h b/retroshare-gui/src/gui/common/FriendListModel.h index 26f39778d..7e2b06dd7 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.h +++ b/retroshare-gui/src/gui/common/FriendListModel.h @@ -47,6 +47,24 @@ public: class RsNodeDetails: public RsPeerDetails {};// in the near future, there will be a specific class for Profile/Node details in replacement of RsPeerDetails class RsProfileDetails: public RsPeerDetails {}; + struct HierarchicalGroupInformation + { + uint32_t group_index; + std::vector child_indices; + }; + struct HierarchicalProfileInformation + { + uint32_t profile_index; + std::vector child_indices; + uint32_t parent_group_index; + }; + struct HierarchicalNodeInformation + { + uint32_t node_index; + uint32_t parent_profile_index; + }; + + enum Columns { COLUMN_THREAD_NAME = 0x00, COLUMN_THREAD_LAST_CONTACT = 0x01, @@ -164,7 +182,14 @@ private: bool mDisplayGroups ; - std::vector mGroups; + // A given profile may belong to multiple groups, so the hierarchy is stored using the 3 variables below. + + std::vector mHG; + std::vector mHP; + std::vector mHL; + + std::vector mGroups; std::vector mProfiles; - std::vector mLocations; + std::vector mLocations; }; +