Forced to push completely broken Contact Groups because a comment was removed from ascentflowercontactgroups.cpp and was committed.

Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
Beeks
2010-10-26 23:01:51 -04:00
parent 395100fef6
commit b23d7f174c
5 changed files with 169 additions and 94 deletions

View File

@@ -45,17 +45,16 @@ void ASFloaterContactGroups::show(LLDynamicArray<LLUUID> ids)
{
if (!sInstance)
sInstance = new ASFloaterContactGroups();
mSelectedUUIDs = ids;
sInstance->open();
sInstance->populateGroupList();
sInstance->populateFriendList();
sInstance->childSetAction("Cancel", onBtnClose, sInstance);
sInstance->childSetAction("Save", onBtnSave, sInstance);
sInstance->childSetAction("Create", onBtnCreate, sInstance);
sInstance->childSetAction("Delete", onBtnDelete, sInstance);
sInstance->childSetAction("combo_group_add", onBtnAdd, sInstance);
sInstance->childSetAction("combo_group_remove", onBtnRemove, sInstance);
//sInstance->childSetAction("New", onBtnCreate, sInstance);
//sInstance->childSetAction("Delete", onBtnDelete, sInstance);
}
void ASFloaterContactGroups::onBtnDelete(void* userdata)
@@ -73,7 +72,28 @@ void ASFloaterContactGroups::onBtnDelete(void* userdata)
}
}
void ASFloaterContactGroups::onBtnSave(void* userdata)
void ASFloaterContactGroups::onBtnAdd(void* userdata)
{
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
llinfos << "Button Add Begin" << llendl;
if(self)
{
LLComboBox* combo = self->getChild<LLComboBox>("buddy_group_combobox");
if (combo->getCurrentIndex() == -1) //Entered text is a new group name, create a group first
{
std::string name = combo->getSimple();
self->createContactGroup(name);
combo->selectByValue(name);
}
for (S32 i = (self->mSelectedUUIDs.count() - 1); i >= 0; --i)
{
//self->addContactMember(combo->getSimple(), self->mSelectedUUIDs.get(i));
}
}
}
void ASFloaterContactGroups::onBtnRemove(void* userdata)
{
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
@@ -98,12 +118,6 @@ void ASFloaterContactGroups::onBtnSave(void* userdata)
}
}
void ASFloaterContactGroups::onBtnClose(void* userdata)
{
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
if(self) self->close();
}
void ASFloaterContactGroups::onBtnCreate(void* userdata)
{
ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata;
@@ -112,12 +126,12 @@ void ASFloaterContactGroups::onBtnCreate(void* userdata)
LLLineEditor* editor = self->getChild<LLLineEditor>("add_group_lineedit");
if (editor)
{
LLScrollListCtrl* scroller = self->getChild<LLScrollListCtrl>("friend_scroll_list");
/*LLScrollListCtrl* scroller = self->getChild<LLScrollListCtrl>("friend_scroll_list");
if(scroller != NULL)
{
self->createContactGroup(editor->getValue().asString());
self->populateGroupList();
}
}*/
}
else
{
@@ -139,17 +153,58 @@ ASFloaterContactGroups::~ASFloaterContactGroups()
void ASFloaterContactGroups::populateFriendList()
{
LLScrollListCtrl* scroller = getChild<LLScrollListCtrl>("friend_scroll_list");
/*LLScrollListCtrl* scroller = getChild<LLScrollListCtrl>("friend_scroll_list");
if(scroller != NULL)
{
}
}*/
}
void ASFloaterContactGroups::addContactMember(std::string contact_grp, LLUUID to_add)
{
ASFloaterContactGroups::mContactGroupData[contact_grp].append(to_add.asString());
gSavedPerAccountSettings.setLLSD("AscentContactGroups", ASFloaterContactGroups::mContactGroupData);
BOOL is_new = true;
S32 entrycount = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][contact_grp].size();
for(S32 i = 0; i < entrycount; i++)
{
if (ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][contact_grp][i].asString() == to_add.asString())
{
is_new = false;
break;
}
}
if (is_new)
{
ASFloaterContactGroups::mContactGroupData[contact_grp].append(to_add.asString());
gSavedPerAccountSettings.setLLSD("AscentContactGroups", ASFloaterContactGroups::mContactGroupData);
}
populateActiveGroupList(to_add);
}
void ASFloaterContactGroups::populateActiveGroupList(LLUUID user_key)
{
LLScrollListCtrl* scroller = getChild<LLScrollListCtrl>("group_scroll_list");
if(scroller != NULL)
{
llinfos << "Cleaning and rebuilding group list" << llendl;
scroller->deleteAllItems();
S32 count = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"].size();
for (S32 index = 0; index < count; index++)
{
llinfos << "Entries for " << ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString() << llendl;
S32 entrycount = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].size();
for(S32 i = 0; i < entrycount; i++)
{
llinfos << "Subentries for " << ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index][i].asString() << llendl;
if (ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index][i].asString() == user_key.asString())
{
scroller->addSimpleElement(ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString(), ADD_BOTTOM);
break;
}
}
}
}
}
void ASFloaterContactGroups::deleteContactGroup(std::string contact_grp)
@@ -167,21 +222,21 @@ void ASFloaterContactGroups::createContactGroup(std::string contact_grp)
void ASFloaterContactGroups::populateGroupList()
{
ASFloaterContactGroups::mContactGroupData = gSavedPerAccountSettings.getLLSD("AscentContactGroups");
LLScrollListCtrl* scroller = getChild<LLScrollListCtrl>("group_scroll_list");
if(scroller != NULL)
LLComboBox* combo = getChild<LLComboBox>("buddy_group_combobox");
if(combo != NULL)
{
scroller->deleteAllItems();
combo->removeall();
S32 count = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"].size();
S32 index;
for (index = 0; index < count; index++)
{
scroller->addSimpleElement(ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString(), ADD_BOTTOM);
std::string group = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString();
if (group != "")
{
llinfos << "Adding " << group << llendl;
combo->add(ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString(), ADD_BOTTOM);
}
}
}
else
{
LLChat msg("Null Scroller");
LLFloaterChat::addChat(msg);
}
}

