diff options
-rw-r--r-- | indra/newview/llfloaterexperiences.cpp | 39 | ||||
-rw-r--r-- | indra/newview/llfloaterexperiences.h | 2 |
2 files changed, 28 insertions, 13 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index d973fe5b33..777dc382cd 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -26,6 +26,7 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterexperiences.h" +#include "llfloaterreg.h" #include "llagent.h" #include "llevents.h" @@ -206,19 +207,8 @@ void LLFloaterExperiences::refreshContents() LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); } - lookup_url = region->getCapability("GetAdminExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Admin_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); - } - - lookup_url = region->getCapability("GetCreatorExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Contrib_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); - } + updateInfo("GetAdminExperiences","Admin_Experiences_Tab"); + updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab"); lookup_url = region->getCapability("AgentExperiences"); if(!lookup_url.empty()) @@ -308,6 +298,24 @@ void LLFloaterExperiences::onClose( bool app_quitting ) void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content) const { panel->enableButton(content.has("purchase")); + + LLFloaterExperiences::findInstance()->updateInfo("GetAdminExperiences","Admin_Experiences_Tab"); + LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab"); +} + +void LLFloaterExperiences::updateInfo(std::string experiences, std::string tab) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + LLExperienceListResponder::NameMap nameMap; + std::string lookup_url = region->getCapability(experiences); + if(!lookup_url.empty()) + { + nameMap["experience_ids"]=tab; + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); + } + } } void LLFloaterExperiences::sendPurchaseRequest() const @@ -325,3 +333,8 @@ void LLFloaterExperiences::sendPurchaseRequest() const LLHTTPClient::post(url, content, responder); } } + +LLFloaterExperiences* LLFloaterExperiences::findInstance() +{ + return LLFloaterReg::findTypedInstance<LLFloaterExperiences>("experiences"); +} diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h index f1a0f49245..769283ff07 100644 --- a/indra/newview/llfloaterexperiences.h +++ b/indra/newview/llfloaterexperiences.h @@ -39,6 +39,7 @@ public: virtual void onClose(bool app_quitting); virtual void onOpen(const LLSD& key); + static LLFloaterExperiences* findInstance(); protected: void clearFromRecent(const LLSD& ids); void resizeToTabs(); @@ -50,6 +51,7 @@ protected: bool updatePermissions(const LLSD& permission); void sendPurchaseRequest() const; void checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content)const; + void updateInfo(std::string experiences, std::string tab); private: |