mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-05 05:12:51 -04:00
fixed show/hide groups option
This commit is contained in:
parent
9df1101bdf
commit
ebed027cba
4 changed files with 61 additions and 40 deletions
|
@ -168,11 +168,14 @@ RsFriendListModel::EntryIndex RsFriendListModel::EntryIndex::parent() const
|
|||
if(i.group_index==0xff)
|
||||
return EntryIndex();
|
||||
else
|
||||
{
|
||||
i.type = ENTRY_TYPE_GROUP;
|
||||
i.profile_index = 0xff;
|
||||
}
|
||||
break;
|
||||
|
||||
case ENTRY_TYPE_NODE: i.type = ENTRY_TYPE_PROFILE;
|
||||
i.node_index = 0;
|
||||
i.node_index = 0xff;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -802,14 +805,20 @@ static bool decreasing_time_comp(const std::pair<time_t,RsGxsMessageId>& e1,cons
|
|||
|
||||
void RsFriendListModel::debug_dump() const
|
||||
{
|
||||
for(uint32_t j=0;j<mGroups.size();++j)
|
||||
{
|
||||
std::cerr << "Group: " << mGroups[j].group_info.name << ", ";
|
||||
std::cerr << " children indices: " ; for(uint32_t i=0;i<mGroups[j].child_profile_indices.size();++i) std::cerr << mGroups[j].child_profile_indices[i] << " " ; std::cerr << std::endl;
|
||||
std::cerr << "==== FriendListModel Debug dump ====" << std::endl;
|
||||
|
||||
for(uint32_t i=0;i<mGroups[j].child_profile_indices.size();++i)
|
||||
for(uint32_t j=0;j<mTopLevel.size();++j)
|
||||
{
|
||||
uint32_t profile_index = mGroups[j].child_profile_indices[i];
|
||||
if(mTopLevel[j].type == ENTRY_TYPE_GROUP)
|
||||
{
|
||||
const HierarchicalGroupInformation& hg(mGroups[mTopLevel[j].group_index]);
|
||||
|
||||
std::cerr << "Group: " << hg.group_info.name << ", ";
|
||||
std::cerr << " children indices: " ; for(uint32_t i=0;i<hg.child_profile_indices.size();++i) std::cerr << hg.child_profile_indices[i] << " " ; std::cerr << std::endl;
|
||||
|
||||
for(uint32_t i=0;i<hg.child_profile_indices.size();++i)
|
||||
{
|
||||
uint32_t profile_index = hg.child_profile_indices[i];
|
||||
|
||||
std::cerr << " Profile " << mProfiles[profile_index].profile_info.gpg_id << std::endl;
|
||||
|
||||
|
@ -818,8 +827,18 @@ void RsFriendListModel::debug_dump() const
|
|||
for(uint32_t k=0;k<hprof.child_node_indices.size();++k)
|
||||
std::cerr << " Node " << mLocations[hprof.child_node_indices[k]].node_info.id << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
else if(mTopLevel[j].type == ENTRY_TYPE_PROFILE)
|
||||
{
|
||||
const HierarchicalProfileInformation& hprof(mProfiles[mTopLevel[j].profile_index]);
|
||||
|
||||
std::cerr << "Profile " << hprof.profile_info.gpg_id << std::endl;
|
||||
|
||||
for(uint32_t k=0;k<hprof.child_node_indices.size();++k)
|
||||
std::cerr << " Node " << mLocations[hprof.child_node_indices[k]].node_info.id << std::endl;
|
||||
}
|
||||
}
|
||||
std::cerr << "====================================" << std::endl;
|
||||
}
|
||||
|
||||
bool RsFriendListModel::getGroupData (const QModelIndex& i,RsGroupInfo & data) const
|
||||
|
@ -943,6 +962,8 @@ void RsFriendListModel::updateInternalData()
|
|||
mLocations.push_back(hnode);
|
||||
}
|
||||
|
||||
if(mDisplayGroups)
|
||||
{
|
||||
// groups
|
||||
|
||||
std::list<RsGroupInfo> groupInfoList;
|
||||
|
@ -973,6 +994,7 @@ void RsFriendListModel::updateInternalData()
|
|||
|
||||
mGroups.push_back(hgroup);
|
||||
}
|
||||
}
|
||||
|
||||
// now the top level list
|
||||
|
||||
|
@ -1004,7 +1026,7 @@ void RsFriendListModel::updateInternalData()
|
|||
|
||||
// finally, tell the model client that layout has changed.
|
||||
|
||||
beginInsertRows(QModelIndex(),0,mGroups.size()-1);
|
||||
beginInsertRows(QModelIndex(),0,mTopLevel.size()-1);
|
||||
endInsertRows();
|
||||
|
||||
postMods();
|
||||
|
|
|
@ -119,6 +119,7 @@ public:
|
|||
// This method will asynchroneously update the data
|
||||
|
||||
void setDisplayGroups(bool b);
|
||||
bool getDisplayGroups() const { return mDisplayGroups; }
|
||||
|
||||
EntryType getType(const QModelIndex&) const;
|
||||
|
||||
|
|
|
@ -141,7 +141,6 @@ NewFriendList::NewFriendList(QWidget *parent) :
|
|||
QWidget(parent),
|
||||
ui(new Ui::NewFriendList()),
|
||||
// mCompareRole(new RSTreeWidgetItemCompareRole),
|
||||
mShowGroups(true),
|
||||
mShowState(false),
|
||||
mHideUnconnected(false),
|
||||
groupsHasChanged(false)
|
||||
|
@ -256,7 +255,7 @@ void NewFriendList::headerContextMenuRequested(QPoint p)
|
|||
|
||||
ui->actionHideOfflineFriends->setChecked(mHideUnconnected);
|
||||
ui->actionShowState->setChecked(mShowState);
|
||||
ui->actionShowGroups->setChecked(mShowGroups);
|
||||
ui->actionShowGroups->setChecked(mModel->getDisplayGroups());
|
||||
|
||||
QHeaderView *header = ui->peerTreeWidget->header();
|
||||
|
||||
|
@ -314,7 +313,7 @@ void NewFriendList::processSettings(bool load)
|
|||
// states
|
||||
setHideUnconnected(Settings->value("hideUnconnected", mHideUnconnected).toBool());
|
||||
setShowState(Settings->value("showState", mShowState).toBool());
|
||||
setShowGroups(Settings->value("showGroups", mShowGroups).toBool());
|
||||
setShowGroups(Settings->value("showGroups", mModel->getDisplayGroups()).toBool());
|
||||
|
||||
// sort
|
||||
toggleSortByState(Settings->value("sortByState", isSortByState()).toBool());
|
||||
|
@ -342,7 +341,7 @@ void NewFriendList::processSettings(bool load)
|
|||
// states
|
||||
Settings->setValue("hideUnconnected", mHideUnconnected);
|
||||
Settings->setValue("showState", mShowState);
|
||||
Settings->setValue("showGroups", mShowGroups);
|
||||
Settings->setValue("showGroups", mModel->getDisplayGroups());
|
||||
|
||||
// sort
|
||||
Settings->setValue("sortByState", isSortByState());
|
||||
|
@ -463,7 +462,7 @@ void NewFriendList::peerTreeWidgetCustomPopupMenu()
|
|||
RsFriendListModel::RsProfileDetails details;
|
||||
mModel->getProfileData(index,details);
|
||||
|
||||
if(mShowGroups)
|
||||
if(mModel->getDisplayGroups())
|
||||
{
|
||||
QMenu* addToGroupMenu = NULL;
|
||||
QMenu* moveToGroupMenu = NULL;
|
||||
|
|
|
@ -108,7 +108,6 @@ private:
|
|||
bool getCurrentProfile(RsFriendListModel::RsProfileDetails& prof) const;
|
||||
|
||||
// Settings for peer list display
|
||||
bool mShowGroups;
|
||||
bool mShowState;
|
||||
bool mHideUnconnected;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue