Added LLUrlEntryExperienceProfile to link to experience profiles
Added LLExperienceHandler to handle experience links Updated LLSidepanelItemInfo to use profile linksmeow-7.2.2
parent
d9ad2d3a13
commit
48e1e10fd6
|
|
@ -37,6 +37,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))"
|
||||
|
||||
|
|
@ -1200,3 +1201,50 @@ 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";
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
LLSD experience_details;
|
||||
if(LLExperienceCache::get(experience_id, experience_details))
|
||||
{
|
||||
return experience_details[LLExperienceCache::NAME].asString();
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
callObservers(experience_details[LLExperienceCache::EXPERIENCE_ID].asString(), experience_details[LLExperienceCache::NAME].asString(), LLStringUtil::null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -257,6 +257,20 @@ private:
|
|||
/*virtual*/ std::string getName(const LLAvatarName& avatar_name);
|
||||
};
|
||||
|
||||
///
|
||||
/// LLUrlEntryExperienceProfile Describes a Second Life experience profile Url, e.g.,
|
||||
/// secondlife:///app/experience/0e346d8b-4433-4d66-a6b0-fd37083abc4c/profile
|
||||
/// that displays the experience name
|
||||
class LLUrlEntryExperienceProfile : public LLUrlEntryBase
|
||||
{
|
||||
public:
|
||||
LLUrlEntryExperienceProfile();
|
||||
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
|
||||
private:
|
||||
void onExperienceDetails(const LLSD& experience_details);
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// LLUrlEntryGroup Describes a Second Life group Url, e.g.,
|
||||
/// secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ LLUrlRegistry::LLUrlRegistry()
|
|||
registerUrl(new LLUrlEntryPlace());
|
||||
registerUrl(new LLUrlEntryInventory());
|
||||
registerUrl(new LLUrlEntryObjectIM());
|
||||
registerUrl(new LLUrlEntryExperienceProfile());
|
||||
//LLUrlEntrySL and LLUrlEntrySLLabel have more common pattern,
|
||||
//so it should be registered in the end of list
|
||||
registerUrl(new LLUrlEntrySL());
|
||||
|
|
|
|||
|
|
@ -26,14 +26,20 @@
|
|||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llfloaterexperienceprofile.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llappviewer.h"
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "llcombobox.h"
|
||||
#include "llcommandhandler.h"
|
||||
#include "llexpandabletextbox.h"
|
||||
#include "llexperiencecache.h"
|
||||
#include "llfloaterexperienceprofile.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llhttpclient.h"
|
||||
#include "lllayoutstack.h"
|
||||
#include "lllineeditor.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llslurl.h"
|
||||
#include "lltabcontainer.h"
|
||||
|
|
@ -41,11 +47,6 @@
|
|||
#include "lltexturectrl.h"
|
||||
#include "lltrans.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "lllineeditor.h"
|
||||
#include "llcombobox.h"
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llappviewer.h"
|
||||
|
||||
#define XML_PANEL_EXPERIENCE_PROFILE "floater_experienceprofile.xml"
|
||||
#define TF_NAME "experience_title"
|
||||
|
|
@ -75,6 +76,34 @@
|
|||
#define BTN_PRIVATE "private_btn"
|
||||
|
||||
|
||||
|
||||
class LLExperienceHandler : public LLCommandHandler
|
||||
{
|
||||
public:
|
||||
LLExperienceHandler() : LLCommandHandler("experience", UNTRUSTED_THROTTLE) { }
|
||||
|
||||
bool handle(const LLSD& params, const LLSD& query_map,
|
||||
LLMediaCtrl* web)
|
||||
{
|
||||
if(params.size() != 2 || params[1].asString() != "profile")
|
||||
return false;
|
||||
|
||||
LLExperienceCache::get(params[0].asUUID(), boost::bind(&LLExperienceHandler::experienceCallback, this, _1));
|
||||
return true;
|
||||
}
|
||||
|
||||
void experienceCallback(const LLSD& experienceDetails)
|
||||
{
|
||||
if(!experienceDetails.has(LLExperienceCache::MISSING))
|
||||
{
|
||||
LLFloaterReg::showInstance("experience_profile", experienceDetails[LLExperienceCache::EXPERIENCE_ID].asUUID(), true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
LLExperienceHandler gExperienceHandler;
|
||||
|
||||
|
||||
LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data)
|
||||
: LLFloater(data)
|
||||
, mExperienceId(data.asUUID())
|
||||
|
|
@ -355,6 +384,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
|
|||
|
||||
value = experience[LLExperienceCache::SLURL].asString();
|
||||
child = getChild<LLTextBox>(TF_SLURL);
|
||||
value = LLSLURL(value).getSLURLString();
|
||||
child->setText(value);
|
||||
locationPanel->setVisible(value.length()>0);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,9 @@
|
|||
#include "llviewercontrol.h"
|
||||
#include "llviewerinventory.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llexperiencecache.h"
|
||||
#include "llexperienceassociationresponder.h"
|
||||
#include "llexperiencecache.h"
|
||||
#include "lltrans.h"
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
@ -684,18 +685,17 @@ void LLSidepanelItemInfo::setAssociatedExperience( LLHandle<LLSidepanelItemInfo>
|
|||
if(info)
|
||||
{
|
||||
LLUUID id;
|
||||
if(experience.has(LLExperienceCache::EXPERIENCE_ID) && experience.has(LLExperienceCache::NAME))
|
||||
if(experience.has(LLExperienceCache::EXPERIENCE_ID))
|
||||
{
|
||||
id=experience[LLExperienceCache::EXPERIENCE_ID].asUUID();
|
||||
}
|
||||
LLTextBox* xpName = info->getChild<LLTextBox>("LabelItemExperience");
|
||||
if(id.isNull())
|
||||
if(id.notNull())
|
||||
{
|
||||
xpName->setText(info->getString("no_experience"));
|
||||
info->getChild<LLTextBox>("LabelItemExperience")->setText(LLSLURL("experience", id, "profile").getSLURLString());
|
||||
}
|
||||
else
|
||||
{
|
||||
xpName->setText(experience[LLExperienceCache::NAME].asString());
|
||||
info->getChild<LLTextBox>("LabelItemExperience")->setText(LLTrans::getString("ExperienceNameNull"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ with the same filename but different name
|
|||
<texture name="ForwardArrow_Off" file_name="icons/ForwardArrow_Off.png" preload="false" />
|
||||
<texture name="ForwardArrow_Press" file_name="icons/ForwardArrow_Press.png" preload="false" />
|
||||
|
||||
<texture name="Generic_Experience" file_name="Blank.png" preload="false" />
|
||||
<texture name="Generic_Group" file_name="icons/Generic_Group.png" preload="false" />
|
||||
<texture name="Generic_Group_Large" file_name="icons/Generic_Group_Large.png" preload="false" />
|
||||
<texture name="icon_group.tga" file_name="icons/Generic_Group.png" preload="false" />
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
title="Item Profile"
|
||||
width="333">
|
||||
<panel.string
|
||||
name="no_experience">
|
||||
(none)
|
||||
</panel.string>
|
||||
<panel.string
|
||||
name="loading_experience">
|
||||
name="loading_experience">
|
||||
(loading)
|
||||
</panel.string>
|
||||
<panel.string
|
||||
|
|
@ -267,6 +263,31 @@
|
|||
top_delta="0"
|
||||
width="210">
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="5"
|
||||
name="LabelItemExperienceTitle"
|
||||
top_pad="0"
|
||||
width="78"
|
||||
visible="true">
|
||||
Experience:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top|right"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left_delta="78"
|
||||
name="LabelItemExperience"
|
||||
top_delta="0"
|
||||
width="210"
|
||||
visible="true"
|
||||
/>
|
||||
<panel
|
||||
border="false"
|
||||
follows="left|top|right"
|
||||
|
|
@ -428,32 +449,6 @@
|
|||
height="23"
|
||||
max_val="999999999"
|
||||
top_pad="10"/>
|
||||
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="5"
|
||||
name="LabelItemExperienceTitle"
|
||||
top_pad="10"
|
||||
width="78"
|
||||
visible="false">
|
||||
Experience:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top|right"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left_delta="78"
|
||||
name="LabelItemExperience"
|
||||
top_delta="0"
|
||||
width="210"
|
||||
visible="false"
|
||||
></text>
|
||||
</panel>
|
||||
|
||||
</scroll_container>
|
||||
|
|
|
|||
|
|
@ -3922,7 +3922,7 @@ Try enclosing path to the editor with double quotes.
|
|||
|
||||
<!-- Experience Tools strings -->
|
||||
<string name="experience_tools_experience">Experience</string>
|
||||
|
||||
<string name="ExperienceNameNull">(no experience)</string>
|
||||
|
||||
<!-- Conversation log messages -->
|
||||
<string name="logging_calls_disabled_log_empty">
|
||||
|
|
|
|||
Loading…
Reference in New Issue