diff options
| author | Merov Linden <merov@lindenlab.com> | 2013-05-06 18:31:27 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2013-05-06 18:31:27 -0700 | 
| commit | 00275301fc6606c98f77f8fbb8e485b3788831a8 (patch) | |
| tree | aaa8cd5920775eabb81ab91d6ca46043bab8ea5a | |
| parent | ad12517329e73abf64ccc926aa49453cb4b73bfc (diff) | |
ACME-275 : Fixed! Filtering on FB list works (tested with simulated data only so far)
| -rw-r--r-- | indra/llui/llfolderview.cpp | 5 | ||||
| -rwxr-xr-x | indra/llui/llfolderviewitem.cpp | 16 | ||||
| -rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 28 | ||||
| -rw-r--r-- | indra/newview/llpersonmodelcommon.h | 14 | 
4 files changed, 33 insertions, 30 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 679a76e26f..9cf822892e 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1653,11 +1653,6 @@ void LLFolderView::update()    BOOL is_visible = isInVisibleChain(); -    if (getName() == "Persons") -    { -        llinfos << "Merov : update Persons, is_visible = " << is_visible << llendl; -    } -    // Puts folders/items in proper positions    // arrange() takes the model filter flag into account and call sort() if necessary (CHUI-849)    // It also handles the open/close folder animation diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 88bc0ccfd4..0c0c54c38c 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -953,12 +953,6 @@ static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange");  // * Makes sure that this view and its children are the right size  S32 LLFolderViewFolder::arrange( S32* width, S32* height )  { -    llinfos << "Merov : LLFolderViewFolder::arrange, folder = " << getName() << llendl; -    if (getName() == "Facebook Friends Tab Two") -    { -        llinfos << "Merov : Arranging Facebook Friends Tab Two, needs arrange = " << needsArrange() << ", is open = " << isOpen() << llendl; -    } -      	// Sort before laying out contents      // Note that we sort from the root (CHUI-849)  	getRoot()->getFolderViewModel()->sort(this); @@ -1115,11 +1109,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )  BOOL LLFolderViewFolder::needsArrange()  { -    if (getName() != "") -    { -        llinfos << "Merov : needsArrange for " << getName() << ", last = " << mLastArrangeGeneration << ", current = " << getRoot()->getArrangeGeneration() << ", need = " << (mLastArrangeGeneration < getRoot()->getArrangeGeneration() ? "true" : "false") << llendl; -    } -	return mLastArrangeGeneration != getRoot()->getArrangeGeneration(); +	return mLastArrangeGeneration < getRoot()->getArrangeGeneration();  }  // Passes selection information on to children and record selection @@ -1641,10 +1631,6 @@ void LLFolderViewFolder::requestArrange()  void LLFolderViewFolder::toggleOpen()  { -    if (getName() == "Facebook Friends Tab Two") -    { -        llinfos << "Merov : toggleOpen, currently open is = " << isOpen() << llendl; -    }  	setOpen(!isOpen());  } diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index 6b4c71faa2..9fefc17345 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -48,6 +48,7 @@ LLPersonModelCommon::LLPersonModelCommon(LLFolderViewModelInterface& root_view_m      LLFolderViewModelItemCommon(root_view_model),  	mName(""),      mSearchableName(""), +    mPrevPassedAllFilters(false),  	mID(LLUUID().generateNewID())  {  } @@ -103,11 +104,11 @@ bool LLPersonModelCommon::filter( LLFolderViewFilter& filter)          llinfos << "Merov : LLPersonModelCommon::filter, exit, no modif" << llendl;          return true;      } -*/         + */      if (!mChildren.empty())      {          // If the current instance has children, it's a "person folder" and always passes filters (we do not filter out empty folders) -        setPassedFilter(1, -1); +        setPassedFilter(1, filter.getCurrentGeneration());          // Call filter recursively on all children          for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end();              iter != end_iter; @@ -121,13 +122,31 @@ bool LLPersonModelCommon::filter( LLFolderViewFilter& filter)      {          // If there's no children, the current instance is a person and we check and set the passed filter flag on it          const bool passed_filter = filter.check(this); -        setPassedFilter(passed_filter, -1, filter.getStringMatchOffset(this), filter.getFilterStringSize()); +        setPassedFilter(passed_filter, filter.getCurrentGeneration(), filter.getStringMatchOffset(this), filter.getFilterStringSize());      }      filter.clearModified();      return true;  } +void LLPersonModelCommon::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) +{ +	LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size); +	bool before = mPrevPassedAllFilters; +	mPrevPassedAllFilters = passedFilter(filter_generation); +     +    if (before != mPrevPassedAllFilters) +	{ +        // Need to rearrange the folder if the filtered state of the item changed +		LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); +		if (parent_folder) +		{ +			parent_folder->requestArrange(); +		} +	} +} + +  //  // LLPersonTabModel  //  @@ -217,7 +236,8 @@ LLPersonViewFilter::LLPersonViewFilter() :      mEmptyLookupMessage(""),      mFilterSubString(""),      mName(""), -    mFilterModified(FILTER_NONE) +    mFilterModified(FILTER_NONE), +    mCurrentGeneration(0)  {  } diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index f44f619d18..1b8197cf6a 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -75,7 +75,7 @@ public:  	virtual bool filter( LLFolderViewFilter& filter);  	virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; } -//	virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { } +	virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0);  	virtual bool passedFilter(S32 filter_generation = -1) { return mPassedFilter; }  	// The action callbacks @@ -102,6 +102,7 @@ protected:  	std::string mName;              // Name of the person  	std::string mSearchableName;	// Name used in string matching for this person +    bool mPrevPassedAllFilters;  	LLUUID mID;  };	 @@ -172,7 +173,7 @@ public:  	void 				clearModified();  	const std::string& 	getName() const { return mName; }  	const std::string& 	getFilterText() { return mName; } -	void 				setModified(EFilterModified behavior = FILTER_RESTART) { mFilterModified = behavior; } +	void 				setModified(EFilterModified behavior = FILTER_RESTART) { mFilterModified = behavior; mCurrentGeneration++; }  	// +-------------------------------------------------------------------+  	// + Time @@ -193,10 +194,10 @@ public:  	// +-------------------------------------------------------------------+  	// + Generation  	// +-------------------------------------------------------------------+ -    // Note : unclear if we have to take tab on generation at that point -	S32 				getCurrentGeneration() const { return 0; } -	S32 				getFirstSuccessGeneration() const { return 0; } -	S32 				getFirstRequiredGeneration() const { return 0; } +    // Note : For the moment, we do not support restrictive filtering so all generation indexes are pointing to the current generation +	S32 				getCurrentGeneration() const { return mCurrentGeneration; } +	S32 				getFirstSuccessGeneration() const { return mCurrentGeneration; } +	S32 				getFirstRequiredGeneration() const { return mCurrentGeneration; }      // Non Virtual Methods (i.e. specific to this class)  	void 				setFilterSubString(const std::string& string); @@ -206,6 +207,7 @@ private:  	std::string         mEmptyLookupMessage;  	std::string			mFilterSubString;  	EFilterModified 	mFilterModified; +	S32					mCurrentGeneration;  };  class LLPersonViewSort  | 
