diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterexperiences.cpp | 44 | ||||
-rw-r--r-- | indra/newview/llfloaterexperiences.h | 5 | ||||
-rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 56 | ||||
-rwxr-xr-x | indra/newview/llfloaterregioninfo.h | 3 | ||||
-rw-r--r-- | indra/newview/llpanelexperiences.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llpanelexperiences.h | 2 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/notifications.xml | 15 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_experiences.xml | 53 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_experiences.xml | 33 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 1 |
10 files changed, 127 insertions, 105 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index 3b15cc62a7..8e860a9ee0 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -34,20 +34,21 @@ #include "lltrans.h" #include "llexperiencecache.h" #include "llevents.h" +#include "llnotificationsutil.h" class LLExperienceListResponder : public LLHTTPClient::Responder { public: typedef std::map<std::string, std::string> NameMap; - LLExperienceListResponder(const LLHandle<LLFloaterExperiences>& parent, NameMap& nameMap):mParent(parent) + LLExperienceListResponder(const LLHandle<LLFloaterExperiences>& parent, NameMap& nameMap, const std::string& errorMessage="ErrorMessage"):mParent(parent),mErrorMessage(errorMessage) { mNameMap.swap(nameMap); } LLHandle<LLFloaterExperiences> mParent; NameMap mNameMap; - + const std::string mErrorMessage; virtual void result(const LLSD& content) { if(mParent.isDead()) @@ -66,12 +67,19 @@ public: { const LLSD& ids = content[it->first]; tab->setExperienceList(ids); - //parent->clearFromRecent(ids); + tab->enableButton(ids.beginArray() == ids.endArray()); } } ++it; } } + + virtual void error(U32 status, const std::string& reason) + { + LLSD subs; + subs["ERROR_MESSAGE"] = reason; + LLNotificationsUtil::add(mErrorMessage, subs); + } }; @@ -81,12 +89,15 @@ LLFloaterExperiences::LLFloaterExperiences(const LLSD& data) { } -void LLFloaterExperiences::addTab(const std::string& name, bool select) +LLPanelExperiences* LLFloaterExperiences::addTab(const std::string& name, bool select) { + LLPanelExperiences* newPanel = LLPanelExperiences::create(name); getChild<LLTabContainer>("xp_tabs")->addTabPanel(LLTabContainer::TabPanelParams(). - panel(LLPanelExperiences::create(name)). + panel(newPanel). label(LLTrans::getString(name)). select_tab(select)); + + return newPanel; } BOOL LLFloaterExperiences::postBuild() @@ -96,6 +107,8 @@ BOOL LLFloaterExperiences::postBuild() addTab("Admin_Experiences_Tab", false); addTab("Contrib_Experiences_Tab", false); addTab("Recent_Experiences_Tab", false); + LLPanelExperiences* owned = addTab("Owned_Experiences_Tab", false); + owned->setButtonAction("acquire", boost::bind(&LLFloaterExperiences::sendPurchaseRequest, this)); resizeToTabs(); @@ -184,6 +197,13 @@ void LLFloaterExperiences::refreshContents() nameMap["experience_ids"]="Contrib_Experiences_Tab"; LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); } + + lookup_url = region->getCapability("AgentExperiences"); + if(!lookup_url.empty()) + { + nameMap["experience_ids"]="Owned_Experiences_Tab"; + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap)); + } } } @@ -260,3 +280,17 @@ void LLFloaterExperiences::onClose( bool app_quitting ) LLEventPumps::instance().obtain("experience_permission").stopListening("LLFloaterExperiences"); LLFloater::onClose(app_quitting); } + +void LLFloaterExperiences::sendPurchaseRequest() const +{ + LLViewerRegion* region = gAgent.getRegion(); + std::string url = region->getCapability("AgentExperiences"); + if(!url.empty()) + { + LLSD content; + + LLExperienceListResponder::NameMap nameMap; + nameMap["experience_ids"]="Owned_Experiences_Tab"; + LLHTTPClient::post(url, content, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap, "ExperienceAcquireFailed")); + } +} diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h index 27b453042b..bb2de2f0db 100644 --- a/indra/newview/llfloaterexperiences.h +++ b/indra/newview/llfloaterexperiences.h @@ -29,6 +29,8 @@ #include "llfloater.h" +class LLPanelExperiences; + class LLFloaterExperiences : public LLFloater { @@ -43,9 +45,10 @@ protected: /*virtual*/ BOOL postBuild(); void refreshContents(); void setupRecentTabs(); - void addTab(const std::string& name, bool select); + LLPanelExperiences* addTab(const std::string& name, bool select); bool updatePermissions(const LLSD& permission); + void sendPurchaseRequest() const; private: diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 43f0ba10a1..027815c593 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3483,10 +3483,6 @@ BOOL LLPanelRegionExperiences::postBuild() mAllowed = setupList("panel_allowed"); mTrusted = setupList("panel_trusted"); mBlocked = setupList("panel_blocked"); - mOwned = LLPanelExperiences::create("owned"); - LLPanel* pOwned = findChild<LLPanel>("panel_owned"); - pOwned->addChild(mOwned); - mOwned->setShape(pOwned->getRect()); return LLPanelRegionInfo::postBuild(); } @@ -3550,8 +3546,7 @@ public: void LLPanelRegionExperiences::infoCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content) -{ - +{ if(handle.isDead()) return; @@ -3560,26 +3555,8 @@ void LLPanelRegionExperiences::infoCallback(LLHandle<LLPanelRegionExperiences> h { floater->processResponse(content); } - } - -void LLPanelRegionExperiences::ownedCallback( LLHandle<LLPanelRegionExperiences> handle, const LLSD& content ) -{ - if(handle.isDead()) - return; - - LLPanelRegionExperiences* floater = handle.get(); - if (floater && content.has("experience_ids")) - { - const LLSD& ids = content["experience_ids"]; - floater->getChild<LLButton>("btn_buy")->setEnabled(ids.beginArray() == ids.endArray()); - - floater->setOwnedExperiences(content["experience_ids"]); - } -} - - bool LLPanelRegionExperiences::FilterExisting(const LLSD& experience) { LLUUID id = experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); @@ -3612,18 +3589,7 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region) mTrusted->setReadonly(!allow_modify); mTrusted->addFilter(boost::bind(&LLPanelRegionExperiences::FilterExisting, this, _1)); - std::string url = region->getCapability("AgentExperiences"); - mOwned->getParent()->setVisible(!url.empty() && region && region->canManageEstate()); - - if(!url.empty()) - { - LLHTTPClient::get(url, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::ownedCallback, - getDerivedHandle<LLPanelRegionExperiences>(), _1))); - - getChild<LLButton>("btn_buy")->setCommitCallback(boost::bind(&LLPanelRegionExperiences::sendPurchaseRequest, this)); - } - - url = region->getCapability("RegionExperiences"); + std::string url = region->getCapability("RegionExperiences"); if (!url.empty()) { LLHTTPClient::get(url, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::infoCallback, @@ -3667,21 +3633,3 @@ void LLPanelRegionExperiences::listChanged() { onChangeAnything(); } - -void LLPanelRegionExperiences::setOwnedExperiences( const LLSD& experiences ) -{ - mOwned->setExperienceList(experiences); -} - -void LLPanelRegionExperiences::sendPurchaseRequest() const -{ - LLViewerRegion* region = gAgent.getRegion(); - std::string url = region->getCapability("AgentExperiences"); - if(!url.empty()) - { - LLSD content; - - LLHTTPClient::post(url, content, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::ownedCallback, - getDerivedHandle<LLPanelRegionExperiences>(), _1))); - } -} diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 066a5c5da9..d2bbcbea61 100755 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -466,8 +466,6 @@ public: bool refreshFromRegion(LLViewerRegion* region); void sendPurchaseRequest()const; private: - static void ownedCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content); - void setOwnedExperiences(const LLSD& experiences); void processResponse( const LLSD& content ); boost::signals2::connection processResponse( LLPanelExperienceListEditor* panel, boost::signals2::connection& connection, const LLSD& content); void refreshRegionExperiences(); @@ -477,7 +475,6 @@ private: bool FilterExisting(const LLSD& experience ); - LLPanelExperiences* mOwned; LLPanelExperienceListEditor* mTrusted; boost::signals2::connection mTrustedConnection; LLPanelExperienceListEditor* mAllowed; diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp index 3aca9eb68b..f1d6ea09ed 100644 --- a/indra/newview/llpanelexperiences.cpp +++ b/indra/newview/llpanelexperiences.cpp @@ -35,6 +35,7 @@ #include "llpanelexperiences.h" #include "llslurl.h" +#include "lllayoutstack.h" static LLRegisterPanelClassWrapper<LLPanelExperiences> register_experiences_panel("experiences_panel"); @@ -114,7 +115,25 @@ void LLPanelExperiences::addExperience( const LLUUID& id ) } } +void LLPanelExperiences::setButtonAction(const std::string& label, const commit_signal_t::slot_type& cb ) +{ + if(label.empty()) + { + getChild<LLLayoutPanel>("button_panel")->setVisible(false); + } + else + { + getChild<LLLayoutPanel>("button_panel")->setVisible(true); + LLButton* child = getChild<LLButton>("btn_action"); + child->setCommitCallback(cb); + child->setLabel(getString(label)); + } +} +void LLPanelExperiences::enableButton( bool enable ) +{ + getChild<LLButton>("btn_action")->setEnabled(enable); +} LLExperienceItem::LLExperienceItem() @@ -142,7 +161,6 @@ LLPanelSearchExperiences* LLPanelSearchExperiences::create( const std::string& n { LLPanelSearchExperiences* panel= new LLPanelSearchExperiences(); panel->getChild<LLPanel>("results")->addChild(LLPanelExperiences::create(name)); - ///XXXif( return panel; } diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h index bda0f4b587..c525b1f548 100644 --- a/indra/newview/llpanelexperiences.h +++ b/indra/newview/llpanelexperiences.h @@ -63,6 +63,8 @@ public: void removeExperiences( const LLSD& ids ); void removeExperience( const LLUUID& id); void addExperience( const LLUUID& id); + void setButtonAction(const std::string& label, const commit_signal_t::slot_type& cb); + void enableButton(bool enable); protected: private: diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index d473b8de00..75a7240c9e 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6985,6 +6985,21 @@ Is this OK? text="Block"/> </form> </notification> + + <notification + icon="alertmodal.tga" + name="ExperienceAcquireFailed" + type="alertmodal"> +Unable to acquire a new experience: + [ERROR_MESSAGE] + <tag>fail</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + + <notification icon="notify.tga" name="TeleportedHomeExperienceRemoved" diff --git a/indra/newview/skins/default/xui/en/panel_experiences.xml b/indra/newview/skins/default/xui/en/panel_experiences.xml index af264e73df..82b69fc344 100644 --- a/indra/newview/skins/default/xui/en/panel_experiences.xml +++ b/indra/newview/skins/default/xui/en/panel_experiences.xml @@ -12,14 +12,51 @@ <string name="no_experiences" value="No experiences."/> - <flat_list_view - name="experiences_list" + <string + name="acquire" + value="Acquire an Experience" /> + <layout_stack layout="topleft" top="0" - left="0" - width="200" - height="300" - follows="all" - > - </flat_list_view> + left="4" + right="-1" + bottom="-4" + orientation="vertical" + follows="all"> + <layout_panel + layout="topleft" + top="0" + left="1" + right="-1" + height="250" + follows="all"> + <flat_list_view + name="experiences_list" + layout="topleft" + top="0" + left="1" + right="-1" + bottom="-1" + follows="all"> + </flat_list_view> + </layout_panel> + <layout_panel + layout="topleft" + top="0" + left="1" + right="-1" + height="24" + min_height="24" + follows="all" + name="button_panel" + visible="false"> + <button + layout="topleft" + left="2" + top="0" + follows="top|left" + name="btn_action" + enabled="true"/> + </layout_panel> + </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_region_experiences.xml b/indra/newview/skins/default/xui/en/panel_region_experiences.xml index ee908348a3..b7602f8fd3 100644 --- a/indra/newview/skins/default/xui/en/panel_region_experiences.xml +++ b/indra/newview/skins/default/xui/en/panel_region_experiences.xml @@ -33,39 +33,6 @@ min_height="140" orientation="vertical"> <layout_panel - layout="topleft" - height="100" - min_height="100" - width="530"> - <text - layout="topleft" - follows="left|top" - height="18" - left="0" - top="4" - value="Your Experiences" - width="460"/> - <button - layout="topleft" - left="464" - top="4" - follows="top|right" - width="64" - name="btn_buy" - label="Buy" - enabled="false"/> - <panel - layout="topleft" - border="true" - left="0" - top="22" - height="74" - follows="all" - width="460" - name="panel_owned"> - </panel> - </layout_panel> - <layout_panel height="100" min_height="100" width="530"> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index fed2d764d0..bf925e02f0 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3949,6 +3949,7 @@ Try enclosing path to the editor with double quotes. <string name="Contrib_Experiences_Tab">CONTRIBUTOR</string> <string name="Admin_Experiences_Tab">ADMIN</string> <string name="Recent_Experiences_Tab">RECENT</string> + <string name="Owned_Experiences_Tab">OWNED</string> <!-- Conversation log messages --> <string name="logging_calls_disabled_log_empty"> |