summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitslist.cpp
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-05-17 18:57:03 +0300
committerSergei Litovchuk <slitovchuk@productengine.com>2010-05-17 18:57:03 +0300
commitd8b989a87b94fd851404b42094e88c0a0c213ac8 (patch)
tree27ab803f2744eff49c944cc5a5b8291aa7465636 /indra/newview/lloutfitslist.cpp
parentfcea61df76ce69b438d26037df4bafc3380f129d (diff)
EXT-7158 ADDITIONAL FIX Optimization and implementation fix
- Fixed issue with filter not applied to outfit newly added while filtering is active. - Optimization of refreshing outfit list when filter is applied - list is not refreshed on every list visibility change. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/394/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r--indra/newview/lloutfitslist.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 12d5203429..43b7e15977 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -170,7 +170,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id)
list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1));
// Setting list refresh callback to apply filter on list change.
- list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onWearableItemsListRefresh, this, _1));
+ list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onFilteredWearableItemsListRefresh, this, _1));
// Fetch the new outfit contents.
cat->fetch();
@@ -178,6 +178,21 @@ void LLOutfitsList::refreshList(const LLUUID& category_id)
// Refresh the list of outfit items after fetch().
// Further list updates will be triggered by the category observer.
list->updateList(cat_id);
+
+ // If filter is currently applied we store the initial tab state and
+ // open it to show matched items if any.
+ if (!mFilterSubString.empty())
+ {
+ tab->notifyChildren(LLSD().with("action","store_state"));
+ tab->setDisplayChildren(true);
+
+ // Setting mForceRefresh flag will make the list refresh its contents
+ // even if it is not currently visible. This is required to apply the
+ // filter to the newly added list.
+ list->setForceRefresh(true);
+
+ list->setFilterSubString(mFilterSubString);
+ }
}
// Handle removed tabs.
@@ -327,7 +342,7 @@ void LLOutfitsList::changeOutfitSelection(LLWearableItemsList* list, const LLUUI
mSelectedOutfitUUID = category_id;
}
-void LLOutfitsList::onWearableItemsListRefresh(LLUICtrl* ctrl)
+void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl)
{
if (!ctrl || mFilterSubString.empty())
return;
@@ -338,7 +353,7 @@ void LLOutfitsList::onWearableItemsListRefresh(LLUICtrl* ctrl)
iter != iter_end; ++iter)
{
LLAccordionCtrlTab* tab = iter->second;
- if (tab) continue;
+ if (!tab) continue;
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
if (list != ctrl) continue;
@@ -395,8 +410,6 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring)
if (!new_filter_substring.empty())
{
- tab->setDisplayChildren(true);
-
std::string title = tab->getTitle();
LLStringUtil::toUpper(title);
@@ -413,6 +426,18 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring)
{
tab->setTitle(tab->getTitle(), cur_filter);
}
+
+ if (tab->getVisible())
+ {
+ // Open tab if it has passed the filter.
+ tab->setDisplayChildren(true);
+ }
+ else
+ {
+ // Set force refresh flag to refresh not visible list
+ // when some changes occur in it.
+ list->setForceRefresh(true);
+ }
}
else
{