From 2206f97d8efb2683e6c0d759a8549de9de67a054 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 23 Apr 2014 22:19:20 +0100 Subject: Added SEARCH tab to Experience floater for ACME-1420 --- indra/newview/llpanelexperiencepicker.cpp | 353 ++++++++++++++++++++++++++++++ 1 file changed, 353 insertions(+) create mode 100644 indra/newview/llpanelexperiencepicker.cpp (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp new file mode 100644 index 0000000000..4e2ae585cd --- /dev/null +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -0,0 +1,353 @@ +/** +* @file llpanelexperiencepicker.cpp +* @brief Implementation of llpanelexperiencepicker +* @author dolphin@lindenlab.com +* +* $LicenseInfo:firstyear=2014&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2014, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelexperiencepicker.h" + + +#include "lllineeditor.h" +#include "llfloaterreg.h" +#include "llscrolllistctrl.h" +#include "llviewerregion.h" +#include "llagent.h" +#include "llexperiencecache.h" +#include "llslurl.h" +#include "llavatarnamecache.h" +#include "llfloaterexperienceprofile.h" +#include "llcombobox.h" +#include "llviewercontrol.h" +#include "lldraghandle.h" + +#define BTN_FIND "find" +#define BTN_PROFILE "profile_btn" +#define TEXT_EDIT "edit" +#define TEXT_MATURITY "maturity" +#define LIST_RESULTS "search_results" +#define PANEL_SEARCH "search_panel" + +const static std::string columnSpace = " "; + +class LLExperienceSearchResponder : public LLHTTPClient::Responder +{ +public: + LLUUID mQueryID; + LLHandle mParent; + + LLExperienceSearchResponder(const LLUUID& id, const LLHandle& parent) : mQueryID(id), mParent(parent) { } + + void completed(U32 status, const std::string& reason, const LLSD& content) + { + if (isGoodStatus(status)) + { + if(mParent.isDead()) + return; + + LLPanelExperiencePicker* panel =mParent.get(); + if (panel) + { + panel->processResponse(mQueryID, content); + } + } + else + { + llwarns << "avatar picker failed [status:" << status << "]: " << content << llendl; + + } + } +}; + +LLPanelExperiencePicker::LLPanelExperiencePicker() + :LLPanel() +{ + buildFromFile("panel_experience_search.xml"); + setDefaultFilters(); +} + +LLPanelExperiencePicker::~LLPanelExperiencePicker() +{ + gFocusMgr.releaseFocusIfNeeded( this ); +} + +BOOL LLPanelExperiencePicker::postBuild() +{ + getChild(TEXT_EDIT)->setKeystrokeCallback( boost::bind(&LLPanelExperiencePicker::editKeystroke, this, _1, _2),NULL); + + childSetAction(BTN_FIND, boost::bind(&LLPanelExperiencePicker::onBtnFind, this)); + getChildView(BTN_FIND)->setEnabled(FALSE); + + LLScrollListCtrl* searchresults = getChild(LIST_RESULTS); + searchresults->setDoubleClickCallback( boost::bind(&LLPanelExperiencePicker::onBtnProfile, this)); + searchresults->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onList, this)); + getChildView(LIST_RESULTS)->setEnabled(FALSE); + getChild(LIST_RESULTS)->setCommentText(getString("no_results")); + + childSetAction(BTN_PROFILE, boost::bind(&LLPanelExperiencePicker::onBtnProfile, this)); + getChildView(BTN_PROFILE)->setEnabled(FALSE); + + getChild(TEXT_MATURITY)->setCurrentByIndex(2); + getChild(TEXT_MATURITY)->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onMaturity, this)); + getChild(TEXT_EDIT)->setFocus(TRUE); + + LLPanel* search_panel = getChild(PANEL_SEARCH); + if (search_panel) + { + // Start searching when Return is pressed in the line editor. + search_panel->setDefaultBtn(BTN_FIND); + } + return TRUE; +} + +void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* user_data ) +{ + getChildView(BTN_FIND)->setEnabled(caller->getText().size() > 0); +} + +void LLPanelExperiencePicker::onBtnFind() +{ + find(); +} + +void LLPanelExperiencePicker::onList() +{ + bool enabled = isSelectButtonEnabled(); + + enabled = enabled && getChild(LIST_RESULTS)->getNumSelected() == 1; + getChildView(BTN_PROFILE)->setEnabled(enabled); +} + +void LLPanelExperiencePicker::find() +{ + std::string text = getChild(TEXT_EDIT)->getValue().asString(); + mQueryID.generate(); + std::string url; + url.reserve(128+text.size()); + + LLViewerRegion* region = gAgent.getRegion(); + url = region->getCapability("FindExperienceByName"); + if (!url.empty()) + { + url+="?query="; + url+=LLURI::escape(text); + LLHTTPClient::get(url, new LLExperienceSearchResponder(mQueryID, getDerivedHandle())); + + } + + + getChild(LIST_RESULTS)->deleteAllItems(); + getChild(LIST_RESULTS)->setCommentText(getString("searching")); + + getChildView(BTN_PROFILE)->setEnabled(FALSE); +} + + +bool LLPanelExperiencePicker::isSelectButtonEnabled() +{ + LLScrollListCtrl* list=getChild(LIST_RESULTS); + return list->getFirstSelectedIndex() >=0; +} + +void LLPanelExperiencePicker::getSelectedExperienceIds( const LLScrollListCtrl* results, uuid_vec_t &experience_ids ) +{ + std::vector items = results->getAllSelected(); + for(std::vector::iterator it = items.begin(); it != items.end(); ++it) + { + LLScrollListItem* item = *it; + if (item->getUUID().notNull()) + { + experience_ids.push_back(item->getUUID()); + } + } +} + +void LLPanelExperiencePicker::setAllowMultiple( bool allow_multiple ) +{ + getChild(LIST_RESULTS)->setAllowMultipleSelection(allow_multiple); +} + + +void name_callback(const LLHandle& floater, const LLUUID& experience_id, const LLUUID& agent_id, const LLAvatarName& av_name) +{ + if(floater.isDead()) + return; + LLPanelExperiencePicker* picker = floater.get(); + LLScrollListCtrl* search_results = picker->getChild(LIST_RESULTS); + + LLScrollListItem* item = search_results->getItem(experience_id); + if(!item) + return; + + item->getColumn(2)->setValue(columnSpace+av_name.getDisplayName()); + +} + +void LLPanelExperiencePicker::processResponse( const LLUUID& query_id, const LLSD& content ) +{ + if(query_id != mQueryID) + { + return; + } + + mResponse = content; + + const LLSD& experiences=mResponse["experience_keys"]; + LLSD::array_const_iterator it = experiences.beginArray(); + for ( ; it != experiences.endArray(); ++it) + { + LLExperienceCache::insert(*it); + } + + filterContent(); + +} + +void LLPanelExperiencePicker::onBtnProfile() +{ + LLScrollListItem* item = getChild(LIST_RESULTS)->getFirstSelected(); + if(item) + { + LLFloaterReg::showInstance("experience_profile", item->getUUID(), true); + } +} + +std::string LLPanelExperiencePicker::getMaturityString(int maturity) +{ + if(maturity <= SIM_ACCESS_PG) + { + return getString("maturity_icon_general"); + } + else if(maturity <= SIM_ACCESS_MATURE) + { + return getString("maturity_icon_moderate"); + } + return getString("maturity_icon_adult"); +} + +void LLPanelExperiencePicker::filterContent() +{ + LLScrollListCtrl* search_results = getChild(LIST_RESULTS); + + const LLSD& experiences=mResponse["experience_keys"]; + + search_results->deleteAllItems(); + + LLSD item; + LLSD::array_const_iterator it = experiences.beginArray(); + for ( ; it != experiences.endArray(); ++it) + { + const LLSD& experience = *it; + + if(isExperienceHidden(experience)) + continue; + + item["id"]=experience[LLExperienceCache::EXPERIENCE_ID]; + LLSD& columns = item["columns"]; + columns[0]["column"] = "maturity"; + columns[0]["value"] = getMaturityString(experience[LLExperienceCache::MATURITY].asInteger()); + columns[0]["type"]="icon"; + columns[0]["halign"]="right"; + columns[1]["column"] = "experience_name"; + columns[1]["value"] = columnSpace+experience[LLExperienceCache::NAME].asString(); + columns[2]["column"] = "owner"; + columns[2]["value"] = columnSpace+getString("loading"); + search_results->addElement(item); + LLAvatarNameCache::get(experience[LLExperienceCache::AGENT_ID], boost::bind(name_callback, getDerivedHandle(), experience[LLExperienceCache::EXPERIENCE_ID], _1, _2)); + } + + if (search_results->isEmpty()) + { + LLStringUtil::format_map_t map; + std::string search_text = childGetText(TEXT_EDIT); + map["[TEXT]"] = search_text; + if (search_text.empty()) + { + getChild(LIST_RESULTS)->setCommentText(getString("no_results")); + } + else + { + getChild(LIST_RESULTS)->setCommentText(getString("not_found", map)); + } + search_results->setEnabled(false); + getChildView(BTN_PROFILE)->setEnabled(false); + } + else + { + search_results->setEnabled(true); + search_results->sortByColumnIndex(1, TRUE); + std::string text = getChild(TEXT_EDIT)->getValue().asString(); + if (!search_results->selectItemByLabel(text, TRUE, 1)) + { + search_results->selectFirstItem(); + } + onList(); + search_results->setFocus(TRUE); + } +} + +void LLPanelExperiencePicker::onMaturity() +{ + if(mResponse.has("experience_keys") && mResponse["experience_keys"].beginArray() != mResponse["experience_keys"].endArray()) + { + filterContent(); + } +} + +bool LLPanelExperiencePicker::isExperienceHidden( const LLSD& experience) const +{ + bool hide=false; + filter_list::const_iterator it = mFilters.begin(); + for(/**/;it != mFilters.end(); ++it) + { + if((*it)(experience)){ + return true; + } + } + + return hide; +} + +bool LLPanelExperiencePicker::FilterOverRating( const LLSD& experience ) +{ + int maturity = getChild(TEXT_MATURITY)->getSelectedValue().asInteger(); + return experience[LLExperienceCache::MATURITY].asInteger() > maturity; +} + +bool LLPanelExperiencePicker::FilterWithProperty( const LLSD& experience, S32 prop) +{ + return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) != 0; +} + +bool LLPanelExperiencePicker::FilterWithoutProperty( const LLSD& experience, S32 prop ) +{ + return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == 0; +} + +void LLPanelExperiencePicker::setDefaultFilters() +{ + mFilters.clear(); + addFilter(boost::bind(&LLPanelExperiencePicker::FilterOverRating, this, _1)); +} -- cgit v1.2.3 From 446a3193b1f2932ed14a16216bcf65dc30889612 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 24 Apr 2014 23:43:54 +0100 Subject: Refactored to share code between experience search floater and panel for ACME-1420 --- indra/newview/llpanelexperiencepicker.cpp | 60 ++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 4e2ae585cd..8da41b59dd 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -38,12 +38,13 @@ #include "llexperiencecache.h" #include "llslurl.h" #include "llavatarnamecache.h" -#include "llfloaterexperienceprofile.h" #include "llcombobox.h" #include "llviewercontrol.h" -#include "lldraghandle.h" +#include "llfloater.h" #define BTN_FIND "find" +#define BTN_OK "ok_btn" +#define BTN_CANCEL "cancel_btn" #define BTN_PROFILE "profile_btn" #define TEXT_EDIT "edit" #define TEXT_MATURITY "maturity" @@ -52,6 +53,8 @@ const static std::string columnSpace = " "; +static LLPanelInjector t_panel_status("llpanelexperiencepicker"); + class LLExperienceSearchResponder : public LLHTTPClient::Responder { public: @@ -75,7 +78,7 @@ public: } else { - llwarns << "avatar picker failed [status:" << status << "]: " << content << llendl; + llwarns << "experience picker failed [status:" << status << "]: " << content << llendl; } } @@ -90,7 +93,6 @@ LLPanelExperiencePicker::LLPanelExperiencePicker() LLPanelExperiencePicker::~LLPanelExperiencePicker() { - gFocusMgr.releaseFocusIfNeeded( this ); } BOOL LLPanelExperiencePicker::postBuild() @@ -101,11 +103,14 @@ BOOL LLPanelExperiencePicker::postBuild() getChildView(BTN_FIND)->setEnabled(FALSE); LLScrollListCtrl* searchresults = getChild(LIST_RESULTS); - searchresults->setDoubleClickCallback( boost::bind(&LLPanelExperiencePicker::onBtnProfile, this)); + searchresults->setDoubleClickCallback( boost::bind(&LLPanelExperiencePicker::onBtnSelect, this)); searchresults->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onList, this)); getChildView(LIST_RESULTS)->setEnabled(FALSE); getChild(LIST_RESULTS)->setCommentText(getString("no_results")); + childSetAction(BTN_OK, boost::bind(&LLPanelExperiencePicker::onBtnSelect, this)); + getChildView(BTN_OK)->setEnabled(FALSE); + childSetAction(BTN_CANCEL, boost::bind(&LLPanelExperiencePicker::onBtnClose, this)); childSetAction(BTN_PROFILE, boost::bind(&LLPanelExperiencePicker::onBtnProfile, this)); getChildView(BTN_PROFILE)->setEnabled(FALSE); @@ -135,6 +140,7 @@ void LLPanelExperiencePicker::onBtnFind() void LLPanelExperiencePicker::onList() { bool enabled = isSelectButtonEnabled(); + getChildView(BTN_OK)->setEnabled(enabled); enabled = enabled && getChild(LIST_RESULTS)->getNumSelected() == 1; getChildView(BTN_PROFILE)->setEnabled(enabled); @@ -157,10 +163,10 @@ void LLPanelExperiencePicker::find() } - getChild(LIST_RESULTS)->deleteAllItems(); getChild(LIST_RESULTS)->setCommentText(getString("searching")); - + + getChildView(BTN_OK)->setEnabled(FALSE); getChildView(BTN_PROFILE)->setEnabled(FALSE); } @@ -225,6 +231,42 @@ void LLPanelExperiencePicker::processResponse( const LLUUID& query_id, const LLS } +void LLPanelExperiencePicker::onBtnSelect() +{ + if(!isSelectButtonEnabled()) + { + return; + } + + if(mSelectionCallback) + { + const LLScrollListCtrl* results = getChild(LIST_RESULTS); + uuid_vec_t experience_ids; + + getSelectedExperienceIds(results, experience_ids); + mSelectionCallback(experience_ids); + getChild(LIST_RESULTS)->deselectAllItems(TRUE); + if(mCloseOnSelect) + { + mCloseOnSelect = FALSE; + onBtnClose(); + } + } + else + { + onBtnProfile(); + } +} + +void LLPanelExperiencePicker::onBtnClose() +{ + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + void LLPanelExperiencePicker::onBtnProfile() { LLScrollListItem* item = getChild(LIST_RESULTS)->getFirstSelected(); @@ -277,7 +319,7 @@ void LLPanelExperiencePicker::filterContent() search_results->addElement(item); LLAvatarNameCache::get(experience[LLExperienceCache::AGENT_ID], boost::bind(name_callback, getDerivedHandle(), experience[LLExperienceCache::EXPERIENCE_ID], _1, _2)); } - + if (search_results->isEmpty()) { LLStringUtil::format_map_t map; @@ -292,10 +334,12 @@ void LLPanelExperiencePicker::filterContent() getChild(LIST_RESULTS)->setCommentText(getString("not_found", map)); } search_results->setEnabled(false); + getChildView(BTN_OK)->setEnabled(false); getChildView(BTN_PROFILE)->setEnabled(false); } else { + getChildView(BTN_OK)->setEnabled(true); search_results->setEnabled(true); search_results->sortByColumnIndex(1, TRUE); std::string text = getChild(TEXT_EDIT)->getValue().asString(); -- cgit v1.2.3 From d14673988d0d26e5029f8f921bf00cce63e4f767 Mon Sep 17 00:00:00 2001 From: dolphin Date: Wed, 7 May 2014 13:40:34 -0700 Subject: removed deprecated logging macros --- indra/newview/llpanelexperiencepicker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 8da41b59dd..5d8f3134d6 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -78,7 +78,7 @@ public: } else { - llwarns << "experience picker failed [status:" << status << "]: " << content << llendl; + LL_WARNS() << "experience picker failed [status:" << status << "]: " << content << LL_ENDL; } } @@ -323,7 +323,7 @@ void LLPanelExperiencePicker::filterContent() if (search_results->isEmpty()) { LLStringUtil::format_map_t map; - std::string search_text = childGetText(TEXT_EDIT); + std::string search_text = getChild(TEXT_EDIT)->getValue().asString(); map["[TEXT]"] = search_text; if (search_text.empty()) { -- cgit v1.2.3 From 6766ef06d44b1991bd6ef3f699354f98651679b4 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 13 May 2014 14:52:10 -0700 Subject: ACME-1474: Prevent the viewer from trying to add or remove the default experience. --- indra/newview/llpanelexperiencepicker.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 5d8f3134d6..eb0c7c65ab 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -395,3 +395,12 @@ void LLPanelExperiencePicker::setDefaultFilters() mFilters.clear(); addFilter(boost::bind(&LLPanelExperiencePicker::FilterOverRating, this, _1)); } + +bool LLPanelExperiencePicker::FilterMatching( const LLSD& experience, const LLUUID& id ) +{ + if(experience.isUUID()) + { + return experience.asUUID() == id; + } + return experience[LLExperienceCache::EXPERIENCE_ID].asUUID() == id; +} -- cgit v1.2.3 From 169bf48f1068b0996f38ef03a9a97cd6c0fa07e0 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 13 May 2014 16:25:52 -0700 Subject: ACME-1450: Added paging to the experience picker and upped the search size to 30 results per page. --- indra/newview/llpanelexperiencepicker.cpp | 45 +++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index eb0c7c65ab..19778cb200 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -46,6 +46,8 @@ #define BTN_OK "ok_btn" #define BTN_CANCEL "cancel_btn" #define BTN_PROFILE "profile_btn" +#define BTN_LEFT "left_btn" +#define BTN_RIGHT "right_btn" #define TEXT_EDIT "edit" #define TEXT_MATURITY "maturity" #define LIST_RESULTS "search_results" @@ -65,11 +67,10 @@ public: void completed(U32 status, const std::string& reason, const LLSD& content) { + if(mParent.isDead()) + return; if (isGoodStatus(status)) { - if(mParent.isDead()) - return; - LLPanelExperiencePicker* panel =mParent.get(); if (panel) { @@ -78,6 +79,11 @@ public: } else { + LLPanelExperiencePicker* panel =mParent.get(); + if (panel) + { + panel->processResponse(mQueryID, LLSD()); + } LL_WARNS() << "experience picker failed [status:" << status << "]: " << content << LL_ENDL; } @@ -118,6 +124,9 @@ BOOL LLPanelExperiencePicker::postBuild() getChild(TEXT_MATURITY)->setCommitCallback(boost::bind(&LLPanelExperiencePicker::onMaturity, this)); getChild(TEXT_EDIT)->setFocus(TRUE); + childSetAction(BTN_LEFT, boost::bind(&LLPanelExperiencePicker::onPage, this, -1)); + childSetAction(BTN_RIGHT, boost::bind(&LLPanelExperiencePicker::onPage, this, 1)); + LLPanel* search_panel = getChild(PANEL_SEARCH); if (search_panel) { @@ -134,6 +143,7 @@ void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* u void LLPanelExperiencePicker::onBtnFind() { + mCurrentPage=1; find(); } @@ -150,24 +160,24 @@ void LLPanelExperiencePicker::find() { std::string text = getChild(TEXT_EDIT)->getValue().asString(); mQueryID.generate(); - std::string url; - url.reserve(128+text.size()); + std::ostringstream url; LLViewerRegion* region = gAgent.getRegion(); - url = region->getCapability("FindExperienceByName"); - if (!url.empty()) + std::string cap = region->getCapability("FindExperienceByName"); + if (!cap.empty()) { - url+="?query="; - url+=LLURI::escape(text); - LLHTTPClient::get(url, new LLExperienceSearchResponder(mQueryID, getDerivedHandle())); + url << cap << "?page=" << mCurrentPage << "&page_size=30&query=" << LLURI::escape(text); + LLHTTPClient::get(url.str(), new LLExperienceSearchResponder(mQueryID, getDerivedHandle())); } - getChild(LIST_RESULTS)->deleteAllItems(); getChild(LIST_RESULTS)->setCommentText(getString("searching")); getChildView(BTN_OK)->setEnabled(FALSE); getChildView(BTN_PROFILE)->setEnabled(FALSE); + + getChildView(BTN_RIGHT)->setEnabled(FALSE); + getChildView(BTN_LEFT)->setEnabled(FALSE); } @@ -227,6 +237,9 @@ void LLPanelExperiencePicker::processResponse( const LLUUID& query_id, const LLS LLExperienceCache::insert(*it); } + getChildView(BTN_RIGHT)->setEnabled(content.has("next_page_url")); + getChildView(BTN_LEFT)->setEnabled(content.has("previous_page_url")); + filterContent(); } @@ -404,3 +417,13 @@ bool LLPanelExperiencePicker::FilterMatching( const LLSD& experience, const LLUU } return experience[LLExperienceCache::EXPERIENCE_ID].asUUID() == id; } + +void LLPanelExperiencePicker::onPage( S32 direction ) +{ + mCurrentPage += direction; + if(mCurrentPage < 1) + { + mCurrentPage = 1; + } + find(); +} -- cgit v1.2.3 From 03abd8dc2033c9166d618c9171975f1dc1d4aaa9 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 19 Jun 2014 01:06:23 +0100 Subject: Updated LLRegionExperienceResponder and LLExperienceSearchResponder to use new interface --- indra/newview/llpanelexperiencepicker.cpp | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 19778cb200..0a572a8a5c 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -65,28 +65,30 @@ public: LLExperienceSearchResponder(const LLUUID& id, const LLHandle& parent) : mQueryID(id), mParent(parent) { } - void completed(U32 status, const std::string& reason, const LLSD& content) +protected: + /*virtual*/ void httpSuccess() { if(mParent.isDead()) return; - if (isGoodStatus(status)) + + LLPanelExperiencePicker* panel =mParent.get(); + if (panel) { - LLPanelExperiencePicker* panel =mParent.get(); - if (panel) - { - panel->processResponse(mQueryID, content); - } + panel->processResponse(mQueryID, getContent()); } - else - { - LLPanelExperiencePicker* panel =mParent.get(); - if (panel) - { - panel->processResponse(mQueryID, LLSD()); - } - LL_WARNS() << "experience picker failed [status:" << status << "]: " << content << LL_ENDL; + } + /*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; } }; -- cgit v1.2.3 From c88b237473a75310722bac8d65a028a33a573215 Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 20 Jun 2014 04:19:45 +0100 Subject: Updated LLExperienceCache::LLExperienceResponder to work with updated LLCurl::Responder interface, to fix ACME-1532 and ACME-1525 --- 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 0a572a8a5c..3a55295d8c 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -57,7 +57,7 @@ const static std::string columnSpace = " "; static LLPanelInjector t_panel_status("llpanelexperiencepicker"); -class LLExperienceSearchResponder : public LLHTTPClient::Responder +class LLExperienceSearchResponder : public LLCurl::Responder { public: LLUUID mQueryID; -- cgit v1.2.3 From 200788c344f5449f99eacc9167ac15c7e6262b69 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 24 Jun 2014 22:43:23 +0100 Subject: Updated all experience responders for LLCurl::Responder interface changes for ACME-1535 and ACME-1536 --- 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 3a55295d8c..0a572a8a5c 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -57,7 +57,7 @@ const static std::string columnSpace = " "; static LLPanelInjector t_panel_status("llpanelexperiencepicker"); -class LLExperienceSearchResponder : public LLCurl::Responder +class LLExperienceSearchResponder : public LLHTTPClient::Responder { public: LLUUID mQueryID; -- cgit v1.2.3 From 89eac2548a9b66d8bab27a7e8d7d1ed2159e9515 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 20 Aug 2014 01:11:27 +0100 Subject: Made it possible to search for experiences with an empty search string, and show experiences with blank names as (untitled experience) for ACME-1585 --- indra/newview/llpanelexperiencepicker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 0a572a8a5c..7592aaa9d0 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -108,7 +108,7 @@ BOOL LLPanelExperiencePicker::postBuild() getChild(TEXT_EDIT)->setKeystrokeCallback( boost::bind(&LLPanelExperiencePicker::editKeystroke, this, _1, _2),NULL); childSetAction(BTN_FIND, boost::bind(&LLPanelExperiencePicker::onBtnFind, this)); - getChildView(BTN_FIND)->setEnabled(FALSE); + getChildView(BTN_FIND)->setEnabled(TRUE); LLScrollListCtrl* searchresults = getChild(LIST_RESULTS); searchresults->setDoubleClickCallback( boost::bind(&LLPanelExperiencePicker::onBtnSelect, this)); @@ -140,7 +140,7 @@ BOOL LLPanelExperiencePicker::postBuild() void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* user_data ) { - getChildView(BTN_FIND)->setEnabled(caller->getText().size() > 0); + getChildView(BTN_FIND)->setEnabled(caller->getText().size() >= 0); } void LLPanelExperiencePicker::onBtnFind() -- cgit v1.2.3 From da639d1c9817c7333b959638e9a33b6ae7c664c0 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 21 Aug 2014 19:43:50 +0100 Subject: Show experiences with blank names as (untitled experience) in experience search, script editor, and allowed/trusted/blocked lists for ACME-1585 --- indra/newview/llpanelexperiencepicker.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 7592aaa9d0..b804899e63 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -41,6 +41,7 @@ #include "llcombobox.h" #include "llviewercontrol.h" #include "llfloater.h" +#include "lltrans.h" #define BTN_FIND "find" #define BTN_OK "ok_btn" @@ -321,6 +322,12 @@ void LLPanelExperiencePicker::filterContent() if(isExperienceHidden(experience)) continue; + std::string experience_name_string = experience[LLExperienceCache::NAME].asString(); + if (experience_name_string.empty()) + { + experience_name_string = LLTrans::getString("ExperienceNameUntitled"); + } + item["id"]=experience[LLExperienceCache::EXPERIENCE_ID]; LLSD& columns = item["columns"]; columns[0]["column"] = "maturity"; @@ -328,7 +335,7 @@ void LLPanelExperiencePicker::filterContent() columns[0]["type"]="icon"; columns[0]["halign"]="right"; columns[1]["column"] = "experience_name"; - columns[1]["value"] = columnSpace+experience[LLExperienceCache::NAME].asString(); + columns[1]["value"] = columnSpace+experience_name_string; columns[2]["column"] = "owner"; columns[2]["value"] = columnSpace+getString("loading"); search_results->addElement(item); -- cgit v1.2.3 From e7645eb995c291ebbbd05bab796639306545d2ad Mon Sep 17 00:00:00 2001 From: dolphin Date: Fri, 5 Sep 2014 10:58:39 -0700 Subject: Allow non-grid-wide experiences in the parcel block list to block estate allowed experiences. --- indra/newview/llpanelexperiencepicker.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index b804899e63..e3fe3c3332 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -407,6 +407,11 @@ bool LLPanelExperiencePicker::FilterWithProperty( const LLSD& experience, S32 pr return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) != 0; } +bool LLPanelExperiencePicker::FilterWithProperties( const LLSD& experience, S32 prop) +{ + return ! ((experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == prop); +} + bool LLPanelExperiencePicker::FilterWithoutProperty( const LLSD& experience, S32 prop ) { return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == 0; -- cgit v1.2.3 From 4e84aa4ecfe3351463ca9c54df4477528f65e41f Mon Sep 17 00:00:00 2001 From: dolphin Date: Fri, 5 Sep 2014 15:14:21 -0700 Subject: Fixed reversed logic --- indra/newview/llpanelexperiencepicker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelexperiencepicker.cpp') diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index e3fe3c3332..b7c0f3b1fb 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -407,9 +407,9 @@ bool LLPanelExperiencePicker::FilterWithProperty( const LLSD& experience, S32 pr return (experience[LLExperienceCache::PROPERTIES].asInteger() & prop) != 0; } -bool LLPanelExperiencePicker::FilterWithProperties( const LLSD& experience, S32 prop) +bool LLPanelExperiencePicker::FilterWithoutProperties( const LLSD& experience, S32 prop) { - return ! ((experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == prop); + return ((experience[LLExperienceCache::PROPERTIES].asInteger() & prop) == prop); } bool LLPanelExperiencePicker::FilterWithoutProperty( const LLSD& experience, S32 prop ) -- cgit v1.2.3 From 1fce3cc89eca7edf05ef550707e955af3d4d5fc7 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 8 Jun 2015 17:35:18 -0400 Subject: corrections needed for new tools --- 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 b7c0f3b1fb..70d826a407 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -141,7 +141,7 @@ BOOL LLPanelExperiencePicker::postBuild() void LLPanelExperiencePicker::editKeystroke( class LLLineEditor* caller, void* user_data ) { - getChildView(BTN_FIND)->setEnabled(caller->getText().size() >= 0); + getChildView(BTN_FIND)->setEnabled(true); } void LLPanelExperiencePicker::onBtnFind() -- cgit v1.2.3