From ab207727fda6d1c238db65827263ff005f4c0aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Sat, 23 Nov 2019 22:44:35 -0500 Subject: [PATCH] Buncha loopy changes --- indra/newview/llavataractions.cpp | 18 +++++++++++------- indra/newview/llgroupactions.cpp | 7 +++++++ indra/newview/llgroupactions.h | 1 + indra/newview/llnamebox.cpp | 13 +++++++++++++ indra/newview/llnamebox.h | 1 + indra/newview/llviewermenu.cpp | 6 ++---- 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index f7eb591ac..8f37e6d49 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -374,8 +374,8 @@ void LLAvatarActions::showProfile(const LLUUID& id, bool web) // static void LLAvatarActions::showProfiles(const uuid_vec_t& ids, bool web) { - for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) - showProfile(*it, web); + for (const auto& id : ids) + showProfile(id, web); } //static @@ -1245,27 +1245,31 @@ bool LLAvatarActions::isAgentMappable(const LLUUID& agent_id) ); } -// static -void LLAvatarActions::copyUUIDs(const uuid_vec_t& ids) +void copy_from_ids(const uuid_vec_t& ids, std::function func) { std::string ids_string; const std::string& separator = LLTrans::getString("words_separator"); - for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (const auto& id : ids) { - const LLUUID& id = *it; if (id.isNull()) continue; if (!ids_string.empty()) ids_string.append(separator); - ids_string.append(id.asString()); + ids_string.append(func(id)); } if (!ids_string.empty()) gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(ids_string)); } +// static +void LLAvatarActions::copyUUIDs(const uuid_vec_t& ids) +{ + copy_from_ids(ids, [](const LLUUID& id) { return id.asString(); }); +} + std::string LLAvatarActions::getSLURL(const LLUUID& id) { return llformat("secondlife:///app/agent/%s/about", id.asString().c_str()); diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 317998558..91141253c 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -400,6 +400,13 @@ void LLGroupActions::show(const LLUUID& group_id) openGroupProfile(group_id); } +// static +void LLGroupActions::showProfiles(const uuid_vec_t& ids) +{ + for (const auto& id : ids) + show(id); +} + // static void LLGroupActions::showTab(const LLUUID& group_id, const std::string& tab_name) { diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h index ac2b0f10d..dc4ff4fe5 100644 --- a/indra/newview/llgroupactions.h +++ b/indra/newview/llgroupactions.h @@ -58,6 +58,7 @@ public: * Show group information panel. */ static void show(const LLUUID& group_id); + static void showProfiles(const uuid_vec_t& group_ids); /** * Show group information panel, with specific tab open. diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index 023fcc426..1e6331e4a 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -89,6 +89,19 @@ BOOL LLNameBox::handleHover(S32 x, S32 y, MASK mask) return handled; } +// virtual +LLXMLNodePtr LLNameBox::getXML(bool save_children) const +{ + LLXMLNodePtr node = LLTextBox::getXML(); + + node->setName("name_box"); + node->createChild("initial_value", TRUE)->setStringValue(mInitialValue); + node->createChild("rlv_sensitive", TRUE)->setBoolValue(mRLVSensitive); + node->createChild("name_system", TRUE)->setStringValue(mNameSystem); + + return node; +} + // static LLView* LLNameBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h index 564970f26..a6b6bcc8c 100644 --- a/indra/newview/llnamebox.h +++ b/indra/newview/llnamebox.h @@ -41,6 +41,7 @@ class LLNameBox final , public LLNameUI { public: + LLXMLNodePtr getXML(bool save_children = true) const override final; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); void displayAsLink(bool link) override final; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0c6a26832..47a6e2223 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9423,8 +9423,7 @@ class ListToggleMute : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - const uuid_vec_t& ids = LFIDBearer::getActiveSelectedIDs(); - for (const auto& id : ids) + for (const auto& id : LFIDBearer::getActiveSelectedIDs()) LLAvatarActions::toggleBlock(id); return true; } @@ -9901,9 +9900,8 @@ void initialize_menus() void region_change() { // Remove current dynamic items - for (custom_menu_item_list_t::iterator i = gCustomMenuItems.begin(); i != gCustomMenuItems.end(); ++i) + for (auto item : gCustomMenuItems) { - LLMenuItemCallGL* item = (*i); item->getParent()->removeChild(item); delete item; }