diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpanelexperiences.cpp | 90 | ||||
-rw-r--r-- | indra/newview/llpanelexperiences.h | 5 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 5 |
5 files changed, 76 insertions, 30 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e49212d9de..c4fdc1ee21 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4818,12 +4818,12 @@ void LLAppViewer::idleExperienceCache() LLViewerRegion* region = gAgent.getRegion(); if (!region) return; - std::string lookup_url=region->getCapability("GetDisplayNames"); // use GetDisplayNames for testing round trip + std::string lookup_url=region->getCapability("GetExperienceInfo"); if(!lookup_url.empty() && lookup_url.back() != '/') { lookup_url += '/'; } - + LLExperienceCache::setLookupURL(lookup_url); LLExperienceCache::idle(); diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp index bc9d3cc0ee..02a3c4c410 100644 --- a/indra/newview/llpanelexperiences.cpp +++ b/indra/newview/llpanelexperiences.cpp @@ -4,6 +4,7 @@ #include "llpanelprofile.h" #include "lluictrlfactory.h" #include "llexperiencecache.h" +#include "llagent.h" #include "llpanelexperiences.h" @@ -26,6 +27,61 @@ void* LLPanelExperiences::create( void* data ) return new LLPanelExperiences(); } +void ExperienceResult(LLHandle<LLPanelExperiences> panel, const LLSD& experience) +{ + LLPanelExperiences* experiencePanel = panel.get(); + if(experiencePanel) + { + experiencePanel->addExperienceInfo(experience); + } +} + +class LLExperienceListResponder : public LLHTTPClient::Responder +{ +public: + LLExperienceListResponder(const LLHandle<LLPanelExperiences>& parent):mParent(parent) + { + } + + LLHandle<LLPanelExperiences> mParent; + + virtual void result(const LLSD& content) + { + if(mParent.isDead()) + return; + + LLSD experiences = content["experiences"]; + LLSD::array_const_iterator it = experiences.beginArray(); + for( /**/ ; it != experiences.endArray(); ++it) + { + LLUUID public_key = it->asUUID(); + + LLExperienceCache::get(public_key, LLExperienceCache::PUBLIC_KEY, boost::bind(ExperienceResult, mParent, _1)); + } + } +}; + +void LLPanelExperiences::addExperienceInfo(const LLSD& experience) +{ + LLExperienceItem* item = new LLExperienceItem(); + if(experience.has(LLExperienceCache::NAME)) + { + item->setExperienceName(experience[LLExperienceCache::NAME].asString()); + } + else if(experience.has("error")) + { + item->setExperienceName(experience["error"].asString()); + } + + if(experience.has(LLExperienceCache::PUBLIC_KEY)) + { + item->setExperienceDescription(experience[LLExperienceCache::PUBLIC_KEY].asString()); + } + + mExperiencesList->addItem(item); + +} + BOOL LLPanelExperiences::postBuild( void ) { @@ -35,15 +91,15 @@ BOOL LLPanelExperiences::postBuild( void ) mExperiencesList->setNoItemsCommentText(getString("no_experiences")); } - const LLExperienceCache::cache_t& experiences = LLExperienceCache::getCached(); - LLExperienceCache::cache_t::const_iterator it = experiences.begin(); - for( ; it != experiences.end() && mExperiencesList->getChildCount() < 10 ; ++it) + LLViewerRegion* region = gAgent.getRegion(); + if (region) { - LLExperienceItem* item = new LLExperienceItem(); - item->setExperienceName(it->second.mDisplayName); - item->setExperienceDescription(it->second.mDescription); - mExperiencesList->addItem(item); + std::string lookup_url=region->getCapability("GetExperiences"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle<LLPanelExperiences>())); + } } mExperiencesAccTab = getChild<LLAccordionCtrlTab>("tab_experiences"); @@ -71,17 +127,6 @@ void LLPanelExperiences::updateData() if(isDirty()) { mNoExperiences = false; - - /* - mNoItemsLabel->setValue(LLTrans::getString("PicksClassifiedsLoadingText")); - mNoItemsLabel->setVisible(TRUE); - - mPicksList->clear(); - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(getAvatarId()); - - mClassifiedsList->clear(); - LLAvatarPropertiesProcessor::getInstance()->sendAvatarClassifiedsRequest(getAvatarId()); - */ } } @@ -179,10 +224,13 @@ LLExperienceItem::LLExperienceItem() buildFromFile("panel_experience_info.xml"); } -void LLExperienceItem::init( LLExperienceData* experience_data ) +void LLExperienceItem::init( LLSD* experience_data ) { - setExperienceDescription(experience_data->mDescription); - setExperienceName(experience_data->mDisplayName); + if(experience_data) + { + setExperienceDescription(experience_data->has(LLExperienceCache::PUBLIC_KEY)?(*experience_data)[LLExperienceCache::PUBLIC_KEY].asString() : std::string()); + setExperienceName(experience_data->has(LLExperienceCache::NAME)?(*experience_data)[LLExperienceCache::NAME].asString() : std::string()); + } } void LLExperienceItem::setExperienceDescription( const std::string& val ) diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h index 33bb0f944a..1fe3f6ae1d 100644 --- a/indra/newview/llpanelexperiences.h +++ b/indra/newview/llpanelexperiences.h @@ -31,7 +31,6 @@ #include "llflatlistview.h" #include "llpanelavatar.h" -class LLExperienceData; class LLExperienceItem; class LLPanelProfile; @@ -69,7 +68,7 @@ public: LLExperienceItem* getSelectedExperienceItem(); void setProfilePanel(LLPanelProfile* profile_panel); - + void addExperienceInfo(const LLSD& experience); protected: void onListCommit(const LLFlatListView* f_list); @@ -97,7 +96,7 @@ public: LLExperienceItem(); ~LLExperienceItem(); - void init(LLExperienceData* experience_data); + void init(LLSD* experience_data); /*virtual*/ BOOL postBuild(); void update(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b607afbd9d..7417e4fa06 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1536,6 +1536,8 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) } capabilityNames.append("GetDisplayNames"); + capabilityNames.append("GetExperiences"); + capabilityNames.append("GetExperienceInfo"); capabilityNames.append("GetMesh"); capabilityNames.append("GetObjectCost"); capabilityNames.append("GetObjectPhysicsData"); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4635138fa3..2d89db6e28 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2517,10 +2517,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) idleUpdateBelowWater(); // wind effect uses this idleUpdateWindEffect(); } - - LLExperienceData ed; - LLExperienceCache::get(getID(), &ed); - + idleUpdateNameTag( root_pos_last ); idleUpdateRenderCost(); } |