diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llpersonmodelcommon.h | 64 |
2 files changed, 64 insertions, 32 deletions
diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index 91c3f6a92a..3e9ca9c3b9 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -170,8 +170,9 @@ LLUUID LLPersonModel::getAgentID() // LLPersonViewFilter::LLPersonViewFilter() : - mEmpty(""), + mEmptyLookupMessage(""), mFilterSubString(""), + mName(""), mFilterModified(FILTER_NONE) { } @@ -184,31 +185,32 @@ 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; mFilterSubString = filter_sub_string_new; } } -std::string::size_type LLPersonViewFilter::getFilterStringSize() const +bool LLPersonViewFilter::showAllResults() const { - return mFilterSubString.size(); + return mFilterSubString.size() > 0; } bool LLPersonViewFilter::check(const LLFolderViewModelItem* item) { - //const LLPersonModelCommon* person = dynamic_cast<const LLPersonModelCommon*>(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); } -bool LLPersonViewFilter::showAllResults() const +std::string::size_type LLPersonViewFilter::getStringMatchOffset(LLFolderViewModelItem* item) const { - return mFilterSubString.size() > 0; + return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; } -std::string::size_type LLPersonViewFilter::getStringMatchOffset(LLFolderViewModelItem* item) const +std::string::size_type LLPersonViewFilter::getFilterStringSize() const { - return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; + return mFilterSubString.size(); } bool LLPersonViewFilter::isActive() const @@ -218,11 +220,21 @@ bool LLPersonViewFilter::isActive() const bool LLPersonViewFilter::isModified() const { - return isActive(); + return mFilterModified != FILTER_NONE; } void LLPersonViewFilter::clearModified() { mFilterModified = FILTER_NONE; - setFilterSubString(""); } + +void LLPersonViewFilter::setEmptyLookupMessage(const std::string& message) +{ + mEmptyLookupMessage = message; +} + +std::string LLPersonViewFilter::getEmptyLookupMessage() const +{ + return mEmptyLookupMessage; +} + diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index 4030cd11df..9e13a7d7d9 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -138,49 +138,69 @@ public: enum ESortOrderType { SO_NAME = 0, // Sort by name - SO_DATE = 0x1, // Sort by date (most recent) - SO_SESSION_TYPE = 0x2, // Sort by type (valid only for sessions) - SO_DISTANCE = 0x3, // Sort by distance (valid only for participants in nearby chat) + SO_ONLINE_STATUS = 0x1 // Sort by online status (i.e. online or not) }; - // Default sort order is by type for sessions and by date for participants - static const U32 SO_DEFAULT = (SO_SESSION_TYPE << 16) | (SO_DATE); + // Default sort order is by name + static const U32 SO_DEFAULT = SO_NAME; LLPersonViewFilter(); ~LLPersonViewFilter() {} - void setFilterSubString(const std::string& string); - std::string::size_type getFilterStringSize() const; + // +-------------------------------------------------------------------+ + // + Execution And Results + // +-------------------------------------------------------------------+ bool check(const LLFolderViewModelItem* item); + bool checkFolder(const LLFolderViewModelItem* folder) const { return true; } + + void setEmptyLookupMessage(const std::string& message); + std::string getEmptyLookupMessage() const; + bool showAllResults() const; + std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const; + std::string::size_type getFilterStringSize() const; + + // +-------------------------------------------------------------------+ + // + Status + // +-------------------------------------------------------------------+ bool isActive() const; bool isModified() const; void clearModified(); - - bool checkFolder(const LLFolderViewModelItem* folder) const { return true; } + const std::string& getName() const { return mName; } + const std::string& getFilterText() { return mName; } + void setModified(EFilterModified behavior = FILTER_RESTART) { mFilterModified = behavior; } - void setEmptyLookupMessage(const std::string& message) { } - std::string getEmptyLookupMessage() const { return mEmpty; } - - const std::string& getName() const { return mEmpty; } - const std::string& getFilterText() { return mEmpty; } - void setModified(EFilterModified behavior = FILTER_RESTART) { } - + // +-------------------------------------------------------------------+ + // + Count + // +-------------------------------------------------------------------+ + // Note : we currently filter the whole person list at once, no need to count then. void setFilterCount(S32 count) { } S32 getFilterCount() const { return 0; } void decrementFilterCount() { } - bool isDefault() const { return true; } - bool isNotDefault() const { return false; } + // +-------------------------------------------------------------------+ + // + Default + // +-------------------------------------------------------------------+ + // Note : we don't support runtime default setting for person filter + bool isDefault() const { return !isActive(); } + bool isNotDefault() const { return isActive(); } void markDefault() { } - void resetDefault() { } - + void resetDefault() { setModified(); } + + // +-------------------------------------------------------------------+ + // + 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; } - + + // Non Virtual Methods (i.e. specific to this class) + void setFilterSubString(const std::string& string); + private: - std::string mEmpty; + std::string mName; + std::string mEmptyLookupMessage; std::string mFilterSubString; EFilterModified mFilterModified; }; |