Add gear button to LL's legacy profiles and replace FSDropTarget with LLProfileDropTarget

meow-7.2.2
Ansariel 2019-07-19 15:00:52 +02:00
parent 16e444f639
commit b0fa0330f1
6 changed files with 41 additions and 57 deletions

View File

@ -34,7 +34,6 @@
#include "llviewerinventory.h"
static LLDefaultChildRegistry::Register<FSCopyTransInventoryDropTarget> r1("fs_copytrans_inventory_drop_target");
static LLDefaultChildRegistry::Register<FSDropTarget> r2("profile_drop_target");
static LLDefaultChildRegistry::Register<FSEmbeddedItemDropTarget> r3("fs_embedded_item_drop_target");
@ -70,29 +69,6 @@ BOOL FSCopyTransInventoryDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask,
return TRUE;
}
FSDropTarget::FSDropTarget(const FSDropTarget::Params& p)
: LLView(p),
mAgentID(p.agent_id)
{}
BOOL FSDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg)
{
if (getParent())
{
LLToolDragAndDrop::handleGiveDragAndDrop(mAgentID, LLUUID::null, drop,
cargo_type, cargo_data, accept);
return TRUE;
}
return FALSE;
}
BOOL FSEmbeddedItemDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,

View File

@ -70,37 +70,6 @@ private:
};
class FSDropTarget : public LLView
{
public:
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Optional<LLUUID> agent_id;
Params()
: agent_id("agent_id")
{
changeDefault(mouse_opaque, false);
changeDefault(follows.flags, FOLLOWS_ALL);
}
};
FSDropTarget(const Params&);
~FSDropTarget() {}
// LLView functionality
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg);
void setAgentID(const LLUUID &agent_id) { mAgentID = agent_id; }
protected:
LLUUID mAgentID;
};
class FSEmbeddedItemDropTarget : public LLTextBox
{
public:

View File

@ -310,7 +310,7 @@ void FSPanelProfileSecondLife::onOpen(const LLSD& key)
mDescriptionEdit->setParseHTML(!own_profile && !getEmbedded());
FSDropTarget* drop_target = getChild<FSDropTarget>("drop_target");
LLProfileDropTarget* drop_target = getChild<LLProfileDropTarget>("drop_target");
drop_target->setVisible(!own_profile);
drop_target->setEnabled(!own_profile);

View File

@ -283,6 +283,7 @@ BOOL LLPanelProfileSecondLife::postBuild()
mIMButton = getChild<LLButton>("im");
mCopyMenuButton = getChild<LLMenuButton>("copy_btn");
mGiveInvPanel = getChild<LLPanel>("give_stack");
mOverflowButton = getChild<LLMenuButton>("overflow_btn"); // <FS:Ansariel> Gear button
mStatusText->setVisible(FALSE);
mCopyMenuButton->setVisible(FALSE);
@ -308,6 +309,24 @@ BOOL LLPanelProfileSecondLife::postBuild()
mGroupList->setDoubleClickCallback(boost::bind(&LLPanelProfileSecondLife::openGroupProfile, this));
mGroupList->setReturnCallback(boost::bind(&LLPanelProfileSecondLife::openGroupProfile, this));
// <FS:Ansariel> Gear button
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("Profile.Call", [this](LLUICtrl*, const LLSD&) { LLAvatarActions::startCall(getAvatarId()); });
registrar.add("Profile.AddToContactSet", [this](LLUICtrl*, const LLSD&) { LLAvatarActions::addToContactSet(getAvatarId()); });
registrar.add("Profile.Share", [this](LLUICtrl*, const LLSD&) { LLAvatarActions::share(getAvatarId()); });
registrar.add("Profile.Kick", [this](LLUICtrl*, const LLSD&) { LLAvatarActions::kick(getAvatarId()); });
registrar.add("Profile.Freeze", [this](LLUICtrl*, const LLSD&) { LLAvatarActions::freeze(getAvatarId()); });
registrar.add("Profile.Unfreeze", [this](LLUICtrl*, const LLSD&) { LLAvatarActions::unfreeze(getAvatarId()); });
registrar.add("Profile.CSR", [this](LLUICtrl*, const LLSD&) { LLAvatarName av_name; LLAvatarNameCache::get(getAvatarId(), &av_name); std::string name = av_name.getUserName(); LLAvatarActions::csr(getAvatarId(), name); });
registrar.add("Profile.CopyNameToClipboard", [this](LLUICtrl*, const LLSD&) { onCommitMenu("complete_name"); });
registrar.add("Profile.CopyURI", [this](LLUICtrl*, const LLSD&) { onCommitMenu("uri"); });
registrar.add("Profile.CopyKey", [this](LLUICtrl*, const LLSD&) { onCommitMenu("id"); });
registrar.add("Profile.Report", [this](LLUICtrl*, const LLSD&) { LLAvatarActions::report(getAvatarId()); });
LLToggleableMenu* profile_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mOverflowButton->setMenu(profile_menu, LLMenuButton::MP_TOP_RIGHT);
// </FS:Ansariel>
LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
mCopyMenuButton->setMenu("menu_name_field.xml", LLMenuButton::MP_BOTTOM_RIGHT);
@ -888,6 +907,16 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata)
{
wstr = utf8str_to_wstring(av_name.getAccountName());
}
// <FS:Ansariel> Gear button
else if (item_name == "complete_name")
{
wstr = utf8str_to_wstring(av_name.getCompleteName());
}
else if (item_name == "uri")
{
wstr = utf8str_to_wstring(LLSLURL("agent", getAvatarId(), "about").getSLURLString());
}
// </FS:Ansariel>
else if (item_name == "id")
{
wstr = utf8str_to_wstring(getAvatarId().asString());

View File

@ -205,6 +205,7 @@ private:
LLButton* mIMButton;
LLMenuButton* mCopyMenuButton;
LLPanel* mGiveInvPanel;
LLMenuButton* mOverflowButton; // <FS:Ansariel> Gear button
bool mVoiceStatus;

View File

@ -122,7 +122,6 @@
height="20"
follows="left|top|right"
layout="topleft"
allow_scroll="false"
bg_visible="false"
border_visible="false">
<text_editor
@ -553,6 +552,7 @@
tool_tip="Block this Resident"
top_pad="2"
height="20"
right="-40"
follows="left|top|right"
layout="topleft"
/>
@ -562,9 +562,18 @@
tool_tip="Unblock this Resident"
top_delta="0"
height="20"
right="-40"
follows="left|top|right"
layout="topleft"
/>
<menu_button
left_pad="4"
height="20"
width="36"
layout="topleft"
follows="top|right"
name="overflow_btn"
image_overlay="OptionsMenu_Off" />
</layout_panel>
</layout_stack>
<check_box