diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-12-11 18:33:37 +0200 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-12-11 18:33:37 +0200 |
commit | 77b5ee1b4d7fb03f757efdaa4169ab38fb754b25 (patch) | |
tree | 721fb2f926ae109d0fa7187158f7aeb1e77e3c5a /indra | |
parent | 28b507dd605724af21d2cf587aaf0c9dfb8dd25e (diff) |
Implemented major task EXT-3390 - Move Moderation options into submenu.
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llparticipantlist.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llparticipantlist.h | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_participant_list.xml | 5 |
3 files changed, 26 insertions, 3 deletions
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index e99a9a5d12..1986a98fb7 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -401,8 +401,13 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu() enable_registrar.add("ParticipantList.CheckItem", boost::bind(&LLParticipantList::LLParticipantListMenu::checkContextMenuItem, this, _2)); // create the context menu from the XUI - return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( + LLContextMenu* main_menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( "menu_participant_list.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); + + main_menu->setItemVisible("Moderator Options", isGroupModerator()); + main_menu->arrangeAndClear(); + + return main_menu; } void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y) @@ -483,6 +488,15 @@ void LLParticipantList::LLParticipantListMenu::toggleMuteVoice(const LLSD& userd toggleMute(userdata, LLMute::flagVoiceChat); } +bool LLParticipantList::LLParticipantListMenu::isGroupModerator() +{ + // Agent is in Group Call + bool is_in_group = gAgent.isInGroup(mParent.mSpeakerMgr->getSessionID()); + // Agent is Moderator + bool is_moderator = mParent.mSpeakerMgr->findSpeaker(gAgentID)->mIsModerator; + return is_in_group && is_moderator; +} + bool LLParticipantList::LLParticipantListMenu::isMuted(const LLUUID& avatar_id) { LLPointer<LLSpeaker> selected_speakerp = mParent.mSpeakerMgr->findSpeaker(avatar_id); @@ -565,8 +579,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& else if (item == "can_allow_text_chat" || "can_moderate_voice" == item) { - LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mParent.mSpeakerMgr->getSessionID()); - return im_session->mType == IM_SESSION_GROUP_START && mParent.mSpeakerMgr->findSpeaker(gAgentID)->mIsModerator; + return isGroupModerator(); } return true; } diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 229769ec09..9d7d3a0cbe 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -138,6 +138,11 @@ class LLParticipantList void toggleMuteText(const LLSD& userdata); void toggleMuteVoice(const LLSD& userdata); + /** + * Return true if Agent is group moderator(and moderator of group call). + */ + bool isGroupModerator(); + // Voice moderation support /** * Check whether specified by argument avatar is muted for group chat or not. 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 ffe5430c55..adf4bd70e1 100644 --- a/indra/newview/skins/default/xui/en/menu_participant_list.xml +++ b/indra/newview/skins/default/xui/en/menu_participant_list.xml @@ -76,6 +76,10 @@ function="ParticipantList.EnableItem" parameter="can_mute_text" /> </menu_item_check> + <context_menu + label="Moderator Options >" + layout="topleft" + name="Moderator Options" > <menu_item_check label="Allow text chat" layout="topleft" @@ -136,4 +140,5 @@ function="ParticipantList.EnableItem" parameter="can_moderate_voice" /> </menu_item_call> + </context_menu> </context_menu> |