From ab246784b069913363e544ab3c9a9fb615e0c71d Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Tue, 13 Apr 2010 13:32:39 +0300
Subject: Fixed normal bug EXT-6034 (Need "View People Icons" option for group
 IM window) - added new menu item to participant list menu for group and
 ad-hoc chats. Reviewed by Mike Antipov at
 https://codereview.productengine.com/secondlife/r/225/.

--HG--
branch : product-engine
---
 indra/newview/app_settings/settings.xml                 | 11 +++++++++++
 indra/newview/llcallfloater.cpp                         |  2 +-
 indra/newview/llparticipantlist.cpp                     | 12 +++++++++++-
 indra/newview/llparticipantlist.h                       |  3 ++-
 .../skins/default/xui/en/menu_participant_list.xml      | 17 +++++++++++++++--
 5 files changed, 40 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 00c29477ce..2dda853f73 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5395,6 +5395,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>ParticipantListShowIcons</key>
+    <map>
+      <key>Comment</key>
+      <string>Show/hide people icons in participant list</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>PerAccountSettingsFile</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 0b58c8f476..d15c5f9bf4 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -334,7 +334,7 @@ void LLCallFloater::refreshParticipantList()
 
 	if (!non_avatar_caller)
 	{
-		mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT);
+		mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT, false);
 		mParticipants->setValidateSpeakerCallback(boost::bind(&LLCallFloater::validateSpeaker, this, _1));
 		mParticipants->setSortOrder(LLParticipantList::E_SORT_BY_RECENT_SPEAKERS);
 
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index dbb8e962bd..026be882ed 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -39,6 +39,7 @@
 
 #include "llparticipantlist.h"
 #include "llspeakers.h"
+#include "llviewercontrol.h"
 #include "llviewermenu.h"
 #include "llvoiceclient.h"
 
@@ -50,7 +51,7 @@
 static const LLAvatarItemAgentOnTopComparator AGENT_ON_TOP_NAME_COMPARATOR;
 
 LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list,  bool use_context_menu/* = true*/,
-		bool exclude_agent /*= true*/):
+		bool exclude_agent /*= true*/, bool can_toggle_icons /*= true*/):
 	mSpeakerMgr(data_source),
 	mAvatarList(avatar_list),
 	mSortOrder(E_SORT_BY_NAME)
@@ -87,6 +88,12 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av
 		mAvatarList->setContextMenu(NULL);
 	}
 
+	if (use_context_menu && can_toggle_icons)
+	{
+		mAvatarList->setShowIcons("ParticipantListShowIcons");
+		mAvatarListToggleIconsConnection = gSavedSettings.getControl("ParticipantListShowIcons")->getSignal()->connect(boost::bind(&LLAvatarList::toggleIcons, mAvatarList));
+	}
+
 	//Lets fill avatarList with existing speakers
 	LLSpeakerMgr::speaker_list_t speaker_list;
 	mSpeakerMgr->getSpeakerList(&speaker_list, true);
@@ -113,6 +120,7 @@ LLParticipantList::~LLParticipantList()
 	mAvatarListDoubleClickConnection.disconnect();
 	mAvatarListRefreshConnection.disconnect();
 	mAvatarListReturnConnection.disconnect();
+	mAvatarListToggleIconsConnection.disconnect();
 
 	// It is possible Participant List will be re-created from LLCallFloater::onCurrentChannelChanged()
 	// See ticket EXT-3427
@@ -440,6 +448,8 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu()
 	main_menu->setItemVisible("SortByName", is_sort_visible);
 	main_menu->setItemVisible("SortByRecentSpeakers", is_sort_visible);
 	main_menu->setItemVisible("Moderator Options", isGroupModerator());
+	main_menu->setItemVisible("View Icons Separator", mParent.mAvatarListToggleIconsConnection.connected());
+	main_menu->setItemVisible("View Icons", mParent.mAvatarListToggleIconsConnection.connected());
 	main_menu->arrangeAndClear();
 
 	return main_menu;
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index d9ca4230a9..953dff4551 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -46,7 +46,7 @@ class LLParticipantList
 
 		typedef boost::function<bool (const LLUUID& speaker_id)> validate_speaker_callback_t;
 
-		LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true);
+		LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true, bool can_toggle_icons = true);
 		~LLParticipantList();
 		void setSpeakingIndicatorsVisible(BOOL visible);
 
@@ -268,6 +268,7 @@ class LLParticipantList
 		boost::signals2::connection mAvatarListDoubleClickConnection;
 		boost::signals2::connection mAvatarListRefreshConnection;
 		boost::signals2::connection mAvatarListReturnConnection;
+		boost::signals2::connection mAvatarListToggleIconsConnection;
 
 		LLPointer<LLAvatarItemRecentSpeakerComparator> mSortByRecentSpeakers;
 		validate_speaker_callback_t mValidateSpeakerCallback;
diff --git a/indra/newview/skins/default/xui/en/menu_participant_list.xml b/indra/newview/skins/default/xui/en/menu_participant_list.xml
index d03a7e3d41..59c7f4ed85 100644
--- a/indra/newview/skins/default/xui/en/menu_participant_list.xml
+++ b/indra/newview/skins/default/xui/en/menu_participant_list.xml
@@ -82,8 +82,21 @@
          function="ParticipantList.EnableItem"
          parameter="can_pay" />
     </menu_item_call>
-        <menu_item_separator
-         layout="topleft" />
+    <menu_item_separator
+        layout="topleft"
+        name="View Icons Separator" />
+    <menu_item_check
+        label="View People Icons"
+        name="View Icons">
+      <on_click
+          function="ToggleControl"
+          parameter="ParticipantListShowIcons"/>
+      <on_check
+          function="CheckControl"
+          parameter="ParticipantListShowIcons" />
+    </menu_item_check>
+    <menu_item_separator
+        layout="topleft" />
     <menu_item_check
      label="Block Voice"
      layout="topleft"
-- 
cgit v1.2.3