Groups/agent profile floaters now update when a group visbility changes.

Apply button in group settings doesn't behave quite as badly after changing notices/chat/show in profile settings.
Groups floater now bolds visible groups, italicized if active (this may need to be something more noticeable)
This commit is contained in:
Shyotl
2011-06-21 12:03:28 -05:00
parent db2f409ef4
commit 5d8ac68d3a
4 changed files with 68 additions and 25 deletions

View File

@@ -2488,15 +2488,18 @@ BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution)
return FALSE; return FALSE;
} }
void update_group_floaters(const LLUUID& group_id);
BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile) BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile)
{ {
S32 count = mGroups.count(); S32 count = mGroups.count();
for(S32 i = 0; i < count; ++i) for(S32 i = 0; i < count; ++i)
{ {
if(mGroups.get(i).mID == group_id) LLGroupData &group = mGroups.get(i);
if(group.mID == group_id)
{ {
mGroups.get(i).mAcceptNotices = accept_notices; group.mAcceptNotices = accept_notices;
mGroups.get(i).mListInProfile = list_in_profile; group.mListInProfile = list_in_profile;
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessage("SetGroupAcceptNotices"); msg->newMessage("SetGroupAcceptNotices");
msg->nextBlock("AgentData"); msg->nextBlock("AgentData");
@@ -2508,6 +2511,9 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
msg->nextBlock("NewData"); msg->nextBlock("NewData");
msg->addBOOL("ListInProfile", list_in_profile); msg->addBOOL("ListInProfile", list_in_profile);
sendReliableMessage(); sendReliableMessage();
update_group_floaters(group.mID);
return TRUE; return TRUE;
} }
} }

View File

@@ -198,15 +198,9 @@ LLPanelGroups::~LLPanelGroups()
// clear the group list, and get a fresh set of info. // clear the group list, and get a fresh set of info.
void LLPanelGroups::reset() void LLPanelGroups::reset()
{ {
LLCtrlListInterface *group_list = childGetListInterface("group list");
if (group_list)
{
group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
}
childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count())); childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count()));
childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups())); childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups()));
const std::string none_text = getString("none"); const std::string none_text = getString("none");
init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), none_text); init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), none_text);
enableButtons(); enableButtons();
@@ -489,6 +483,10 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s
LLCtrlListInterface *group_list = ctrl->getListInterface(); LLCtrlListInterface *group_list = ctrl->getListInterface();
if (!group_list) return; if (!group_list) return;
const LLUUID selected_id = group_list->getSelectedValue();
const S32 selected_idx = group_list->getFirstSelectedIndex();
const S32 scroll_pos = ctrl->getScrollPos();
group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); group_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
for(S32 i = 0; i < count; ++i) for(S32 i = 0; i < count; ++i)
@@ -497,10 +495,10 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s
LLGroupData* group_datap = &gAgent.mGroups.get(i); LLGroupData* group_datap = &gAgent.mGroups.get(i);
if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0)) if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0))
{ {
std::string style = "NORMAL"; std::string style = group_datap->mListInProfile ? "BOLD" : "NORMAL";
if(highlight_id == id) if(highlight_id == id)
{ {
style = "BOLD"; style.append("|ITALIC");
} }
LLSD element; LLSD element;
@@ -519,7 +517,7 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s
std::string style = "NORMAL"; std::string style = "NORMAL";
if (highlight_id.isNull()) if (highlight_id.isNull())
{ {
style = "BOLD"; style = "ITALIC";
} }
LLSD element; LLSD element;
element["id"] = LLUUID::null; element["id"] = LLUUID::null;
@@ -531,6 +529,13 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s
group_list->addElement(element, ADD_TOP); group_list->addElement(element, ADD_TOP);
} }
group_list->selectByValue(highlight_id); if(selected_id.notNull())
group_list->selectByValue(selected_id);
else
group_list->selectByValue(highlight_id); //highlight is actually active group
if(selected_idx!=group_list->getFirstSelectedIndex()) //if index changed then our stored pos is pointless.
ctrl->scrollToShowSelected();
else
ctrl->setScrollPos(scroll_pos);
} }

View File

