From b89d7ef92ca955ef600729b54353eb235b79038c Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 16 Sep 2024 15:33:27 +0200 Subject: Add the RLVa menu --- indra/newview/app_settings/settings.xml | 11 ++++ indra/newview/llviewercontrol.cpp | 3 + indra/newview/llviewermenu.cpp | 3 + indra/newview/rlvcommon.cpp | 33 +++++++++- indra/newview/rlvcommon.h | 1 + indra/newview/skins/default/xui/en/menu_viewer.xml | 70 ++++++++++++++++++++++ 6 files changed, 119 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ab577200f5..bb9c1d0057 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9908,6 +9908,17 @@ Boolean Value 1 + + RLVaTopLevelMenu + + Comment + Show the RLVa specific menu as a top level menu + Persist + 1 + Type + Boolean + Value + 1 RevokePermsOnStopAnimation diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index c1bf31ff9a..b9d80fff8e 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -76,6 +76,7 @@ #include "llslurl.h" #include "llstartup.h" #include "llperfstats.h" +#include "rlvcommon.h" // Third party library includes #include @@ -933,6 +934,8 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "TerrainPaintBitDepth", handleSetShaderChanged); setting_setup_signal_listener(gSavedPerAccountSettings, "AvatarHoverOffsetZ", handleAvatarHoverOffsetChanged); + + setting_setup_signal_listener(gSavedSettings, Rlv::Settings::TopLevelMenu, Rlv::Util::menuToggleVisible); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 97d5781566..b8a4cc89fd 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -147,6 +147,7 @@ #include "llviewershadermgr.h" #include "gltfscenemanager.h" #include "gltf/asset.h" +#include "rlvcommon.h" using namespace LLAvatarAppearanceDefines; @@ -6375,6 +6376,8 @@ void show_debug_menus() gMenuBarView->setItemVisible("Advanced", debug); // gMenuBarView->setItemEnabled("Advanced", debug); // Don't disable Advanced keyboard shortcuts when hidden + Rlv::Util::menuToggleVisible(); + gMenuBarView->setItemVisible("Debug", qamode); gMenuBarView->setItemEnabled("Debug", qamode); diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index eda2cdedc8..abb54b5b39 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -1,15 +1,18 @@ #include "llviewerprecompiledheaders.h" + #include "llagent.h" #include "llchat.h" #include "lldbstrings.h" #include "llversioninfo.h" +#include "llviewermenu.h" #include "llviewerstats.h" #include "message.h" +#include -#include "rlvdefines.h" #include "rlvcommon.h" -#include +#include "llviewercontrol.h" +#include "rlvhandler.h" using namespace Rlv; @@ -48,6 +51,32 @@ std::string Strings::getVersionImplNum() // RlvUtil // +void Util::menuToggleVisible() +{ + bool isTopLevel = gSavedSettings.getBOOL(Settings::TopLevelMenu); + bool isRlvEnabled = RlvHandler::isEnabled(); + + LLMenuGL* menuRLVaMain = gMenuBarView->findChildMenuByName("RLVa Main", false); + LLMenuGL* menuAdvanced = gMenuBarView->findChildMenuByName("Advanced", false); + LLMenuGL* menuRLVaEmbed= menuAdvanced->findChildMenuByName("RLVa Embedded", false); + + gMenuBarView->setItemVisible("RLVa Main", isRlvEnabled && isTopLevel); + menuAdvanced->setItemVisible("RLVa Embedded", isRlvEnabled && !isTopLevel); + + if ( isRlvEnabled && menuRLVaMain && menuRLVaEmbed && + ( (isTopLevel && 1 == menuRLVaMain->getItemCount()) || (!isTopLevel && 1 == menuRLVaEmbed->getItemCount())) ) + { + LLMenuGL* menuFrom = isTopLevel ? menuRLVaEmbed : menuRLVaMain; + LLMenuGL* menuTo = isTopLevel ? menuRLVaMain : menuRLVaEmbed; + while (LLMenuItemGL* pItem = menuFrom->getItem(1)) + { + menuFrom->removeChild(pItem); + menuTo->addChild(pItem); + pItem->updateBranchParent(menuTo); + } + } +} + bool Util::parseStringList(const std::string& strInput, std::vector& optionList, std::string_view strSeparator) { if (!strInput.empty()) diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index bec3e23e11..d18abcf1ac 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -24,6 +24,7 @@ namespace Rlv namespace Util { bool isValidReplyChannel(S32 nChannel, bool isLoopback = false); + void menuToggleVisible(); bool parseStringList(const std::string& strInput, std::vector& optionList, std::string_view strSeparator = Constants::OptionSeparator); bool sendChatReply(S32 nChannel, const std::string& strUTF8Text); bool sendChatReply(const std::string& strChannel, const std::string& strUTF8Text); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 40f3e51fca..d04bf87676 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1818,6 +1818,71 @@ function="World.EnvPreset" parameter="sl_about" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3