Object info with right-clickable owner naame, also improve code overall

This commit is contained in:
Liru Færs
2020-02-11 15:06:39 -05:00
parent e65b513562
commit 2f369299c5
3 changed files with 14 additions and 43 deletions

View File

@@ -35,17 +35,13 @@
#include "llfloaterobjectiminfo.h"
#include "llagentdata.h"
#include "llavataractions.h"
#include "llcachename.h"
#include "llcommandhandler.h"
#include "llfloatergroupinfo.h"
#include "llfloatermute.h"
#include "llgroupactions.h"
#include "llmutelist.h"
#include "llnamebox.h"
#include "llslurl.h"
#include "lltrans.h"
#include "llui.h"
#include "lluictrl.h"
#include "lluictrlfactory.h"
#include "llurlaction.h"
#include "llweb.h"
@@ -61,24 +57,15 @@ LLFloaterObjectIMInfo::LLFloaterObjectIMInfo(const LLSD& seed)
: mName(), mSLurl(), mOwnerID(), mGroupOwned(false)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_object_im_info.xml");
if (!getRect().mLeft && !getRect().mBottom)
center();
}
static void show_avatar_profile(const LLUUID& id)
{
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
if ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) && RlvUtil::isNearbyAgent(id))
return;
// [/RLVa:KB]
LLAvatarActions::showProfile(id);
const auto& rect = getRect();
if (!rect.mLeft && !rect.mBottom)
center();
}
BOOL LLFloaterObjectIMInfo::postBuild()
{
getChild<LLUICtrl>("Mute")->setCommitCallback(boost::bind(&LLFloaterObjectIMInfo::onClickMute, this));
getChild<LLTextBox>("OwnerName")->setClickedCallback(boost::bind(boost::ref(mGroupOwned) ? boost::bind(LLGroupActions::show, boost::ref(mOwnerID)) : boost::bind(show_avatar_profile, boost::ref(mOwnerID))));
getChild<LLTextBox>("Slurl")->setClickedCallback(boost::bind(LLUrlAction::executeSLURL, boost::bind(std::plus<std::string>(), "secondlife:///app/worldmap/", boost::ref(mSLurl)), true));
return true;
@@ -103,23 +90,20 @@ void LLFloaterObjectIMInfo::update(const LLSD& data)
childSetVisible("Unknown_Slurl",!have_slurl);
childSetVisible("Slurl",have_slurl);
childSetText("ObjectName",mName);
childSetText("ObjectName", mName);
std::string slurl(mSLurl);
std::string::size_type i = slurl.rfind("?owner_not_object");
if (i != std::string::npos)
slurl.erase(i) += getString("owner");
childSetText("Slurl", slurl);
childSetText("OwnerName", LLStringUtil::null);
getChild<LLNameBox>("OwnerName")->setNameID(mOwnerID, mGroupOwned ? LFIDBearer::GROUP : LFIDBearer::AVATAR);
getChildView("ObjectID")->setValue(data["object_id"].asUUID());
// bool my_object = (owner_id == gAgentID);
// bool my_object = !mGroupOwned && (owner_id == gAgentID);
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
bool my_object = (mOwnerID == gAgentID) || ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) && (RlvUtil::isNearbyAgent(mOwnerID)));
bool my_object = !mGroupOwned && (mOwnerID == gAgentID) || ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) && (RlvUtil::isNearbyAgent(mOwnerID)));
// [/RLVa:KB]
childSetEnabled("Mute",!my_object);
if (gCacheName)
gCacheName->get(mOwnerID, mGroupOwned, boost::bind(&LLFloaterObjectIMInfo::nameCallback, this, _2));
}
void LLFloaterObjectIMInfo::onClickMute()
@@ -134,27 +118,17 @@ void LLFloaterObjectIMInfo::onClickMute()
close();
}
//static
void LLFloaterObjectIMInfo::nameCallback(const std::string& full_name)
{
childSetText("OwnerName", mName =
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
(!mGroupOwned && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) && RlvUtil::isNearbyAgent(mOwnerID)) ? RlvStrings::getAnonym(mName) :
// [/RLVa:KB]
full_name);
}
////////////////////////////////////////////////////////////////////////////
// LLObjectIMHandler
//moved to llchathistory.cpp in v2
// support for secondlife:///app/objectim/{UUID}/ SLapps
class LLObjectIMHandler : public LLCommandHandler
class LLObjectIMHandler final : public LLCommandHandler
{
public:
// requests will be throttled from a non-trusted browser
LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) override
{
if (params.size() < 1)
{

View File

@@ -35,21 +35,19 @@
#include "llfloater.h"
class LLFloaterObjectIMInfo : public LLFloater, public LLFloaterSingleton<LLFloaterObjectIMInfo>
class LLFloaterObjectIMInfo final : public LLFloater, public LLFloaterSingleton<LLFloaterObjectIMInfo>
{
public:
LLFloaterObjectIMInfo(const LLSD& sd);
virtual ~LLFloaterObjectIMInfo() { };
/*virtual*/ BOOL postBuild();
BOOL postBuild() override;
void update(const LLSD& payload);
// UI Handlers
void onClickMute();
void nameCallback(const std::string& full_name);
private:
LLUUID mOwnerID;
std::string mSLurl;

View File

@@ -42,11 +42,10 @@
mouse_opaque="true" name="LabelOwnerNameTitle" v_pad="0" width="78">
Owner:
</text>
<text bevel_style="none" border_style="line" border_visible="false"
<name_box bevel_style="none" border_style="line" border_visible="false"
border_thickness="0" bottom_delta="-10" enabled="true" follows="left|top"
font="SansSerif" height="20" is_unicode="false" left="70" hover="true"
max_length="254" mouse_opaque="true" name="OwnerName" font-style="UNDERLINE"
width="200" hover_cursor="UI_CURSOR_HAND" text_color="TextLinkColor" hover_color="TextLinkHoverColor"/>
max_length="254" mouse_opaque="true" name="OwnerName" width="200" rlv_sensitive="true"/>
<text bottom_delta="-10" follows="left|top" font="SansSerif" h_pad="0" halign="left" height="10" left="10" name="LabelObjectID" width="78">
Key:
</text>