From 45400260212b300a7fd4fb3aff1898c8053594e1 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 14 Sep 2010 16:40:00 -0700 Subject: Added checkboxes to the group list for receiving group notices, joining group chat, and listing group in profile --- linden/indra/newview/llfloatergroups.cpp | 82 +++++++++++++++++++--- linden/indra/newview/llfloatergroups.h | 1 + .../skins/default/xui/en-us/panel_groups.xml | 13 +++- 3 files changed, 82 insertions(+), 14 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llfloatergroups.cpp b/linden/indra/newview/llfloatergroups.cpp index f00489c..4ddacfd 100644 --- a/linden/indra/newview/llfloatergroups.cpp +++ b/linden/indra/newview/llfloatergroups.cpp @@ -65,7 +65,7 @@ std::map LLFloaterGroupPicker::sInstances; // helper functions -void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const std::string& none_text, U64 powers_mask = GP_ALL_POWERS); +void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const std::string& none_text, bool group_picker, U64 powers_mask = GP_ALL_POWERS); ///---------------------------------------------------------------------------- /// Class LLFloaterGroupPicker @@ -121,7 +121,7 @@ void LLFloaterGroupPicker::setPowersMask(U64 powers_mask) BOOL LLFloaterGroupPicker::postBuild() { const std::string none_text = getString("none"); - init_group_list(getChild("group list"), gAgent.getGroupID(), none_text, mPowersMask); + init_group_list(getChild("group list"), gAgent.getGroupID(), none_text, true, mPowersMask); childSetAction("OK", onBtnOK, this); @@ -206,7 +206,7 @@ void LLPanelGroups::reset() childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups())); const std::string none_text = getString("none"); - init_group_list(getChild("group list"), gAgent.getGroupID(), none_text); + init_group_list(getChild("group list"), gAgent.getGroupID(), none_text, false); enableButtons(); } @@ -218,7 +218,7 @@ BOOL LLPanelGroups::postBuild() childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups())); const std::string none_text = getString("none"); - init_group_list(getChild("group list"), gAgent.getGroupID(), none_text); + init_group_list(getChild("group list"), gAgent.getGroupID(), none_text, false); childSetAction("Activate", onBtnActivate, this); @@ -344,13 +344,13 @@ void LLPanelGroups::onBtnTitles(void* userdata) void LLPanelGroups::create() { - llinfos << "LLPanelGroups::create" << llendl; + //llinfos << "LLPanelGroups::create" << llendl; LLFloaterGroupInfo::showCreateGroup(NULL); } void LLPanelGroups::activate() { - llinfos << "LLPanelGroups::activate" << llendl; + //llinfos << "LLPanelGroups::activate" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; if (group_list) @@ -368,7 +368,7 @@ void LLPanelGroups::activate() void LLPanelGroups::info() { - llinfos << "LLPanelGroups::info" << llendl; + //llinfos << "LLPanelGroups::info" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; if (group_list && (group_id = group_list->getCurrentID()).notNull()) @@ -406,7 +406,7 @@ void LLPanelGroups::startIM() void LLPanelGroups::leave() { - llinfos << "LLPanelGroups::leave" << llendl; + //llinfos << "LLPanelGroups::leave" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; if (group_list && (group_id = group_list->getCurrentID()).notNull()) @@ -446,7 +446,7 @@ void LLPanelGroups::invite() group_id = group_list->getCurrentID(); } - LLFloaterGroupInvite::showForGroup(group_id); + LLFloaterGroupInvite::showForGroup(group_id); } void LLPanelGroups::titles() @@ -477,10 +477,15 @@ bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& res void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) { LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->enableButtons(); + if (self) + { + self->enableButtons(); + // check to see if group checkboxes have changed + self->applyChangesToGroups(); + } } -void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const std::string& none_text, U64 powers_mask) +void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const std::string& none_text, bool group_picker, U64 powers_mask) { S32 count = gAgent.mGroups.count(); LLUUID id; @@ -501,6 +506,11 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s style = "BOLD"; } + // 0 - Group Name + // 1 - Group Notices + // 2 - Group Chat + // 3 - Group Listing in Profile + LLSD element; element["id"] = id; element["columns"][0]["column"] = "name"; @@ -508,6 +518,24 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s element["columns"][0]["font"] = "SANSSERIF"; element["columns"][0]["font-style"] = style; + if (!group_picker) + { + LLSD& receive_notices_column = element["columns"][1]; + receive_notices_column["column"] = "receive_notices"; + receive_notices_column["type"] = "checkbox"; + receive_notices_column["value"] = group_datap->mAcceptNotices; + + LLSD& join_group_chat_column = element["columns"][2]; + join_group_chat_column["column"] = "join_group_chat"; + join_group_chat_column["type"] = "checkbox"; + join_group_chat_column["value"] = !gIMMgr->getIgnoreGroup(id); + + LLSD& list_in_profile_column = element["columns"][3]; + list_in_profile_column["column"] = "list_in_profile"; + list_in_profile_column["type"] = "checkbox"; + list_in_profile_column["value"] = group_datap->mListInProfile; + } + group_list->addElement(element, ADD_SORTED); } } @@ -532,3 +560,35 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s group_list->selectByValue(highlight_id); } +void LLPanelGroups::applyChangesToGroups() +{ + LLScrollListCtrl* group_list = getChild("group list"); + if (group_list) + { + // just in case we want to allow selecting multiple groups ever + std::vector selected = group_list->getAllSelected(); + for (std::vector::iterator itr = selected.begin(); itr != selected.end(); ++itr) + { + LLUUID group_id = (*itr)->getValue(); + BOOL receive_notices = (*itr)->getColumn(1)->getValue().asBoolean(); + BOOL join_group_chat = (*itr)->getColumn(2)->getValue().asBoolean(); + BOOL list_in_profile = (*itr)->getColumn(3)->getValue().asBoolean(); + + LLGroupData group_datap; + if (gAgent.getGroupData(group_id, group_datap)) + { + // notices and profile + if ((receive_notices != group_datap.mAcceptNotices) || (list_in_profile != group_datap.mListInProfile)) + { + gAgent.setUserGroupFlags(group_id, receive_notices, list_in_profile); + } + + // chat + if (join_group_chat != (!gIMMgr->getIgnoreGroup(group_id))) + { + gIMMgr->updateIgnoreGroup(group_id, join_group_chat); + } + } + } + } +} diff --git a/linden/indra/newview/llfloatergroups.h b/linden/indra/newview/llfloatergroups.h index c0d06e7..91021f0 100644 --- a/linden/indra/newview/llfloatergroups.h +++ b/linden/indra/newview/llfloatergroups.h @@ -102,6 +102,7 @@ protected: // highlight_id is a group id to highlight void enableButtons(); + void applyChangesToGroups(); static void onGroupList(LLUICtrl* ctrl, void* userdata); static void onBtnCreate(void* userdata); diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml b/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml index e6b78fb..22967dc 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml @@ -1,12 +1,19 @@ + name="groups" width="350" min_width="350"> - + + + +