Include object key in objectiminfo floater

General cleanup of llfloaterobjectiminfo included
Update of object im command handler code from v3
This commit is contained in:
Inusaito Sayori
2014-12-30 18:02:32 -05:00
parent a29b50b4cd
commit e7c1dc3b8e
3 changed files with 48 additions and 79 deletions

View File

@@ -58,32 +58,37 @@
// LLFloaterObjectIMInfo // LLFloaterObjectIMInfo
LLFloaterObjectIMInfo::LLFloaterObjectIMInfo(const LLSD& seed) LLFloaterObjectIMInfo::LLFloaterObjectIMInfo(const LLSD& seed)
: mObjectID(), mName(), mSLurl(), mOwnerID(), mGroupOwned(false) : mName(), mSLurl(), mOwnerID(), mGroupOwned(false)
{ {
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_object_im_info.xml"); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_object_im_info.xml");
if (getRect().mLeft == 0 if (!getRect().mLeft && !getRect().mBottom)
&& getRect().mBottom == 0)
{
center(); center();
}
} }
BOOL LLFloaterObjectIMInfo::postBuild(void) static void show_avatar_profile(const LLUUID& id)
{ {
childSetAction("Mute",onClickMute,this); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
childSetActionTextbox("OwnerName",onClickOwner, this); if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || !RlvUtil::isNearbyAgent(id))
childSetActionTextbox("Slurl",onClickMap, this); return;
// [/RLVa:KB]
LLAvatarActions::showProfile(id);
}
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::showLocationOnMap, "secondlife://" + static_cast<std::string>(boost::ref(mSLurl))));
return true; return true;
} }
void LLFloaterObjectIMInfo::update(LLSD& data) void LLFloaterObjectIMInfo::update(const LLSD& data)
{ {
// Extract appropriate object information from input LLSD // Extract appropriate object information from input LLSD
// (Eventually, it might be nice to query server for details // (Eventually, it might be nice to query server for details
// rather than require caller to pass in the information.) // rather than require caller to pass in the information.)
mObjectID = data["object_id"].asUUID();
mName = data["name"].asString(); mName = data["name"].asString();
mOwnerID = data["owner_id"].asUUID(); mOwnerID = data["owner_id"].asUUID();
mGroupOwned = data["group_owned"].asBoolean(); mGroupOwned = data["group_owned"].asBoolean();
@@ -100,7 +105,8 @@ void LLFloaterObjectIMInfo::update(LLSD& data)
childSetText("ObjectName",mName); childSetText("ObjectName",mName);
childSetText("Slurl",mSLurl); childSetText("Slurl",mSLurl);
childSetText("OwnerName",std::string("")); childSetText("OwnerName", LLStringUtil::null);
getChildView("ObjectID")->setValue(data["object_id"].asUUID());
// bool my_object = (owner_id == gAgentID); // bool my_object = (owner_id == gAgentID);
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
@@ -108,77 +114,43 @@ void LLFloaterObjectIMInfo::update(LLSD& data)
// [/RLVa:KB] // [/RLVa:KB]
childSetEnabled("Mute",!my_object); childSetEnabled("Mute",!my_object);
if (gCacheName) gCacheName->get(mOwnerID,mGroupOwned,boost::bind(&LLFloaterObjectIMInfo::nameCallback,this,_1,_2,_3)); if (gCacheName)
gCacheName->get(mOwnerID, mGroupOwned, boost::bind(&LLFloaterObjectIMInfo::nameCallback, this, _2));
} }
//static void LLFloaterObjectIMInfo::onClickMute()
void LLFloaterObjectIMInfo::onClickMap(void* data)
{ {
LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data;
std::string url = "secondlife://" + self->mSLurl;
LLUrlAction::showLocationOnMap(url);
}
//static
void LLFloaterObjectIMInfo::onClickOwner(void* data)
{
LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data;
if (self->mGroupOwned)
{
LLGroupActions::show(self->mOwnerID);
}
// else
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
else if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (!RlvUtil::isNearbyAgent(self->mOwnerID)) ) if (!mGroupOwned && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && RlvUtil::isNearbyAgent(mOwnerID))
// [/RLVa:KB]
{
LLAvatarActions::showProfile(self->mOwnerID);
}
}
//static
void LLFloaterObjectIMInfo::onClickMute(void* data)
{
LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data;
LLMute::EType mute_type = (self->mGroupOwned) ? LLMute::GROUP : LLMute::AGENT;
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
if ( (LLMute::GROUP != mute_type) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(self->mOwnerID)) )
{
return; return;
}
// [/RLVa:KB] // [/RLVa:KB]
LLMute mute(self->mOwnerID, self->mName, mute_type); LLMuteList::instance().add(LLMute(mOwnerID, mName, mGroupOwned ? LLMute::GROUP : LLMute::AGENT));
LLMuteList::getInstance()->add(mute);
LLFloaterMute::showInstance(); LLFloaterMute::showInstance();
self->close(); close();
} }
//static //static
void LLFloaterObjectIMInfo::nameCallback(const LLUUID& id, const std::string& full_name, bool is_group) void LLFloaterObjectIMInfo::nameCallback(const std::string& full_name)
{ {
mName = full_name; childSetText("OwnerName", mName =
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g
if ( (!is_group) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(id)) ) (!mGroupOwned && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && RlvUtil::isNearbyAgent(mOwnerID)) ? RlvStrings::getAnonym(mName) :
{
mName = RlvStrings::getAnonym(mName);
}
// [/RLVa:KB] // [/RLVa:KB]
full_name);
childSetText("OwnerName", mName);
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// LLObjectIMInfoHandler // LLObjectIMHandler
//moved to llchathistory.cpp in v2 //moved to llchathistory.cpp in v2
class LLObjectIMInfoHandler : public LLCommandHandler // support for secondlife:///app/objectim/{UUID}/ SLapps
class LLObjectIMHandler : public LLCommandHandler
{ {
public: public:
LLObjectIMInfoHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) { } // 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)
{ {
if (params.size() < 1) if (params.size() < 1)
{ {
@@ -197,12 +169,8 @@ public:
payload["name"] = query_map["name"]; payload["name"] = query_map["name"];
payload["slurl"] = LLWeb::escapeURL(query_map["slurl"]); payload["slurl"] = LLWeb::escapeURL(query_map["slurl"]);
payload["group_owned"] = query_map["groupowned"]; payload["group_owned"] = query_map["groupowned"];
LLFloaterObjectIMInfo::showInstance()->update(payload); LLFloaterObjectIMInfo::showInstance()->update(payload);
return true; return true;
} }
}; };
LLObjectIMHandler gObjectIMHandler;
// Creating the object registers with the dispatcher.
LLObjectIMInfoHandler gObjectIMHandler;

View File

@@ -41,19 +41,16 @@ public:
LLFloaterObjectIMInfo(const LLSD& sd); LLFloaterObjectIMInfo(const LLSD& sd);
virtual ~LLFloaterObjectIMInfo() { }; virtual ~LLFloaterObjectIMInfo() { };
/*virtual*/ BOOL postBuild(void); /*virtual*/ BOOL postBuild();
void update(LLSD& payload); void update(const LLSD& payload);
// UI Handlers // UI Handlers
static void onClickMap(void* data); void onClickMute();
static void onClickOwner(void* data);
static void onClickMute(void* data);
void nameCallback(const LLUUID& id, const std::string& full_name, bool is_group); void nameCallback(const std::string& full_name);
private: private:
LLUUID mObjectID;
LLUUID mOwnerID; LLUUID mOwnerID;
std::string mSLurl; std::string mSLurl;
std::string mName; std::string mName;

View File

@@ -5,7 +5,7 @@
rect_control="FloaterObjectIMInfo" short_title="Object Info" title="Object Information" > rect_control="FloaterObjectIMInfo" short_title="Object Info" title="Object Information" >
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-35" drop_shadow_visible="true" follows="left|top" bottom="-33" drop_shadow_visible="true" follows="left|top"
font="SansSerif" h_pad="0" halign="left" height="10" left="10" font="SansSerif" h_pad="0" halign="left" height="10" left="10"
mouse_opaque="true" name="LabelItemNameTitle" v_pad="0" width="78"> mouse_opaque="true" name="LabelItemNameTitle" v_pad="0" width="78">
Object: Object:
@@ -17,7 +17,7 @@
width="200" /> width="200" />
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-60" drop_shadow_visible="true" follows="left|top" bottom_delta="-10" drop_shadow_visible="true" follows="left|top"
font="SansSerif" h_pad="0" halign="left" height="10" left="10" font="SansSerif" h_pad="0" halign="left" height="10" left="10"
mouse_opaque="true" name="LabelSlurlTitle" v_pad="0" width="78"> mouse_opaque="true" name="LabelSlurlTitle" v_pad="0" width="78">
Location: Location:
@@ -37,7 +37,7 @@
</text> </text>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="-85" drop_shadow_visible="true" follows="left|top" bottom_delta="-10" drop_shadow_visible="true" follows="left|top"
font="SansSerif" h_pad="0" halign="left" height="10" left="10" font="SansSerif" h_pad="0" halign="left" height="10" left="10"
mouse_opaque="true" name="LabelOwnerNameTitle" v_pad="0" width="78"> mouse_opaque="true" name="LabelOwnerNameTitle" v_pad="0" width="78">
Owner: Owner:
@@ -47,8 +47,12 @@
font="SansSerif" height="20" is_unicode="false" left="70" hover="true" font="SansSerif" height="20" is_unicode="false" left="70" hover="true"
max_length="254" mouse_opaque="true" name="OwnerName" font-style="UNDERLINE" max_length="254" mouse_opaque="true" name="OwnerName" font-style="UNDERLINE"
width="200" hover_cursor="UI_CURSOR_HAND" text_color="TextLinkColor" hover_color="TextLinkHoverColor"/> width="200" hover_cursor="UI_CURSOR_HAND" text_color="TextLinkColor" hover_color="TextLinkHoverColor"/>
<text bottom_delta="-10" follows="left|top" font="SansSerif" h_pad="0" halign="left" height="10" left="10" name="LabelObjectID" width="78">
Key:
</text>
<line_editor name="ObjectID" width="209" height="16" left="70" bottom_delta="-7" enabled="false"/>
<button bottom_delta="-30" font="SansSerif" halign="center" height="20" label="Mute Owner" <button bottom_delta="-28" font="SansSerif" halign="center" height="20" label="Mute Owner"
label_selected="Mute Owner" left="70" mouse_opaque="true" name="Mute" label_selected="Mute Owner" left="70" mouse_opaque="true" name="Mute"
width="160" /> width="160" />
</floater> </floater>