From 48e1e10fd69aaea6ef22feb2518e80a120e9f999 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 23 Sep 2013 11:44:21 -0700 Subject: Added LLUrlEntryExperienceProfile to link to experience profiles Added LLExperienceHandler to handle experience links Updated LLSidepanelItemInfo to use profile links --- indra/llui/llurlentry.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++ indra/llui/llurlentry.h | 14 +++++++++++++ indra/llui/llurlregistry.cpp | 1 + 3 files changed, 63 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index b1cc502c4b..6f7d072d00 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -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); +} + + diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 8c6c32178a..48b4a1d531 100755 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -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 diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 523ee5d78c..480f05bd72 100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -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()); -- cgit v1.3 From 977ee4cd6d20d6c3018c7d005ca40c523178678a Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 24 Sep 2013 23:25:29 -0700 Subject: Added stubs for llurlentry_test.cpp --- indra/llui/tests/llurlentry_test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index c3f0e92cb0..e8b9dde753 100755 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -32,9 +32,22 @@ #include "lltut.h" #include "../lluicolortable.h" #include "../llrender/lluiimage.h" +#include "../llmessage/llexperiencecache.h" #include + +namespace LLExperienceCache +{ + bool get( const LLUUID& key, LLSD& experience_data ) + { + return false; + } + + void get( const LLUUID& key, callback_slot_t slot ){} + +} + typedef std::map settings_map_t; settings_map_t LLUI::sSettingGroups; -- cgit v1.3 From 1aed2f848c4f2a86d6c2ea6385ebb920e7658aa8 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 15 Oct 2013 16:42:55 -0700 Subject: Added LLTabContainer::getTotalTabWidth Cleaned up experience profile floater --- indra/llui/lltabcontainer.cpp | 5 + indra/llui/lltabcontainer.h | 5 +- indra/newview/llfloaterexperienceprofile.cpp | 66 +++++++--- indra/newview/llfloaterexperienceprofile.h | 8 +- indra/newview/llfloaterexperiences.cpp | 79 ++++++----- indra/newview/llfloaterexperiences.h | 6 + indra/newview/llpanelexperiences.cpp | 19 +++ indra/newview/llpanelexperiences.h | 11 ++ .../default/xui/en/floater_experienceprofile.xml | 145 +++++++++++++++------ .../skins/default/xui/en/floater_experiences.xml | 2 +- .../default/xui/en/panel_experience_list_item.xml | 6 +- .../skins/default/xui/en/panel_experiences.xml | 1 - 12 files changed, 255 insertions(+), 98 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index fd98155704..148dc6b232 100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -2060,3 +2060,8 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y) } } } + +S32 LLTabContainer::getTotalTabWidth() const +{ + return mTotalTabWidth; +} diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 57862fc626..057809dc42 100755 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -182,7 +182,8 @@ public: LLPanel* getPanelByIndex(S32 index); S32 getIndexForPanel(LLPanel* panel); S32 getPanelIndexByTitle(const std::string& title); - LLPanel* getPanelByName(const std::string& name); + LLPanel* getPanelByName(const std::string& name); + S32 getTotalTabWidth() const; void setCurrentTabName(const std::string& name); void selectFirstTab(); @@ -287,7 +288,7 @@ private: S32 mMaxTabWidth; S32 mTotalTabWidth; - S32 mTabHeight; + S32 mTabHeight; // Padding under the text labels of tab buttons S32 mLabelPadBottom; diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index f99e20f7e0..e1667a39b7 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -55,6 +55,7 @@ #define TF_MRKT "marketplace" #define TF_MATURITY "ContentRatingText" #define TF_OWNER "OwnerText" +#define TF_GROUP "GroupText" #define TF_GRID_WIDE "grid_wide" #define EDIT "edit_" @@ -65,6 +66,7 @@ #define PNL_DESC "description panel" #define PNL_LOC "location panel" #define PNL_MRKT "marketplace panel" +#define PNL_GROUP "group_panel" #define BTN_EDIT "edit_btn" #define BTN_ALLOW "allow_btn" @@ -74,6 +76,8 @@ #define BTN_SAVE "save_btn" #define BTN_ENABLE "enable_btn" #define BTN_PRIVATE "private_btn" +#define BTN_SET_LOCATION "location_btn" +#define BTN_CLEAR_LOCATION "clear_btn" @@ -236,14 +240,15 @@ BOOL LLFloaterExperienceProfile::postBuild() childSetAction(BTN_BLOCK, boost::bind(&LLFloaterExperienceProfile::onClickPermission, this, "Block")); childSetAction(BTN_CANCEL, boost::bind(&LLFloaterExperienceProfile::onClickCancel, this)); childSetAction(BTN_SAVE, boost::bind(&LLFloaterExperienceProfile::onClickSave, this)); + childSetAction(BTN_SET_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickLocation, this)); + childSetAction(BTN_CLEAR_LOCATION, boost::bind(&LLFloaterExperienceProfile::onClickClear, this)); - getChild(EDIT TF_NAME)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_DESC)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_SLURL)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_DESC)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); getChild(EDIT TF_MATURITY)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_MRKT)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); - getChild(EDIT TF_NAME)->setCommitCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); + getChild(EDIT TF_MRKT)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + getChild(EDIT TF_NAME)->setKeystrokeCallback(boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this), NULL); + childSetAction(EDIT BTN_ENABLE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); childSetAction(EDIT BTN_PRIVATE, boost::bind(&LLFloaterExperienceProfile::onFieldChanged, this)); @@ -384,28 +389,35 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) value = experience[LLExperienceCache::SLURL].asString(); child = getChild(TF_SLURL); + bool has_value = value.length()>0; + locationPanel->setVisible(has_value); value = LLSLURL(value).getSLURLString(); child->setText(value); - locationPanel->setVisible(value.length()>0); - - linechild = getChild(EDIT TF_SLURL); - linechild->setText(value); - - setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), getChild(TF_MATURITY), getChild(EDIT TF_MATURITY)); - child = getChild(TF_OWNER); - LLUUID id = experience[LLExperienceCache::GROUP_ID].asUUID(); - if(id.notNull()) + child = getChild(EDIT TF_SLURL); + if(has_value) { - value = LLSLURL("group", id, "inspect").getSLURLString(); + child->setText(value); } else { - id = experience[LLExperienceCache::AGENT_ID].asUUID(); - value = LLSLURL("agent", id, "inspect").getSLURLString(); + child->setText(getString("empty_slurl")); } + + setMaturityString((U8)(experience[LLExperienceCache::MATURITY].asInteger()), getChild(TF_MATURITY), getChild(EDIT TF_MATURITY)); + + LLUUID id = experience[LLExperienceCache::AGENT_ID].asUUID(); + child = getChild(TF_OWNER); + value = LLSLURL("agent", id, "inspect").getSLURLString(); + child->setText(value); + + + id = experience[LLExperienceCache::GROUP_ID].asUUID(); + child = getChild(TF_GROUP); + value = LLSLURL("group", id, "inspect").getSLURLString(); child->setText(value); + getChild(PNL_GROUP)->setVisible(id.notNull()); LLCheckBoxCtrl* enable = getChild(EDIT BTN_ENABLE); S32 properties = mExperienceDetails[LLExperienceCache::PROPERTIES].asInteger(); @@ -479,7 +491,7 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience ) mDirty=false; setCanClose(!mDirty); - + mForceClose = false; getChild(BTN_SAVE)->setEnabled(mDirty); } @@ -703,3 +715,21 @@ void LLFloaterExperienceProfile::changeToView() LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLFloaterExperienceProfile::handleSaveChangesDialog, this, _1, _2, VIEW)); } } + +void LLFloaterExperienceProfile::onClickLocation() +{ + LLViewerRegion* region = gAgent.getRegion(); + if(region) + { + LLTextBox* child = getChild(EDIT TF_SLURL); + child->setText(LLSLURL(region->getName(), gAgent.getPositionGlobal()).getSLURLString()); + onFieldChanged(); + } +} + +void LLFloaterExperienceProfile::onClickClear() +{ + LLTextBox* child = getChild(EDIT TF_SLURL); + child->setText(getString("empty_slurl")); + onFieldChanged(); +} diff --git a/indra/newview/llfloaterexperienceprofile.h b/indra/newview/llfloaterexperienceprofile.h index 4aa9820a91..feaff0547e 100644 --- a/indra/newview/llfloaterexperienceprofile.h +++ b/indra/newview/llfloaterexperienceprofile.h @@ -63,13 +63,13 @@ protected: void onClickPermission(const char* permission); void onClickForget(); void onClickCancel(); - - void changeToView(); - void onClickSave(); - + void onClickLocation(); + void onClickClear(); void onFieldChanged(); + void changeToView(); + static void experienceCallback(LLHandle handle, const LLSD& experience); BOOL postBuild(); diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index 9ec94f457b..57f08742be 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -27,7 +27,6 @@ public: return; LLFloaterExperiences* parent=mParent.get(); - LLTabContainer* tabs = parent->getChild("xp_tabs"); NameMap::iterator it = mNameMap.begin(); @@ -40,7 +39,7 @@ public: { const LLSD& ids = content[it->first]; tab->setExperienceList(ids); - parent->clearFromRecent(ids); + //parent->clearFromRecent(ids); } } ++it; @@ -70,36 +69,10 @@ BOOL LLFloaterExperiences::postBuild() addTab("Admin_Experiences_Tab", false); addTab("Contrib_Experiences_Tab", false); addTab("Recent_Experiences_Tab", false); + resizeToTabs(); - setupRecentTabs(); - - LLViewerRegion* region = gAgent.getRegion(); - - if (region) - { - LLExperienceListResponder::NameMap nameMap; - std::string lookup_url=region->getCapability("GetExperiences"); - if(!lookup_url.empty()) - { - nameMap["experiences"]="Allowed_Experiences_Tab"; - nameMap["blocked"]="Blocked_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); - } + refreshContents(); - lookup_url = region->getCapability("GetAdminExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Admin_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); - } - - lookup_url = region->getCapability("GetCreatorExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Contrib_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); - } - } return TRUE; } @@ -138,3 +111,49 @@ void LLFloaterExperiences::setupRecentTabs() tab->setExperienceList(recent); } + +void LLFloaterExperiences::resizeToTabs() +{ + const S32 TAB_WIDTH_PADDING = 16; + + LLTabContainer* tabs = getChild("xp_tabs"); + LLRect rect = getRect(); + if(rect.getWidth() < tabs->getTotalTabWidth() + TAB_WIDTH_PADDING) + { + rect.mRight = rect.mLeft + tabs->getTotalTabWidth() + TAB_WIDTH_PADDING; + } + reshape(rect.getWidth(), rect.getHeight(), FALSE); +} + +void LLFloaterExperiences::refreshContents() +{ + setupRecentTabs(); + + LLViewerRegion* region = gAgent.getRegion(); + + if (region) + { + LLExperienceListResponder::NameMap nameMap; + std::string lookup_url=region->getCapability("GetExperiences"); + if(!lookup_url.empty()) + { + nameMap["experiences"]="Allowed_Experiences_Tab"; + nameMap["blocked"]="Blocked_Experiences_Tab"; + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); + } + + lookup_url = region->getCapability("GetAdminExperiences"); + if(!lookup_url.empty()) + { + nameMap["experience_ids"]="Admin_Experiences_Tab"; + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); + } + + lookup_url = region->getCapability("GetCreatorExperiences"); + if(!lookup_url.empty()) + { + nameMap["experience_ids"]="Contrib_Experiences_Tab"; + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); + } + } +} diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h index 7d8c4a4be7..01a0f4c551 100644 --- a/indra/newview/llfloaterexperiences.h +++ b/indra/newview/llfloaterexperiences.h @@ -36,9 +36,15 @@ public: LLFloaterExperiences(const LLSD& data); void clearFromRecent(const LLSD& ids); + void resizeToTabs(); + protected: /*virtual*/ BOOL postBuild(); + void refreshContents(); + + + void setupRecentTabs(); void addTab(const std::string& name, bool select); diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp index 0d7cdce6e8..67ce3d3aa6 100644 --- a/indra/newview/llpanelexperiences.cpp +++ b/indra/newview/llpanelexperiences.cpp @@ -87,3 +87,22 @@ LLExperienceItem::~LLExperienceItem() { } + +void LLPanelSearchExperiences::doSearch() +{ + +} + +LLPanelSearchExperiences* LLPanelSearchExperiences::create( const std::string& name ) +{ + LLPanelSearchExperiences* panel= new LLPanelSearchExperiences(); + panel->getChild("results")->addChild(LLPanelExperiences::create(name)); + ///XXXif( + return panel; +} + +BOOL LLPanelSearchExperiences::postBuild( void ) +{ + childSetAction("search_button", boost::bind(&LLPanelSearchExperiences::doSearch, this)); + return TRUE; +} diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h index e3c223d9db..45773adda9 100644 --- a/indra/newview/llpanelexperiences.h +++ b/indra/newview/llpanelexperiences.h @@ -35,6 +35,17 @@ class LLExperienceItem; class LLPanelProfile; +class LLPanelSearchExperiences + : public LLPanel +{ +public: + LLPanelSearchExperiences(){} + static LLPanelSearchExperiences* create(const std::string& name); + /*virtual*/ BOOL postBuild(void); + + void doSearch(); +}; + class LLPanelExperiences : public LLPanel { diff --git a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml index ca9469474c..e70151c64e 100644 --- a/indra/newview/skins/default/xui/en/floater_experienceprofile.xml +++ b/indra/newview/skins/default/xui/en/floater_experienceprofile.xml @@ -6,9 +6,15 @@ enabled="true" can_resize="true" title="EXPERIENCE PROFILE" + save_rect="true" min_width="325" + min_height="325" width="358" height="580"> + + (none) + "Parcel_PG_Light" @@ -195,7 +201,7 @@ layout="topleft" left="10" name="ContentRating" - width="100"> + width="75"> Rating: @@ -272,13 +279,14 @@ layout="topleft" left="10" valign="center" + use_ellipses="true" name="marketplace" width="288"> + width="75"> Owner: -