diff options
author | dolphin <dolphin@lindenlab.com> | 2014-05-13 14:52:10 -0700 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2014-05-13 14:52:10 -0700 |
commit | 6766ef06d44b1991bd6ef3f699354f98651679b4 (patch) | |
tree | 1ac2d2eb804cecc50bf47e7409f958ed0c87e6d0 /indra | |
parent | 1b704efb17a2278588146760d189daaffe56d35d (diff) |
ACME-1474: Prevent the viewer from trying to add or remove the default experience.
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 23 | ||||
-rwxr-xr-x | indra/newview/llfloaterregioninfo.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelexperiencelisteditor.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llpanelexperiencelisteditor.h | 8 | ||||
-rw-r--r-- | indra/newview/llpanelexperiencepicker.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llpanelexperiencepicker.h | 1 |
6 files changed, 55 insertions, 5 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 6bfb31164a..d65661c6e9 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3583,9 +3583,22 @@ LLPanelExperienceListEditor* LLPanelRegionExperiences::setupList( const char* co void LLPanelRegionExperiences::processResponse( const LLSD& content ) { + if(content.has("default")) + { + mDefaultExperience = content["default"].asUUID(); + } + mAllowed->setExperienceIds(content["allowed"]); mBlocked->setExperienceIds(content["blocked"]); - mTrusted->setExperienceIds(content["trusted"]); + + LLSD trusted = content["trusted"]; + if(mDefaultExperience.notNull()) + { + mTrusted->setStickyFunction(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience)); + trusted.append(mDefaultExperience); + } + + mTrusted->setExperienceIds(trusted); if (!mAllowed->getReadonly()) { @@ -3646,6 +3659,8 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region) mAllowed->setReadonly(!allow_modify); // remove grid-wide experiences mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_GRID)); + // remove default experience + mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience)); mBlocked->loading(); mBlocked->setReadonly(!allow_modify); @@ -3653,6 +3668,8 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region) mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperty, _1, LLExperienceCache::PROPERTY_GRID)); // but not privileged ones mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_PRIVILEGED)); + // remove default experience + mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterMatching, _1, mDefaultExperience)); mTrusted->loading(); mTrusted->setReadonly(!allow_modify); @@ -3699,6 +3716,10 @@ BOOL LLPanelRegionExperiences::sendUpdate() void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id ) { + if(id == mDefaultExperience) + { + return; + } strings_t str(3, std::string()); gAgent.getID().toString(str[0]); str[1] = llformat("%u", event_type); diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 4a8bc19ace..2020cbce2b 100755 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -478,6 +478,7 @@ private: LLPanelExperienceListEditor* mTrusted; LLPanelExperienceListEditor* mAllowed; LLPanelExperienceListEditor* mBlocked; + LLUUID mDefaultExperience; }; #endif diff --git a/indra/newview/llpanelexperiencelisteditor.cpp b/indra/newview/llpanelexperiencelisteditor.cpp index f01438b34e..323adbe2b7 100644 --- a/indra/newview/llpanelexperiencelisteditor.cpp +++ b/indra/newview/llpanelexperiencelisteditor.cpp @@ -143,7 +143,23 @@ void LLPanelExperienceListEditor::checkButtonsEnabled() { mAdd->setEnabled(!mReadonly); int selected = mItems->getNumSelected(); - mRemove->setEnabled(!mReadonly && selected>0); + + bool remove_enabled = !mReadonly && selected>0; + if(remove_enabled && mSticky) + { + std::vector<LLScrollListItem*> items= mItems->getAllSelected(); + std::vector<LLScrollListItem*>::iterator it = items.begin(); + for(/**/; it != items.end() && remove_enabled; ++it) + { + if((*it) != NULL) + { + remove_enabled = !mSticky((*it)->getValue()); + } + } + + + } + mRemove->setEnabled(remove_enabled); mProfile->setEnabled(selected==1); } diff --git a/indra/newview/llpanelexperiencelisteditor.h b/indra/newview/llpanelexperiencelisteditor.h index b361748d29..189d81f897 100644 --- a/indra/newview/llpanelexperiencelisteditor.h +++ b/indra/newview/llpanelexperiencelisteditor.h @@ -41,8 +41,8 @@ public: typedef boost::signals2::signal<void (const LLUUID&) > list_changed_signal_t; // filter function for experiences, return true if the experience should be hidden. - typedef boost::function<bool (const LLSD&)> filter_function; - typedef std::vector<filter_function> filter_list; + typedef boost::function<bool (const LLSD&)> experience_function; + typedef std::vector<experience_function> filter_list; typedef LLHandle<LLFloaterExperiencePicker> PickerHandle; LLPanelExperienceListEditor(); ~LLPanelExperienceListEditor(); @@ -64,7 +64,8 @@ public: void refreshExperienceCounter(std::string string_name); - void addFilter(filter_function func){mFilters.push_back(func);} + void addFilter(experience_function func){mFilters.push_back(func);} + void setStickyFunction(experience_function func){mSticky = func;} private: void onItems(); @@ -89,6 +90,7 @@ private: list_changed_signal_t mRemovedCallback; LLUUID mKey; bool mReadonly; + experience_function mSticky; }; diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 5d8f3134d6..eb0c7c65ab 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -395,3 +395,12 @@ void LLPanelExperiencePicker::setDefaultFilters() mFilters.clear(); addFilter(boost::bind(&LLPanelExperiencePicker::FilterOverRating, this, _1)); } + +bool LLPanelExperiencePicker::FilterMatching( const LLSD& experience, const LLUUID& id ) +{ + if(experience.isUUID()) + { + return experience.asUUID() == id; + } + return experience[LLExperienceCache::EXPERIENCE_ID].asUUID() == id; +} diff --git a/indra/newview/llpanelexperiencepicker.h b/indra/newview/llpanelexperiencepicker.h index af0a30ceba..d5c38598e1 100644 --- a/indra/newview/llpanelexperiencepicker.h +++ b/indra/newview/llpanelexperiencepicker.h @@ -56,6 +56,7 @@ public: static bool FilterWithProperty(const LLSD& experience, S32 prop); static bool FilterWithoutProperty(const LLSD& experience, S32 prop); + static bool FilterMatching(const LLSD& experience, const LLUUID& id); bool FilterOverRating(const LLSD& experience); private: |