summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfloater.cpp4
-rw-r--r--indra/llui/llfloater.h3
-rw-r--r--indra/llui/llfloaterreglistener.cpp20
-rw-r--r--indra/llui/llfloaterreglistener.h1
-rw-r--r--indra/llui/llluafloater.cpp39
-rw-r--r--indra/llui/llluafloater.h3
-rw-r--r--indra/newview/scripts/lua/test_luafloater_demo.lua2
-rw-r--r--indra/newview/scripts/lua/test_luafloater_gesture_list.lua2
8 files changed, 23 insertions, 51 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index b9b69b5a33..de3de53569 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -3623,10 +3623,6 @@ void LLFloater::applyRelativePosition()
translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY);
}
-bool LLFloater::isDefaultBtnName(const std::string& name)
-{
- return (std::find(std::begin(sButtonNames), std::end(sButtonNames), name) != std::end(sButtonNames));
-}
LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater)
: coord_t((S32)x, (S32)y)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 9d49c4538e..88f9e77777 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -372,9 +372,6 @@ public:
void enableResizeCtrls(bool enable, bool width = true, bool height = true);
bool isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mPositioning); }
-
- static bool isDefaultBtnName(const std::string& name);
-
protected:
void applyControlsAndPosition(LLFloater* other);
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index bdf26c1db8..8316101264 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -74,11 +74,9 @@ LLFloaterRegListener::LLFloaterRegListener():
&LLFloaterRegListener::clickButton,
requiredNameButton);
- LLSD requiredParams;
- requiredParams["xml_path"] = LLSD();
add("showLuaFloater",
- "Open the new floater using XML file specified in [\"xml_path\"]",
- &LLFloaterRegListener::showLuaFloater, requiredParams);
+ "Open the new floater using XML file specified in [\"xml_path\"] with ID in [\"reqid\"]",
+ &LLLuaFloater::showLuaFloater, {llsd::map("xml_path", LLSD(), "reqid", LLSD())});
add("getFloaterEvents",
"Return the table of Lua Floater events which are send to the script",
&LLFloaterRegListener::getLuaFloaterEvents);
@@ -165,20 +163,8 @@ void LLFloaterRegListener::clickButton(const LLSD& event) const
}
}
-void LLFloaterRegListener::showLuaFloater(const LLSD &event) const
-{
- LLLuaFloater::showLuaFloater(event);
-}
-
void LLFloaterRegListener::getLuaFloaterEvents(const LLSD &event) const
{
- if (event.has("reply"))
- {
- LLSD events_data = LLLuaFloater::getEventsData();
-
- LLReqID reqID(event);
- LLSD reply(reqID.makeResponse());
- LLEventPumps::instance().obtain(event["reply"]).post(reply.with("events", events_data));
- }
+ Response response(llsd::map("events", LLLuaFloater::getEventsData()), event);
}
diff --git a/indra/llui/llfloaterreglistener.h b/indra/llui/llfloaterreglistener.h
index cbfb7855b9..9cb0af2de5 100644
--- a/indra/llui/llfloaterreglistener.h
+++ b/indra/llui/llfloaterreglistener.h
@@ -50,7 +50,6 @@ private:
void instanceVisible(const LLSD& event) const;
void clickButton(const LLSD& event) const;
- void showLuaFloater(const LLSD &event) const;
void getLuaFloaterEvents(const LLSD &event) const;
};
diff --git a/indra/llui/llluafloater.cpp b/indra/llui/llluafloater.cpp
index 27ae85c844..668c0edc53 100644
--- a/indra/llui/llluafloater.cpp
+++ b/indra/llui/llluafloater.cpp
@@ -51,8 +51,9 @@ std::map<std::string, std::string> EVENT_LIST =
LLLuaFloater::LLLuaFloater(const LLSD &key) :
LLFloater(key),
- mCommandPumpName(key["reply"].asString()),
- mDispatcher("LLLuaFloater", "action")
+ mReplyPumpName(key["reply"].asString()),
+ mDispatcher("LLLuaFloater", "action"),
+ mReqID(key)
{
mListenerPumpName = LLUUID::generateNewID().asString();
@@ -69,7 +70,7 @@ LLLuaFloater::LLLuaFloater(const LLSD &key) :
return false;
});
- LLSD requiredParams = LLSD().with("ctrl_name", LLSD()).with("value", LLSD());
+ LLSD requiredParams = llsd::map("ctrl_name", LLSD(), "value", LLSD());
mDispatcher.add("set_enabled", "", [this](const LLSD &event)
{
LLUICtrl *ctrl = getChild<LLUICtrl>(event["ctrl_name"].asString());
@@ -103,13 +104,11 @@ LLLuaFloater::LLLuaFloater(const LLSD &key) :
}
}, requiredParams);
- requiredParams = LLSD().with("value", LLSD());
mDispatcher.add("set_title", "", [this](const LLSD &event)
{
setTitle(event["value"].asString());
- }, requiredParams);
+ }, llsd::map("value", LLSD()));
- requiredParams = LLSD().with("ctrl_name", LLSD()).with("reqid", LLSD());
mDispatcher.add("get_value", "", [this](const LLSD &event)
{
LLUICtrl *ctrl = getChild<LLUICtrl>(event["ctrl_name"].asString());
@@ -120,7 +119,7 @@ LLLuaFloater::LLLuaFloater(const LLSD &key) :
response["reqid"] = event["reqid"];
post(response);
}
- }, requiredParams);
+ }, llsd::map("ctrl_name", LLSD(), "reqid", LLSD()));
}
LLLuaFloater::~LLLuaFloater()
@@ -131,13 +130,8 @@ LLLuaFloater::~LLLuaFloater()
BOOL LLLuaFloater::postBuild()
{
- child_list_t::const_iterator iter = getChildList()->begin();
- child_list_t::const_iterator end = getChildList()->end();
- for (; iter != end; ++iter)
+ for (LLView *view : *getChildList())
{
- LLView *view = *iter;
- if (!view) continue;
-
LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(view);
if (ctrl)
{
@@ -158,27 +152,24 @@ BOOL LLLuaFloater::postBuild()
if (mKey.has("extra_events"))
{
//the first value is ctrl name, the second contains array of events to send
- const LLSD &events_map = mKey["extra_events"];
- for (LLSD::map_const_iterator it = events_map.beginMap(); it != events_map.endMap(); ++it)
+ for (const auto &[name, data] : llsd::inMap(mKey["extra_events"]))
{
- std::string name = (*it).first;
- LLSD data = (*it).second;
- for (LLSD::array_const_iterator events_it = data.beginArray(); events_it != data.endArray(); ++events_it)
+ for (const auto &event : llsd::inArray(data))
{
- registerCallback(name, events_it->asString());
+ registerCallback(name, event);
}
}
}
//send pump name to the script after the floater is built
- post(LLSD().with("command_name", mListenerPumpName).with("event", EVENT_LIST["POST_BUILD_EVENT"]));
+ post(llsd::map("command_name", mListenerPumpName, "event", EVENT_LIST["POST_BUILD_EVENT"]));
return true;
}
void LLLuaFloater::onClose(bool app_quitting)
{
- post(LLSD().with("event", EVENT_LIST["CLOSE_EVENT"]));
+ post(llsd::map("event", EVENT_LIST["CLOSE_EVENT"], "app_quitting", app_quitting));
}
void LLLuaFloater::registerCallback(const std::string &ctrl_name, const std::string &event)
@@ -247,8 +238,10 @@ void LLLuaFloater::registerCallback(const std::string &ctrl_name, const std::str
void LLLuaFloater::post(const LLSD &data)
{
- //send event data to the script
- LLEventPumps::instance().obtain(mCommandPumpName).post(data);
+ // send event data to the script signed with ["reqid"] key
+ LLSD stamped_data(data);
+ mReqID.stamp(stamped_data);
+ LLEventPumps::instance().obtain(mReplyPumpName).post(stamped_data);
}
void LLLuaFloater::showLuaFloater(const LLSD &data)
diff --git a/indra/llui/llluafloater.h b/indra/llui/llluafloater.h
index 0dd39e7d1e..b9f96f0ad3 100644
--- a/indra/llui/llluafloater.h
+++ b/indra/llui/llluafloater.h
@@ -45,10 +45,11 @@ public:
static LLSD getEventsData();
private:
+ LLReqID mReqID;
LLEventDispatcher mDispatcher;
LLTempBoundListener mBoundListener;
std::string mListenerPumpName;
- std::string mCommandPumpName;
+ std::string mReplyPumpName;
};
#endif
diff --git a/indra/newview/scripts/lua/test_luafloater_demo.lua b/indra/newview/scripts/lua/test_luafloater_demo.lua
index a7bbdccb30..2cbafcec14 100644
--- a/indra/newview/scripts/lua/test_luafloater_demo.lua
+++ b/indra/newview/scripts/lua/test_luafloater_demo.lua
@@ -62,7 +62,7 @@ local key = {xml_path = XML_FILE_PATH, op = "showLuaFloater"}
--sign for additional events for defined control {<control_name>= {action1, action2, ...}}
key.extra_events={show_time_lbl = {e.RIGHT_MOUSE_DOWN_EVENT, e.DOUBLE_CLICK_EVENT}}
-leap.send("LLFloaterReg", key)
+leap.send("LLFloaterReg", key, "floater1")
coro.launch(process_events, catch_events)
leap.process()
diff --git a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua
index 070ff8415a..5ea2b1e30d 100644
--- a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua
+++ b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua
@@ -56,7 +56,7 @@ end
local key = {xml_path = XML_FILE_PATH, op = "showLuaFloater"}
--receive additional events for defined control {<control_name>= {action1, action2, ...}}
key.extra_events={gesture_list = {e.DOUBLE_CLICK_EVENT}}
-leap.send("LLFloaterReg", key)
+leap.send("LLFloaterReg", key, "floater1")
coro.launch(process_events, catch_events)
leap.process()