diff options
author | McCabe Maxsted | 2010-09-16 06:08:15 -0700 |
---|---|---|
committer | McCabe Maxsted | 2010-09-16 22:17:46 -0700 |
commit | 162cf8240158d2d487d014bdac77f58a8c75595f (patch) | |
tree | 3cf3d15c7dafd7716e02bc4bf3ef0763e74bf843 /linden/indra | |
parent | Fixed up the logic for the Hide Misspellings/Show Misspellings menu options. ... (diff) | |
download | meta-impy-162cf8240158d2d487d014bdac77f58a8c75595f.zip meta-impy-162cf8240158d2d487d014bdac77f58a8c75595f.tar.gz meta-impy-162cf8240158d2d487d014bdac77f58a8c75595f.tar.bz2 meta-impy-162cf8240158d2d487d014bdac77f58a8c75595f.tar.xz |
Added search bars for friends and groups lists, based on a feature in the Ascent viewer by Charley Levenque
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/newview/llcallingcard.cpp | 5 | ||||
-rw-r--r-- | linden/indra/newview/llcallingcard.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/llfloaterfriends.cpp | 52 | ||||
-rw-r--r-- | linden/indra/newview/llfloaterfriends.h | 4 | ||||
-rw-r--r-- | linden/indra/newview/llfloatergroups.cpp | 52 | ||||
-rw-r--r-- | linden/indra/newview/llfloatergroups.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/panel_friends.xml | 39 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/panel_groups.xml | 7 |
8 files changed, 142 insertions, 23 deletions
diff --git a/linden/indra/newview/llcallingcard.cpp b/linden/indra/newview/llcallingcard.cpp index db28c7a..155fb60 100644 --- a/linden/indra/newview/llcallingcard.cpp +++ b/linden/indra/newview/llcallingcard.cpp | |||
@@ -357,6 +357,11 @@ void LLAvatarTracker::setBuddyOnline(const LLUUID& id, bool is_online) | |||
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | S32 LLAvatarTracker::getBuddyCount() | ||
361 | { | ||
362 | return mBuddyInfo.size(); | ||
363 | } | ||
364 | |||
360 | bool LLAvatarTracker::isBuddyOnline(const LLUUID& id) const | 365 | bool LLAvatarTracker::isBuddyOnline(const LLUUID& id) const |
361 | { | 366 | { |
362 | LLRelationship* info = get_ptr_in_map(mBuddyInfo, id); | 367 | LLRelationship* info = get_ptr_in_map(mBuddyInfo, id); |
diff --git a/linden/indra/newview/llcallingcard.h b/linden/indra/newview/llcallingcard.h index 85a1ab6..0db5376 100644 --- a/linden/indra/newview/llcallingcard.h +++ b/linden/indra/newview/llcallingcard.h | |||
@@ -129,6 +129,9 @@ public: | |||
129 | void setBuddyOnline(const LLUUID& id, bool is_online); | 129 | void setBuddyOnline(const LLUUID& id, bool is_online); |
130 | bool isBuddyOnline(const LLUUID& id) const; | 130 | bool isBuddyOnline(const LLUUID& id) const; |
131 | 131 | ||
132 | // get count of buddies | ||
133 | S32 getBuddyCount(); | ||
134 | |||
132 | // simple empowered status | 135 | // simple empowered status |
133 | void setBuddyEmpowered(const LLUUID& id, bool is_empowered); | 136 | void setBuddyEmpowered(const LLUUID& id, bool is_empowered); |
134 | bool isBuddyEmpowered(const LLUUID& id) const; | 137 | bool isBuddyEmpowered(const LLUUID& id) const; |
diff --git a/linden/indra/newview/llfloaterfriends.cpp b/linden/indra/newview/llfloaterfriends.cpp index e18e705..479da89 100644 --- a/linden/indra/newview/llfloaterfriends.cpp +++ b/linden/indra/newview/llfloaterfriends.cpp | |||
@@ -183,6 +183,52 @@ void LLPanelFriends::updateFriends(U32 changed_mask) | |||
183 | mShowMaxSelectWarning = true; | 183 | mShowMaxSelectWarning = true; |
184 | } | 184 | } |
185 | 185 | ||
186 | void LLPanelFriends::filterContacts(const std::string& search_string) | ||
187 | { | ||
188 | std::string search = search_string; | ||
189 | LLStringUtil::toLower(search); | ||
190 | |||
191 | if (search.empty()) | ||
192 | { | ||
193 | // repopulate | ||
194 | refreshNames(LLFriendObserver::ADD); | ||
195 | } | ||
196 | else | ||
197 | { | ||
198 | // just in case someone else emptied us, tsk | ||
199 | if (mFriendsList->isEmpty() && LLAvatarTracker::instance().getBuddyCount() > 0) | ||
200 | { | ||
201 | refreshNames(LLFriendObserver::ADD); | ||
202 | } | ||
203 | |||
204 | // don't worry about maintaining selection since we're searching | ||
205 | std::vector<LLScrollListItem*> vFriends(mFriendsList->getAllData()); | ||
206 | |||
207 | // this should really REALLY use deleteAllItems() to rebuild the list instead | ||
208 | std::string friend_name; | ||
209 | for (std::vector<LLScrollListItem*>::iterator itr = vFriends.begin(); itr != vFriends.end(); ++itr) | ||
210 | { | ||
211 | friend_name = (*itr)->getColumn(LIST_FRIEND_NAME)->getValue().asString(); | ||
212 | LLStringUtil::toLower(friend_name); | ||
213 | BOOL show_entry = (friend_name.find(search) != std::string::npos); | ||
214 | if (!show_entry) | ||
215 | { | ||
216 | mFriendsList->deleteItems((*itr)->getValue()); | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | refreshUI(); | ||
221 | } | ||
222 | |||
223 | void LLPanelFriends::onContactSearchKeystroke(const std::string& search_string, void* user_data) | ||
224 | { | ||
225 | LLPanelFriends* panelp = (LLPanelFriends*)user_data; | ||
226 | if (panelp) | ||
227 | { | ||
228 | panelp->filterContacts(search_string); | ||
229 | } | ||
230 | } | ||
231 | |||
186 | // virtual | 232 | // virtual |
187 | BOOL LLPanelFriends::postBuild() | 233 | BOOL LLPanelFriends::postBuild() |
188 | { | 234 | { |
@@ -193,6 +239,12 @@ BOOL LLPanelFriends::postBuild() | |||
193 | childSetCommitCallback("friend_list", onSelectName, this); | 239 | childSetCommitCallback("friend_list", onSelectName, this); |
194 | childSetDoubleClickCallback("friend_list", onClickIM); | 240 | childSetDoubleClickCallback("friend_list", onClickIM); |
195 | 241 | ||
242 | LLSearchEditor* buddy_search = getChild<LLSearchEditor>("buddy_search"); | ||
243 | if (buddy_search) | ||
244 | { | ||
245 | buddy_search->setSearchCallback(&onContactSearchKeystroke, this); | ||
246 | } | ||
247 | |||
196 | U32 changed_mask = LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE; | 248 | U32 changed_mask = LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE; |
197 | refreshNames(changed_mask); | 249 | refreshNames(changed_mask); |
198 | 250 | ||
diff --git a/linden/indra/newview/llfloaterfriends.h b/linden/indra/newview/llfloaterfriends.h index f7f0b32..9a1feba 100644 --- a/linden/indra/newview/llfloaterfriends.h +++ b/linden/indra/newview/llfloaterfriends.h | |||
@@ -101,6 +101,8 @@ private: | |||
101 | // protected members | 101 | // protected members |
102 | typedef std::map<LLUUID, S32> rights_map_t; | 102 | typedef std::map<LLUUID, S32> rights_map_t; |
103 | void refreshNames(U32 changed_mask); | 103 | void refreshNames(U32 changed_mask); |
104 | void filterContacts(const std::string& search_string); | ||
105 | |||
104 | BOOL refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies); | 106 | BOOL refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies); |
105 | BOOL refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies); | 107 | BOOL refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies); |
106 | void refreshUI(); | 108 | void refreshUI(); |
@@ -126,7 +128,7 @@ private: | |||
126 | static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); | 128 | static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); |
127 | static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data); | 129 | static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data); |
128 | static void onMaximumSelect(void* user_data); | 130 | static void onMaximumSelect(void* user_data); |
129 | 131 | static void onContactSearchKeystroke(const std::string& search_string, void* user_data); | |
130 | static void onClickIM(void* user_data); | 132 | static void onClickIM(void* user_data); |
131 | static void onClickProfile(void* user_data); | 133 | static void onClickProfile(void* user_data); |
132 | static void onClickAddFriend(void* user_data); | 134 | static void onClickAddFriend(void* user_data); |
diff --git a/linden/indra/newview/llfloatergroups.cpp b/linden/indra/newview/llfloatergroups.cpp index daf1709..b3fbb1b 100644 --- a/linden/indra/newview/llfloatergroups.cpp +++ b/linden/indra/newview/llfloatergroups.cpp | |||
@@ -214,6 +214,12 @@ BOOL LLPanelGroups::postBuild() | |||
214 | { | 214 | { |
215 | childSetCommitCallback("group list", onGroupList, this); | 215 | childSetCommitCallback("group list", onGroupList, this); |
216 | 216 | ||
217 | LLSearchEditor* group_search = getChild<LLSearchEditor>("group_search"); | ||
218 | if (group_search) | ||
219 | { | ||
220 | group_search->setSearchCallback(&onGroupSearchKeystroke, this); | ||
221 | } | ||
222 | |||
217 | childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count())); | 223 | childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count())); |
218 | childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups())); | 224 | childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups())); |
219 | 225 | ||
@@ -379,7 +385,7 @@ void LLPanelGroups::info() | |||
379 | 385 | ||
380 | void LLPanelGroups::startIM() | 386 | void LLPanelGroups::startIM() |
381 | { | 387 | { |
382 | //llinfos << "LLPanelFriends::onClickIM()" << llendl; | 388 | //llinfos << "LLPanelGroups::onClickIM()" << llendl; |
383 | LLCtrlListInterface *group_list = childGetListInterface("group list"); | 389 | LLCtrlListInterface *group_list = childGetListInterface("group list"); |
384 | LLUUID group_id; | 390 | LLUUID group_id; |
385 | 391 | ||
@@ -612,3 +618,47 @@ void LLPanelGroups::applyChangesToGroups() | |||
612 | } | 618 | } |
613 | } | 619 | } |
614 | } | 620 | } |
621 | |||
622 | void LLPanelGroups::filterContacts(const std::string& search_string) | ||
623 | { | ||
624 | std::string search = search_string; | ||
625 | LLStringUtil::toLower(search); | ||
626 | |||
627 | if (search.empty()) | ||
628 | { | ||
629 | // repopulate | ||
630 | reset(); | ||
631 | } | ||
632 | else | ||
633 | { | ||
634 | LLScrollListCtrl* group_list = getChild<LLScrollListCtrl>("group list"); | ||
635 | if (group_list) | ||
636 | { | ||
637 | // don't worry about maintaining selection since we're searching | ||
638 | std::vector<LLScrollListItem*> vGroups(group_list->getAllData()); | ||
639 | |||
640 | // this should really REALLY use deleteAllItems() to rebuild the list instead | ||
641 | std::string group_name; | ||
642 | for (std::vector<LLScrollListItem*>::iterator itr = vGroups.begin(); itr != vGroups.end(); ++itr) | ||
643 | { | ||
644 | group_name = (*itr)->getColumn(0)->getValue().asString(); | ||
645 | LLStringUtil::toLower(group_name); | ||
646 | BOOL show_entry = (group_name.find(search) != std::string::npos); | ||
647 | if (!show_entry) | ||
648 | { | ||
649 | group_list->deleteItems((*itr)->getValue()); | ||
650 | } | ||
651 | } | ||
652 | enableButtons(); | ||
653 | } | ||
654 | } | ||
655 | } | ||
656 | |||
657 | void LLPanelGroups::onGroupSearchKeystroke(const std::string& search_string, void* user_data) | ||
658 | { | ||
659 | LLPanelGroups* panelp = (LLPanelGroups*)user_data; | ||
660 | if (panelp) | ||
661 | { | ||
662 | panelp->filterContacts(search_string); | ||
663 | } | ||
664 | } | ||
diff --git a/linden/indra/newview/llfloatergroups.h b/linden/indra/newview/llfloatergroups.h index 91021f0..5dc7ad8 100644 --- a/linden/indra/newview/llfloatergroups.h +++ b/linden/indra/newview/llfloatergroups.h | |||
@@ -115,6 +115,7 @@ protected: | |||
115 | static void onBtnInvite(void* userdata); | 115 | static void onBtnInvite(void* userdata); |
116 | static void onBtnTitles(void* userdata); | 116 | static void onBtnTitles(void* userdata); |
117 | static void onDoubleClickGroup(void* userdata); | 117 | static void onDoubleClickGroup(void* userdata); |
118 | static void onGroupSearchKeystroke(const std::string& search_string, void* user_data); | ||
118 | 119 | ||
119 | void create(); | 120 | void create(); |
120 | void activate(); | 121 | void activate(); |
@@ -125,9 +126,9 @@ protected: | |||
125 | void callVote(); | 126 | void callVote(); |
126 | void invite(); | 127 | void invite(); |
127 | void titles(); | 128 | void titles(); |
129 | void filterContacts(const std::string& search_string); | ||
128 | 130 | ||
129 | static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response); | 131 | static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response); |
130 | |||
131 | }; | 132 | }; |
132 | 133 | ||
133 | 134 | ||
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_friends.xml b/linden/indra/newview/skins/default/xui/en-us/panel_friends.xml index 0854c99..a64560f 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_friends.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_friends.xml | |||
@@ -3,43 +3,46 @@ | |||
3 | <string name="Multiple"> | 3 | <string name="Multiple"> |
4 | Multiple friends... | 4 | Multiple friends... |
5 | </string> | 5 | </string> |
6 | <scroll_list bottom="10" can_resize="true" column_padding="0" draw_heading="true" | 6 | <scroll_list bottom="10" can_resize="true" column_padding="0" draw_heading="true" |
7 | follows="left|top|bottom|right" left="10" multi_select="true" | 7 | follows="left|top|bottom|right" left="10" multi_select="true" |
8 | name="friend_list" right="-100" search_column="1" | 8 | name="friend_list" right="-100" search_column="1" |
9 | tool_tip="Hold shift or control while clicking to select multiple friends" | 9 | tool_tip="Hold shift or control while clicking to select multiple friends" |
10 | top="-10"> | 10 | top="-30"> |
11 | <column image="ff_online_status_button.tga" name="icon_online_status" | 11 | <column image="ff_online_status_button.tga" name="icon_online_status" |
12 | tool_tip="Online status" width="20" /> | 12 | tool_tip="Online status" width="20" /> |
13 | <column dynamicwidth="true" label="Name" name="friend_name" tool_tip="Name" /> | 13 | <column dynamicwidth="true" label="Name" name="friend_name" tool_tip="Name" /> |
14 | <column image="ff_visible_online_button.tga" name="icon_visible_online" | 14 | <column image="ff_visible_online_button.tga" name="icon_visible_online" |
15 | tool_tip="Friend can see when you're online" width="20" /> | 15 | tool_tip="Friend can see when you're online" width="20" /> |
16 | <column image="ff_visible_map_button.tga" name="icon_visible_map" | 16 | <column image="ff_visible_map_button.tga" name="icon_visible_map" |
17 | tool_tip="Friend can locate you on the map" width="20" /> | 17 | tool_tip="Friend can locate you on the map" width="20" /> |
18 | <column image="ff_edit_mine_button.tga" name="icon_edit_mine" | 18 | <column image="ff_edit_mine_button.tga" name="icon_edit_mine" |
19 | tool_tip="Friend can edit, delete or take objects" width="20" /> | 19 | tool_tip="Friend can edit, delete or take objects" width="20" /> |
20 | <column image="ff_visible_map_button.tga" name="icon_visible_map_theirs" | 20 | <column image="ff_visible_map_button.tga" name="icon_visible_map_theirs" |
21 | tool_tip="You can locate this friend on the map" width="20" /> | 21 | tool_tip="You can locate this friend on the map" width="20" /> |
22 | <column image="ff_edit_theirs_button.tga" name="icon_edit_theirs" | 22 | <column image="ff_edit_theirs_button.tga" name="icon_edit_theirs" |
23 | tool_tip="You can edit this friend's objects" width="20" /> | 23 | tool_tip="You can edit this friend's objects" width="20" /> |
24 | <column name="friend_last_update_generation" width="0" /> | 24 | <column name="friend_last_update_generation" width="0" /> |
25 | </scroll_list> | 25 | </scroll_list> |
26 | <pad bottom="-7" height="0" left="-90" width="1" /> | 26 | <pad bottom="-7" height="0" left="-90" width="1" /> |
27 | <button bottom_delta="-25" follows="top|right" height="22" label="IM/Call" | 27 | <button bottom_delta="-45" follows="top|right" height="22" label="IM/Call" |
28 | left_delta="0" name="im_btn" tool_tip="Open Instant Message session" | 28 | left_delta="0" name="im_btn" tool_tip="Open Instant Message session" |
29 | width="80" /> | 29 | width="80" /> |
30 | <button bottom_delta="-25" follows="top|right" height="22" label="Profile" | 30 | <button bottom_delta="-25" follows="top|right" height="22" label="Profile" |
31 | left_delta="0" name="profile_btn" | 31 | left_delta="0" name="profile_btn" |
32 | tool_tip="Show picture, groups, and other information" width="80" /> | 32 | tool_tip="Show picture, groups, and other information" width="80" /> |
33 | <button bottom_delta="-25" follows="top|right" height="22" label="Teleport..." | 33 | <button bottom_delta="-25" follows="top|right" height="22" label="Teleport..." |
34 | left_delta="0" name="offer_teleport_btn" | 34 | left_delta="0" name="offer_teleport_btn" |
35 | tool_tip="Offer this friend a teleport to your current location" width="80" /> | 35 | tool_tip="Offer this friend a teleport to your current location" width="80" /> |
36 | <button bottom_delta="-25" follows="top|right" height="22" label="Pay..." | 36 | <button bottom_delta="-25" follows="top|right" height="22" label="Pay..." |
37 | left_delta="0" name="pay_btn" | 37 | left_delta="0" name="pay_btn" |
38 | tool_tip="Give currency to this friend" width="80" /> | 38 | tool_tip="Give currency to this friend" width="80" /> |
39 | <button bottom_delta="-25" follows="top|right" height="22" label="Remove..." | 39 | <button bottom_delta="-25" follows="top|right" height="22" label="Remove..." |
40 | left_delta="0" name="remove_btn" | 40 | left_delta="0" name="remove_btn" |
41 | tool_tip="Remove this person from your friends list" width="80" /> | 41 | tool_tip="Remove this person from your friends list" width="80" /> |
42 | <button bottom_delta="-35" follows="top|right" height="22" label="Add..." | 42 | <button bottom_delta="-35" follows="top|right" height="22" label="Add..." |
43 | left_delta="0" name="add_btn" tool_tip="Offer friendship to a resident" | 43 | left_delta="0" name="add_btn" tool_tip="Offer friendship to a resident" |
44 | width="80" /> | 44 | width="80" /> |
45 | <search_editor bottom="-24" enabled="true" follows="left|right|top" font="SansSerif" | ||
46 | height="18" left="10" right="-100" name="buddy_search" | ||
47 | label="Type here to search your friends" width="130" /> | ||
45 | </panel> | 48 | </panel> |
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 22967dc..9303852 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 | |||
@@ -4,7 +4,7 @@ | |||
4 | <scroll_list background_visible="true" bottom="45" column_padding="5" draw_border="true" | 4 | <scroll_list background_visible="true" bottom="45" column_padding="5" draw_border="true" |
5 | draw_heading="true" draw_stripes="true" enabled="true" | 5 | draw_heading="true" draw_stripes="true" enabled="true" |
6 | follows="left|top|right|bottom" left="10" mouse_opaque="true" | 6 | follows="left|top|right|bottom" left="10" mouse_opaque="true" |
7 | multi_select="false" name="group list" tab_stop="true" top="-10" | 7 | multi_select="false" name="group list" tab_stop="true" top="-30" |
8 | width="240"> | 8 | width="240"> |
9 | <column label="Group Name" name="name" dynamicwidth="true" /> | 9 | <column label="Group Name" name="name" dynamicwidth="true" /> |
10 | <column label="Notices" name="receive_notices" width="60" | 10 | <column label="Notices" name="receive_notices" width="60" |
@@ -28,7 +28,7 @@ | |||
28 | You belong to [COUNT] groups (of [MAX] maximum). | 28 | You belong to [COUNT] groups (of [MAX] maximum). |
29 | </text> | 29 | </text> |
30 | <pad bottom="-7" height="0" left="-90" width="1" /> | 30 | <pad bottom="-7" height="0" left="-90" width="1" /> |
31 | <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" | 31 | <button bottom_delta="-45" follows="top|right" font="SansSerif" height="22" |
32 | label="IM/Call" left_delta="0" name="IM" | 32 | label="IM/Call" left_delta="0" name="IM" |
33 | tool_tip="Open Instant Message session" width="80" /> | 33 | tool_tip="Open Instant Message session" width="80" /> |
34 | <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" | 34 | <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" |
@@ -45,6 +45,9 @@ | |||
45 | label="Search..." name="Search..." width="80" /> | 45 | label="Search..." name="Search..." width="80" /> |
46 | <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" | 46 | <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" |
47 | label="Leave" name="Leave" width="80" /> | 47 | label="Leave" name="Leave" width="80" /> |
48 | <search_editor bottom="-24" enabled="true" follows="left|right|top" font="SansSerif" | ||
49 | height="18" left="10" right="-100" name="group_search" | ||
50 | label="Type here to search your groups" width="130" /> | ||
48 | <string name="none"> | 51 | <string name="none"> |
49 | none | 52 | none |
50 | </string> | 53 | </string> |