Allow Name UI to be marked rlv_sensitive (via xui)

This allows these parts of UI to be hidden when they need to be
This commit is contained in:
Liru Færs
2019-10-09 20:35:16 -04:00
parent b1be8bb7f3
commit d54bf78c08
5 changed files with 24 additions and 5 deletions

View File

@@ -79,6 +79,7 @@ void LLNameBox::initFromXML(LLXMLNodePtr node, LLView* parent)
LLTextBox::initFromXML(node, parent);
node->getAttributeString("initial_value", mInitialValue);
setText(mInitialValue);
node->getAttribute_bool("rlv_sensitive", mRLVSensitive);
}
// static

View File

@@ -43,9 +43,10 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect,
const LLUUID& name_id,
bool is_group,
const std::string& loading,
bool rlv_sensitive,
const LLFontGL* glfont,
S32 max_text_length)
: LLNameUI(loading, name_id, is_group)
: LLNameUI(loading, rlv_sensitive, name_id, is_group)
, LLLineEditor(name, rect, LLStringUtil::null, glfont, max_text_length)
{
if (!name_id.isNull())
@@ -115,10 +116,12 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
node->getAttributeUUID("id", id);
std::string loading;
node->getAttributeString("label", loading);
bool rlv_sensitive = false;
node->getAttribute_bool("rlv_sensitive", rlv_sensitive);
LLNameEditor* line_editor = new LLNameEditor("name_editor",
rect,
id, is_group, loading,
id, is_group, loading, rlv_sensitive,
LLView::selectFont(node),
max_text_length);

View File

@@ -45,6 +45,7 @@ public:
const LLUUID& name_id = LLUUID::null,
bool is_group = false,
const std::string& loading = LLStringUtil::null,
bool rlv_sensitive = false,
const LLFontGL* glfont = nullptr,
S32 max_text_length = 254);

View File

@@ -33,13 +33,16 @@
#include "llviewerprecompiledheaders.h"
#include "llnameui.h"
#include "llagentdata.h"
#include "lltrans.h"
#include "rlvhandler.h"
// statics
std::set<LLNameUI*> LLNameUI::sInstances;
LLNameUI::LLNameUI(const std::string& loading, const LLUUID& id, bool is_group)
: mNameID(id), mIsGroup(is_group), mAllowInteract(false)
LLNameUI::LLNameUI(const std::string& loading, bool rlv_sensitive, const LLUUID& id, bool is_group)
: mNameID(id), mRLVSensitive(rlv_sensitive), mIsGroup(is_group), mAllowInteract(false)
, mInitialValue(!loading.empty() ? loading : LLTrans::getString("LoadingData"))
{
sInstances.insert(this);
@@ -69,6 +72,16 @@ void LLNameUI::setNameText()
got_name = gCacheName->getFullName(mNameID, name);
}
if (!mIsGroup && got_name && mRLVSensitive) // Filter if needed
{
if ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS))
&& mNameID.notNull() && mNameID != gAgentID && RlvUtil::isNearbyAgent(mNameID))
{
mAllowInteract = false;
name = RlvStrings::getAnonym(name);
}
else mAllowInteract = true;
}
// Got the name already? Set it.
// Otherwise it will be set later in refresh().

View File

@@ -38,7 +38,7 @@
struct LLNameUI : public LFIDBearer
{
LLNameUI(const std::string& loading = LLStringUtil::null, const LLUUID& id = LLUUID::null, bool is_group = false);
LLNameUI(const std::string& loading = LLStringUtil::null, bool rlv_sensitive = false, const LLUUID& id = LLUUID::null, bool is_group = false);
virtual ~LLNameUI() { sInstances.erase(this); }
LLUUID getStringUUIDSelectedItem() const override final { return mNameID; }
@@ -57,6 +57,7 @@ private:
protected:
LLUUID mNameID;
bool mRLVSensitive; // Whether or not we're doing RLV filtering
bool mIsGroup;
bool mAllowInteract;
std::string mInitialValue;