[LLNameUI] Handle LFIDBearer::Type instead of jusst group or not

Removes "is_group" and switches it out for "type"
setValue no longer takes "group", instead it takes "type"
Constructors and setNameID now take Type instead of a boolean
setIsGroup is now setType
This commit is contained in:
Liru Færs
2020-01-06 12:30:47 -05:00
parent 6839cba56a
commit 1813a7bf8b
13 changed files with 54 additions and 52 deletions

View File

@@ -622,7 +622,7 @@ void LLPanelLandGeneral::refresh()
bool group_owned = parcel->getIsGroupOwned();
// Is it owned?
mTextOwner->setValue(is_public ? LLSD(LLUUID::null) : LLSD().with("id", owner_id).with("group", group_owned));
mTextOwner->setValue(is_public ? LLSD(LLUUID::null) : LLSD().with("id", owner_id).with("type", group_owned ? LFIDBearer::GROUP : LFIDBearer::AVATAR));
mTextGroup->setValue(is_public ? LLUUID::null : group_id);
if (is_public)
{
@@ -828,7 +828,7 @@ void LLPanelLandGeneral::refreshNames()
}
bool group_owned = parcel->getIsGroupOwned();
mTextOwner->setValue(LLSD().with("id", parcel->getOwnerID()).with("group", group_owned));
mTextOwner->setValue(LLSD().with("id", parcel->getOwnerID()).with("type", group_owned ? LFIDBearer::GROUP : LFIDBearer::AVATAR));
if (group_owned)
{
mTextOwner->setText(getString("group_owned_text"));

View File

@@ -39,17 +39,17 @@ static LLRegisterWidget<LLNameBox> r("name_box");
LLNameBox::LLNameBox(const std::string& name,
const LLUUID& name_id,
bool is_group,
const Type& type,
const std::string& loading,
bool rlv_sensitive,
const std::string& name_system)
: LLNameUI(loading, rlv_sensitive, name_id, is_group, name_system)
: LLNameUI(loading, rlv_sensitive, name_id, type, name_system)
, LLTextBox(name, LLRect(), LLStringUtil::null, nullptr, TRUE)
{
setClickedCallback(boost::bind(&LLNameUI::showProfile, this));
if (!name_id.isNull())
{
setNameID(name_id, is_group);
setNameID(name_id, type);
}
else setText(mInitialValue);
}
@@ -104,8 +104,8 @@ LLXMLNodePtr LLNameBox::getXML(bool save_children) const
// static
LLView* LLNameBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
bool is_group = false;
node->getAttribute_bool("is_group", is_group);
S8 type = AVATAR;
node->getAttributeS8("type", type);
LLUUID id;
node->getAttributeUUID("id", id);
std::string loading;
@@ -114,7 +114,7 @@ LLView* LLNameBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
node->getAttribute_bool("rlv_sensitive", rlv_sensitive);
std::string name_system;
node->getAttributeString("name_system", name_system);
LLNameBox* name_box = new LLNameBox("name_box", id, is_group, loading, rlv_sensitive, name_system);
LLNameBox* name_box = new LLNameBox("name_box", id, (Type)type, loading, rlv_sensitive, name_system);
name_box->initFromXML(node,parent);
return name_box;

View File

@@ -54,7 +54,7 @@ public:
LLNameBox(const std::string& name,
const LLUUID& name_id = LLUUID::null,
bool is_group = false,
const Type& type = AVATAR,
const std::string& loading = LLStringUtil::null,
bool rlv_sensitive = false,
const std::string& name_system = LLStringUtil::null);

View File

@@ -42,20 +42,20 @@ static LLRegisterWidget<LLNameEditor> r("name_editor");
LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect,
const LLUUID& name_id,
bool is_group,
const Type& type,
const std::string& loading,
bool rlv_sensitive,
const std::string& name_system,
bool click_for_profile,
const LLFontGL* glfont,
S32 max_text_length)
: LLNameUI(loading, rlv_sensitive, name_id, is_group, name_system)
: LLNameUI(loading, rlv_sensitive, name_id, type, name_system)
, LLLineEditor(name, rect, LLStringUtil::null, glfont, max_text_length)
, mClickForProfile(click_for_profile)
{
if (!name_id.isNull())
{
setNameID(name_id, is_group);
setNameID(name_id, type);
}
else setText(mInitialValue);
}
@@ -83,7 +83,7 @@ BOOL LLNameEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
}
else // TODO: This is lazy, but I cannot recall a name editor that switches between group and avatar, so logic is not needed yet.
{
new_menu = mIsGroup ? "menu_nameeditor_group.xml" : "menu_nameeditor_avatar.xml";
new_menu = mType == GROUP ? "menu_nameeditor_group.xml" : "menu_nameeditor_avatar.xml";
}
if (!new_menu.empty()) setContextMenu(LLUICtrlFactory::instance().buildMenu(new_menu, LLMenuGL::sMenuContainer));
setActive();
@@ -136,8 +136,8 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
S32 max_text_length = 1024;
node->getAttributeS32("max_length", max_text_length);
bool is_group = false;
node->getAttribute_bool("is_group", is_group);
S8 type = AVATAR;
node->getAttributeS8("type", type);
LLUUID id;
node->getAttributeUUID("id", id);
std::string loading;
@@ -151,7 +151,7 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
LLNameEditor* line_editor = new LLNameEditor("name_editor",
rect,
id, is_group, loading, rlv_sensitive, name_system,
id, (Type)type, loading, rlv_sensitive, name_system,
click_for_profile,
LLView::selectFont(node),
max_text_length);

