diff options
| -rw-r--r-- | indra/newview/llblocklist.cpp | 82 | ||||
| -rw-r--r-- | indra/newview/llblocklist.h | 3 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_people_blocked_gear.xml | 74 | 
3 files changed, 157 insertions, 2 deletions
| diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 272a68bdf7..08d6db4ceb 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -55,7 +55,9 @@ LLBlockList::LLBlockList(const Params& p)  	registrar.add		("Block.Action",	boost::bind(&LLBlockList::onCustomAction,	this, _2));  	enable_registrar.add("Block.Enable",	boost::bind(&LLBlockList::isActionEnabled,	this, _2)); - +	enable_registrar.add("Block.Check",     boost::bind(&LLBlockList::isMenuItemChecked, this, _2)); +	enable_registrar.add("Block.Visible",   boost::bind(&LLBlockList::isMenuItemVisible, this, _2)); +	  	LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(  									"menu_people_blocked_gear.xml",  									gMenuHolder, @@ -272,7 +274,11 @@ bool LLBlockList::isActionEnabled(const LLSD& userdata)  	const std::string command_name = userdata.asString(); -	if ("profile_item" == command_name) +	if ("profile_item" == command_name  +		|| "block_voice" == command_name +		|| "block_text" == command_name +		|| "block_particles" == command_name +		|| "block_obj_sounds" == command_name)  	{  		LLBlockedListItem* item = getBlockedItem();  		action_enabled = item && (LLMute::AGENT == item->getType()); @@ -314,6 +320,78 @@ void LLBlockList::onCustomAction(const LLSD& userdata)  			break;  		}  	} +	else if ("block_voice" == command_name) +	{ +		toggleMute(LLMute::flagVoiceChat); +	} +	else if ("block_text" == command_name) +	{ +		toggleMute(LLMute::flagTextChat); +	} +	else if ("block_particles" == command_name) +	{ +		toggleMute(LLMute::flagParticles); +	} +	else if ("block_obj_sounds" == command_name) +	{ +		toggleMute(LLMute::flagObjectSounds); +	} +} + +bool LLBlockList::isMenuItemChecked(const LLSD& userdata) +{ +	LLBlockedListItem* item = getBlockedItem(); +	const std::string command_name = userdata.asString(); + +	if ("block_voice" == command_name) +	{ +		return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagVoiceChat); +	} +	else if ("block_text" == command_name) +	{ +		return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagTextChat); +	} +	else if ("block_particles" == command_name) +	{ +		return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagParticles); +	} +	else if ("block_obj_sounds" == command_name) +	{ +		return LLMuteList::getInstance()->isMuted(item->getUUID(), LLMute::flagObjectSounds); +	} + +	return false; +} + +bool LLBlockList::isMenuItemVisible(const LLSD& userdata) +{ +	LLBlockedListItem* item = getBlockedItem(); +	const std::string command_name = userdata.asString(); + +	if ("block_voice" == command_name +		|| "block_text" == command_name +		|| "block_particles" == command_name +		|| "block_obj_sounds" == command_name) +	{ +		return item && (LLMute::AGENT == item->getType()); +	} + +	return false; +} + +void LLBlockList::toggleMute(U32 flags) +{ +	LLBlockedListItem* item = getBlockedItem(); +	LLMute mute(item->getUUID(), item->getName(), item->getType()); + +	if (!LLMuteList::getInstance()->isMuted(item->getUUID(), flags)) +	{ +		LLMuteList::getInstance()->add(mute, flags); +	} +	else +	{ +		LLMuteList::getInstance()->remove(mute, flags); +	}  }  bool LLBlockListItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const diff --git a/indra/newview/llblocklist.h b/indra/newview/llblocklist.h index 96af8d898e..ac0729c610 100644 --- a/indra/newview/llblocklist.h +++ b/indra/newview/llblocklist.h @@ -79,6 +79,9 @@ private:  	bool isActionEnabled(const LLSD& userdata);  	void onCustomAction (const LLSD& userdata); +	bool isMenuItemChecked(const LLSD& userdata); +	bool isMenuItemVisible(const LLSD& userdata); +	void toggleMute(U32 flags);  	void createList();  	BlockListActionType getCurrentMuteListActionType(); diff --git a/indra/newview/skins/default/xui/en/menu_people_blocked_gear.xml b/indra/newview/skins/default/xui/en/menu_people_blocked_gear.xml index 63295ea27b..01ca38f51a 100644 --- a/indra/newview/skins/default/xui/en/menu_people_blocked_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_people_blocked_gear.xml @@ -13,6 +13,80 @@         function="Block.Enable"         parameter="unblock_item" />     </menu_item_call> + +  <menu_item_check +   label="Block Voice" +   layout="topleft" +   name="BlockVoice"> +      <on_check +       function="Block.Check" +       parameter="block_voice" /> +      <on_click +       function="Block.Action" +       parameter="block_voice" /> +      <on_enable +       function="Block.Enable" +       parameter="block_voice" /> +      <on_visible +       function="Block.Visible" +       parameter="block_voice" /> +  </menu_item_check> + +  <menu_item_check +   label="Block Text" +   layout="topleft" +   name="MuteText"> +      <on_check +       function="Block.Check" +       parameter="block_text" /> +      <on_click +       function="Block.Action" +       parameter="block_text" /> +     <on_enable +       function="Block.Enable" +       parameter="block_text" /> +     <on_visible +       function="Block.Visible" +       parameter="block_text" /> +  </menu_item_check> + +  <menu_item_check +   label="Block Particles" +   layout="topleft" +   name="MuteText"> +      <on_check +       function="Block.Check" +       parameter="block_particles" /> +      <on_click +       function="Block.Action"  +       parameter="block_particles" /> +      <on_enable +       function="Block.Enable" +       parameter="block_particles" /> +      <on_visible +       function="Block.Visible" +       parameter="block_particles" /> +  </menu_item_check> + +  <menu_item_check +   label="Block Object Sounds" +   layout="topleft" +   name="BlockObjectSounds"> +      <on_check +       function="Block.Check" +       parameter="block_obj_sounds" /> +      <on_click +       function="Block.Action" +       parameter="block_obj_sounds" /> +      <on_enable +       function="Block.Enable" +       parameter="block_obj_sounds" /> +      <on_visible +       function="Block.Visible" +       parameter="block_obj_sounds" /> +  </menu_item_check> + +  <menu_item_separator />    <menu_item_call     label="Profile..."     name="profile"> | 
