From b0fa0330f1064c2a66974aea1aec9990a6f7f40f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 19 Jul 2019 15:00:52 +0200 Subject: [PATCH] Add gear button to LL's legacy profiles and replace FSDropTarget with LLProfileDropTarget --- indra/newview/fsdroptarget.cpp | 24 -------------- indra/newview/fsdroptarget.h | 31 ------------------- indra/newview/fspanelprofile.cpp | 2 +- indra/newview/llpanelprofile.cpp | 29 +++++++++++++++++ indra/newview/llpanelprofile.h | 1 + .../xui/en/panel_profile_secondlife.xml | 11 ++++++- 6 files changed, 41 insertions(+), 57 deletions(-) diff --git a/indra/newview/fsdroptarget.cpp b/indra/newview/fsdroptarget.cpp index 99957ed6d7..8e6a4bcf5f 100644 --- a/indra/newview/fsdroptarget.cpp +++ b/indra/newview/fsdroptarget.cpp @@ -34,7 +34,6 @@ #include "llviewerinventory.h" static LLDefaultChildRegistry::Register r1("fs_copytrans_inventory_drop_target"); -static LLDefaultChildRegistry::Register r2("profile_drop_target"); static LLDefaultChildRegistry::Register 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, diff --git a/indra/newview/fsdroptarget.h b/indra/newview/fsdroptarget.h index f676cc4eb8..a5cc32fb3f 100644 --- a/indra/newview/fsdroptarget.h +++ b/indra/newview/fsdroptarget.h @@ -70,37 +70,6 @@ private: }; -class FSDropTarget : public LLView -{ -public: - struct Params : public LLInitParam::Block - { - Optional 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: diff --git a/indra/newview/fspanelprofile.cpp b/indra/newview/fspanelprofile.cpp index 4abea930ab..79bb862e5c 100644 --- a/indra/newview/fspanelprofile.cpp +++ b/indra/newview/fspanelprofile.cpp @@ -310,7 +310,7 @@ void FSPanelProfileSecondLife::onOpen(const LLSD& key) mDescriptionEdit->setParseHTML(!own_profile && !getEmbedded()); - FSDropTarget* drop_target = getChild("drop_target"); + LLProfileDropTarget* drop_target = getChild("drop_target"); drop_target->setVisible(!own_profile); drop_target->setEnabled(!own_profile); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 8ee27fa949..59e949d488 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -283,6 +283,7 @@ BOOL LLPanelProfileSecondLife::postBuild() mIMButton = getChild("im"); mCopyMenuButton = getChild("copy_btn"); mGiveInvPanel = getChild("give_stack"); + mOverflowButton = getChild("overflow_btn"); // 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)); + // 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("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + mOverflowButton->setMenu(profile_menu, LLMenuButton::MP_TOP_RIGHT); + // + 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()); } + // 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()); + } + // else if (item_name == "id") { wstr = utf8str_to_wstring(getAvatarId().asString()); diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 260fa78378..64bbd6f090 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -205,6 +205,7 @@ private: LLButton* mIMButton; LLMenuButton* mCopyMenuButton; LLPanel* mGiveInvPanel; + LLMenuButton* mOverflowButton; // Gear button bool mVoiceStatus; diff --git a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml index 4f6eddb56c..e2e7019f8a 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml @@ -122,7 +122,6 @@ height="20" follows="left|top|right" layout="topleft" - allow_scroll="false" bg_visible="false" border_visible="false"> @@ -562,9 +562,18 @@ tool_tip="Unblock this Resident" top_delta="0" height="20" + right="-40" follows="left|top|right" layout="topleft" /> +