View File

@@ -44,7 +44,7 @@ class LLNameEditor final
public:
LLNameEditor(const std::string& name, const LLRect& rect,
const LLUUID& name_id = LLUUID::null,
bool is_group = false,
const Type& type = AVATAR,
const std::string& loading = LLStringUtil::null,
bool rlv_sensitive = false,
const std::string& name_system = LLStringUtil::null,

View File

@@ -46,35 +46,36 @@
// statics
std::set<LLNameUI*> LLNameUI::sInstances;
LLNameUI::LLNameUI(const std::string& loading, bool rlv_sensitive, const LLUUID& id, bool is_group, const std::string& name_system)
: mNameID(id), mRLVSensitive(rlv_sensitive), mIsGroup(!is_group), mAllowInteract(false)
LLNameUI::LLNameUI(const std::string& loading, bool rlv_sensitive, const LLUUID& id, const Type& type, const std::string& name_system)
: mNameID(id), mRLVSensitive(rlv_sensitive), mType(NONE), mAllowInteract(false)
, mNameSystem(name_system.empty() ? "PhoenixNameSystem" : name_system), mInitialValue(!loading.empty() ? loading : LLTrans::getString("LoadingData"))
{
setIsGroup(is_group);
setType(type);
}
void LLNameUI::setIsGroup(bool is_group)
void LLNameUI::setType(const Type& type)
{
// Disconnect active connections if needed
for (auto& connection : mConnections)
connection.disconnect();
if (mIsGroup != is_group)
if (mType != type)
{
if (mIsGroup = is_group)
if (type == GROUP)
sInstances.insert(this);
else
{
sInstances.erase(this);
mConnections[1] = gSavedSettings.getControl(mNameSystem)->getCommitSignal()->connect(boost::bind(&LLNameUI::setNameText, this));
}
mType = type;
}
}
void LLNameUI::setNameID(const LLUUID& name_id, bool is_group)
void LLNameUI::setNameID(const LLUUID& name_id, const Type& type)
{
mNameID = name_id;
setIsGroup(is_group);
setType(type);
if (mAllowInteract = mNameID.notNull())
{
@@ -82,7 +83,7 @@ void LLNameUI::setNameID(const LLUUID& name_id, bool is_group)
}
else
{
setText(LLTrans::getString(mIsGroup ? "GroupNameNone" : "AvatarNameNobody"));
setText(LLTrans::getString(mType == GROUP ? "GroupNameNone" : "AvatarNameNobody"));
displayAsLink(false);
}
}
@@ -92,7 +93,7 @@ void LLNameUI::setNameText()
std::string name;
bool got_name = false;
if (mIsGroup)
if (mType == GROUP)
{
got_name = gCacheName->getGroupName(mNameID, name);
}
@@ -105,7 +106,7 @@ void LLNameUI::setNameText()
mConnections[0] = LLAvatarNameCache::get(mNameID, boost::bind(&LLNameUI::setNameText, this));
}
if (!mIsGroup && got_name && mRLVSensitive) // Filter if needed
if (mType == AVATAR && got_name && mRLVSensitive) // Filter if needed
{
if ((RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMES) || RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMETAGS))
&& mNameID != gAgentID && RlvUtil::isNearbyAgent(mNameID))
@@ -143,8 +144,10 @@ void LLNameUI::showProfile()
{
if (!mAllowInteract) return;
if (mIsGroup)
LLGroupActions::show(mNameID);
else
LLAvatarActions::showProfile(mNameID);
switch (LFIDBearer::getActiveType())
{
case LFIDBearer::GROUP: LLGroupActions::show(mNameID); break;
case LFIDBearer::AVATAR: LLAvatarActions::showProfile(mNameID); break;
default: break;
}
}

View File

