diff options
author | Andrew Dyukov <adyukov@productengine.com> | 2010-06-24 01:52:26 +0300 |
---|---|---|
committer | Andrew Dyukov <adyukov@productengine.com> | 2010-06-24 01:52:26 +0300 |
commit | 9aad53a4370b7647e4f907be7c3dc908906491b9 (patch) | |
tree | c84cd35c01a96555de9b9df7887826bc293aeb53 | |
parent | 2583a4d6ea60aeefa1d21f578d6fbf1f2f68c72a (diff) |
EXT-7158 FIXED Implemented showing of full outfit content if its name or any item(s) inside it match current filter.
- Added availability to force showing unmatched items to LLFlatListViewEx
- Applied it to wearable items lists in LLOutfitsList
- Changed condition for outfit accordion tab showing (because now all items are visible, so checking their number doesn't help).
Used here check for a flag added in this fix, which tells whether last applied filter found any matches in the list.
Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/648/
--HG--
branch : product-engine
-rw-r--r-- | indra/llui/llflatlistview.cpp | 21 | ||||
-rw-r--r-- | indra/llui/llflatlistview.h | 17 | ||||
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 7 |
3 files changed, 43 insertions, 2 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index c7463e581c..f22b49f30f 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -1226,6 +1226,8 @@ LLFlatListViewEx::LLFlatListViewEx(const Params& p) : LLFlatListView(p) , mNoFilteredItemsMsg(p.no_filtered_items_msg) , mNoItemsMsg(p.no_items_msg) +, mForceShowingUnmatchedItems(false) +, mLastFilterSucceded(false) { } @@ -1250,6 +1252,16 @@ void LLFlatListViewEx::updateNoItemsMessage(const std::string& filter_string) } +bool LLFlatListViewEx::getForceShowingUnmatchedItems() +{ + return mForceShowingUnmatchedItems; +} + +void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show) +{ + mForceShowingUnmatchedItems = show; +} + void LLFlatListViewEx::setFilterSubString(const std::string& filter_str) { if (0 != LLStringUtil::compareInsensitive(filter_str, mFilterSubString)) @@ -1273,6 +1285,7 @@ void LLFlatListViewEx::filterItems() item_panel_list_t items; getItems(items); + mLastFilterSucceded = false; for (item_panel_list_t::iterator iter = items.begin(), iter_end = items.end(); @@ -1283,13 +1296,14 @@ void LLFlatListViewEx::filterItems() // i.e. we don't hide items that don't support 'match_filter' action, separators etc. if (0 == pItem->notify(action)) { + mLastFilterSucceded = true; pItem->setVisible(true); } else { // TODO: implement (re)storing of current selection. selectItem(pItem, false); - pItem->setVisible(false); + pItem->setVisible(mForceShowingUnmatchedItems); } } @@ -1297,4 +1311,9 @@ void LLFlatListViewEx::filterItems() notifyParentItemsRectChanged(); } +bool LLFlatListViewEx::wasLasFilterSuccessfull() +{ + return mLastFilterSucceded; +} + //EOF diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 0820a7ab67..caeddfc179 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -470,6 +470,10 @@ public: void setNoItemsMsg(const std::string& msg) { mNoItemsMsg = msg; } void setNoFilteredItemsMsg(const std::string& msg) { mNoFilteredItemsMsg = msg; } + bool getForceShowingUnmatchedItems(); + + void setForceShowingUnmatchedItems(bool show); + /** * Sets up new filter string and filters the list. */ @@ -481,6 +485,11 @@ public: */ void filterItems(); + /** + * Returns true if last call of filterItems() found at least one matching item + */ + bool wasLasFilterSuccessfull(); + protected: LLFlatListViewEx(const Params& p); @@ -496,6 +505,14 @@ private: std::string mNoFilteredItemsMsg; std::string mNoItemsMsg; std::string mFilterSubString; + /** + * Show list items that don't match current filter + */ + bool mForceShowingUnmatchedItems; + /** + * True if last call of filterItems() found at least one matching item + */ + bool mLastFilterSucceded; }; #endif diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index b8489d450b..67442dd573 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -439,6 +439,9 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Setting callback to reset items selection inside outfit on accordion collapsing and expanding (EXT-7875) tab->setDropDownStateChangedCallback(boost::bind(&LLOutfitsList::resetItemSelection, this, list, cat_id)); + // force showing list items that don't match current filter(EXT-7158) + list->setForceShowingUnmatchedItems(true); + // Setting list commit callback to monitor currently selected wearable item. list->setCommitCallback(boost::bind(&LLOutfitsList::onSelectionChange, this, _1)); @@ -850,6 +853,8 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring) restoreOutfitSelection(tab, iter->first); } } + + mAccordion->arrange(); } void LLOutfitsList::applyFilterToTab( @@ -873,7 +878,7 @@ void LLOutfitsList::applyFilterToTab( { // hide tab if its title doesn't pass filter // and it has no visible items - tab->setVisible(list->size() > 0); + tab->setVisible(list->wasLasFilterSuccessfull()); // remove title highlighting because it might // have been previously highlighted by less restrictive filter |