diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-29 18:02:04 +0300 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-29 18:02:04 +0300 |
commit | c10eed08189161bab67cfc296b1891a989d5748d (patch) | |
tree | 845828bf1731241681349380af59a8ebe558d876 /indra/newview/llinventorygallery.cpp | |
parent | e5b8b799cc75f3b9cd259403c323cd47b59453d8 (diff) |
SL-19379 WIP allow change search type for Gallery
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index bfca22ba8a..8516ff37c2 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -83,7 +83,8 @@ LLInventoryGallery::LLInventoryGallery(const LLInventoryGallery::Params& p) mItemsInRow(p.items_in_row), mRowPanWidthFactor(p.row_panel_width_factor), mGalleryWidthFactor(p.gallery_width_factor), - mIsInitialized(false) + mIsInitialized(false), + mSearchType(LLInventoryFilter::SEARCHTYPE_NAME) { updateGalleryWidth(); @@ -473,6 +474,9 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L gitem->setGallery(this); gitem->setType(type, is_link); gitem->setThumbnail(thumbnail_id); + gitem->setCreatorName(get_searchable_creator_name(&gInventory, item_id)); + gitem->setDescription(get_searchable_description(&gInventory, item_id)); + gitem->setAssetIDStr(get_searchable_UUID(&gInventory, item_id)); return gitem; } @@ -556,16 +560,43 @@ void LLInventoryGallery::applyFilter(LLInventoryGalleryItem* item, const std::st { if (!item) return; - std::string item_name = item->getItemName(); - LLStringUtil::toUpper(item_name); + std::string desc; + + switch(mSearchType) + { + case LLInventoryFilter::SEARCHTYPE_CREATOR: + desc = item->getCreatorName(); + break; + case LLInventoryFilter::SEARCHTYPE_DESCRIPTION: + desc = item->getDescription(); + break; + case LLInventoryFilter::SEARCHTYPE_UUID: + desc = item->getAssetIDStr(); + break; + case LLInventoryFilter::SEARCHTYPE_NAME: + default: + desc = item->getItemName(); + break; + } + + LLStringUtil::toUpper(desc); std::string cur_filter = filter_substring; LLStringUtil::toUpper(cur_filter); - bool hidden = (std::string::npos == item_name.find(cur_filter)); + bool hidden = (std::string::npos == desc.find(cur_filter)); item->setHidden(hidden); } +void LLInventoryGallery::setSearchType(LLInventoryFilter::ESearchType type) +{ + if(mSearchType != type) + { + mSearchType = type; + reArrangeRows(); + } +} + void LLInventoryGallery::getCurrentCategories(uuid_vec_t& vcur) { for (gallery_item_map_t::const_iterator iter = mItemMap.begin(); |