View File

@@ -32,14 +32,15 @@ public:
static void show(LLDynamicArray<LLUUID> ids);
void populateGroupList();
void populateActiveGroupList(LLUUID to_add);
void populateFriendList();
void addContactMember(std::string contact_grp, LLUUID to_add);
void createContactGroup(std::string contact_grp);
void deleteContactGroup(std::string contact_grp);
// Buttons
static void onBtnClose(void* userdata);
static void onBtnSave(void* userdata);
static void onBtnAdd(void* userdata);
static void onBtnRemove(void* userdata);
static void onBtnCreate(void* userdata);
static void onBtnDelete(void* userdata);

View File

@@ -385,13 +385,14 @@ BOOL LLPanelFriends::postBuild()
childSetAction("im_btn", onClickIM, this);
childSetAction("assign_btn", onClickAssign, this);
childSetAction("expand_collapse_btn", onClickExpand, this);
childSetAction("profile_btn", onClickProfile, this);
childSetAction("offer_teleport_btn", onClickOfferTeleport, this);
childSetAction("pay_btn", onClickPay, this);
childSetAction("add_btn", onClickAddFriend, this);
childSetAction("remove_btn", onClickRemove, this);
childSetAction("export_btn", onClickExport, this);
childSetAction("import_btn", onClickImport, this);
//childSetAction("export_btn", onClickExport, this); Making Dummy View -HgB
//childSetAction("import_btn", onClickImport, this); Making Dummy View -HgB
setDefaultBtn("im_btn");
@@ -402,6 +403,8 @@ BOOL LLPanelFriends::postBuild()
mFriendsList->sortByColumn(std::string("friend_name"), TRUE);
mFriendsList->sortByColumn(std::string("icon_online_status"), FALSE);
updateColumns(this);
return TRUE;
}
@@ -551,7 +554,7 @@ void LLPanelFriends::refreshRightsChangeList()
bool can_offer_teleport = num_selected >= 1;
bool selected_friends_online = true;
LLTextBox* processing_label = getChild<LLTextBox>("process_rights_label");
/*LLTextBox* processing_label = getChild<LLTextBox>("process_rights_label");
if(!mAllowRightsChange)
{
@@ -566,7 +569,7 @@ void LLPanelFriends::refreshRightsChangeList()
else if(processing_label)
{
processing_label->setVisible(false);
}
} Making Dummy View -HgB */
const LLRelationship* friend_status = NULL;
for(LLDynamicArray<LLUUID>::iterator itr = friends.begin(); itr != friends.end(); ++itr)
{
@@ -602,7 +605,7 @@ void LLPanelFriends::refreshRightsChangeList()
// to be consistent with context menus in inventory and because otherwise
// offline friends would be silently dropped from the session
childSetEnabled("im_btn", selected_friends_online || num_selected == 1);
childSetEnabled("assign_btn", TRUE);
childSetEnabled("assign_btn", num_selected == 1);
childSetEnabled("offer_teleport_btn", can_offer_teleport);
}
}
@@ -727,29 +730,20 @@ void LLPanelFriends::refreshUI()
single_selected = TRUE;
if(num_selected > 1)
{
childSetText("friend_name_label", getString("Multiple"));
multiple_selected = TRUE;
}
else
{
childSetText("friend_name_label", mFriendsList->getFirstSelected()->getColumn(LIST_FRIEND_NAME)->getValue().asString() + "...");
}
}
else
{
childSetText("friend_name_label", LLStringUtil::null);
}
//Options that can only be performed with one friend selected
childSetEnabled("profile_btn", single_selected && !multiple_selected);
childSetEnabled("pay_btn", single_selected && !multiple_selected);
childSetEnabled("assign_btn", single_selected && !multiple_selected);
//Options that can be performed with up to MAX_FRIEND_SELECT friends selected
//(single_selected will always be true in this situations)
childSetEnabled("remove_btn", single_selected);
childSetEnabled("im_btn", single_selected);
childSetEnabled("assign_btn", single_selected);
childSetEnabled("friend_rights", single_selected);
//childSetEnabled("friend_rights", single_selected); Making Dummy View -HgB
refreshRightsChangeList();
}
@@ -814,6 +808,47 @@ void LLPanelFriends::onClickAssign(void* user_data)
}
}
// static
void LLPanelFriends::onClickExpand(void* user_data)
{
BOOL collapsed = gSavedSettings.getBOOL("ContactListCollapsed");
gSavedSettings.setBOOL("ContactListCollapsed", !collapsed);
updateColumns(user_data);
}
void LLPanelFriends::updateColumns(void* user_data)
{
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
if (panelp)
{
LLButton* expand_button = panelp->getChild<LLButton>("expand_collapse_btn");
LLScrollListCtrl* list = panelp->getChild<LLScrollListCtrl>("friend_list");
//llinfos << "Refreshing UI" << llendl;
S32 width = 22;
std::string button = ">";
if (gSavedSettings.getBOOL("ContactListCollapsed"))
{
width = 0;
button = "<";
}
expand_button->setLabel(button);
LLScrollListColumn* column = list->getColumn(5);
list->updateStaticColumnWidth(column, width);
column->setWidth(width);
column = list->getColumn(6);
list->updateStaticColumnWidth(column, width);
column->setWidth(width);
column = list->getColumn(7);
list->updateStaticColumnWidth(column, width);
column->setWidth(width);
list->updateLayout();
if (!gSavedSettings.getBOOL("ContactListCollapsed"))
{
panelp->updateFriends(LLFriendObserver::ADD);
}
}
}
void LLPanelFriends::onClickIM(void* user_data)
{
LLPanelFriends* panelp = (LLPanelFriends*)user_data;

View File

@@ -138,6 +138,8 @@ private:
static void onContactSearchKeystroke(LLLineEditor* caller, void* user_data);
static void onClickIM(void* user_data);
static void onClickAssign(void* user_data);
static void onClickExpand(void* user_data);
static void updateColumns(void* user_data);
static void onClickProfile(void* user_data);
static void onClickAddFriend(void* user_data);
static void onClickRemove(void* user_data);

View File

@@ -4,53 +4,35 @@
<!-- Floaters can optionally have their titlebar drag handle on the left.
If so, the title is not visible.
When a floater is resizable, a min_width and min_height must be specified. -->
<floater
name="floater_contact_groups"
title="Manage Contact Groups"
rect_control="FloaterContactRect"
can_resize="true"
can_minimize="false"
can_close="true"
can_drag_on_left="false"
width="335"
height="275"
min_width="335"
min_height="275"
>
<tab_container bottom="30" follows="left|right|top|bottom" height="220" left="4"
name="ContactTabs" tab_position="top" tab_width="65" width="330">
<panel name="AddPanel" label="Add Contact"
border="true" bottom_delta="-10" height="150" left="6" width="135"
mouse_opaque="true">
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-24" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="10"
mouse_opaque="true" name="InstructManageContacts" v_pad="0"
width="240">
Create a new group or select an existing one:
</text>
<line_editor bevel_style="in" border_style="line"
border_thickness="1" bottom_delta="-20" enabled="true" follows="left|top|right"
font="SansSerifSmall" height="16" left="10" right="-120"
max_length="254" mouse_opaque="true" name="add_group_lineedit"
width="112" />
<button bottom_delta="-3" follows="top|right" font="SansSerif" halign="center"
height="20" label="Create" label_selected="Create" left_delta="20" right="-10"
mouse_opaque="true" name="Create" scale_image="TRUE" width="90" />
<button bottom_delta="-25" follows="top|right" font="SansSerif" halign="center"
height="20" label="Delete" label_selected="Delete" right="-15"
mouse_opaque="true" name="Delete" scale_image="TRUE" width="90" />
<scroll_list background_visible="true" bottom_delta="-125" column_padding="5"
draw_border="true" draw_heading="false" draw_stripes="true"
follows="left|top|right" height="120" left="10" mouse_opaque="true"
multi_select="false" name="group_scroll_list" width="115" />
</panel>
</tab_container>
<button bottom="6" left="10" follows="left|bottom" font="SansSerif" halign="center"
width="95" height="20" label="Save" label_selected="Save" mouse_opaque="true"
name="Save" scale_image="TRUE" />
<button bottom_delta="0" right="240" follows="left|bottom" font="SansSerif" halign="center"
width="95" height="20" label="Cancel" label_selected="Cancel" mouse_opaque="true"
name="Cancel" scale_image="TRUE" />
<floater name="floater_contact_groups" title="Manage Contact Groups" rect_control="FloaterContactRect"
can_resize="true" can_minimize="false" can_close="true" can_drag_on_left="false" width="335"
height="275" min_width="260" min_height="275">
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-35" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="10"
mouse_opaque="true" name="InstructManageContacts" v_pad="0"
width="240">
Select a group (Or press New to create one):
</text>
<combo_box allow_text_entry="true" enabled="true" follows="left|top|right"
bottom_delta="-20" height="18" hidden="false" left="10" right="-96" max_chars="20" mouse_opaque="true"
tool_tip="Buddy group" name="buddy_group_combobox" width="200">
<combo_item type="string" length="20" enabled="true" name="All" value="All">
All
</combo_item>
</combo_box>
<button follows="top|right" bottom_delta="-1" height="20" label="+" right="-71" name="combo_group_add" width="21" />
<button follows="top|right" bottom_delta="0" height="20" label="-" left_delta="22" name="combo_group_remove" width="21" />
<button follows="top|right" bottom_delta="0" height="20" label="New" left_delta="22" name="combo_group_create" width="40" />
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-18" drop_shadow_visible="true" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="10"
mouse_opaque="true" name="contact_list_text" v_pad="0"
width="240">
Currently in:
</text>
<scroll_list background_visible="true" bottom="15" column_padding="5"
draw_border="true" draw_heading="false" draw_stripes="true"
follows="left|top|right|bottom" left="10" right="-10" mouse_opaque="true"
multi_select="false" name="group_scroll_list" top="-75" />
</floater>