Added checkboxes to groups list for visibility, groupchat, and notices...

-Required addition of an extra texture overlay for list headers, as normal button overlay is used for sort arrows.
-Added padding to italic text in scroll list, as the text clipped outside of the element.
-Groups list is now sortable and has header visible.
-'none' entry always be first in the list, regardless of sort order.
-LLGroupMgrGroupData::mListInProfile removed. Was unreferenced and always false. LLGroupMgrGroupData doesn't handle show/chat/notify properties
This commit is contained in:
Shyotl
2011-06-23 03:56:09 -05:00
parent 5d8ac68d3a
commit 0663a3f028
10 changed files with 312 additions and 89 deletions

View File

@@ -2488,8 +2488,6 @@ BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution)
return FALSE;
}
void update_group_floaters(const LLUUID& group_id);
BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile)
{
S32 count = mGroups.count();

View File

@@ -873,4 +873,5 @@ extern std::string gAuthString;
extern LLUUID gReSitTargetID;
extern LLVector3 gReSitOffset;
// </edit>
void update_group_floaters(const LLUUID& group_id);
#endif

View File

@@ -67,6 +67,9 @@ std::map<const LLUUID, LLFloaterGroupPicker*> 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);
//callbacks
void onGroupSortChanged(void* user_data);
///----------------------------------------------------------------------------
/// Class LLFloaterGroupPicker
///----------------------------------------------------------------------------
@@ -214,7 +217,9 @@ BOOL LLPanelGroups::postBuild()
childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups()));
const std::string none_text = getString("none");
init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), none_text);
LLScrollListCtrl *group_list = getChild<LLScrollListCtrl>("group list");
init_group_list(group_list, gAgent.getGroupID(), none_text);
group_list->setSortChangedCallback(onGroupSortChanged); //Force 'none' to always be first entry.
childSetAction("Activate", onBtnActivate, this);
@@ -472,8 +477,97 @@ bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& res
void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->enableButtons();
LLPanelGroups *self = (LLPanelGroups*)userdata;
if(!self)
return;
self->enableButtons();
LLScrollListCtrl *group_list = (LLScrollListCtrl*)self->getChild<LLScrollListCtrl>("group list");
if(!group_list)
return;
LLScrollListItem *item = group_list->getFirstSelected();
if(!item)
return;
const LLUUID group_id = item->getValue().asUUID();
if(group_id.isNull())
return;
LLGroupData group_data;
if(!gAgent.getGroupData(group_id,group_data))
return;
bool list_in_profile = item->getColumn(1)->getValue().asBoolean();
bool receive_chat = item->getColumn(2)->getValue().asBoolean();
bool recieve_notify = item->getColumn(3)->getValue().asBoolean();
bool update_floaters = false;
if(gIMMgr->getIgnoreGroup(group_id) == receive_chat)
{
gIMMgr->updateIgnoreGroup(group_id, !receive_chat);
update_floaters = true;
}
if( (bool)group_data.mListInProfile != list_in_profile ||
(bool)group_data.mAcceptNotices != recieve_notify )
{
gAgent.setUserGroupFlags(group_id, recieve_notify, list_in_profile);
}
else if(update_floaters) //gAgent.setUserGroupFlags already calls update_group_floaters
update_group_floaters(group_id);
}
LLSD create_group_element(const LLGroupData *group_datap, const LLUUID &active_group, const std::string& none_text, const U64 &powers_mask)
{
if(group_datap && !((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0)))
return LLSD();
const LLUUID &id = group_datap ? group_datap->mID : LLUUID::null;
const bool enabled = !!group_datap;
std::string style = (group_datap && group_datap->mListInProfile) ? "BOLD" : "NORMAL";
if(active_group == id)
{
style.append("|ITALIC");
}
LLSD element;
element["id"] = id;
LLSD& name_column = element["columns"][0];
name_column["column"] = "name";
name_column["value"] = group_datap ? group_datap->mName : none_text;
name_column["font"] = "SANSSERIF";
name_column["font-style"] = style;
LLSD& show_column = element["columns"][1];
show_column["column"] = "is_listed_group";
show_column["type"] = "checkbox";
show_column["enabled"] = enabled;
show_column["value"] = enabled && group_datap->mListInProfile;
LLSD& chat_column = element["columns"][2];
chat_column["column"] = "is_chattable_group";
chat_column["type"] = "checkbox";
chat_column["enabled"] = enabled;
chat_column["value"] = enabled && !gIMMgr->getIgnoreGroup(id);
LLSD& notice_column = element["columns"][3];
notice_column["column"] = "is_notice_group";
notice_column["type"] = "checkbox";
notice_column["enabled"] = enabled;
notice_column["value"] = enabled && group_datap->mAcceptNotices;
return element;
}
void onGroupSortChanged(void* user_data)
{
LLPanelGroups *panel = (LLPanelGroups*)user_data;
if(!panel)
return;
LLScrollListCtrl *group_list = (LLScrollListCtrl*)panel->getChild<LLScrollListCtrl>("group list");
if(!group_list)
return;
group_list->moveToFront(group_list->getItemIndex(LLUUID::null));
}
void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const std::string& none_text, U64 powers_mask)
@@ -491,43 +585,13 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const s
for(S32 i = 0; i < count; ++i)
{
id = gAgent.mGroups.get(i).mID;
LLGroupData* group_datap = &gAgent.mGroups.get(i);
if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0))
{
std::string style = group_datap->mListInProfile ? "BOLD" : "NORMAL";
if(highlight_id == id)
{
style.append("|ITALIC");
}
LLSD element;
element["id"] = id;
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = group_datap->mName;
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][0]["font-style"] = style;
LLSD element = create_group_element(&gAgent.mGroups.get(i), highlight_id, none_text, powers_mask);
if(element.size())
group_list->addElement(element, ADD_SORTED);
}
}
// add "none" to list at top
{
std::string style = "NORMAL";
if (highlight_id.isNull())
{
style = "ITALIC";
}
LLSD element;
element["id"] = LLUUID::null;
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = none_text;
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][0]["font-style"] = style;
group_list->addElement(element, ADD_TOP);
}
group_list->addElement(create_group_element(NULL, highlight_id, none_text, powers_mask), ADD_TOP);
if(selected_id.notNull())
group_list->selectByValue(selected_id);

