summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-04-30 17:18:29 -0700
committerMerov Linden <merov@lindenlab.com>2013-04-30 17:18:29 -0700
commit336efe17d8f24a8445e93645f2cf18b68e18de2e (patch)
tree08ded5bbee444b30e0964997f771479f0e873d4d /indra
parent44ba579bb8897bab3ddeaa279587068abdb10c0d (diff)
ACME-275 : WIP : Write all LLPersonViewerFilter methods and clean up interface
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpersonmodelcommon.cpp32
-rw-r--r--indra/newview/llpersonmodelcommon.h64
2 files changed, 64 insertions, 32 deletions
diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp
index 4e54562f18..32ceef096d 100644
--- a/indra/newview/llpersonmodelcommon.cpp
+++ b/indra/newview/llpersonmodelcommon.cpp
@@ -163,8 +163,9 @@ LLPersonModelCommon(root_view_model)
//
LLPersonViewFilter::LLPersonViewFilter() :
- mEmpty(""),
+ mEmptyLookupMessage(""),
mFilterSubString(""),
+ mName(""),
mFilterModified(FILTER_NONE)
{
}
@@ -177,31 +178,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
@@ -211,11 +213,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 bdbee002e6..2ddec3d05e 100644
--- a/indra/newview/llpersonmodelcommon.h
+++ b/indra/newview/llpersonmodelcommon.h
@@ -136,49 +136,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;
};