diff options
author | dolphin <dolphin@lindenlab.com> | 2013-10-22 10:51:53 -0700 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2013-10-22 10:51:53 -0700 |
commit | 309ffd57fade231c3d14eedfe1171788e250f088 (patch) | |
tree | 61b6bfb1072bdb67b0399b90288525f647648a03 /indra/newview/llfloaterexperiences.cpp | |
parent | 035eafb0c69c434c709862c816663f2b4ca2ab2b (diff) |
Post events on experience permission changes to refresh uis
Diffstat (limited to 'indra/newview/llfloaterexperiences.cpp')
-rw-r--r-- | indra/newview/llfloaterexperiences.cpp | 83 |
1 files changed, 80 insertions, 3 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index 57f08742be..58ec4afd7c 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -7,6 +7,7 @@ #include "lltabcontainer.h" #include "lltrans.h" #include "llexperiencecache.h" +#include "llevents.h" class LLExperienceListResponder : public LLHTTPClient::Responder @@ -71,9 +72,11 @@ BOOL LLFloaterExperiences::postBuild() addTab("Recent_Experiences_Tab", false); resizeToTabs(); - refreshContents(); - - return TRUE; + + LLEventPumps::instance().obtain("experience_permission").listen("LLFloaterExperiences", + boost::bind(&LLFloaterExperiences::updatePermissions, this, _1)); + + return FALSE; } void LLFloaterExperiences::clearFromRecent(const LLSD& ids) @@ -157,3 +160,77 @@ void LLFloaterExperiences::refreshContents() } } } + +void LLFloaterExperiences::onOpen( const LLSD& key ) +{ + LLViewerRegion* region = gAgent.getRegion(); + if(region) + { + if(region->capabilitiesReceived()) + { + refreshContents(); + return; + } + region->setCapabilitiesReceivedCallback(boost::bind(&LLFloaterExperiences::refreshContents, this)); + return; + } +} + +bool LLFloaterExperiences::updatePermissions( const LLSD& permission ) +{ + LLTabContainer* tabs = getChild<LLTabContainer>("xp_tabs"); + LLUUID experience; + std::string permission_string; + if(permission.has("experience")) + { + experience = permission["experience"].asUUID(); + permission_string = permission[experience.asString()]["permission"].asString(); + + } + LLPanelExperiences* tab = (LLPanelExperiences*)tabs->getPanelByName("Allowed_Experiences_Tab"); + if(tab) + { + if(permission.has("experiences")) + { + tab->setExperienceList(permission["experiences"]); + } + else if(experience.notNull()) + { + if(permission_string != "Allow") + { + tab->removeExperience(experience); + } + else + { + tab->addExperience(experience); + } + } + } + + tab = (LLPanelExperiences*)tabs->getPanelByName("Blocked_Experiences_Tab"); + if(tab) + { + if(permission.has("blocked")) + { + tab->setExperienceList(permission["blocked"]); + } + else if(experience.notNull()) + { + if(permission_string != "Block") + { + tab->removeExperience(experience); + } + else + { + tab->addExperience(experience); + } + } + } + return false; +} + +void LLFloaterExperiences::onClose( bool app_quitting ) +{ + LLEventPumps::instance().obtain("experience_permission").stopListening("LLFloaterExperiences"); + LLFloater::onClose(app_quitting); +} |