diff options
author | Rider Linden <rider@lindenlab.com> | 2016-01-15 13:36:38 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2016-01-15 13:36:38 -0800 |
commit | e7eaa94dfa1eba24cbf1667190a0be37b2f417e4 (patch) | |
tree | 9e9db05ef4d37698a7fa5f68149f724aa569528d /indra/newview/llfloaterexperiences.cpp | |
parent | 34fe371bfdeb6fc83818c58660c038c372c0f64a (diff) | |
parent | 5a5c023e291990a463b1a91846ce82c70da8daab (diff) |
Merge VR
Diffstat (limited to 'indra/newview/llfloaterexperiences.cpp')
-rw-r--r-- | indra/newview/llfloaterexperiences.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index fbe00beddd..fdc1b47334 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -243,6 +243,32 @@ void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LL LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab"); } +void LLFloaterExperiences::checkAndOpen(LLPanelExperiences* panel, const LLSD& content) const +{ + checkPurchaseInfo(panel, content); + + // determine new item + const LLSD& response_ids = content["experience_ids"]; + + if (mPrepurchaseIds.size() + 1 == response_ids.size()) + { + // we have a new element + for (LLSD::array_const_iterator it = response_ids.beginArray(); it != response_ids.endArray(); ++it) + { + LLUUID experience_id = it->asUUID(); + if (std::find(mPrepurchaseIds.begin(), mPrepurchaseIds.end(), experience_id) == mPrepurchaseIds.end()) + { + // new element found, open it + LLSD args; + args["experience_id"] = experience_id; + args["edit_experience"] = true; + LLFloaterReg::showInstance("experience_profile", args, true); + break; + } + } + } +} + void LLFloaterExperiences::updateInfo(std::string experienceCap, std::string tab) { LLViewerRegion* region = gAgent.getRegion(); @@ -264,12 +290,22 @@ void LLFloaterExperiences::sendPurchaseRequest() if (region) { NameMap_t tabMap; + const std::string tab_owned_name = "Owned_Experiences_Tab"; LLHandle<LLFloaterExperiences> handle = getDerivedHandle<LLFloaterExperiences>(); - tabMap["experience_ids"] = "Owned_Experiences_Tab"; + tabMap["experience_ids"] = tab_owned_name; + + // extract ids for experiences that we already have + LLTabContainer* tabs = getChild<LLTabContainer>("xp_tabs"); + LLPanelExperiences* tab_owned = (LLPanelExperiences*)tabs->getPanelByName(tab_owned_name); + mPrepurchaseIds.clear(); + if (tab_owned) + { + tab_owned->getExperienceIdsList(mPrepurchaseIds); + } requestNewExperience(region->getCapability("AgentExperiences"), handle, tabMap, "ExperienceAcquireFailed", - boost::bind(&LLFloaterExperiences::checkPurchaseInfo, this, _1, _2)); + boost::bind(&LLFloaterExperiences::checkAndOpen, this, _1, _2)); } } |