View File

@@ -221,7 +221,6 @@ LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) :
mOpenEnrollment(FALSE),
mMembershipFee(0),
mAllowPublish(FALSE),
mListInProfile(FALSE),
mMaturePublish(FALSE),
mChanged(FALSE),
mMemberCount(0),

View File

@@ -255,7 +255,6 @@ public:
BOOL mOpenEnrollment;
S32 mMembershipFee;
BOOL mAllowPublish;
BOOL mListInProfile;
BOOL mMaturePublish;
BOOL mChanged;
S32 mMemberCount;

View File

@@ -780,61 +780,80 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
mBtnInfo->setVisible(is_member && !mAllowEdit);
}
if (mCtrlReceiveNotices)
if(gc == GC_ALL || gc == GC_PROPERTIES)
{
mCtrlReceiveNotices->setVisible(is_member);
if (is_member)
if (mCtrlReceiveNotices)
{
mCtrlReceiveNotices->setEnabled(mAllowEdit);
mCtrlReceiveNotices->setVisible(is_member);
if (is_member)
{
mCtrlReceiveNotices->setEnabled(mAllowEdit);
if(!mCtrlReceiveNotices->isDirty()) //If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc.
{
mCtrlReceiveNotices->set(agent_gdatap.mAcceptNotices);
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 (mCtrlListGroup)
{
mCtrlListGroup->setVisible(is_member);
if (is_member)
{
mCtrlListGroup->setEnabled(mAllowEdit);
if(!mCtrlListGroup->isDirty()) //If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc.
{
mCtrlListGroup->set(agent_gdatap.mListInProfile);
mCtrlListGroup->resetDirty();
}
}
}
if (mCtrlReceiveChat)
{
mCtrlReceiveChat->setVisible(is_member);
mCtrlReceiveChat->setEnabled(TRUE);
//mCtrlReceiveChat->resetDirty(); Don't resetDirty. This ctrl is decoupled from update.
}
if (mCtrlReceiveChat)
{
mCtrlReceiveChat->setVisible(is_member);
if (is_member)
{
mCtrlReceiveChat->setEnabled(mAllowEdit);
if(!mCtrlReceiveChat->isDirty()) //If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc.
{
mCtrlReceiveChat->set(!gIMMgr->getIgnoreGroup(mGroupID));
mCtrlReceiveChat->resetDirty();
}
}
}
if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
if (mGroupName) mGroupName->setText(gdatap->mName);
if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
if (mFounderName) mFounderName->setNameID(gdatap->mFounderID,FALSE);
if (mGroupName) mGroupName->setText(gdatap->mName);
if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
if (mFounderName) mFounderName->setNameID(gdatap->mFounderID,FALSE);
LLNameEditor* key_edit = getChild<LLNameEditor>("group_key");
if(key_edit)
{
key_edit->setText(gdatap->getID().asString());
}
if (mInsignia)
{
if (gdatap->mInsigniaID.notNull())
LLNameEditor* key_edit = getChild<LLNameEditor>("group_key");
if(key_edit)
{
mInsignia->setImageAssetID(gdatap->mInsigniaID);
key_edit->setText(gdatap->getID().asString());
}
else
{
mInsignia->setImageAssetID(mDefaultIconID);
}
}
if (mEditCharter)
{
mEditCharter->setText(gdatap->mCharter);
mEditCharter->resetDirty();
if (mInsignia)
{
if (gdatap->mInsigniaID.notNull())
{
mInsignia->setImageAssetID(gdatap->mInsigniaID);
}
else
{
mInsignia->setImageAssetID(mDefaultIconID);
}
}
if (mEditCharter)
{
mEditCharter->setText(gdatap->mCharter);
mEditCharter->resetDirty();
}
}
if (mListVisibleMembers)

View File

@@ -1,18 +1,26 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel border="true" bottom="-371" height="300" left="280" mouse_opaque="true"
name="groups" width="350">
<scroll_list background_visible="true" bottom="45" column_padding="5" draw_border="true"
draw_heading="false" draw_stripes="true" enabled="true"
<scroll_list background_visible="true" bottom="45" column_padding="0" draw_border="true"
draw_heading="true" draw_stripes="true" enabled="true"
follows="left|top|right|bottom" left="10" mouse_opaque="true"
multi_select="false" name="group list" tab_stop="true" top="-10"
width="240">
<column label="" name="name" width="248" />
<column dynamicwidth="true" label="Name" name="name" tool_tip="Name" />
<!--<column label="Active" name="is_active_group"
tool_tip="Group is set as active" width="40" />-->
<column image_overlay="ff_visible_online.tga" name="is_listed_group"
tool_tip="Group is visible in profile." width="20" />
<column image_overlay="icn_chat_overlay.tga" name="is_chattable_group"
tool_tip="Receive group chat" width="20" />
<column image_overlay="smicon_warn.tga" name="is_notice_group"
tool_tip="Receive group notices" width="20" />
</scroll_list>
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="22" drop_shadow_visible="true" enabled="true" follows="left|bottom"
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="12"
mouse_opaque="false" name="groupdesc" v_pad="0" width="248">
Your currently active group is displayed in bold.
Your currently active group is displayed in italics.
</text>
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="5" drop_shadow_visible="true" enabled="true" follows="left|bottom"