From 7040ae108ef60a17ad683cb0e9f81719a0270e51 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 2 Mar 2017 19:05:09 +0200 Subject: MAINT-7076 Add the ability to see/modify mute types within the block list --- indra/newview/llblocklist.cpp | 82 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 2 deletions(-) (limited to 'indra/newview/llblocklist.cpp') 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( "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 -- cgit v1.2.3 From 7d386378732fb19875e7fb0a3d969d0ba02dc7b3 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 15 Mar 2017 01:24:59 +0200 Subject: MAINT-7206 Fixed crash on doubleclick deselecting last mute type from the context menu --- indra/newview/llblocklist.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llblocklist.cpp') diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 08d6db4ceb..1589db15a5 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -341,6 +341,11 @@ void LLBlockList::onCustomAction(const LLSD& userdata) bool LLBlockList::isMenuItemChecked(const LLSD& userdata) { LLBlockedListItem* item = getBlockedItem(); + if (!item) + { + return false; + } + const std::string command_name = userdata.asString(); if ("block_voice" == command_name) -- cgit v1.2.3 From ae59476522c1d91074df53968b28da182c25381c Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 22 Mar 2017 15:53:17 +0200 Subject: MAINT-7225 Blocks list wasn't updating corretly for name based muting. --- indra/newview/llblocklist.cpp | 53 +++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 17 deletions(-) (limited to 'indra/newview/llblocklist.cpp') diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 1589db15a5..54617169c8 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -130,7 +130,14 @@ BOOL LLBlockList::handleRightMouseDown(S32 x, S32 y, MASK mask) void LLBlockList::removeListItem(const LLMute* mute) { - removeItemByUUID(mute->mID); + if (mute->mID.notNull()) + { + removeItemByUUID(mute->mID); + } + else + { + removeItemByValue(mute->mName); + } } void LLBlockList::hideListItem(LLBlockedListItem* item, bool show) @@ -178,7 +185,14 @@ void LLBlockList::addNewItem(const LLMute* mute) { item->highlightName(mNameFilter); } - addItem(item, item->getUUID(), ADD_BOTTOM); + if (item->getUUID().notNull()) + { + addItem(item, item->getUUID(), ADD_BOTTOM); + } + else + { + addItem(item, item->getName(), ADD_BOTTOM); + } } void LLBlockList::refresh() @@ -186,7 +200,8 @@ void LLBlockList::refresh() bool have_filter = !mNameFilter.empty(); // save selection to restore it after list rebuilt - LLUUID selected = getSelectedUUID(), next_selected; + LLSD selected = getSelectedValue(); + LLSD next_selected; if(mShouldAddAll) // creating list of blockers { @@ -204,14 +219,15 @@ void LLBlockList::refresh() } else if(mActionType == REMOVE) { - if(selected == mute.mID) + if ((mute.mID.notNull() && selected.isUUID() && selected.asUUID() == mute.mID) + || mute.mID.isNull() && selected.isString() && selected.asString() == mute.mName) { // we are going to remove currently selected item, so select next item and save the selection to restore it - if (!selectNextItemPair(false, true)) - { - selectNextItemPair(true, true); - } - next_selected = getSelectedUUID(); + if (!selectNextItemPair(false, true)) + { + selectNextItemPair(true, true); + } + next_selected = getSelectedValue(); } removeListItem(&mute); } @@ -237,15 +253,18 @@ void LLBlockList::refresh() } mPrevNameFilter = mNameFilter; - if (getItemPair(selected)) - { - // restore previously selected item - selectItemPair(getItemPair(selected), true); - } - else if (getItemPair(next_selected)) + if (selected.isDefined()) { - // previously selected item was removed, so select next item - selectItemPair(getItemPair(next_selected), true); + if (getItemPair(selected)) + { + // restore previously selected item + selectItemPair(getItemPair(selected), true); + } + else if (next_selected.isDefined() && getItemPair(next_selected)) + { + // previously selected item was removed, so select next item + selectItemPair(getItemPair(next_selected), true); + } } mMuteListSize = LLMuteList::getInstance()->getMutes().size(); -- cgit v1.2.3 From 66a9db4b06fed51477db1c09901b5120b36ce11c Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 22 Mar 2017 18:41:51 +0200 Subject: MAINT-7225 MAC build fix --- indra/newview/llblocklist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llblocklist.cpp') diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 54617169c8..1eab2d8e23 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -220,7 +220,7 @@ void LLBlockList::refresh() else if(mActionType == REMOVE) { if ((mute.mID.notNull() && selected.isUUID() && selected.asUUID() == mute.mID) - || mute.mID.isNull() && selected.isString() && selected.asString() == mute.mName) + || (mute.mID.isNull() && selected.isString() && selected.asString() == mute.mName)) { // we are going to remove currently selected item, so select next item and save the selection to restore it if (!selectNextItemPair(false, true)) -- cgit v1.2.3