summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-04-18 19:26:37 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-04-18 19:26:37 +0300
commit8a3fce881fbf971046be50d9d7198e58772e3164 (patch)
tree7dd98d630eb24559a36190dbb36c6eba4266c104
parentb5f842183958f5de8a09156510ede53ac34a5310 (diff)
SL-10791 [Legacy Profiles] Functionality to copy agent id and name from profile
-rw-r--r--indra/llui/llmenubutton.cpp8
-rw-r--r--indra/llui/llmenubutton.h3
-rw-r--r--indra/newview/llpanelprofile.cpp37
-rw-r--r--indra/newview/llpanelprofile.h2
-rw-r--r--indra/newview/skins/default/textures/icons/CopyBright.pngbin0 -> 519 bytes
-rw-r--r--indra/newview/skins/default/textures/textures.xml1
-rw-r--r--indra/newview/skins/default/xui/en/menu_name_field.xml22
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_secondlife.xml48
8 files changed, 109 insertions, 12 deletions
diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp
index 303afcda15..583704418b 100644
--- a/indra/llui/llmenubutton.cpp
+++ b/indra/llui/llmenubutton.cpp
@@ -40,6 +40,7 @@ void LLMenuButton::MenuPositions::declareValues()
declare("topleft", MP_TOP_LEFT);
declare("topright", MP_TOP_RIGHT);
declare("bottomleft", MP_BOTTOM_LEFT);
+ declare("bottomright", MP_BOTTOM_RIGHT);
}
LLMenuButton::Params::Params()
@@ -212,6 +213,13 @@ void LLMenuButton::updateMenuOrigin()
mY = rect.mBottom;
break;
}
+ case MP_BOTTOM_RIGHT:
+ {
+ const LLRect& menu_rect = menu->getRect();
+ mX = rect.mRight - menu_rect.getWidth();
+ mY = rect.mBottom;
+ break;
+ }
}
}
diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h
index 67ec1983b3..e42f8f53bd 100644
--- a/indra/llui/llmenubutton.h
+++ b/indra/llui/llmenubutton.h
@@ -41,7 +41,8 @@ public:
{
MP_TOP_LEFT,
MP_TOP_RIGHT,
- MP_BOTTOM_LEFT
+ MP_BOTTOM_LEFT,
+ MP_BOTTOM_RIGHT
} EMenuPosition;
struct MenuPositions
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index e5fa8de6a0..d40f874f24 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -34,7 +34,7 @@
// UI
#include "llavatariconctrl.h"
-// #include "llclipboard.h" //gClipboard
+#include "llclipboard.h"
#include "llcheckboxctrl.h"
#include "lllineeditor.h"
#include "llloadingindicator.h"
@@ -269,8 +269,10 @@ BOOL LLPanelProfileSecondLife::postBuild()
mGroupInviteButton = getChild<LLButton>("group_invite");
mPayButton = getChild<LLButton>("pay");
mIMButton = getChild<LLButton>("im");
+ mCopyMenuButton = getChild<LLMenuButton>("copy_btn");
mStatusText->setVisible(FALSE);
+ mCopyMenuButton->setVisible(FALSE);
mAddFriendButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onAddFriendButtonClick, this));
mIMButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onIMButtonClick, this));
@@ -283,6 +285,9 @@ BOOL LLPanelProfileSecondLife::postBuild()
mDisplayNameButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onClickSetName, this));
mSecondLifePic->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onCommitTexture, this));
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit;
+ commit.add("Profile.CopyName", [this](LLUICtrl*, const LLSD& userdata) { onCommitMenu(userdata); });
+
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable;
enable.add("Profile.EnableCall", [this](LLUICtrl*, const LLSD&) { return mVoiceStatus; });
enable.add("Profile.EnableGod", [](LLUICtrl*, const LLSD&) { return gAgent.isGodlike(); });
@@ -291,6 +296,7 @@ BOOL LLPanelProfileSecondLife::postBuild()
mGroupList->setReturnCallback(boost::bind(&LLPanelProfileSecondLife::openGroupProfile, this));
LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
+ mCopyMenuButton->setMenu("menu_name_field.xml", LLMenuButton::MP_BOTTOM_RIGHT);
return TRUE;
}
@@ -407,6 +413,7 @@ void LLPanelProfileSecondLife::resetData()
mDescriptionEdit->setValue(LLStringUtil::null);
mStatusText->setVisible(FALSE);
+ mCopyMenuButton->setVisible(FALSE);
mGroups.clear();
mGroupList->setGroups(mGroups);
}
@@ -467,6 +474,7 @@ void LLPanelProfileSecondLife::onAvatarNameCache(const LLUUID& agent_id, const L
mAvatarNameCacheConnection.disconnect();
getChild<LLUICtrl>("complete_name")->setValue( av_name.getCompleteName() );
+ mCopyMenuButton->setVisible(TRUE);
}
void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
@@ -763,6 +771,33 @@ void LLPanelProfileSecondLife::onCommitTexture()
}
}
+void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata)
+{
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(getAvatarId(), &av_name))
+ {
+ // shouldn't happen, button(menu) is supposed to be invisible while name is fetching
+ LL_WARNS() << "Failed to get agent data" << LL_ENDL;
+ return;
+ }
+
+ const std::string item_name = userdata.asString();
+ LLWString wstr;
+ if (item_name == "display")
+ {
+ wstr = utf8str_to_wstring(av_name.getDisplayName());
+ }
+ else if (item_name == "name")
+ {
+ wstr = utf8str_to_wstring(av_name.getAccountName());
+ }
+ else if (item_name == "id")
+ {
+ wstr = utf8str_to_wstring(getAvatarId().asString());
+ }
+ LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size());
+}
+
void LLPanelProfileSecondLife::onAvatarNameCacheSetName(const LLUUID& agent_id, const LLAvatarName& av_name)
{
if (av_name.getDisplayName().empty())
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 4ed09761df..ba98a360fa 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -178,6 +178,7 @@ private:
/*virtual*/ void updateButtons();
void onClickSetName();
void onCommitTexture();
+ void onCommitMenu(const LLSD& userdata);
void onAvatarNameCacheSetName(const LLUUID& id, const LLAvatarName& av_name);
private:
@@ -201,6 +202,7 @@ private:
LLButton* mGroupInviteButton;
LLButton* mPayButton;
LLButton* mIMButton;
+ LLMenuButton* mCopyMenuButton;
bool mVoiceStatus;
diff --git a/indra/newview/skins/default/textures/icons/CopyBright.png b/indra/newview/skins/default/textures/icons/CopyBright.png
new file mode 100644
index 0000000000..8d21c47295
--- /dev/null
+++ b/indra/newview/skins/default/textures/icons/CopyBright.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 2540ee148d..444ad358c3 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -187,6 +187,7 @@ with the same filename but different name
<texture name="Conv_log_inbox" file_name="icons/Conv_log_inbox.png" preload="false" />
<texture name="Copy" file_name="icons/Copy.png" preload="false" />
+ <texture name="CopyBright" file_name="icons/CopyBright.png" preload="false" />
<texture name="DisclosureArrow_Opened_Off" file_name="widgets/DisclosureArrow_Opened_Off.png" preload="true" />
diff --git a/indra/newview/skins/default/xui/en/menu_name_field.xml b/indra/newview/skins/default/xui/en/menu_name_field.xml
new file mode 100644
index 0000000000..3c5e5dd353
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_name_field.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<toggleable_menu
+ name="CopyMenu">
+ <menu_item_call
+ label="Copy Display Name"
+ layout="topleft"
+ name="copy_display">
+ <on_click function="Profile.CopyName" parameter="display"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Copy Agent Name"
+ layout="topleft"
+ name="copy_name">
+ <on_click function="Profile.CopyName" parameter="name"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Copy Agent Id"
+ layout="topleft"
+ name="copy_id">
+ <on_click function="Profile.CopyName" parameter="id"/>
+ </menu_item_call>
+</toggleable_menu>
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 8ebb1522b4..e577e6a4d2 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
@@ -112,23 +112,51 @@
layout="topleft"
visible="false"
/>
- <text_editor
- name="complete_name"
- value="(loading...)"
- enabled="false"
+ <panel
+ name="name_holder"
top_delta="0"
left_pad="4"
- right="-6"
+ right="-5"
height="20"
follows="left|top|right"
layout="topleft"
allow_scroll="false"
bg_visible="false"
- border_visible="true"
- h_pad="1"
- v_pad="2"
- max_length="254"
- />
+ border_visible="false">
+ <text_editor
+ name="complete_name"
+ value="(loading...)"
+ enabled="false"
+ top="0"
+ left="0"
+ right="-1"
+ height="20"
+ follows="left|top|right"
+ layout="topleft"
+ allow_scroll="false"
+ bg_visible="false"
+ border_visible="true"
+ h_pad="1"
+ v_pad="2"
+ max_length="254"
+ />
+ <!--mouse_opaque="true"-->
+ <menu_button
+ name="copy_btn"
+ height="16"
+ right="-2"
+ top="2"
+ width="16"
+ image_selected="Copy"
+ image_unselected="Copy"
+ image_hover_selected="CopyBright"
+ image_hover_unselected="CopyBright"
+ hover_glow_amount="0.33"
+ chrome="true"
+ tab_stop="false"
+ follows="top|right"
+ layout="topleft" />
+ </panel>
<layout_stack
name="imagepositioner"
top_pad="6"