diff options
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llcommandlineparser.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/llviewercontrollistener.cpp | 35 | ||||
| -rw-r--r-- | indra/newview/llviewercontrollistener.h | 1 |
3 files changed, 41 insertions, 0 deletions
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index 0734b12531..84d3ff90d5 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -611,6 +611,11 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, ctrl->setValue(llsdArray, false); } + else if (ctrl->isType(TYPE_LLSD)) + { + // Command-line LLSD should support a notation format string + ctrl->setValueFromNotation(onevalue(option, value), false); + } else { ctrl->setValue(onevalue(option, value), false); diff --git a/indra/newview/llviewercontrollistener.cpp b/indra/newview/llviewercontrollistener.cpp index 6f77e21fcc..f8e829deb9 100644 --- a/indra/newview/llviewercontrollistener.cpp +++ b/indra/newview/llviewercontrollistener.cpp @@ -65,6 +65,11 @@ LLViewerControlListener::LLViewerControlListener() grouphelp + replyhelp, &LLViewerControlListener::set, LLSDMap("group", LLSD())("key", LLSD())); + add("set_notation", + std::string("Set [\"group\"] TYPE_LLSD control [\"key\"] by parsing [\"value\"] as LLSD notation.\n") + + grouphelp + replyhelp, + &LLViewerControlListener::set_notation, + LLSDMap("group", LLSD())("key", LLSD())("value", LLSD())); add("toggle", std::string("Toggle [\"group\"] control [\"key\"], if boolean\n") + grouphelp + replyhelp, &LLViewerControlListener::toggle, @@ -150,6 +155,36 @@ void LLViewerControlListener::set(LLSD const & request) } //static +void LLViewerControlListener::set_notation(LLSD const& request) +{ + Info info(request); + if (!info.control) + return; + + if (!info.control->isType(TYPE_LLSD)) + { + info.response.error(STRINGIZE("set_notation requires a TYPE_LLSD control, but '" + << info.key << "' in group '" << info.groupname + << "' has type " + << LLControlGroup::typeEnumToString(info.control->type()))); + return; + } + + if (!request["value"].isString()) + { + info.response.error(STRINGIZE("set_notation requires [\"value\"] to be a string " + "containing LLSD notation, but received type: " + << LLSD::typeString(request["value"].type()))); + return; + } + + if (!info.control->setValueFromNotation(request["value"].asString())) + { + info.response.error(STRINGIZE("set_notation failed to parse notation")); + } +} + +//static void LLViewerControlListener::toggle(LLSD const & request) { Info info(request); diff --git a/indra/newview/llviewercontrollistener.h b/indra/newview/llviewercontrollistener.h index 346acac439..c5a3a31baf 100644 --- a/indra/newview/llviewercontrollistener.h +++ b/indra/newview/llviewercontrollistener.h @@ -41,6 +41,7 @@ public: private: static void set(LLSD const & event_data); + static void set_notation(LLSD const & event_data); static void toggle(LLSD const & event_data); static void get(LLSD const & event_data); static void groups(LLSD const & event_data); |
