From 346f885473282a2826699c1d2c7dd624d60a1bf3 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 2 Sep 2015 15:16:37 -0700 Subject: Moved find experience into experience cache (moved cache recording into cache and out of UI) changed from responder to coroutine. --- indra/newview/llpanelexperiencepicker.cpp | 67 ++++++++----------------------- indra/newview/llpanelexperiencepicker.h | 3 +- 2 files changed, 18 insertions(+), 52 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 7c19e32e7e..db846ffad9 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -59,41 +59,6 @@ const static std::string columnSpace = " "; static LLPanelInjector t_panel_status("llpanelexperiencepicker"); -class LLExperienceSearchResponder : public LLHTTPClient::Responder -{ -public: - LLUUID mQueryID; - LLHandle mParent; - - LLExperienceSearchResponder(const LLUUID& id, const LLHandle& parent) : mQueryID(id), mParent(parent) { } - -protected: - /*virtual*/ void httpSuccess() - { - if(mParent.isDead()) - return; - - LLPanelExperiencePicker* panel =mParent.get(); - if (panel) - { - panel->processResponse(mQueryID, getContent()); - } - } - - /*virtual*/ void httpFailure() - { - if(mParent.isDead()) - return; - - LLPanelExperiencePicker* panel =mParent.get(); - if (panel) - { - panel->processResponse(mQueryID, LLSD()); - } - LL_WARNS() << "experience picker failed [status:" << getStatus() << "]: " << getContent() << LL_ENDL; - } -}; - LLPanelExperiencePicker::LLPanelExperiencePicker() :LLPanel() { @@ -164,17 +129,11 @@ void LLPanelExperiencePicker::find() { std::string text = getChild(TEXT_EDIT)->getValue().asString(); mQueryID.generate(); - std::ostringstream url; - LLViewerRegion* region = gAgent.getRegion(); - std::string cap = region->getCapability("FindExperienceByName"); - if (!cap.empty()) - { - url << cap << "?page=" << mCurrentPage << "&page_size=30&query=" << LLURI::escape(text); - LLHTTPClient::get(url.str(), new LLExperienceSearchResponder(mQueryID, getDerivedHandle())); + LLExperienceCache::getInstance()->findExperienceByName(text, mCurrentPage, + boost::bind(&LLPanelExperiencePicker::findResults, getDerivedHandle(), mQueryID, _1)); - } - getChild(LIST_RESULTS)->deleteAllItems(); + getChild(LIST_RESULTS)->deleteAllItems(); getChild(LIST_RESULTS)->setCommentText(getString("searching")); getChildView(BTN_OK)->setEnabled(FALSE); @@ -184,6 +143,19 @@ void LLPanelExperiencePicker::find() getChildView(BTN_LEFT)->setEnabled(FALSE); } +/*static*/ +void LLPanelExperiencePicker::findResults(LLHandle hparent, LLUUID queryId, LLSD foundResult) +{ + if (hparent.isDead()) + return; + + LLPanelExperiencePicker* panel = hparent.get(); + if (panel) + { + panel->processResponse(queryId, foundResult); + } +} + bool LLPanelExperiencePicker::isSelectButtonEnabled() { @@ -234,13 +206,6 @@ void LLPanelExperiencePicker::processResponse( const LLUUID& query_id, const LLS mResponse = content; - const LLSD& experiences=mResponse["experience_keys"]; - LLSD::array_const_iterator it = experiences.beginArray(); - for ( ; it != experiences.endArray(); ++it) - { - LLExperienceCache::getInstance()->insert(*it); - } - getChildView(BTN_RIGHT)->setEnabled(content.has("next_page_url")); getChildView(BTN_LEFT)->setEnabled(content.has("previous_page_url")); diff --git a/indra/newview/llpanelexperiencepicker.h b/indra/newview/llpanelexperiencepicker.h index e39ffed70b..97aa04cf4c 100644 --- a/indra/newview/llpanelexperiencepicker.h +++ b/indra/newview/llpanelexperiencepicker.h @@ -74,8 +74,9 @@ private: void getSelectedExperienceIds( const LLScrollListCtrl* results, uuid_vec_t &experience_ids ); void setAllowMultiple(bool allow_multiple); - void find(); + static void findResults(LLHandle hparent, LLUUID queryId, LLSD foundResult); + bool isSelectButtonEnabled(); void processResponse( const LLUUID& query_id, const LLSD& content ); -- cgit v1.2.3