From 7caae9f3e72f1a18c1af35eabe4d0ac031383577 Mon Sep 17 00:00:00 2001
From: Steven Bennetts <steve@lindenlab.com>
Date: Tue, 11 Aug 2009 01:34:57 +0000
Subject: [PATCH] EXT-260 -  I18N: the term 'Geek' is hard to translate EXT-404
 - Make Debug and Develop menus based on QAMode Test: * Advanced menu should
 be toggled based on ctrl-alt-D (as before) * 'Advanced > Debug (QA) Mode'
 (ctrl-alt-Q) should now toggle the Advanced and Debug menus * God Mode
 (ctrl-alt-G to enable, ctrl-shift-G to disable) should toggle the 'Admin'
 menu, but *only* when the 'Advanced' menu is visible

---
 indra/newview/llviewercontrol.cpp                  |  3 +++
 indra/newview/llviewermenu.cpp                     |  9 +++++----
 indra/newview/llviewermenu.h                       |  1 +
 indra/newview/llviewerwindow.cpp                   |  3 +--
 indra/newview/skins/default/xui/en/menu_viewer.xml | 14 +++++++++++++-
 5 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 30c97cdfa3e..4640745e8c4 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -49,6 +49,7 @@
 
 #include "llsky.h"
 #include "llvieweraudio.h"
+#include "llviewermenu.h"
 #include "llviewertexturelist.h"
 #include "llviewerthrottle.h"
 #include "llviewerwindow.h"
@@ -599,6 +600,8 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));
 	gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2));	
 	gSavedSettings.getControl("VelocityInterpolate")->getSignal()->connect(boost::bind(&handleVelocityInterpolate, _2));
+	gSavedSettings.getControl("QAMode")->getSignal()->connect(boost::bind(&show_debug_menus));
+	gSavedSettings.getControl("UseDebugMenus")->getSignal()->connect(boost::bind(&show_debug_menus));
 }
 
 #if TEST_CACHED_CONTROL
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index fe599a3370b..66b1869aef6 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5110,15 +5110,16 @@ void show_debug_menus()
 	if ( gMenuBarView )
 	{
 		BOOL debug = gSavedSettings.getBOOL("UseDebugMenus");
+		BOOL qamode = gSavedSettings.getBOOL("QAMode");
 
 		gMenuBarView->setItemVisible("Advanced", debug);
 // 		gMenuBarView->setItemEnabled("Advanced", debug); // Don't disable Advanced keyboard shortcuts when hidden
 		
-		gMenuBarView->setItemVisible("Debug", debug);
-		gMenuBarView->setItemEnabled("Debug", debug);
+		gMenuBarView->setItemVisible("Debug", qamode);
+		gMenuBarView->setItemEnabled("Debug", qamode);
 
-		gMenuBarView->setItemVisible("Develop", debug);
-		gMenuBarView->setItemEnabled("Develop", debug);
+		gMenuBarView->setItemVisible("Develop", qamode);
+		gMenuBarView->setItemEnabled("Develop", qamode);
 
 		// Server ('Admin') menu hidden when not in godmode.
 		const bool show_server_menu = debug && (gAgent.getGodLevel() > GOD_NOT);
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index e8d350b0b6a..cf482266d6c 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -49,6 +49,7 @@ void init_menus();
 void cleanup_menus();
 
 void show_debug_menus(); // checks for if menus should be shown first.
+void toggle_debug_menus(void*);
 void show_context_menu( S32 x, S32 y, MASK mask );
 void show_build_mode_context_menu(S32 x, S32 y, MASK mask);
 BOOL enable_save_into_inventory(void*);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 4d51fe2ab82..d6be326a76d 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -41,6 +41,7 @@
 #include "llfloaterreg.h"
 #include "llpanellogin.h"
 #include "llviewerkeyboard.h"
+#include "llviewermenu.h"
 #include "llviewerwindow.h"
 
 #include "llviewquery.h"
@@ -251,8 +252,6 @@ std::string	LLViewerWindow::sSnapshotDir;
 
 std::string	LLViewerWindow::sMovieBaseName;
 
-extern void toggle_debug_menus(void*);
-
 class RecordToChatConsole : public LLError::Recorder, public LLSingleton<RecordToChatConsole>
 {
 public:
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 44565333e56..2bb3c887f59 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -930,7 +930,7 @@
         </menu>
     </menu>
     <menu
-     label="Geek"
+     label="Advanced"
      layout="topleft"
      name="Advanced"
      tear_off="true"
@@ -1824,6 +1824,18 @@
              function="Advanced.ShowDebugSettings"
              parameter="all" />
         </menu_item_call>
+        <menu_item_check
+         label="Debug (QA) Mode"
+         layout="topleft"
+         name="Debug Mode"
+         shortcut="control|alt|Q">
+            <menu_item_check.on_check
+             function="CheckControl"
+             parameter="QAMode" />
+            <menu_item_check.on_click
+             function="ToggleControl"
+             parameter="QAMode" />
+        </menu_item_check>
     </menu>
     <menu
      create_jump_keys="true"
-- 
GitLab