@@ -38,21 +38,20 @@
struct LLNameUI : public LFIDBearer
{
LLNameUI(const std::string& loading = LLStringUtil::null, bool rlv_sensitive = false, const LLUUID& id = LLUUID::null, bool is_group = false, const std::string& name_system = LLStringUtil::null);
LLNameUI(const std::string& loading = LLStringUtil::null, bool rlv_sensitive = false, const LLUUID& id = LLUUID::null, const Type& type = AVATAR, const std::string& name_system = LLStringUtil::null);
virtual ~LLNameUI()
{
if (mIsGroup)
sInstances.erase(this);
if (mType == GROUP) sInstances.erase(this);
for (auto& connection : mConnections)
connection.disconnect();
}
LLUUID getStringUUIDSelectedItem() const override final { return mNameID; }
S32 getNumSelected() const override final { return 1; }
Type getSelectedType() const override final { return mIsGroup ? GROUP : AVATAR; }
Type getSelectedType() const override final { return mType; }
void setIsGroup(bool is_group);
void setNameID(const LLUUID& name_id, bool is_group);
void setType(const Type& type);
void setNameID(const LLUUID& name_id, const Type& type);
void setNameText(); // Sets the name to whatever the name cache has at the moment
void refresh(const LLUUID& id, const std::string& name);
static void refreshAll(const LLUUID& id, const std::string& name);
@@ -66,9 +65,9 @@ struct LLNameUI : public LFIDBearer
virtual void setValue(const LLSD& value)
{
if (value.has("id"))
setNameID(value["id"].asUUID(), value["group"].asBoolean());
setNameID(value["id"].asUUID(), (Type)value["type"].asInteger());
else
setNameID(value.asUUID(), mIsGroup);
setNameID(value.asUUID(), mType);
}
// Return agent UUIDs
virtual LLSD getValue() const { return LLSD(mNameID); }
@@ -80,7 +79,7 @@ private:
protected:
LLUUID mNameID;
bool mRLVSensitive; // Whether or not we're doing RLV filtering
bool mIsGroup;
Type mType;
bool mAllowInteract;
std::string mInitialValue;
std::string mNameSystem;

View File

@@ -1241,7 +1241,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id)
if (mAvatarID.notNull())
LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this);
mAvatarID = avatar_id;
getChild<LLNameEditor>("dnname")->setNameID(avatar_id, false);
getChild<LLNameEditor>("dnname")->setNameID(avatar_id, LFIDBearer::AVATAR);
}
if (avatar_id.isNull()) return;

View File

@@ -101,15 +101,15 @@ void LLPanelMediaSettingsPermissions::draw()
{
if(mPermsGroupName)
{
mPermsGroupName->setNameID(group_id, true);
mPermsGroupName->setNameID(group_id, LFIDBearer::GROUP);
}
}
else
{
if(mPermsGroupName)
{
mPermsGroupName->setNameID(LLUUID::null, TRUE);
mPermsGroupName->refresh(LLUUID::null, std::string(), true);
mPermsGroupName->setNameID(LLUUID::null, LFIDBearer::GROUP);
mPermsGroupName->refresh(LLUUID::null, std::string());
}
}
}

View File

@@ -445,7 +445,7 @@ void LLPanelPermissions::refresh()
{
if(mLabelGroupName)
{
mLabelGroupName->setNameID(group_id, TRUE);
mLabelGroupName->setNameID(group_id, LFIDBearer::GROUP);
mLabelGroupName->setEnabled(TRUE);
}
}
@@ -453,8 +453,8 @@ void LLPanelPermissions::refresh()
{
if(mLabelGroupName)
{
mLabelGroupName->setNameID(LLUUID::null, TRUE);
mLabelGroupName->refresh(LLUUID::null, std::string(), true);
mLabelGroupName->setNameID(LLUUID::null, LFIDBearer::GROUP);
mLabelGroupName->refresh(LLUUID::null, std::string());
mLabelGroupName->setEnabled(FALSE);
}
}
@@ -1016,7 +1016,7 @@ void LLPanelPermissions::cbGroupID(LLUUID group_id)
{
if(mLabelGroupName)
{
mLabelGroupName->setNameID(group_id, TRUE);
mLabelGroupName->setNameID(group_id, LFIDBearer::GROUP);
}
LLSelectMgr::getInstance()->sendGroup(group_id);
}

View File

@@ -78,7 +78,7 @@
<name_box type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-162" drop_shadow_visible="true" enabled="false" follows="left|top"
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="96"
mouse_opaque="true" name="GroupText" v_pad="0" is_group="true"/>
mouse_opaque="true" name="GroupText" v_pad="0" type="1"/>
<button bottom="-160" enabled="true" follows="left|top" font="SansSerifSmall"
halign="center" height="16" label="Set..." label_selected="Set..."
left="350" mouse_opaque="true" name="Set..." scale_image="true" width="90" />

View File

@@ -497,7 +497,7 @@
bottom="-126"
left_delta="78"
name="Group Name Proxy"
width="142" is_group="true"/>
width="142" type="1"/>
<button bottom="-126" follows="top|right" font="SansSerifSmall" halign="center"
height="16" label="Set" label_selected="Set..." left_delta="142"
mouse_opaque="true" name="button set group" scale_image="TRUE" width="30" />

View File

@@ -22,7 +22,7 @@ Hover your mouse over the options for more help.
<name_box bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-20" drop_shadow_visible="true" follows="left|top"
font="SansSerifBig" h_pad="0" halign="left" height="16" left="7"
mouse_opaque="true" name="group_name" v_pad="0" is_group="true">
mouse_opaque="true" name="group_name" v_pad="0" type="1">
Type your new group name here
</name_box>
<text font="SansSerifSmall" name="prepend_founded_by">