diff options
author | Lynx Linden <lynx@lindenlab.com> | 2009-11-03 19:11:17 +0000 |
---|---|---|
committer | Lynx Linden <lynx@lindenlab.com> | 2009-11-03 19:11:17 +0000 |
commit | b368f466248054517813922bb745f1da2a6a8df9 (patch) | |
tree | 5efe101f920cc353f65876b38f107cbe502bf012 | |
parent | 329a1f321c44460cb05daa3ed591ab91ad13b79d (diff) | |
parent | 00e56b09071f4e29ccec1a5451161817ffba4d96 (diff) |
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0
-rw-r--r-- | indra/llui/lltextbase.cpp | 1 | ||||
-rw-r--r-- | indra/llui/llurlaction.cpp | 12 | ||||
-rw-r--r-- | indra/llui/llurlaction.h | 3 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 58 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 12 | ||||
-rw-r--r-- | indra/llui/llurlregistry.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llfloaterworldmap.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 48 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_url_map.xml | 30 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_url_objectim.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_url_parcel.xml | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_url_slurl.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_url_teleport.xml | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 5 |
14 files changed, 226 insertions, 6 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 9a26f0b472..e11e5f446e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1419,6 +1419,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url)); registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url)); registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); + registrar.add("Url.ShowOnMap", boost::bind(&LLUrlAction::showLocationOnMap, url)); registrar.add("Url.CopyLabel", boost::bind(&LLUrlAction::copyLabelToClipboard, url)); registrar.add("Url.CopyUrl", boost::bind(&LLUrlAction::copyURLToClipboard, url)); diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index f3401f91f7..679db5e39b 100644 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp @@ -121,6 +121,18 @@ void LLUrlAction::teleportToLocation(std::string url) } } +void LLUrlAction::showLocationOnMap(std::string url) +{ + LLUrlMatch match; + if (LLUrlRegistry::instance().findUrl(url, match)) + { + if (! match.getLocation().empty()) + { + executeSLURL("secondlife:///app/worldmap/" + match.getLocation()); + } + } +} + void LLUrlAction::copyURLToClipboard(std::string url) { LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(url)); diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index 6b9d565b44..4830cf27ef 100644 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -67,6 +67,9 @@ public: /// if the Url specifies an SL location, teleport there static void teleportToLocation(std::string url); + /// if the Url specifies an SL location, show it on a map + static void showLocationOnMap(std::string url); + /// perform the appropriate action for left-clicking on a Url static void clickAction(std::string url); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 52e4229fb4..ddb6c6baff 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -468,6 +468,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe LLURI uri(url); LLSD path_array = uri.pathArray(); S32 path_parts = path_array.size(); + const std::string label = LLTrans::getString("SLurlLabelTeleport"); if (path_parts == 6) { // handle teleport url with (X,Y,Z) coordinates @@ -475,7 +476,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe std::string x = path_array[path_parts-3]; std::string y = path_array[path_parts-2]; std::string z = path_array[path_parts-1]; - return "Teleport to " + location + " (" + x + "," + y + "," + z + ")"; + return label + " " + location + " (" + x + "," + y + "," + z + ")"; } else if (path_parts == 5) { @@ -483,20 +484,20 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe std::string location = unescapeUrl(path_array[path_parts-3]); std::string x = path_array[path_parts-2]; std::string y = path_array[path_parts-1]; - return "Teleport to " + location + " (" + x + "," + y + ")"; + return label + " " + location + " (" + x + "," + y + ")"; } else if (path_parts == 4) { // handle teleport url with (X) coordinate only std::string location = unescapeUrl(path_array[path_parts-2]); std::string x = path_array[path_parts-1]; - return "Teleport to " + location + " (" + x + ")"; + return label + " " + location + " (" + x + ")"; } else if (path_parts == 3) { // handle teleport url with no coordinates std::string location = unescapeUrl(path_array[path_parts-1]); - return "Teleport to " + location; + return label + " " + location; } return url; @@ -599,3 +600,52 @@ std::string LLUrlEntrySLLabel::getUrl(const std::string &string) return getUrlFromWikiLink(string); } +// +// LLUrlEntryWorldMap Describes secondlife:///<location> URLs +// +LLUrlEntryWorldMap::LLUrlEntryWorldMap() +{ + mPattern = boost::regex("secondlife:///app/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_map.xml"; + mTooltip = LLTrans::getString("TooltipMapUrl"); +} + +std::string LLUrlEntryWorldMap::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + // + // we handle SLURLs in the following formats: + // - secondlife:///app/worldmap/PLACE/X/Y/Z + // - secondlife:///app/worldmap/PLACE/X/Y + // - secondlife:///app/worldmap/PLACE/X + // + LLURI uri(url); + LLSD path_array = uri.pathArray(); + S32 path_parts = path_array.size(); + if (path_parts < 3) + { + return url; + } + + const std::string label = LLTrans::getString("SLurlLabelShowOnMap"); + std::string location = path_array[2]; + std::string x = (path_parts > 3) ? path_array[3] : "128"; + std::string y = (path_parts > 4) ? path_array[4] : "128"; + std::string z = (path_parts > 5) ? path_array[5] : "0"; + return label + " " + location + " (" + x + "," + y + "," + z + ")"; +} + +std::string LLUrlEntryWorldMap::getLocation(const std::string &url) const +{ + // return the part of the Url after secondlife:///app/worldmap/ part + const std::string search_string = "//app/worldmap/"; + size_t pos = url.find(search_string); + if (pos == std::string::npos) + { + return ""; + } + + pos += search_string.size(); + return url.substr(pos, url.size() - pos); +} + diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index afb2fdcde9..180ef85673 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -243,4 +243,16 @@ public: /*virtual*/ std::string getUrl(const std::string &string); }; +/// +/// LLUrlEntryWorldMap Describes a Second Life worldmap Url, e.g., +/// secondlife:///app/worldmap/Ahern/50/50/50 +/// +class LLUrlEntryWorldMap : public LLUrlEntryBase +{ +public: + LLUrlEntryWorldMap(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getLocation(const std::string &url) const; +}; + #endif diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 249c7320d6..60275b60bc 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -51,6 +51,7 @@ LLUrlRegistry::LLUrlRegistry() registerUrl(new LLUrlEntryGroup()); registerUrl(new LLUrlEntryParcel()); registerUrl(new LLUrlEntryTeleport()); + registerUrl(new LLUrlEntryWorldMap()); registerUrl(new LLUrlEntryObjectIM()); registerUrl(new LLUrlEntryPlace()); registerUrl(new LLUrlEntrySL()); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index b7e8835fb8..f3f600149f 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -45,6 +45,7 @@ #include "llcallingcard.h" #include "llcombobox.h" #include "llviewercontrol.h" +#include "llcommandhandler.h" #include "lldraghandle.h" #include "llfirstuse.h" #include "llfloaterreg.h" // getTypedInstance() @@ -96,6 +97,35 @@ static const F32 SIM_COORD_DEFAULT = 128.f; // Globals //--------------------------------------------------------------------------- +// handle secondlife:///app/worldmap/{NAME}/{COORDS} URLs +class LLWorldMapHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_THROTTLE) { } + + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if (params.size() == 0) + { + return false; + } + + const std::string region_name = params[0].asString(); + S32 x = (params.size() > 1) ? params[1].asInteger() : 128; + S32 y = (params.size() > 2) ? params[2].asInteger() : 128; + S32 z = (params.size() > 3) ? params[3].asInteger() : 0; + + LLFloaterWorldMap::getInstance()->trackURL(region_name, x, y, z); + LLFloaterReg::showInstance("world_map", "center"); + + return true; + } +}; +LLWorldMapHandler gWorldMapHandler; + + LLFloaterWorldMap* gFloaterWorldMap = NULL; class LLMapInventoryObserver : public LLInventoryObserver diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index bec670cdaa..8147ff17f0 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -59,17 +59,61 @@ public: return false; } - if (params[1].asString() == "about") + const std::string verb = params[1].asString(); + if (verb == "about") { LLAvatarActions::showProfile(avatar_id); return true; } - if (params[1].asString() == "inspect") + if (verb == "inspect") { LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", avatar_id)); return true; } + + if (verb == "im") + { + LLAvatarActions::startIM(avatar_id); + return true; + } + + if (verb == "pay") + { + LLAvatarActions::pay(avatar_id); + return true; + } + + if (verb == "offerteleport") + { + LLAvatarActions::offerTeleport(avatar_id); + return true; + } + + if (verb == "requestfriend") + { + LLAvatarActions::requestFriendshipDialog(avatar_id); + return true; + } + + if (verb == "mute") + { + if (! LLAvatarActions::isBlocked(avatar_id)) + { + LLAvatarActions::toggleBlock(avatar_id); + } + return true; + } + + if (verb == "unmute") + { + if (LLAvatarActions::isBlocked(avatar_id)) + { + LLAvatarActions::toggleBlock(avatar_id); + } + return true; + } + return false; } }; diff --git a/indra/newview/skins/default/xui/en/menu_url_map.xml b/indra/newview/skins/default/xui/en/menu_url_map.xml new file mode 100644 index 0000000000..2ca9e3b3fe --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_url_map.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<context_menu + layout="topleft" + name="Url Popup"> + <menu_item_call + label="Show on Map" + layout="topleft" + name="show_on_map"> + <menu_item_call.on_click + function="Url.Execute" /> + </menu_item_call> + <menu_item_separator + layout="topleft" /> + <menu_item_call + label="Teleport to Location" + layout="topleft" + name="teleport_to_location"> + <menu_item_call.on_click + function="Url.Teleport" /> + </menu_item_call> + <menu_item_separator + layout="topleft" /> + <menu_item_call + label="Copy SLurl to clipboard" + layout="topleft" + name="url_copy"> + <menu_item_call.on_click + function="Url.CopyUrl" /> + </menu_item_call> +</context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_url_objectim.xml b/indra/newview/skins/default/xui/en/menu_url_objectim.xml index 6f7e659f48..35c2269b0d 100644 --- a/indra/newview/skins/default/xui/en/menu_url_objectim.xml +++ b/indra/newview/skins/default/xui/en/menu_url_objectim.xml @@ -12,6 +12,13 @@ <menu_item_separator layout="topleft" /> <menu_item_call + label="Show on Map" + layout="topleft" + name="show_on_map"> + <menu_item_call.on_click + function="Url.ShowOnMap" /> + </menu_item_call> + <menu_item_call label="Teleport to Object Location" layout="topleft" name="teleport_to_object"> diff --git a/indra/newview/skins/default/xui/en/menu_url_parcel.xml b/indra/newview/skins/default/xui/en/menu_url_parcel.xml index 3804f7f780..f477c310fb 100644 --- a/indra/newview/skins/default/xui/en/menu_url_parcel.xml +++ b/indra/newview/skins/default/xui/en/menu_url_parcel.xml @@ -12,6 +12,15 @@ <menu_item_separator layout="topleft" /> <menu_item_call + label="Show on Map" + layout="topleft" + name="show_on_map"> + <menu_item_call.on_click + function="Url.ShowOnMap" /> + </menu_item_call> + <menu_item_separator + layout="topleft" /> + <menu_item_call label="Copy SLurl to clipboard" layout="topleft" name="url_copy"> diff --git a/indra/newview/skins/default/xui/en/menu_url_slurl.xml b/indra/newview/skins/default/xui/en/menu_url_slurl.xml index 58714f1f42..98abc206a5 100644 --- a/indra/newview/skins/default/xui/en/menu_url_slurl.xml +++ b/indra/newview/skins/default/xui/en/menu_url_slurl.xml @@ -12,6 +12,13 @@ <menu_item_separator layout="topleft" /> <menu_item_call + label="Show on Map" + layout="topleft" + name="show_on_map"> + <menu_item_call.on_click + function="Url.ShowOnMap" /> + </menu_item_call> + <menu_item_call label="Teleport to Location" layout="topleft" name="teleport_to_location"> diff --git a/indra/newview/skins/default/xui/en/menu_url_teleport.xml b/indra/newview/skins/default/xui/en/menu_url_teleport.xml index ff52d7e109..289e32bcf4 100644 --- a/indra/newview/skins/default/xui/en/menu_url_teleport.xml +++ b/indra/newview/skins/default/xui/en/menu_url_teleport.xml @@ -12,6 +12,15 @@ <menu_item_separator layout="topleft" /> <menu_item_call + label="Show on Map" + layout="topleft" + name="show_on_map"> + <menu_item_call.on_click + function="Url.ShowOnMap" /> + </menu_item_call> + <menu_item_separator + layout="topleft" /> + <menu_item_call label="Copy SLurl to clipboard" layout="topleft" name="url_copy"> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index e842517853..0f7e8cb137 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -73,8 +73,13 @@ <string name="TooltipParcelUrl">Click to view this parcel's description</string> <string name="TooltipTeleportUrl">Click to teleport to this location</string> <string name="TooltipObjectIMUrl">Click to view this object's description</string> + <string name="TooltipMapUrl">Click to view this location on a map</string> <string name="TooltipSLAPP">Click to run the secondlife:// command</string> <string name="CurrentURL" value=" CurrentURL: [CurrentURL]" /> + + <!-- text for SLURL labels --> + <string name="SLurlLabelTeleport">Teleport to</string> + <string name="SLurlLabelShowOnMap">Show Map for</string> <!-- ButtonToolTips, llfloater.cpp --> <string name="BUTTON_CLOSE_DARWIN">Close (⌘W)</string> |