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(-) 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: -