diff options
author | McCabe Maxsted | 2011-06-08 08:08:14 -0700 |
---|---|---|
committer | Jacek Antonelli | 2011-06-09 23:11:49 -0500 |
commit | f97f281c4f7d1407d2518067ff73c77fa975132c (patch) | |
tree | d402e895352d0e9a0967762dba8fd26294b0663b /linden/indra/newview | |
parent | Merge remote-tracking branch 'mccabe/1.4-fbeta-iwsupport' into next (diff) | |
download | meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.zip meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.tar.gz meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.tar.bz2 meta-impy-f97f281c4f7d1407d2518067ff73c77fa975132c.tar.xz |
Added copy group link button to create clickable links to groups in the viewer
(cherry picked from commit 18464593de52a31fa098f5ee5e543d9a44f1889e)
Diffstat (limited to 'linden/indra/newview')
-rw-r--r-- | linden/indra/newview/llpanelgroupgeneral.cpp | 44 | ||||
-rw-r--r-- | linden/indra/newview/llpanelgroupgeneral.h | 2 | ||||
-rw-r--r-- | linden/indra/newview/llurldispatcher.cpp | 12 | ||||
-rw-r--r-- | linden/indra/newview/llurldispatcher.h | 2 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml | 10 |
5 files changed, 68 insertions, 2 deletions
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp index 8c522cc..e466f05 100644 --- a/linden/indra/newview/llpanelgroupgeneral.cpp +++ b/linden/indra/newview/llpanelgroupgeneral.cpp | |||
@@ -38,6 +38,8 @@ | |||
38 | 38 | ||
39 | #include "lluictrlfactory.h" | 39 | #include "lluictrlfactory.h" |
40 | #include "llagent.h" | 40 | #include "llagent.h" |
41 | #include "llchat.h" | ||
42 | #include "llfloaterchat.h" | ||
41 | #include "roles_constants.h" | 43 | #include "roles_constants.h" |
42 | #include "llfloateravatarinfo.h" | 44 | #include "llfloateravatarinfo.h" |
43 | #include "llfloatergroupinfo.h" | 45 | #include "llfloatergroupinfo.h" |
@@ -56,6 +58,7 @@ | |||
56 | #include "lltextbox.h" | 58 | #include "lltextbox.h" |
57 | #include "lltexteditor.h" | 59 | #include "lltexteditor.h" |
58 | #include "lltexturectrl.h" | 60 | #include "lltexturectrl.h" |
61 | #include "llurldispatcher.h" | ||
59 | #include "llviewercontrol.h" | 62 | #include "llviewercontrol.h" |
60 | #include "llviewerwindow.h" | 63 | #include "llviewerwindow.h" |
61 | 64 | ||
@@ -144,6 +147,13 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
144 | mBtnInfo->setCallbackUserData(this); | 147 | mBtnInfo->setCallbackUserData(this); |
145 | } | 148 | } |
146 | 149 | ||
150 | mBtnCopyLink = getChild<LLButton>("copy_link_button", recurse); | ||
151 | if ( mBtnCopyLink ) | ||
152 | { | ||
153 | mBtnCopyLink->setClickedCallback(onClickCopyLink); | ||
154 | mBtnCopyLink->setCallbackUserData(this); | ||
155 | } | ||
156 | |||
147 | LLTextBox* founder = getChild<LLTextBox>("founder_name"); | 157 | LLTextBox* founder = getChild<LLTextBox>("founder_name"); |
148 | if (founder) | 158 | if (founder) |
149 | { | 159 | { |
@@ -269,6 +279,7 @@ BOOL LLPanelGroupGeneral::postBuild() | |||
269 | 279 | ||
270 | mBtnJoinGroup->setVisible(FALSE); | 280 | mBtnJoinGroup->setVisible(FALSE); |
271 | mBtnInfo->setVisible(FALSE); | 281 | mBtnInfo->setVisible(FALSE); |
282 | mBtnCopyLink->setVisible(FALSE); | ||
272 | mGroupName->setVisible(FALSE); | 283 | mGroupName->setVisible(FALSE); |
273 | } | 284 | } |
274 | 285 | ||
@@ -404,6 +415,39 @@ bool LLPanelGroupGeneral::joinDlgCB(const LLSD& notification, const LLSD& respon | |||
404 | } | 415 | } |
405 | 416 | ||
406 | // static | 417 | // static |
418 | void LLPanelGroupGeneral::onClickCopyLink(void* userdata) | ||
419 | { | ||
420 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)userdata; | ||
421 | |||
422 | if (!self || (self->mGroupID).isNull()) return; | ||
423 | |||
424 | LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID); | ||
425 | |||
426 | // make sure we don't have junk | ||
427 | if (gdatap) | ||
428 | { | ||
429 | std::string buffer = LLURLDispatcher::createGroupJoinLink(gdatap->getID()); | ||
430 | |||
431 | // Say same info in chat -- MC | ||
432 | LLStringUtil::format_map_t targs; | ||
433 | targs["[SLURL]"] = buffer; | ||
434 | std::string msg = self->getString("copy_group_link_info"); | ||
435 | LLStringUtil::format(msg, targs); | ||
436 | |||
437 | LLChat chat; | ||
438 | chat.mSourceType = CHAT_SOURCE_SYSTEM; | ||
439 | chat.mText = msg; | ||
440 | LLFloaterChat::addChat(chat); | ||
441 | |||
442 | gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); | ||
443 | } | ||
444 | else | ||
445 | { | ||
446 | llwarns << "Trying to copy group slurl link with no group data!" << llendl; | ||
447 | } | ||
448 | } | ||
449 | |||
450 | // static | ||
407 | void LLPanelGroupGeneral::openProfile(void* data) | 451 | void LLPanelGroupGeneral::openProfile(void* data) |
408 | { | 452 | { |
409 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; | 453 | LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; |
diff --git a/linden/indra/newview/llpanelgroupgeneral.h b/linden/indra/newview/llpanelgroupgeneral.h index c4572e2..9e39125 100644 --- a/linden/indra/newview/llpanelgroupgeneral.h +++ b/linden/indra/newview/llpanelgroupgeneral.h | |||
@@ -76,6 +76,7 @@ private: | |||
76 | static void onClickInfo(void* userdata); | 76 | static void onClickInfo(void* userdata); |
77 | static void onReceiveNotices(LLUICtrl* ctrl, void* data); | 77 | static void onReceiveNotices(LLUICtrl* ctrl, void* data); |
78 | static void openProfile(void* data); | 78 | static void openProfile(void* data); |
79 | static void onClickCopyLink(void* userdata); | ||
79 | 80 | ||
80 | static bool joinDlgCB(const LLSD& notification, const LLSD& response); | 81 | static bool joinDlgCB(const LLSD& notification, const LLSD& response); |
81 | 82 | ||
@@ -98,6 +99,7 @@ private: | |||
98 | LLTextEditor *mEditCharter; | 99 | LLTextEditor *mEditCharter; |
99 | LLButton *mBtnJoinGroup; | 100 | LLButton *mBtnJoinGroup; |
100 | LLButton *mBtnInfo; | 101 | LLButton *mBtnInfo; |
102 | LLButton *mBtnCopyLink; | ||
101 | 103 | ||
102 | LLNameListCtrl *mListVisibleMembers; | 104 | LLNameListCtrl *mListVisibleMembers; |
103 | 105 | ||
diff --git a/linden/indra/newview/llurldispatcher.cpp b/linden/indra/newview/llurldispatcher.cpp index 460ffb2..0d6f6d7 100644 --- a/linden/indra/newview/llurldispatcher.cpp +++ b/linden/indra/newview/llurldispatcher.cpp | |||
@@ -402,6 +402,18 @@ std::string LLURLDispatcherImpl::stripProtocol(const std::string& url) | |||
402 | return stripped; | 402 | return stripped; |
403 | } | 403 | } |
404 | 404 | ||
405 | // static | ||
406 | std::string LLURLDispatcher::createGroupJoinLink(const LLUUID& group_id) | ||
407 | { | ||
408 | std::string slurl = ""; | ||
409 | if (group_id.notNull()) | ||
410 | { | ||
411 | //secondlife:///app/group/uuid/about | ||
412 | slurl = SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN + "group/" + group_id.asString() + "/about"; | ||
413 | } | ||
414 | return slurl; | ||
415 | } | ||
416 | |||
405 | //--------------------------------------------------------------------------- | 417 | //--------------------------------------------------------------------------- |
406 | // Teleportation links are handled here because they are tightly coupled | 418 | // Teleportation links are handled here because they are tightly coupled |
407 | // to URL parsing and sim-fragment parsing | 419 | // to URL parsing and sim-fragment parsing |
diff --git a/linden/indra/newview/llurldispatcher.h b/linden/indra/newview/llurldispatcher.h index c947e5e..cfdc2db 100644 --- a/linden/indra/newview/llurldispatcher.h +++ b/linden/indra/newview/llurldispatcher.h | |||
@@ -66,6 +66,8 @@ public: | |||
66 | 66 | ||
67 | static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z); | 67 | static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z); |
68 | // builds: http://slurl.com/secondlife/RegionName/x/y/z/ | 68 | // builds: http://slurl.com/secondlife/RegionName/x/y/z/ |
69 | |||
70 | static std::string createGroupJoinLink(const LLUUID& group_id); | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | #endif | 73 | #endif |
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml b/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml index b032b09..2974490 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml | |||
@@ -8,9 +8,12 @@ general Group Preferences and member options. | |||
8 | 8 | ||
9 | Hover your mouse over the options for more help. | 9 | Hover your mouse over the options for more help. |
10 | </string> | 10 | </string> |
11 | <string name="group_info_unchanged"> | 11 | <string name="group_info_unchanged"> |
12 | General group information has changed. | 12 | General group information has changed. |
13 | </string> | 13 | </string> |
14 | <string name="copy_group_link_info"> | ||
15 | Copied group link: [SLURL] | ||
16 | </string> | ||
14 | <button bottom="-24" follows="left|top" font="SansSerif" halign="center" height="16" | 17 | <button bottom="-24" follows="left|top" font="SansSerif" halign="center" height="16" |
15 | label="?" label_selected="?" left="391" mouse_opaque="true" | 18 | label="?" label_selected="?" left="391" mouse_opaque="true" |
16 | name="help_button" width="20" /> | 19 | name="help_button" width="20" /> |
@@ -50,7 +53,10 @@ Hover your mouse over the options for more help. | |||
50 | width="265" word_wrap="true" spell_check="true"> | 53 | width="265" word_wrap="true" spell_check="true"> |
51 | Group Charter | 54 | Group Charter |
52 | </text_editor> | 55 | </text_editor> |
53 | <button bottom_delta="0" follows="left|top" font="SansSerif" halign="center" | 56 | <button bottom_delta="-28" follows="left|top" font="SansSerif" halign="center" |
57 | height="22" label="Copy Group Link" | ||
58 | right="-7" mouse_opaque="true" name="copy_link_button" width="128" /> | ||
59 | <button bottom_delta="28" follows="left|top" font="SansSerif" halign="center" | ||
54 | height="22" label="Join (free)" label_selected="Join (free)" left="7" | 60 | height="22" label="Join (free)" label_selected="Join (free)" left="7" |
55 | mouse_opaque="true" name="join_button" width="128" /> | 61 | mouse_opaque="true" name="join_button" width="128" /> |
56 | <button bottom_delta="0" follows="left|top" font="SansSerif" halign="center" | 62 | <button bottom_delta="0" follows="left|top" font="SansSerif" halign="center" |