summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-05-02 14:03:34 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-05-02 14:03:34 +0300
commitf9a2748b542d05d153fa591a8c452162d9402828 (patch)
tree4334ec60cadf7aefddf8266c21731b38592aa583 /indra/newview
parent79dca07d790a47db192099bcb85e740676a643ee (diff)
Raise Lua error if LLViewerControlListener response contains one
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewerlistener.cpp14
-rw-r--r--indra/newview/llappviewerlistener.h2
-rw-r--r--indra/newview/llviewercontrollistener.cpp5
-rw-r--r--indra/newview/scripts/lua/LLDebugSettings.lua13
4 files changed, 13 insertions, 21 deletions
diff --git a/indra/newview/llappviewerlistener.cpp b/indra/newview/llappviewerlistener.cpp
index bd0c6955b1..2380a8ebf0 100644
--- a/indra/newview/llappviewerlistener.cpp
+++ b/indra/newview/llappviewerlistener.cpp
@@ -35,7 +35,6 @@
// external library headers
// other Linden headers
#include "llappviewer.h"
-#include "llviewercontrol.h"
LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
LLEventAPI("LLAppViewer",
@@ -49,10 +48,6 @@ LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
add("forceQuit",
"Quit abruptly",
&LLAppViewerListener::forceQuit);
-
- add("setDebugSetting",
- "Apply specified [\"value\"] to the debug [\"setting\"] (this change won't persist across sessions)",
- &LLAppViewerListener::setDebugSetting, llsd::map("setting", LLSD(), "value", LLSD()));
}
void LLAppViewerListener::requestQuit(const LLSD& event)
@@ -66,12 +61,3 @@ void LLAppViewerListener::forceQuit(const LLSD& event)
LL_INFOS() << "Listener requested force quit" << LL_ENDL;
mAppViewerGetter()->forceQuit();
}
-
-void LLAppViewerListener::setDebugSetting(const LLSD &event)
-{
- auto setting_name = event["setting"].asString();
- auto value = event["value"];
- LL_WARNS("LLAppViewerListener") << "Changing debug setting \"" << setting_name << "\" to " << value << LL_ENDL;
- //don't save this change between sesssions
- gSavedSettings.setUntypedValue(setting_name, value, false);
-}
diff --git a/indra/newview/llappviewerlistener.h b/indra/newview/llappviewerlistener.h
index 8b38636bd1..78c8b1909e 100644
--- a/indra/newview/llappviewerlistener.h
+++ b/indra/newview/llappviewerlistener.h
@@ -47,8 +47,6 @@ private:
void requestQuit(const LLSD& event);
void forceQuit(const LLSD& event);
- void setDebugSetting(const LLSD &event);
-
LLAppViewerGetter mAppViewerGetter;
};
diff --git a/indra/newview/llviewercontrollistener.cpp b/indra/newview/llviewercontrollistener.cpp
index 5c1b020c9d..16c4084a77 100644
--- a/indra/newview/llviewercontrollistener.cpp
+++ b/indra/newview/llviewercontrollistener.cpp
@@ -159,8 +159,9 @@ void LLViewerControlListener::toggle(LLSD const & request)
if (info.control->isType(TYPE_BOOLEAN))
{
- LL_WARNS("LLViewerControlListener") << "Toggling debug setting " << std::quoted(info.key) << LL_ENDL;
- info.control->set(! info.control->get().asBoolean(), false);
+ bool value = !info.control->get().asBoolean();
+ LL_WARNS("LLViewerControlListener") << "Toggling debug setting " << std::quoted(info.key) << " to " << value << LL_ENDL;
+ info.control->set(value, false);
}
else
{
diff --git a/indra/newview/scripts/lua/LLDebugSettings.lua b/indra/newview/scripts/lua/LLDebugSettings.lua
index 80ae7e87bb..c809dfff91 100644
--- a/indra/newview/scripts/lua/LLDebugSettings.lua
+++ b/indra/newview/scripts/lua/LLDebugSettings.lua
@@ -1,17 +1,24 @@
leap = require 'leap'
+function check_response(res)
+ if res.error then
+ error(res.error)
+ end
+ return res
+end
+
local LLDebugSettings = {}
function LLDebugSettings.set(name, value)
- return leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value})
+ check_response(leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value}))
end
function LLDebugSettings.toggle(name)
- return leap.request('LLViewerControl', {op='toggle', group='Global', key=name})
+ check_response(leap.request('LLViewerControl', {op='toggle', group='Global', key=name}))
end
function LLDebugSettings.get(name)
- return leap.request('LLViewerControl', {op='get', group='Global', key=name})['value']
+ return check_response(leap.request('LLViewerControl', {op='get', group='Global', key=name}))['value']
end
return LLDebugSettings