From b132578692d7737f4fc641567568c327d4436eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Wed, 9 Oct 2019 20:03:26 -0400 Subject: [PATCH] Bit of refactor in prep for bigger changes --- indra/newview/llnameui.cpp | 17 ++++++++++------- indra/newview/llnameui.h | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/indra/newview/llnameui.cpp b/indra/newview/llnameui.cpp index b0426c684..e1cd63491 100644 --- a/indra/newview/llnameui.cpp +++ b/indra/newview/llnameui.cpp @@ -39,8 +39,8 @@ std::set LLNameUI::sInstances; LLNameUI::LLNameUI(const std::string& loading, const LLUUID& id, bool is_group) - : mInitialValue(!loading.empty() ? loading : LLTrans::getString("LoadingData")) - , mNameID(id), mIsGroup(is_group) +: mNameID(id), mIsGroup(is_group) +, mInitialValue(!loading.empty() ? loading : LLTrans::getString("LoadingData")) { sInstances.insert(this); } @@ -48,20 +48,23 @@ LLNameUI::LLNameUI(const std::string& loading, const LLUUID& id, bool is_group) void LLNameUI::setNameID(const LLUUID& name_id, bool is_group) { mNameID = name_id; + mIsGroup = is_group; + setNameText(); +void LLNameUI::setNameText() +{ std::string name; bool got_name = false; - if (!is_group) + if (mIsGroup) { - got_name = gCacheName->getFullName(name_id, name); + got_name = gCacheName->getGroupName(mNameID, name); } else { - got_name = gCacheName->getGroupName(name_id, name); + got_name = gCacheName->getFullName(mNameID, name); } - mIsGroup = is_group; // Got the name already? Set it. // Otherwise it will be set later in refresh(). @@ -72,7 +75,7 @@ void LLNameUI::refresh(const LLUUID& id, const std::string& full_name, bool is_g { if (id == mNameID) { - setText(full_name); + setNameText(); } } diff --git a/indra/newview/llnameui.h b/indra/newview/llnameui.h index 50d621032..f5825d6ca 100644 --- a/indra/newview/llnameui.h +++ b/indra/newview/llnameui.h @@ -46,6 +46,7 @@ struct LLNameUI : public LFIDBearer S32 getNumSelected() const override final { return 1; } void setNameID(const LLUUID& name_id, bool is_group); + void setNameText(); // Sets the name to whatever the name cache has at the moment void refresh(const LLUUID& id, const std::string& full_name, bool is_group); static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group);