summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lloutfitslist.cpp65
-rw-r--r--indra/newview/lloutfitslist.h15
-rw-r--r--indra/newview/llpanelappearancetab.cpp2
-rw-r--r--indra/newview/llpanelappearancetab.h2
4 files changed, 45 insertions, 39 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index c153561d70..32831fcd9b 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -54,7 +54,7 @@
#include "llvoavatarself.h"
#include "llwearableitemslist.h"
-static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y);
+static bool is_tab_header_clicked(LLOutfitAccordionCtrlTab* tab, S32 y);
static const LLOutfitTabNameComparator OUTFIT_TAB_NAME_COMPARATOR;
static const LLOutfitTabFavComparator OUTFIT_TAB_FAV_COMPARATOR;
@@ -246,7 +246,10 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id)
list->setCommitCallback(boost::bind(&LLOutfitsList::onListSelectionChange, this, _1));
// Setting list refresh callback to apply filter on list change.
- list->setRefreshCompleteCallback(boost::bind(&LLOutfitsList::onRefreshComplete, this, _1));
+ list->setRefreshCompleteCallback([this, tab](LLUICtrl* ctrl, const LLSD& sd)
+ {
+ onRefreshComplete(ctrl, tab);
+ });
list->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onWearableItemsListRightClick, this, _1, _2, _3));
@@ -294,7 +297,7 @@ void LLOutfitsList::updateRemovedCategory(LLUUID cat_id)
if (outfits_iter != mOutfitsMap.end())
{
const LLUUID& outfit_id = outfits_iter->first;
- LLAccordionCtrlTab* tab = outfits_iter->second;
+ LLOutfitAccordionCtrlTab* tab = outfits_iter->second;
// An outfit is removed from the list. Do the following:
// 1. Remove outfit category from observer to stop monitoring its changes.
@@ -322,11 +325,11 @@ void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
{
if (mOutfitsMap[prev_id])
{
- ((LLOutfitAccordionCtrlTab*)mOutfitsMap[prev_id])->setOutfitSelected(false);
+ mOutfitsMap[prev_id]->setOutfitSelected(false);
}
if (mOutfitsMap[base_id])
{
- ((LLOutfitAccordionCtrlTab*)mOutfitsMap[base_id])->setOutfitSelected(true);
+ mOutfitsMap[base_id]->setOutfitSelected(true);
}
}
@@ -370,7 +373,7 @@ void LLOutfitsList::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid)
{
if (outfit_uuid == iter->first)
{
- LLAccordionCtrlTab* tab = iter->second;
+ LLOutfitAccordionCtrlTab* tab = iter->second;
if (!tab) continue;
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
@@ -464,7 +467,7 @@ void LLOutfitsList::onCollapseAllFolders()
iter != mOutfitsMap.end();
++iter)
{
- LLAccordionCtrlTab* tab = iter->second;
+ LLOutfitAccordionCtrlTab* tab = iter->second;
if(tab && tab->isExpanded())
{
tab->changeOpenClose(true);
@@ -478,7 +481,7 @@ void LLOutfitsList::onExpandAllFolders()
iter != mOutfitsMap.end();
++iter)
{
- LLAccordionCtrlTab* tab = iter->second;
+ LLOutfitAccordionCtrlTab* tab = iter->second;
if(tab && !tab->isExpanded())
{
tab->changeOpenClose(false);
@@ -501,7 +504,7 @@ void LLOutfitsList::updateChangedCategoryName(LLViewerInventoryCategory *cat, st
if (outfits_iter != mOutfitsMap.end())
{
// Update tab name with the new category name.
- LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*) outfits_iter->second;
+ LLOutfitAccordionCtrlTab* tab = outfits_iter->second;
if (tab)
{
tab->setName(name);
@@ -554,7 +557,7 @@ void LLOutfitsList::deselectOutfit(const LLUUID& category_id)
LLOutfitListBase::deselectOutfit(category_id);
}
-void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id)
+void LLOutfitsList::restoreOutfitSelection(LLOutfitAccordionCtrlTab* tab, const LLUUID& category_id)
{
// Try restoring outfit selection after filtering.
if (mAccordion->getSelectedTab() == tab)
@@ -563,27 +566,21 @@ void LLOutfitsList::restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID
}
}
-void LLOutfitsList::onRefreshComplete(LLUICtrl* ctrl)
+void LLOutfitsList::onRefreshComplete(LLUICtrl* ctrl, LLOutfitAccordionCtrlTab* tab)
{
if (!ctrl || getFilterSubString().empty())
return;
- LL_PROFILE_ZONE_SCOPED;
-
- // TODO: We are doing it multiple times per frame on init
- // as multiple lists are refreshing. Needs improvements.
- for (outfits_map_t::iterator
- iter = mOutfitsMap.begin(),
- iter_end = mOutfitsMap.end();
- iter != iter_end; ++iter)
+ LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
+ if (list != ctrl)
{
- LLAccordionCtrlTab* tab = iter->second;
- if (!tab) continue;
-
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
- if (list != ctrl) continue;
-
- applyFilterToTab(iter->first, tab, getFilterSubString());
+ llassert(false);
+ LL_WARNS() << "LLOutfitsList::onRefreshComplete: ctrl does not match tab's list!" << LL_ENDL;
+ return;
+ }
+ if (tab->getFilterGeneration() != getFilterGeneration())
+ {
+ applyFilterToTab(tab->getFolderID(), tab, getFilterSubString());
}
}
@@ -596,7 +593,7 @@ void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, cons
while (iter != iter_end)
{
const LLUUID& category_id = iter->first;
- LLAccordionCtrlTab* tab = iter++->second;
+ LLOutfitAccordionCtrlTab* tab = iter++->second;
if (!tab) continue;
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
@@ -635,9 +632,10 @@ void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, cons
void LLOutfitsList::applyFilterToTab(
const LLUUID& category_id,
- LLAccordionCtrlTab* tab,
+ LLOutfitAccordionCtrlTab* tab,
const std::string& filter_substring)
{
+ LL_PROFILE_ZONE_SCOPED;
if (!tab) return;
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
if (!list) return;
@@ -649,6 +647,7 @@ void LLOutfitsList::applyFilterToTab(
LLStringUtil::toUpper(cur_filter);
tab->setTitle(tab->getTitle(), cur_filter);
+ tab->setFilterGeneration(getFilterGeneration());
if (std::string::npos == title.find(cur_filter))
{
@@ -772,7 +771,7 @@ void LLOutfitsList::onCOFChanged()
outfits_map_t::iterator map_iter = mOutfitsMap.begin(), map_end = mOutfitsMap.end();
while (map_iter != map_end)
{
- LLAccordionCtrlTab* tab = (map_iter++)->second;
+ LLOutfitAccordionCtrlTab* tab = (map_iter++)->second;
if (!tab) continue;
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
@@ -803,7 +802,7 @@ void LLOutfitsList::sortOutfits()
void LLOutfitsList::onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id)
{
- LLAccordionCtrlTab* tab = dynamic_cast<LLAccordionCtrlTab*>(ctrl);
+ LLOutfitAccordionCtrlTab* tab = dynamic_cast<LLOutfitAccordionCtrlTab*>(ctrl);
if (mOutfitMenu && is_tab_header_clicked(tab, y) && cat_id.notNull())
{
// Focus tab header to trigger tab selection change.
@@ -826,7 +825,7 @@ void LLOutfitsList::handleInvFavColorChange()
++iter)
{
if (!iter->second) continue;
- LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*)iter->second;
+ LLOutfitAccordionCtrlTab* tab = iter->second;
// refresh font color
tab->setFavorite(tab->getFavorite());
@@ -853,7 +852,7 @@ void LLOutfitsList::onChangeSortOrder(const LLSD& userdata)
{
for (outfits_map_t::value_type& outfit : mOutfitsMap)
{
- LLAccordionCtrlTab* tab = outfit.second;
+ LLOutfitAccordionCtrlTab* tab = outfit.second;
const LLUUID& category_id = outfit.first;
if (!tab) continue;
@@ -894,7 +893,7 @@ LLOutfitListGearMenuBase* LLOutfitsList::createGearMenu()
}
-bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y)
+bool is_tab_header_clicked(LLOutfitAccordionCtrlTab* tab, S32 y)
{
if(!tab || !tab->getHeaderVisible()) return false;
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index 0bf5becb05..5010be50eb 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -38,14 +38,13 @@
#include "lltoggleablemenu.h"
#include "llviewermenu.h"
-class LLAccordionCtrlTab;
+class LLOutfitAccordionCtrlTab;
class LLInventoryCategoriesObserver;
class LLOutfitListGearMenuBase;
class LLOutfitListSortMenuBase;
class LLWearableItemsList;
class LLListContextMenu;
-
/**
* @class LLOutfitTabNameComparator
*
@@ -266,7 +265,10 @@ public:
void setFavorite(bool is_favorite);
bool getFavorite() const { return mIsFavorite; }
+ LLUUID getFolderID() const { return mFolderID; }
void setOutfitSelected(bool val);
+ U32 getFilterGeneration() const { return mFilterGeneration; }
+ void setFilterGeneration(U32 generation) { mFilterGeneration = generation; }
static LLUIImage* sFavoriteIcon;
static LLUIColor sFgColor;
@@ -284,6 +286,7 @@ public:
LLUUID mFolderID;
bool mIsFavorite = false;
bool mIsSelected = false;
+ U32 mFilterGeneration = 0;
};
/**
* @class LLOutfitsList
@@ -386,20 +389,20 @@ private:
*
* A tab may be hidden if it doesn't match current filter.
*/
- void restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id);
+ void restoreOutfitSelection(LLOutfitAccordionCtrlTab* tab, const LLUUID& category_id);
/**
* Called upon list refresh event to update tab visibility depending on
* the results of applying filter to the title and list items of the tab.
*/
- void onRefreshComplete(LLUICtrl* ctrl);
+ void onRefreshComplete(LLUICtrl* ctrl, LLOutfitAccordionCtrlTab* tab);
/**
* Applies filter to the given tab
*
* @see applyFilter()
*/
- void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring);
+ void applyFilterToTab(const LLUUID& category_id, LLOutfitAccordionCtrlTab* tab, const std::string& filter_substring);
/**
* Returns true if all selected items can be worn.
@@ -426,7 +429,7 @@ private:
typedef wearables_lists_map_t::value_type wearables_lists_map_value_t;
wearables_lists_map_t mSelectedListsMap;
- typedef std::map<LLUUID, LLAccordionCtrlTab*> outfits_map_t;
+ typedef std::map<LLUUID, LLOutfitAccordionCtrlTab*> outfits_map_t;
typedef outfits_map_t::value_type outfits_map_value_t;
outfits_map_t mOutfitsMap;
diff --git a/indra/newview/llpanelappearancetab.cpp b/indra/newview/llpanelappearancetab.cpp
index 3ee4ab8e51..ef04d7f13f 100644
--- a/indra/newview/llpanelappearancetab.cpp
+++ b/indra/newview/llpanelappearancetab.cpp
@@ -40,6 +40,7 @@ void LLPanelAppearanceTab::setFilterSubString(const std::string& new_string)
{
std::string old_string = mFilterSubString;
mFilterSubString = new_string;
+ mFilterGeneration++;
onFilterSubStringChanged(mFilterSubString, old_string);
}
@@ -52,6 +53,7 @@ void LLPanelAppearanceTab::checkFilterSubString()
{
std::string old_string = mFilterSubString;
mFilterSubString = sRecentFilterSubString;
+ mFilterGeneration++;
onFilterSubStringChanged(mFilterSubString, old_string);
}
}
diff --git a/indra/newview/llpanelappearancetab.h b/indra/newview/llpanelappearancetab.h
index e088c3e6f0..936fe2aec7 100644
--- a/indra/newview/llpanelappearancetab.h
+++ b/indra/newview/llpanelappearancetab.h
@@ -48,6 +48,7 @@ public:
virtual void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const {}
const std::string& getFilterSubString() { return mFilterSubString; }
+ U32 getFilterGeneration() { return mFilterGeneration; }
virtual void updateMenuItemsVisibility() = 0;
virtual LLToggleableMenu* getGearMenu() = 0;
@@ -63,6 +64,7 @@ protected:
private:
std::string mFilterSubString;
+ U32 mFilterGeneration = 0;
static std::string sRecentFilterSubString;
};