summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-11-05 19:40:26 +0200
committerandreykproductengine <akleshchev@productengine.com>2015-11-05 19:40:26 +0200
commit7d88f8814b2f4f409d182a6cabcd62b04ee4df89 (patch)
tree4d2e794a9065d6d218b728612c880fddd34b9d4e /indra
parentf1ddcfeb1d1530bf2b8ef8da3cdfe6bdb68e013f (diff)
SL-192 Edit Experience Profile shows up once an Exp is acquired
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterexperienceprofile.cpp29
-rw-r--r--indra/newview/llfloaterexperienceprofile.h2
-rw-r--r--indra/newview/llfloaterexperiences.cpp42
-rw-r--r--indra/newview/llfloaterexperiences.h4
-rw-r--r--indra/newview/llpanelexperiences.cpp10
-rw-r--r--indra/newview/llpanelexperiences.h1
6 files changed, 79 insertions, 9 deletions
diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp
index 197162487d..4d60d01922 100644
--- a/indra/newview/llfloaterexperienceprofile.cpp
+++ b/indra/newview/llfloaterexperienceprofile.cpp
@@ -117,12 +117,20 @@ LLExperienceHandler gExperienceHandler;
LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data)
: LLFloater(data)
- , mExperienceId(data.asUUID())
, mSaveCompleteAction(NOTHING)
, mDirty(false)
, mForceClose(false)
{
-
+ if (data.has("experience_id"))
+ {
+ mExperienceId = data["experience_id"].asUUID();
+ mPostEdit = data.has("edit_experience") && data["edit_experience"].asBoolean();
+ }
+ else
+ {
+ mExperienceId = data.asUUID();
+ mPostEdit = false;
+ }
}
@@ -356,9 +364,7 @@ bool LLFloaterExperienceProfile::experiencePermission( LLHandle<LLFloaterExperie
void LLFloaterExperienceProfile::onClickEdit()
{
- LLTabContainer* tabs = getChild<LLTabContainer>("tab_container");
-
- tabs->selectTabByName("edit_panel_experience_info");
+ changeToEdit();
}
@@ -615,6 +621,12 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
mDirty=false;
mForceClose = false;
getChild<LLButton>(BTN_SAVE)->setEnabled(mDirty);
+
+ if (mPostEdit)
+ {
+ mPostEdit = false;
+ changeToEdit();
+ }
}
void LLFloaterExperienceProfile::setPreferences( const LLSD& content )
@@ -829,6 +841,13 @@ void LLFloaterExperienceProfile::changeToView()
}
}
+void LLFloaterExperienceProfile::changeToEdit()
+{
+ LLTabContainer* tabs = getChild<LLTabContainer>("tab_container");
+
+ tabs->selectTabByName("edit_panel_experience_info");
+}
+
void LLFloaterExperienceProfile::onClickLocation()
{
LLViewerRegion* region = gAgent.getRegion();
diff --git a/indra/newview/llfloaterexperienceprofile.h b/indra/newview/llfloaterexperienceprofile.h
index 78d54eb447..14e033d240 100644
--- a/indra/newview/llfloaterexperienceprofile.h
+++ b/indra/newview/llfloaterexperienceprofile.h
@@ -76,6 +76,7 @@ protected:
void setEditGroup(LLUUID group_id);
void changeToView();
+ void changeToEdit();
void experienceForgotten();
void experienceBlocked();
@@ -99,6 +100,7 @@ protected:
int mSaveCompleteAction;
bool mDirty;
bool mForceClose;
+ bool mPostEdit; // edit experience after opening and updating it
};
#endif // LL_LLFLOATEREXPERIENCEPROFILE_H
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp
index 777dc382cd..63f1fab823 100644
--- a/indra/newview/llfloaterexperiences.cpp
+++ b/indra/newview/llfloaterexperiences.cpp
@@ -303,6 +303,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 experiences, std::string tab)
{
LLViewerRegion* region = gAgent.getRegion();
@@ -318,18 +344,28 @@ void LLFloaterExperiences::updateInfo(std::string experiences, std::string tab)
}
}
-void LLFloaterExperiences::sendPurchaseRequest() const
+void LLFloaterExperiences::sendPurchaseRequest()
{
LLViewerRegion* region = gAgent.getRegion();
std::string url = region->getCapability("AgentExperiences");
if(!url.empty())
{
LLSD content;
+ const std::string tab_owned_name = "Owned_Experiences_Tab";
+
+ // 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);
+ }
LLExperienceListResponder::NameMap nameMap;
- nameMap["experience_ids"]="Owned_Experiences_Tab";
+ nameMap["experience_ids"] = tab_owned_name;
LLExperienceListResponder* responder = new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap, "ExperienceAcquireFailed");
- responder->mCallback = boost::bind(&LLFloaterExperiences::checkPurchaseInfo, this, _1, _2);
+ responder->mCallback = boost::bind(&LLFloaterExperiences::checkAndOpen, this, _1, _2);
LLHTTPClient::post(url, content, responder);
}
}
diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h
index 769283ff07..06fd6c93d6 100644
--- a/indra/newview/llfloaterexperiences.h
+++ b/indra/newview/llfloaterexperiences.h
@@ -49,12 +49,14 @@ protected:
LLPanelExperiences* addTab(const std::string& name, bool select);
bool updatePermissions(const LLSD& permission);
- void sendPurchaseRequest() const;
+ void sendPurchaseRequest();
void checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content)const;
+ void checkAndOpen(LLPanelExperiences* panel, const LLSD& content) const;
void updateInfo(std::string experiences, std::string tab);
private:
+ std::vector<LLUUID> mPrepurchaseIds;
};
#endif //LL_LLFLOATEREXPERIENCES_H
diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp
index 3ee4b5e968..37981b36a9 100644
--- a/indra/newview/llpanelexperiences.cpp
+++ b/indra/newview/llpanelexperiences.cpp
@@ -98,6 +98,16 @@ void LLPanelExperiences::setExperienceList( const LLSD& experiences )
mExperiencesList->sort();
}
+void LLPanelExperiences::getExperienceIdsList(std::vector<LLUUID>& result)
+{
+ std::vector<LLSD> ids;
+ mExperiencesList->getValues(ids);
+ for (LLSD::array_const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ result.push_back(it->asUUID());
+ }
+}
+
LLPanelExperiences* LLPanelExperiences::create(const std::string& name)
{
LLPanelExperiences* panel= new LLPanelExperiences();
diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h
index 0370499583..f29fdfdecb 100644
--- a/indra/newview/llpanelexperiences.h
+++ b/indra/newview/llpanelexperiences.h
@@ -58,6 +58,7 @@ public:
/*virtual*/ void onClosePanel();
void setExperienceList(const LLSD& experiences);
+ void getExperienceIdsList(std::vector<LLUUID>& result);
LLExperienceItem* getSelectedExperienceItem();
void removeExperiences( const LLSD& ids );