summaryrefslogtreecommitdiff
path: root/indra/llui/llurlentry.cpp
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-07-01 14:40:05 +0300
committerandreykproductengine <akleshchev@productengine.com>2015-07-01 14:40:05 +0300
commit79ffc6569b8b0f4656c61f86b18e3bde22eb6dd5 (patch)
treeaa47a0b1f3f086ae884990107014ede35745fdd8 /indra/llui/llurlentry.cpp
parent51aaed86dee3b45fa96fc7b4e8c1b9486c880b3b (diff)
parent4aa64b99dbe6cafdccf0c25501feaef5ba3445c4 (diff)
Merge from viewer-relese and become version 3.8.1
Diffstat (limited to 'indra/llui/llurlentry.cpp')
-rwxr-xr-xindra/llui/llurlentry.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index c63289aa07..874046a4a8 100755
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -38,6 +38,7 @@
#include "lltrans.h"
#include "lluicolortable.h"
#include "message.h"
+#include "llexperiencecache.h"
#define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))"
@@ -1399,3 +1400,57 @@ std::string LLUrlEntryIcon::getIcon(const std::string &url)
LLStringUtil::trim(mIcon);
return mIcon;
}
+
+LLUrlEntryExperienceProfile::LLUrlEntryExperienceProfile()
+{
+ mPattern = boost::regex(APP_HEADER_REGEX "/experience/[\\da-f-]+/\\w+\\S*",
+ boost::regex::perl|boost::regex::icase);
+ mIcon = "Generic_Experience";
+ mMenuName = "menu_url_experience.xml";
+}
+
+std::string LLUrlEntryExperienceProfile::getLabel( const std::string &url, const LLUrlLabelCallback &cb )
+{
+ if (!gCacheName)
+ {
+ // probably at the login screen, use short string for layout
+ return LLTrans::getString("LoadingData");
+ }
+
+ std::string experience_id_string = getIDStringFromUrl(url);
+ if (experience_id_string.empty())
+ {
+ // something went wrong, just give raw url
+ return unescapeUrl(url);
+ }
+
+ LLUUID experience_id(experience_id_string);
+ if (experience_id.isNull())
+ {
+ return LLTrans::getString("ExperienceNameNull");
+ }
+
+ const LLSD& experience_details = LLExperienceCache::get(experience_id);
+ if(!experience_details.isUndefined())
+ {
+ std::string experience_name_string = experience_details[LLExperienceCache::NAME].asString();
+ return experience_name_string.empty() ? LLTrans::getString("ExperienceNameUntitled") : experience_name_string;
+ }
+
+ addObserver(experience_id_string, url, cb);
+ LLExperienceCache::get(experience_id, boost::bind(&LLUrlEntryExperienceProfile::onExperienceDetails, this, _1));
+ return LLTrans::getString("LoadingData");
+
+}
+
+void LLUrlEntryExperienceProfile::onExperienceDetails( const LLSD& experience_details )
+{
+ std::string name = experience_details[LLExperienceCache::NAME].asString();
+ if(name.empty())
+ {
+ name = LLTrans::getString("ExperienceNameUntitled");
+ }
+ callObservers(experience_details[LLExperienceCache::EXPERIENCE_ID].asString(), name, LLStringUtil::null);
+}
+
+