@@ -1689,6 +1689,10 @@ void LLPanelAvatar::resetGroupList()
LLScrollListCtrl* group_list = mPanelSecondLife->getChild<LLScrollListCtrl>("groups"); LLScrollListCtrl* group_list = mPanelSecondLife->getChild<LLScrollListCtrl>("groups");
if (group_list) if (group_list)
{ {
const LLUUID selected_id = group_list->getSelectedValue();
const S32 selected_idx = group_list->getFirstSelectedIndex();
const S32 scroll_pos = group_list->getScrollPos();
group_list->deleteAllItems(); group_list->deleteAllItems();
S32 count = gAgent.mGroups.count(); S32 count = gAgent.mGroups.count();
@@ -1717,11 +1721,19 @@ void LLPanelAvatar::resetGroupList()
row["id"] = id ; row["id"] = id ;
row["columns"][0]["value"] = group_string; row["columns"][0]["value"] = group_string;
row["columns"][0]["font"] = "SANSSERIF_SMALL"; row["columns"][0]["font"] = "SANSSERIF_SMALL";
row["columns"][0]["font-style"] = group_data.mListInProfile ? "BOLD" : "NORMAL"; std::string font_style = group_data.mListInProfile ? "BOLD" : "NORMAL";
if(group_data.mID == gAgent.getGroupID())
font_style.append("|ITALIC");
row["columns"][0]["font-style"] = font_style;
row["columns"][0]["width"] = 0; row["columns"][0]["width"] = 0;
group_list->addElement(row); group_list->addElement(row,ADD_SORTED);
} }
group_list->sortByColumnIndex(0, TRUE); if(selected_id.notNull())
group_list->selectByValue(selected_id);
if(selected_idx!=group_list->getFirstSelectedIndex()) //if index changed then our stored pos is pointless.
group_list->scrollToShowSelected();
else
group_list->setScrollPos(scroll_pos);
} }
} }
} }
@@ -2248,22 +2260,23 @@ void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**)
} }
} }
// Set normal color if not found or if group is visible in profile // Set normal color if not found or if group is visible in profile
if (!group_data || group_data->mListInProfile) if (group_data)
{ {
row["columns"][0]["font-style"] = "BOLD"; std::string font_style = group_data->mListInProfile ? "BOLD" : "NORMAL";
if(group_data->mID == gAgent.getGroupID())
font_style.append("|ITALIC");
row["columns"][0]["font-style"] = font_style;
} }
else
row["columns"][0]["font-style"] = "NORMAL";
} }
if (group_list) if (group_list)
{ {
group_list->addElement(row); group_list->addElement(row,ADD_SORTED);
} }
} }
} }
if(group_list) group_list->sortByColumnIndex(0, TRUE);
} }
} }

View File

@@ -220,6 +220,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mCtrlReceiveNotices->setCallbackUserData(this); mCtrlReceiveNotices->setCallbackUserData(this);
mCtrlReceiveNotices->set(accept_notices); mCtrlReceiveNotices->set(accept_notices);
mCtrlReceiveNotices->setEnabled(data.mID.notNull()); mCtrlReceiveNotices->setEnabled(data.mID.notNull());
mCtrlReceiveNotices->resetDirty();
} }
mCtrlReceiveChat = getChild<LLCheckBoxCtrl>("receive_chat", recurse); mCtrlReceiveChat = getChild<LLCheckBoxCtrl>("receive_chat", recurse);
@@ -229,6 +230,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mCtrlReceiveChat->setCallbackUserData(this); mCtrlReceiveChat->setCallbackUserData(this);
mCtrlReceiveChat->set(!gIMMgr->getIgnoreGroup(mGroupID)); mCtrlReceiveChat->set(!gIMMgr->getIgnoreGroup(mGroupID));
mCtrlReceiveChat->setEnabled(mGroupID.notNull()); mCtrlReceiveChat->setEnabled(mGroupID.notNull());
mCtrlReceiveChat->resetDirty();
} }
mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse); mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
@@ -549,9 +551,17 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
BOOL receive_notices = false; BOOL receive_notices = false;
BOOL list_in_profile = false; BOOL list_in_profile = false;
if (mCtrlReceiveNotices) if (mCtrlReceiveNotices)
{
receive_notices = mCtrlReceiveNotices->get(); receive_notices = mCtrlReceiveNotices->get();
mCtrlReceiveNotices->resetDirty(); //resetDirty() here instead of in update because this is where the settings
//are actually being applied. onCommitUserOnly doesn't call updateChanged directly.
}
if (mCtrlListGroup) if (mCtrlListGroup)
{
list_in_profile = mCtrlListGroup->get(); list_in_profile = mCtrlListGroup->get();
mCtrlListGroup->resetDirty(); //resetDirty() here instead of in update because this is where the settings
//are actually being applied. onCommitUserOnly doesn't call updateChanged directly.
}
gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile); gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
@@ -561,6 +571,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
gIMMgr->updateIgnoreGroup(mGroupID, !receive_chat); gIMMgr->updateIgnoreGroup(mGroupID, !receive_chat);
// Save here too in case we crash somewhere down the road -- MC // Save here too in case we crash somewhere down the road -- MC
gIMMgr->saveIgnoreGroup(); gIMMgr->saveIgnoreGroup();
mCtrlReceiveChat->resetDirty();
} }
mChanged = FALSE; mChanged = FALSE;
@@ -776,14 +787,22 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
{ {
mCtrlReceiveNotices->setEnabled(mAllowEdit); mCtrlReceiveNotices->setEnabled(mAllowEdit);
} }
mCtrlReceiveNotices->resetDirty(); //mCtrlReceiveNotices->resetDirty(); Don't resetDirty. This ctrl is decoupled from update.
}
if (mCtrlListGroup)
{
mCtrlListGroup->setVisible(is_member);
if (is_member)
mCtrlListGroup->setEnabled(mAllowEdit);
//mCtrlReceiveChat->resetDirty(); Don't resetDirty. This ctrl is decoupled from update.
} }
if (mCtrlReceiveChat) if (mCtrlReceiveChat)
{ {
mCtrlReceiveChat->setVisible(is_member); mCtrlReceiveChat->setVisible(is_member);
mCtrlReceiveChat->setEnabled(TRUE); mCtrlReceiveChat->setEnabled(TRUE);
mCtrlReceiveChat->resetDirty(); //mCtrlReceiveChat->resetDirty(); Don't resetDirty. This ctrl is decoupled from update.
} }