summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitgallery.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-10 06:57:52 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-10 07:08:25 +0300
commit84dfe55810815e8c274044cea5c81aaed89a787f (patch)
tree4e499acfe5617682c5eca52998b5c10cdac8609a /indra/newview/lloutfitgallery.cpp
parent16e638db975278f6018fe1e21ba1954b7f159149 (diff)
parentda9a1dcb55548a249ff7a1255f3e518696b81245 (diff)
Merge branch 'main' into marchcat/y-merge
# Conflicts: # autobuild.xml # indra/llcommon/llsys.cpp
Diffstat (limited to 'indra/newview/lloutfitgallery.cpp')
-rw-r--r--indra/newview/lloutfitgallery.cpp48
1 files changed, 22 insertions, 26 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 9bf0fde302..efffcefc4a 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -431,8 +431,7 @@ bool compareGalleryItem(LLOutfitGalleryItem* item1, LLOutfitGalleryItem* item2)
}
void LLOutfitGallery::reArrangeRows(S32 row_diff)
-{
-
+{
std::vector<LLOutfitGalleryItem*> buf_items = mItems;
for (std::vector<LLOutfitGalleryItem*>::const_reverse_iterator it = buf_items.rbegin(); it != buf_items.rend(); ++it)
{
@@ -444,16 +443,24 @@ void LLOutfitGallery::reArrangeRows(S32 row_diff)
}
mHiddenItems.clear();
- mItemsInRow+= row_diff;
+ mItemsInRow += row_diff;
updateGalleryWidth();
std::sort(buf_items.begin(), buf_items.end(), compareGalleryItem);
-
+
+ std::string cur_filter = getFilterSubString();
+ LLStringUtil::toUpper(cur_filter);
+
for (std::vector<LLOutfitGalleryItem*>::const_iterator it = buf_items.begin(); it != buf_items.end(); ++it)
{
- (*it)->setHidden(false);
- applyFilter(*it,sFilterSubString);
+ std::string outfit_name = (*it)->getItemName();
+ LLStringUtil::toUpper(outfit_name);
+
+ bool hidden = (std::string::npos == outfit_name.find(cur_filter));
+ (*it)->setHidden(hidden);
+
addToGallery(*it);
}
+
updateMessageVisibility();
}
@@ -723,9 +730,9 @@ LLOutfitGallery::~LLOutfitGallery()
}
}
-void LLOutfitGallery::setFilterSubString(const std::string& string)
+// virtual
+void LLOutfitGallery::onFilterSubStringChanged(const std::string& new_string, const std::string& old_string)
{
- sFilterSubString = string;
reArrangeRows();
}
@@ -741,20 +748,6 @@ void LLOutfitGallery::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
}
}
-void LLOutfitGallery::applyFilter(LLOutfitGalleryItem* item, const std::string& filter_substring)
-{
- if (!item) return;
-
- std::string outfit_name = item->getItemName();
- LLStringUtil::toUpper(outfit_name);
-
- std::string cur_filter = filter_substring;
- LLStringUtil::toUpper(cur_filter);
-
- bool hidden = (std::string::npos == outfit_name.find(cur_filter));
- item->setHidden(hidden);
-}
-
void LLOutfitGallery::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid)
{
}
@@ -902,11 +895,11 @@ bool LLOutfitGallery::hasDefaultImage(const LLUUID& outfit_cat_id)
void LLOutfitGallery::updateMessageVisibility()
{
- if(mItems.empty())
+ if (mItems.empty())
{
mMessageTextBox->setVisible(TRUE);
mScrollPanel->setVisible(FALSE);
- std::string message = sFilterSubString.empty()? getString("no_outfits_msg") : getString("no_matched_outfits_msg");
+ std::string message = getString(getFilterSubString().empty() ? "no_outfits_msg" : "no_matched_outfits_msg");
mMessageTextBox->setValue(message);
}
else
@@ -1099,8 +1092,11 @@ bool LLOutfitGalleryItem::openOutfitsContent()
{
outfit_list->setSelectedOutfitByUUID(mUUID);
LLAccordionCtrlTab* tab = accordion->getSelectedTab();
- tab->showAndFocusHeader();
- return true;
+ if (tab)
+ {
+ tab->showAndFocusHeader();
+ return true;
+ }
}
}
}