From 25639b267db13f86f8446c10d61c814839920bc3 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 20 Oct 2009 17:52:56 +0000 Subject: EXT-462 Avatar context menu only shows Freeze/Eject/Debug when in god mode. Changed enable and visible named callbacks to "IsGodCustomerService" so we have one global function that can be used in menus everywhere. Reviewed with Leyla. --- indra/newview/llinspectavatar.cpp | 7 ------ indra/newview/llviewermenu.cpp | 20 +++++------------ indra/newview/llviewermenu.h | 1 - .../default/xui/en/menu_inspect_avatar_gear.xml | 9 +++----- indra/newview/skins/default/xui/en/menu_viewer.xml | 26 +++++++++++----------- 5 files changed, 22 insertions(+), 41 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 4eb6061bea..99580d0918 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -110,7 +110,6 @@ private: void onClickZoomIn(); void onClickFindOnMap(); bool onVisibleFindOnMap(); - bool onVisibleGodMode(); void onClickMuteVolume(); void onVolumeChange(const LLSD& data); @@ -195,7 +194,6 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd) mCommitCallbackRegistrar.add("InspectAvatar.FindOnMap", boost::bind(&LLInspectAvatar::onClickFindOnMap, this)); mCommitCallbackRegistrar.add("InspectAvatar.ZoomIn", boost::bind(&LLInspectAvatar::onClickZoomIn, this)); mVisibleCallbackRegistrar.add("InspectAvatar.VisibleFindOnMap", boost::bind(&LLInspectAvatar::onVisibleFindOnMap, this)); - mVisibleCallbackRegistrar.add("InspectAvatar.VisibleGodMode", boost::bind(&LLInspectAvatar::onVisibleGodMode, this)); // can't make the properties request until the widgets are constructed @@ -453,11 +451,6 @@ bool LLInspectAvatar::onVisibleFindOnMap() return gAgent.isGodlike() || is_agent_mappable(mAvatarID); } -bool LLInspectAvatar::onVisibleGodMode() -{ - return gAgent.isGodlike(); -} - void LLInspectAvatar::onClickIM() { LLAvatarActions::startIM(mAvatarID); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 806085dc24..a9ba9ead1a 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1634,16 +1634,6 @@ class LLAdvancedToggleCharacterGeometry : public view_listener_t } }; -class LLEnableGodCustomerService : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) -{ - bool new_value = enable_god_customer_service(NULL); - return new_value; - } -}; - - ///////////////////////////// // TEST MALE / TEST FEMALE // @@ -4029,7 +4019,7 @@ void handle_god_request_avatar_geometry(void *) { if (gAgent.isGodlike()) { - LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", NULL); + LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", ""); } } @@ -6802,7 +6792,7 @@ BOOL enable_god_liaison(void*) return gAgent.getGodLevel() >= GOD_LIAISON; } -BOOL enable_god_customer_service(void*) +bool is_god_customer_service() { return gAgent.getGodLevel() >= GOD_CUSTOMER_SERVICE; } @@ -7746,8 +7736,10 @@ void initialize_menus() LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar(); LLUICtrl::VisibleCallbackRegistry::Registrar& visible = LLUICtrl::VisibleCallbackRegistry::currentRegistrar(); - // Enable God Mode - view_listener_t::addMenu(new LLEnableGodCustomerService(), "EnableGodCustomerService"); + // Generic enable and visible + // Don't prepend MenuName.Foo because these can be used in any menu. + enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service)); + visible.add("IsGodCustomerService", boost::bind(&is_god_customer_service)); // Agent commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying)); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index d28d54c933..6d32df2bc5 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -84,7 +84,6 @@ void detach_label(std::string& label, const LLSD&); void handle_detach(void*); BOOL enable_god_full(void* user_data); BOOL enable_god_liaison(void* user_data); -BOOL enable_god_customer_service(void* user_data); BOOL enable_god_basic(void* user_data); void set_underclothes_menu_options(); diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml index 5279f9d141..edff1a093a 100644 --- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml @@ -64,30 +64,27 @@ + function="IsGodCustomerService"/> + function="IsGodCustomerService"/> + function="IsGodCustomerService"/> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" /> + function="IsGodCustomerService" />