diff options
| author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-05-02 16:41:53 -0700 | 
|---|---|---|
| committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-05-02 16:41:53 -0700 | 
| commit | f9dc6d9708523591eb95b4ec79c62270ed2ecb93 (patch) | |
| tree | 13d2a1e3bad87bfc670990778e65ff33463e28ae | |
| parent | 933cff41a6b03f2b11403970866db9fbbcf7e85f (diff) | |
| parent | cc7440d0853d269a5b955ab021db729ed5b6a92c (diff) | |
merge
| -rw-r--r-- | indra/newview/llpanelpeople.cpp | 17 | ||||
| -rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 55 | ||||
| -rw-r--r-- | indra/newview/llpersonmodelcommon.h | 18 | 
3 files changed, 73 insertions, 17 deletions
| diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 77c3430c01..03135ce580 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -111,12 +111,11 @@ public:  					{  						mPanelPeople->connectToFacebook(query_map["code"]);  						mPanelPeople = NULL; -						return true;  					}  				} +				return true;  			}  		} -  		return false;  	}  }; @@ -1687,10 +1686,22 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends)  void LLPanelPeople::addTestParticipant()  { +    std::string suffix("Aa"); +    std::string prefix("Test Name");  	for(int i = 0; i < 300; ++i)  	{  		LLPersonTabModel * person_folder_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->mPersonFolderModelMap.begin()->second); -		addParticipantToModel(person_folder_model, gAgent.getID(), "Test Name"); +        std::string name = prefix + " " + suffix; +		addParticipantToModel(person_folder_model, gAgent.getID(), name); +        // Next suffix : Aa, Ab, Ac ... Az, Ba, Bb, Bc ... Bz, Ca, Cb ... +        suffix[1]+=1; +        if (suffix[1]=='{') +        { +            suffix[1]='a'; +            suffix[0]+=1; +            if (suffix[0]=='[') +                suffix[0]='A'; +        }  	}  } diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index 3e9ca9c3b9..9660432b80 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -31,21 +31,23 @@  #include "llevents.h"  #include "llsdutil.h" +#include "llstring.h"  //  // LLPersonModelCommon  //   LLPersonModelCommon::LLPersonModelCommon(std::string display_name, LLFolderViewModelInterface& root_view_model) : -LLFolderViewModelItemCommon(root_view_model), -	mName(display_name), +    LLFolderViewModelItemCommon(root_view_model),  	mID(LLUUID().generateNewID())  { +    renameItem(display_name);  }  LLPersonModelCommon::LLPersonModelCommon(LLFolderViewModelInterface& root_view_model) : -LLFolderViewModelItemCommon(root_view_model), +    LLFolderViewModelItemCommon(root_view_model),  	mName(""), +    mSearchableName(""),  	mID(LLUUID().generateNewID())  {  } @@ -55,6 +57,14 @@ LLPersonModelCommon::~LLPersonModelCommon()  } +BOOL LLPersonModelCommon::renameItem(const std::string& new_name) +{ +    mName = new_name; +    mSearchableName = new_name; +    LLStringUtil::toUpper(mSearchableName); +    return TRUE; +} +  void LLPersonModelCommon::postEvent(const std::string& event_type, LLPersonTabModel* folder, LLPersonModel* person)  {  	LLUUID folder_id = folder->getID(); @@ -84,6 +94,39 @@ void LLPersonModelCommon::showProperties(void)  {  } +bool LLPersonModelCommon::filter( LLFolderViewFilter& filter) +{ +    // See LLFolderViewModelItemInventory::filter() +/* +    if (!filter.isModified()) +    { +        llinfos << "Merov : LLPersonModelCommon::filter, exit, no modif" << llendl; +        return true; +    } +*/         +    if (!mChildren.empty()) +    { +        //llinfos << "Merov : LLPersonModelCommon::filter, filtering folder = " << getDisplayName() << llendl; +        setPassedFilter(1, -1, filter.getStringMatchOffset(this), filter.getFilterStringSize()); +        for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); +            iter != end_iter; +            ++iter) +        { +            // LLFolderViewModelItem +            LLPersonModelCommon* item = dynamic_cast<LLPersonModelCommon*>(*iter); +            item->filter(filter); +        } +    } +    else +    { +        const bool passed_filter = filter.check(this); +        setPassedFilter(passed_filter, -1, filter.getStringMatchOffset(this), filter.getFilterStringSize()); +    } +     +    filter.clearModified(); +    return true; +} +  //  // LLPersonTabModel  //  @@ -186,7 +229,7 @@ void LLPersonViewFilter::setFilterSubString(const std::string& string)  	if (mFilterSubString != filter_sub_string_new)  	{          // *TODO : Add logic to support more and less restrictive filtering -        mFilterModified = FILTER_RESTART; +        setModified(FILTER_RESTART);  		mFilterSubString = filter_sub_string_new;  	}  } @@ -198,9 +241,7 @@ bool LLPersonViewFilter::showAllResults() const  bool LLPersonViewFilter::check(const LLFolderViewModelItem* item)  { -	std::string::size_type string_offset = mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; -     -	return (mFilterSubString.size() == 0 || string_offset != std::string::npos); +	return (mFilterSubString.size() ? (item->getSearchableName().find(mFilterSubString) != std::string::npos) : true);  }  std::string::size_type LLPersonViewFilter::getStringMatchOffset(LLFolderViewModelItem* item) const diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index 9e13a7d7d9..1e9117c2df 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -46,13 +46,14 @@ public:  	// Stub those things we won't really be using in this conversation context  	virtual const std::string& getName() const { return mName; }  	virtual const std::string& getDisplayName() const { return mName; } -	virtual const std::string& getSearchableName() const { return mName; } +	virtual const std::string& getSearchableName() const { return mSearchableName; } +  	virtual LLPointer<LLUIImage> getIcon() const { return NULL; }  	virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }  	virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }  	virtual std::string getLabelSuffix() const { return LLStringUtil::null; }  	virtual BOOL isItemRenameable() const { return TRUE; } -	virtual BOOL renameItem(const std::string& new_name) { mName = new_name; return TRUE; } +	virtual BOOL renameItem(const std::string& new_name);  	virtual BOOL isItemMovable( void ) const { return FALSE; }  	virtual BOOL isItemRemovable( void ) const { return FALSE; }  	virtual BOOL isItemInTrash( void) const { return FALSE; } @@ -70,10 +71,12 @@ public:  	virtual bool hasChildren() const { return FALSE; }  	virtual bool potentiallyVisible() { return true; } -	virtual bool filter( LLFolderViewFilter& filter) { return false; } +     +	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 bool passedFilter(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 bool passedFilter(S32 filter_generation = -1) { return mPassedFilter; }  	// The action callbacks  	virtual void performAction(LLInventoryModel* model, std::string action); @@ -97,7 +100,8 @@ public:  protected: -	std::string mName;	// Name of the session or the participant +	std::string mName;              // Name of the person +	std::string mSearchableName;	// Name used in string matching for this person  	LLUUID mID;  };	 @@ -175,7 +179,7 @@ public:  	// +-------------------------------------------------------------------+      // Note : we currently filter the whole person list at once, no need to count then.  	void 				setFilterCount(S32 count) { } -	S32 				getFilterCount() const { return 0; } +	S32 				getFilterCount() const { return 1; }  	void 				decrementFilterCount() { }  	// +-------------------------------------------------------------------+ | 
