summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordolphin <dolphin@lindenlab.com>2014-05-09 10:26:06 -0700
committerdolphin <dolphin@lindenlab.com>2014-05-09 10:26:06 -0700
commitbb5e0f7877d06f10cd9ba82bc596a072427306b2 (patch)
tree534e3a99f342fff55a7f365b3d7552853bc3e17f
parentd331db79c2a1f07f9919703677b44d4664c36509 (diff)
Enable the experience purchase button based on the sim providing purchase info.
-rw-r--r--indra/newview/llfloaterexperiences.cpp24
-rw-r--r--indra/newview/llfloaterexperiences.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_experiences.xml6
3 files changed, 22 insertions, 9 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp
index 2153079fa4..5ed77d3680 100644
--- a/indra/newview/llfloaterexperiences.cpp
+++ b/indra/newview/llfloaterexperiences.cpp
@@ -47,11 +47,13 @@ class LLExperienceListResponder : public LLHTTPClient::Responder
{
public:
typedef std::map<std::string, std::string> NameMap;
- LLExperienceListResponder(const LLHandle<LLFloaterExperiences>& parent, NameMap& nameMap, const std::string& errorMessage="ErrorMessage"):mParent(parent),mErrorMessage(errorMessage)
- {
- mNameMap.swap(nameMap);
- }
+ typedef boost::function<void(LLPanelExperiences*, const LLSD&)> Callback;
+ LLExperienceListResponder(const LLHandle<LLFloaterExperiences>& parent, NameMap& nameMap, const std::string& errorMessage="ErrorMessage"):mParent(parent),mErrorMessage(errorMessage)
+ {
+ mNameMap.swap(nameMap);
+ }
+ Callback mCallback;
LLHandle<LLFloaterExperiences> mParent;
NameMap mNameMap;
const std::string mErrorMessage;
@@ -73,7 +75,10 @@ public:
{
const LLSD& ids = content[it->first];
tab->setExperienceList(ids);
- tab->enableButton(ids.beginArray() == ids.endArray());
+ if(!mCallback.empty())
+ {
+ mCallback(tab, content);
+ }
}
}
++it;
@@ -298,6 +303,11 @@ void LLFloaterExperiences::onClose( bool app_quitting )
LLFloater::onClose(app_quitting);
}
+void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content) const
+{
+ panel->enableButton(content.has("purchase"));
+}
+
void LLFloaterExperiences::sendPurchaseRequest() const
{
LLViewerRegion* region = gAgent.getRegion();
@@ -308,6 +318,8 @@ void LLFloaterExperiences::sendPurchaseRequest() const
LLExperienceListResponder::NameMap nameMap;
nameMap["experience_ids"]="Owned_Experiences_Tab";
- LLHTTPClient::post(url, content, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap, "ExperienceAcquireFailed"));
+ LLExperienceListResponder* responder = new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap, "ExperienceAcquireFailed");
+ responder->mCallback = boost::bind(&LLFloaterExperiences::checkPurchaseInfo, this, _1, _2);
+ LLHTTPClient::post(url, content, responder);
}
}
diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h
index bb2de2f0db..f1a0f49245 100644
--- a/indra/newview/llfloaterexperiences.h
+++ b/indra/newview/llfloaterexperiences.h
@@ -49,6 +49,7 @@ protected:
bool updatePermissions(const LLSD& permission);
void sendPurchaseRequest() const;
+ void checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content)const;
private:
diff --git a/indra/newview/skins/default/xui/en/floater_experiences.xml b/indra/newview/skins/default/xui/en/floater_experiences.xml
index e727512b7f..fe959ea6d8 100644
--- a/indra/newview/skins/default/xui/en/floater_experiences.xml
+++ b/indra/newview/skins/default/xui/en/floater_experiences.xml
@@ -4,9 +4,9 @@
can_close="true"
can_resize="true"
height="400"
- width="300"
+ width="500"
min_height="300"
- min_width="300"
+ min_width="500"
layout="topleft"
name="floater_experiences"
save_rect="true"
@@ -18,7 +18,7 @@
top="3"
left="3"
layout="topleft"
- width="294"
+ right="-3"
follows="all"
height="394"
name="xp_tabs">