From a9680462828d99cb482cdb235f14d6bd3c87bc9c Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 13 May 2010 19:31:50 +0300 Subject: EXT-7158 FIXED Implemented filter in "My Outfits" tab. - Added accordion tab title highlighting setter and title getter. - Added filtered tabs title highlighting. - Tabs which don't pass filter are hidden. - Added applying filter on list refresh event to avoid refreshing list on every filter change. - Moved part of LLTextUtil to llui/lluitextutil to reuse code in llaccordionctrltab. - Fixed passing list size to mRefreshCompleteSignal. - Added list refresh callback to LLInventoryItemsList for checking tab visibility without re-applying filter sub-string. Committed to proceed with dependent tasks. If there are any comments/suggestions related to text utils this part of code may be changed without requiring much effort. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/363/ --HG-- branch : product-engine --- indra/newview/llinventoryitemslist.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'indra/newview/llinventoryitemslist.cpp') diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index f48e7b3966..2d1d401cd4 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -40,11 +40,13 @@ // llcommon #include "llcommonutils.h" +// llui #include "lliconctrl.h" +#include "lluitextutil.h" +#include "llcallbacklist.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" -#include "lltextutil.h" #include "lltrans.h" //////////////////////////////////////////////////////////////////////////////// @@ -320,6 +322,7 @@ LLInventoryItemsList::Params::Params() LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p) : LLFlatListViewEx(p) , mNeedsRefresh(false) +, mPrevVisibility(false) { // TODO: mCommitOnSelectionChange is set to "false" in LLFlatListView // but reset to true in all derived classes. This settings might need to @@ -327,6 +330,8 @@ LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p setCommitOnSelectionChange(true); setNoFilteredItemsMsg(LLTrans::getString("InventoryNoMatchingItems")); + + gIdleCallbacks.addFunction(idle, this); } // virtual @@ -344,12 +349,31 @@ void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item mNeedsRefresh = true; } -void LLInventoryItemsList::draw() +boost::signals2::connection LLInventoryItemsList::setRefreshCompleteCallback(const commit_signal_t::slot_type& cb) { - LLFlatListViewEx::draw(); - if(mNeedsRefresh) + return mRefreshCompleteSignal.connect(cb); +} + +void LLInventoryItemsList::doIdle() +{ + bool cur_visibility = getVisible(); + if(cur_visibility != mPrevVisibility || mNeedsRefresh) { refresh(); + + mRefreshCompleteSignal(this, LLSD()); + + mPrevVisibility = getVisible(); + } +} + +//static +void LLInventoryItemsList::idle(void* user_data) +{ + LLInventoryItemsList* self = static_cast(user_data); + if ( self ) + { // Do the real idle + self->doIdle(); } } -- cgit v1.2.3