On second thought, clicking a name editor should open up the profile, too

The initial thinking behind this decision was that people may want to
select, if they do, they can right click for this very rare use case.
This commit is contained in:
Liru Færs
2019-10-10 12:37:47 -04:00
parent 2f72ed2e80
commit c6089637e7
6 changed files with 27 additions and 18 deletions

View File

@@ -34,18 +34,13 @@
#include "llnamebox.h"
#include "llcachename.h"
#include "llavataractions.h"
#include "llgroupactions.h"
static LLRegisterWidget<LLNameBox> r("name_box");
LLNameBox::LLNameBox(const std::string& name)
: LLNameUI()
, LLTextBox(name, LLRect(), LLStringUtil::null, nullptr, TRUE)
{
setClickedCallback(boost::bind(&LLNameBox::showProfile, this));
setClickedCallback(boost::bind(&LLNameUI::showProfile, this));
}
void LLNameBox::displayAsLink(bool link)
@@ -55,16 +50,6 @@ void LLNameBox::displayAsLink(bool link)
setDisabledColor(link ? color : LLUI::sColorsGroup->getColor("LabelDisabledColor"));
}
void LLNameBox::showProfile()
{
if (!mAllowInteract) return;
if (mIsGroup)
LLGroupActions::show(mNameID);
else
LLAvatarActions::showProfile(mNameID);
}
// virtual
BOOL LLNameBox::handleRightMouseDown(S32 x, S32 y, MASK mask)
{

View File

@@ -49,7 +49,6 @@ public:
void setValue(const LLSD& value) override final { LLNameUI::setValue(value); }
LLSD getValue() const override final { return LLNameUI::getValue(); }
void showProfile();
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override final;
protected:

View File

@@ -33,7 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llnameeditor.h"
#include "llcachename.h"
#include "llmenugl.h"
#include "lluictrlfactory.h"
@@ -56,6 +56,17 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect,
else setText(mInitialValue);
}
// virtual
BOOL LLNameEditor::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (mAllowInteract)
{
showProfile();
return true;
}
else return LLLineEditor::handleMouseDown(x, y, mask);
}
// virtual
BOOL LLNameEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
{

View File

@@ -49,6 +49,7 @@ public:
const LLFontGL* glfont = nullptr,
S32 max_text_length = 254);
BOOL handleMouseDown(S32 x, S32 y, MASK mask) override final;
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override final;
LLXMLNodePtr getXML(bool save_children = true) const override final;

View File

@@ -35,7 +35,9 @@
#include "llnameui.h"
#include "llagentdata.h"
#include "llavataractions.h"
#include "llavatarnamecache.h"
#include "llgroupactions.h"
#include "lltrans.h"
#include "rlvhandler.h"
@@ -126,4 +128,14 @@ void LLNameUI::refreshAll(const LLUUID& id, const std::string& full_name, bool i
{
box->refresh(id, full_name, is_group);
}
}
void LLNameUI::showProfile()
{
if (!mAllowInteract) return;
if (mIsGroup)
LLGroupActions::show(mNameID);
else
LLAvatarActions::showProfile(mNameID);
}

View File

@@ -57,6 +57,7 @@ struct LLNameUI : public LFIDBearer
static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group);
void setShowCompleteName(bool show) { mShowCompleteName = show; }
void showProfile();
virtual void displayAsLink(bool link) = 0; // Override to make the name display as a link
virtual void setText(const std::string& text) = 0;