From 1b80e02b0b99b9bde50efba8bc95788e9057e7b0 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 1 Jul 2015 09:21:12 -0700 Subject: Added header for httpclient to llpanelexperiencepicker. (Will be removed when converted to coroutines) --- indra/newview/llpanelexperiencepicker.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 70d826a407..c7a353a6af 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -42,6 +42,7 @@ #include "llviewercontrol.h" #include "llfloater.h" #include "lltrans.h" +#include "llhttpclient.h" // *TODO: Rider, remove when converting #define BTN_FIND "find" #define BTN_OK "ok_btn" -- cgit v1.2.3 From 96e343b49b0b5a0951ffab0beb2e1d09c37bbdc5 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 1 Sep 2015 16:13:52 -0700 Subject: MAINT-5575: Convert the Experience cache into a coro based singleton. --HG-- branch : MAINT-5575 --- indra/newview/llpanelexperiencepicker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index c7a353a6af..7c19e32e7e 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -238,7 +238,7 @@ void LLPanelExperiencePicker::processResponse( const LLUUID& query_id, const LLS LLSD::array_const_iterator it = experiences.beginArray(); for ( ; it != experiences.endArray(); ++it) { - LLExperienceCache::insert(*it); + LLExperienceCache::getInstance()->insert(*it); } getChildView(BTN_RIGHT)->setEnabled(content.has("next_page_url")); -- cgit v1.2.3 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 ++++++++----------------------- 1 file changed, 16 insertions(+), 51 deletions(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') 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")); -- cgit v1.2.3 From 8913ed6692fddc5d72ee01ecb92a21093c5d22ad Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 3 Sep 2015 16:59:00 -0700 Subject: Changes from code review with Nat --- indra/newview/llpanelexperiencepicker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index db846ffad9..d71ced443b 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -130,7 +130,7 @@ void LLPanelExperiencePicker::find() std::string text = getChild(TEXT_EDIT)->getValue().asString(); mQueryID.generate(); - LLExperienceCache::getInstance()->findExperienceByName(text, mCurrentPage, + LLExperienceCache::instance().findExperienceByName(text, mCurrentPage, boost::bind(&LLPanelExperiencePicker::findResults, getDerivedHandle(), mQueryID, _1)); getChild(LIST_RESULTS)->deleteAllItems(); -- cgit v1.2.3 From 97236a42ca08979897d5c7b0826312345754cd67 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 14 Sep 2015 11:15:23 -0700 Subject: MAINT-5507: Remove HTTPClient and related cruft. --- indra/newview/llpanelexperiencepicker.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index d71ced443b..dcc5f4f234 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -42,7 +42,6 @@ #include "llviewercontrol.h" #include "llfloater.h" #include "lltrans.h" -#include "llhttpclient.h" // *TODO: Rider, remove when converting #define BTN_FIND "find" #define BTN_OK "ok_btn" -- cgit v1.2.3