diff options
author | andreykproductengine <akleshchev@productengine.com> | 2015-07-01 14:40:05 +0300 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2015-07-01 14:40:05 +0300 |
commit | 79ffc6569b8b0f4656c61f86b18e3bde22eb6dd5 (patch) | |
tree | aa47a0b1f3f086ae884990107014ede35745fdd8 /indra/newview/llfloaterland.cpp | |
parent | 51aaed86dee3b45fa96fc7b4e8c1b9486c880b3b (diff) | |
parent | 4aa64b99dbe6cafdccf0c25501feaef5ba3445c4 (diff) |
Merge from viewer-relese and become version 3.8.1
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rwxr-xr-x | indra/newview/llfloaterland.cpp | 140 |
1 files changed, 138 insertions, 2 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 6f64bcc945..f9fd5069af 100755 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -75,6 +75,9 @@ #include "llviewercontrol.h" #include "roles_constants.h" #include "lltrans.h" +#include "llpanelexperiencelisteditor.h" +#include "llpanelexperiencepicker.h" +#include "llexperiencecache.h" #include "llgroupactions.h" @@ -112,6 +115,28 @@ public: } }; + +class LLPanelLandExperiences + : public LLPanel +{ +public: + LLPanelLandExperiences(LLSafeHandle<LLParcelSelection>& parcelp); + virtual BOOL postBuild(); + void refresh(); + + void experienceAdded(const LLUUID& id, U32 xp_type, U32 access_type); + void experienceRemoved(const LLUUID& id, U32 access_type); +protected: + LLPanelExperienceListEditor* setupList( const char* control_name, U32 xp_type, U32 access_type ); + void refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type); + + LLSafeHandle<LLParcelSelection>& mParcel; + + + LLPanelExperienceListEditor* mAllowed; + LLPanelExperienceListEditor* mBlocked; +}; + // inserts maturity info(icon and text) into target textbox // names_floater - pointer to floater which contains strings with maturity icons filenames // str_to_parse is string in format "txt1[MATURITY]txt2" where maturity icon and text will be inserted instead of [MATURITY] @@ -250,6 +275,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) mFactoryMap["land_audio_panel"] = LLCallbackMap(createPanelLandAudio, this); mFactoryMap["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); mFactoryMap["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); + mFactoryMap["land_experiences_panel"] = LLCallbackMap(createPanelLandExperiences, this); sObserver = new LLParcelSelectionObserver(); LLViewerParcelMgr::getInstance()->addObserver( sObserver ); @@ -290,6 +316,7 @@ void LLFloaterLand::refresh() mPanelMedia->refresh(); mPanelAccess->refresh(); mPanelCovenant->refresh(); + mPanelExperiences->refresh(); } @@ -350,6 +377,15 @@ void* LLFloaterLand::createPanelLandAccess(void* data) return self->mPanelAccess; } +// static +void* LLFloaterLand::createPanelLandExperiences(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelExperiences = new LLPanelLandExperiences(self->mParcel); + return self->mPanelExperiences; +} + + //--------------------------------------------------------------------------- // LLPanelLandGeneral //--------------------------------------------------------------------------- @@ -2408,7 +2444,7 @@ void LLPanelLandAccess::refresh() getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); - for (access_map_const_iterator cit = parcel->mAccessList.begin(); + for (LLAccessEntry::map::const_iterator cit = parcel->mAccessList.begin(); cit != parcel->mAccessList.end(); ++cit) { const LLAccessEntry& entry = (*cit).second; @@ -2455,7 +2491,7 @@ void LLPanelLandAccess::refresh() getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); - for (access_map_const_iterator cit = parcel->mBanList.begin(); + for (LLAccessEntry::map::const_iterator cit = parcel->mBanList.begin(); cit != parcel->mBanList.end(); ++cit) { const LLAccessEntry& entry = (*cit).second; @@ -3062,3 +3098,103 @@ void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_fl target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false); target_textbox->appendText(text_after_rating, false); } + +LLPanelLandExperiences::LLPanelLandExperiences( LLSafeHandle<LLParcelSelection>& parcelp ) + : mParcel(parcelp) +{ + +} + + +BOOL LLPanelLandExperiences::postBuild() +{ + mAllowed = setupList("panel_allowed", EXPERIENCE_KEY_TYPE_ALLOWED, AL_ALLOW_EXPERIENCE); + mBlocked = setupList("panel_blocked", EXPERIENCE_KEY_TYPE_BLOCKED, AL_BLOCK_EXPERIENCE); + + // only non-grid-wide experiences + mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_GRID)); + + // no privileged ones + mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperties, _1, LLExperienceCache::PROPERTY_PRIVILEGED|LLExperienceCache::PROPERTY_GRID)); + + getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(FALSE); + getChild<LLTextBox>("experiences_help_text")->setVisible(FALSE); + getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_parcel_text")); + getChild<LLTextBox>("blocked_text_help")->setText(getString("blocked_parcel_text")); + + return LLPanel::postBuild(); +} + +LLPanelExperienceListEditor* LLPanelLandExperiences::setupList( const char* control_name, U32 xp_type, U32 access_type ) +{ + LLPanelExperienceListEditor* child = findChild<LLPanelExperienceListEditor>(control_name); + if(child) + { + child->getChild<LLTextBox>("text_name")->setText(child->getString(control_name)); + child->setMaxExperienceIDs(PARCEL_MAX_EXPERIENCE_LIST); + child->setAddedCallback(boost::bind(&LLPanelLandExperiences::experienceAdded, this, _1, xp_type, access_type)); + child->setRemovedCallback(boost::bind(&LLPanelLandExperiences::experienceRemoved, this, _1, access_type)); + } + + return child; +} + +void LLPanelLandExperiences::experienceAdded( const LLUUID& id, U32 xp_type, U32 access_type ) +{ + LLParcel* parcel = mParcel->getParcel(); + if (parcel) + { + parcel->setExperienceKeyType(id, xp_type); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type); + refresh(); + } +} + +void LLPanelLandExperiences::experienceRemoved( const LLUUID& id, U32 access_type ) +{ + LLParcel* parcel = mParcel->getParcel(); + if (parcel) + { + parcel->setExperienceKeyType(id, EXPERIENCE_KEY_TYPE_NONE); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type); + refresh(); + } +} + +void LLPanelLandExperiences::refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type) +{ + LLParcel *parcel = mParcel->getParcel(); + + // Display options + if (panel == NULL) + { + return; + } + if (parcel == NULL) + { + // disable the panel + panel->setEnabled(FALSE); + panel->setExperienceIds(LLSD::emptyArray()); + } + else + { + // enable the panel + panel->setEnabled(TRUE); + LLAccessEntry::map entries = parcel->getExperienceKeysByType(xp_type); + LLAccessEntry::map::iterator it = entries.begin(); + LLSD ids = LLSD::emptyArray(); + for (/**/; it != entries.end(); ++it) + { + ids.append(it->second.mID); + } + panel->setExperienceIds(ids); + panel->setReadonly(!LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS)); + panel->refreshExperienceCounter(); + } +} + +void LLPanelLandExperiences::refresh() +{ + refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED); + refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED); +} |