From 9940ca5ae7698e89c0587733f7ab922027c8ddcc Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 15 Jun 2012 09:44:27 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose llfolderview refactornig --- indra/newview/llinventoryfilter.cpp | 181 ++++++++++++++++++------------------ 1 file changed, 91 insertions(+), 90 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 5496c273f2..9c84be5eac 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -41,39 +41,39 @@ // linden library includes #include "lltrans.h" -LLInventoryFilter::FilterOps::FilterOps() : - mFilterObjectTypes(0xffffffffffffffffULL), - mFilterCategoryTypes(0xffffffffffffffffULL), - mFilterWearableTypes(0xffffffffffffffffULL), - mMinDate(time_min()), - mMaxDate(time_max()), - mHoursAgo(0), - mShowFolderState(SHOW_NON_EMPTY_FOLDERS), - mPermissions(PERM_NONE), - mFilterTypes(FILTERTYPE_OBJECT), - mFilterUUID(LLUUID::null), - mFilterLinks(FILTERLINK_INCLUDE_LINKS) +LLInventoryFilter::FilterOps::FilterOps(const Params& p) +: mFilterObjectTypes(p.object_types), + mFilterCategoryTypes(p.category_types), + mFilterWearableTypes(p.wearable_types), + mMinDate(p.date_range.min_date), + mMaxDate(p.date_range.max_date), + mHoursAgo(p.hours_ago), + mShowFolderState(p.show_folder_state), + mPermissions(p.permissions), + mFilterTypes(p.types), + mFilterUUID(p.uuid), + mFilterLinks(p.links) { } ///---------------------------------------------------------------------------- /// Class LLInventoryFilter ///---------------------------------------------------------------------------- -LLInventoryFilter::LLInventoryFilter(const std::string& name) +LLInventoryFilter::LLInventoryFilter(const std::string& name, const Params& p) : mName(name), mModified(FALSE), mNeedTextRebuild(TRUE), - mEmptyLookupMessage("InventoryNoMatchingItems") + mEmptyLookupMessage("InventoryNoMatchingItems"), + mFilterOps(p.filter_ops) { - mOrder = SO_FOLDERS_BY_NAME; // This gets overridden by a pref immediately + mOrder = p.sort_order; // This gets overridden by a pref immediately - mSubStringMatchOffset = 0; - mFilterSubString.clear(); - mFilterGeneration = 0; - mMustPassGeneration = S32_MAX; - mMinRequiredGeneration = 0; + mFilterSubString(p.substring); + mLastSuccessGeneration = 0; + mLastFailGeneration = S32_MAX; + getFirstSuccessGeneration = 0; mFilterCount = 0; - mNextFilterGeneration = mFilterGeneration + 1; + mNextFilterGeneration = mLastSuccessGeneration + 1; mLastLogoff = gSavedPerAccountSettings.getU32("LastLogoff"); mFilterBehavior = FILTER_NONE; @@ -95,7 +95,7 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item) return TRUE; } - mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; const BOOL passed_filtertype = checkAgainstFilterType(item); const BOOL passed_permissions = checkAgainstPermissions(item); @@ -103,20 +103,20 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item) const BOOL passed = (passed_filtertype && passed_permissions && passed_filterlink && - (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos)); + (mFilterSubString.size() == 0 || string_offset != std::string::npos)); return passed; } bool LLInventoryFilter::check(const LLInventoryItem* item) { - mSubStringMatchOffset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; const bool passed_filtertype = checkAgainstFilterType(item); const bool passed_permissions = checkAgainstPermissions(item); const bool passed = (passed_filtertype && passed_permissions && - (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos)); + (mFilterSubString.size() == 0 || string_offset != std::string::npos)); return passed; } @@ -130,7 +130,7 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const return false; } - const LLFolderViewEventListener* listener = folder->getListener(); + const LLFolderViewModelItemInventory* listener = folder->getListener(); if (!listener) { llwarns << "Folder view event listener not found." << llendl; @@ -168,7 +168,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const { - const LLFolderViewEventListener* listener = item->getListener(); + const LLFolderViewModelItemInventory* listener = item->getListener(); if (!listener) return FALSE; LLInventoryType::EType object_type = listener->getInventoryType(); @@ -311,7 +311,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) cons BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const { - const LLFolderViewEventListener* listener = item->getListener(); + const LLFolderViewModelItemInventory* listener = item->getListener(); if (!listener) return FALSE; PermissionMask perm = listener->getPermissionMask(); @@ -339,7 +339,7 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) con BOOL LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const { - const LLFolderViewEventListener* listener = item->getListener(); + const LLFolderViewModelItemInventory* listener = item->getListener(); if (!listener) return TRUE; const LLUUID object_id = listener->getUUID(); @@ -359,9 +359,9 @@ const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const return mFilterSubString; } -std::string::size_type LLInventoryFilter::getStringMatchOffset() const +std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewItem* item) const { - return mSubStringMatchOffset; + return mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; } // has user modified default filter params? @@ -685,7 +685,7 @@ void LLInventoryFilter::setModified(EFilterBehavior behavior) { mModified = TRUE; mNeedTextRebuild = TRUE; - mFilterGeneration = mNextFilterGeneration++; + mLastSuccessGeneration = mNextFilterGeneration++; if (mFilterBehavior == FILTER_NONE) { @@ -704,17 +704,17 @@ void LLInventoryFilter::setModified(EFilterBehavior behavior) switch(mFilterBehavior) { case FILTER_RESTART: - mMustPassGeneration = mFilterGeneration; - mMinRequiredGeneration = mFilterGeneration; + mLastFailGeneration = mLastSuccessGeneration; + mFirstSuccessGeneration = mLastSuccessGeneration; break; case FILTER_LESS_RESTRICTIVE: - mMustPassGeneration = mFilterGeneration; + mLastFailGeneration = mLastSuccessGeneration; break; case FILTER_MORE_RESTRICTIVE: - mMinRequiredGeneration = mFilterGeneration; + mFirstSuccessGeneration = mLastSuccessGeneration; // must have passed either current filter generation (meaningless, as it hasn't been run yet) // or some older generation, so keep the value - mMustPassGeneration = llmin(mMustPassGeneration, mFilterGeneration); + mLastFailGeneration = llmin(mLastFailGeneration, mLastSuccessGeneration); break; default: llerrs << "Bad filter behavior specified" << llendl; @@ -930,60 +930,34 @@ const std::string& LLInventoryFilter::getFilterText() return mFilterText; } -void LLInventoryFilter::toLLSD(LLSD& data) const +void LLInventoryFilter::toParams(Params& params) const { - data["filter_types"] = (LLSD::Integer)getFilterObjectTypes(); - data["min_date"] = (LLSD::Integer)getMinDate(); - data["max_date"] = (LLSD::Integer)getMaxDate(); - data["hours_ago"] = (LLSD::Integer)getHoursAgo(); - data["show_folder_state"] = (LLSD::Integer)getShowFolderState(); - data["permissions"] = (LLSD::Integer)getFilterPermissions(); - data["substring"] = (LLSD::String)getFilterSubString(); - data["sort_order"] = (LLSD::Integer)getSortOrder(); - data["since_logoff"] = (LLSD::Boolean)isSinceLogoff(); + params.filter_ops.types = getFilterObjectTypes(); + params.filter_ops.date_range.min_date = getMinDate(); + params.filter_ops.date_range.max_date = getMaxDate(); + params.filter_ops.hours_ago = getHoursAgo(); + params.filter_ops.show_folder_state = getShowFolderState(); + params.filter_ops.permissions = getFilterPermissions(); + params.substring = getFilterSubString(); + params.sort_order = getSortOrder(); + params.since_logoff = isSinceLogoff(); } -void LLInventoryFilter::fromLLSD(LLSD& data) +void LLInventoryFilter::fromParams(const Params& data) { - if(data.has("filter_types")) + if (!params.validateBlock()) { - setFilterObjectTypes((U32)data["filter_types"].asInteger()); + return; } - if(data.has("min_date") && data.has("max_date")) - { - setDateRange(data["min_date"].asInteger(), data["max_date"].asInteger()); - } - - if(data.has("hours_ago")) - { - setHoursAgo((U32)data["hours_ago"].asInteger()); - } - - if(data.has("show_folder_state")) - { - setShowFolderState((EFolderShow)data["show_folder_state"].asInteger()); - } - - if(data.has("permissions")) - { - setFilterPermissions((PermissionMask)data["permissions"].asInteger()); - } - - if(data.has("substring")) - { - setFilterSubString(std::string(data["substring"].asString())); - } - - if(data.has("sort_order")) - { - setSortOrder((U32)data["sort_order"].asInteger()); - } - - if(data.has("since_logoff")) - { - setDateRangeLastLogoff((bool)data["since_logoff"].asBoolean()); - } + setFilterObjectTypes(params.filter_ops.types); + setDateRange(params.filter_ops.date_range.min_date, params.filter_ops.date_range.max_date); + setHoursAgo(params.filter_ops.hours_ago); + setShowFolderState(params.filter_ops.show_folder_state); + setFilterPermissions(params.filter_ops.permissions); + setFilterSubString(params.substring); + setSortOrder(params.sort_order); + setDateRangeLastLogoff(params.since_logoff); } U64 LLInventoryFilter::getFilterObjectTypes() const @@ -1052,15 +1026,15 @@ void LLInventoryFilter::decrementFilterCount() S32 LLInventoryFilter::getCurrentGeneration() const { - return mFilterGeneration; + return mLastSuccessGeneration; } -S32 LLInventoryFilter::getMinRequiredGeneration() const +S32 LLInventoryFilter::getFirstSuccessGeneration() const { - return mMinRequiredGeneration; + return mFirstSuccessGeneration; } -S32 LLInventoryFilter::getMustPassGeneration() const +S32 LLInventoryFilter::getFirstRequiredGeneration() const { - return mMustPassGeneration; + return mLastFailGeneration; } void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) @@ -1068,9 +1042,13 @@ void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) mEmptyLookupMessage = message; } +RN: turn this into a param const std::string& LLInventoryFilter::getEmptyLookupMessage() const { - return mEmptyLookupMessage; + LLStringUtil::format_map_t args; + args["[SEARCH_TERM]"] = LLURI::escape(getFilterSubStringOrig()); + + return LLTrans::getString(mEmptyLookupMessage, args); } @@ -1080,3 +1058,26 @@ bool LLInventoryFilter::areDateLimitsSet() || mFilterOps.mMaxDate != time_max() || mFilterOps.mHoursAgo != 0; } + +LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& other ) +{ + fromParams(other.toParams()); +} + + +bool LLInventoryFilter::FilterOps::DateRange::validateBlock( bool emit_errors /*= true*/ ) +{ + bool valid = LLInitParam::Block::validateBlock(emit_errors); + if (valid) + { + if (max_date() < min_date()) + { + if (emit_errors) + { + llwarns << "max_date should be greater or equal to min_date" << llendl; + } + valid = false; + } + } + return valid; +} -- cgit v1.2.3 From 379eec8841212665881569c69804fafd96152387 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 15 Jun 2012 13:35:39 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose continuing fixing build errors renamed llfoldervieweventlistener.h to llfolderviewmodel.h --- indra/newview/llinventoryfilter.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 5de3f0cb4e..1d25a7a1f9 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -29,7 +29,7 @@ #include "llinventoryfilter.h" // viewer includes -#include "llfoldervieweventlistener.h" +#include "llfolderviewmodel.h" #include "llfolderviewitem.h" #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" @@ -92,7 +92,7 @@ LLInventoryFilter::~LLInventoryFilter() BOOL LLInventoryFilter::check(const LLFolderViewItem* item) { // Clipboard cut items are *always* filtered so we need this value upfront - const LLFolderViewEventListener* listener = item->getListener(); + const LLFolderViewEventListener* listener = item->getViewModelItem(); const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); // If it's a folder and we're showing all folders, return automatically. @@ -140,7 +140,7 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const return false; } - const LLFolderViewModelItemInventory* listener = folder->getListener(); + const LLFolderViewModelItemInventory* listener = folder->getViewModelItem(); if (!listener) { llwarns << "Folder view event listener not found." << llendl; @@ -155,6 +155,13 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const { + // when applying a filter, matching folders get their contents downloaded first + if (isNotDefault() + && !gInventory.isCategoryComplete(getUUID()))) + { + LLInventoryModelBackgroundFetch::instance().start(getViewModelItem()->getUUID()); + } + // Always check against the clipboard const BOOL passed_clipboard = checkAgainstClipboard(folder_id); @@ -181,7 +188,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const { - const LLFolderViewModelItemInventory* listener = item->getListener(); + const LLFolderViewModelItemInventory* listener = item->getViewModelItem(); if (!listener) return FALSE; LLInventoryType::EType object_type = listener->getInventoryType(); @@ -349,11 +356,11 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const { - const LLFolderViewModelItemInventory* listener = item->getListener(); + const LLFolderViewModelItemInventory* listener = item->getViewModelItem(); if (!listener) return FALSE; PermissionMask perm = listener->getPermissionMask(); - const LLInvFVBridge *bridge = dynamic_cast(item->getListener()); + const LLInvFVBridge *bridge = dynamic_cast(item->getViewModelItem()); if (bridge && bridge->isLink()) { const LLUUID& linked_uuid = gInventory.getLinkedItemID(bridge->getUUID()); @@ -377,7 +384,7 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) con BOOL LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const { - const LLFolderViewModelItemInventory* listener = item->getListener(); + const LLFolderViewModelItemInventory* listener = item->getViewModelItem(); if (!listener) return TRUE; const LLUUID object_id = listener->getUUID(); @@ -408,9 +415,9 @@ BOOL LLInventoryFilter::isDefault() const } // has user modified default filter params? -BOOL LLInventoryFilter::isNotDefault() const +bool LLInventoryFilter::isNotDefault() const { - BOOL not_default = FALSE; + bool not_default = FALSE; not_default |= (mFilterOps.mFilterObjectTypes != mDefaultFilterOps.mFilterObjectTypes); not_default |= (mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes); @@ -1125,6 +1132,12 @@ LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& othe fromParams(other.toParams()); } +bool LLInventoryFilter::showAllResults() const +{ + return hasFilterString(); +} + + bool LLInventoryFilter::FilterOps::DateRange::validateBlock( bool emit_errors /*= true*/ ) { -- cgit v1.2.3 From 59987bb051ed39146ec9b3831eec81434779a73f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 18 Jun 2012 19:01:59 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose continuing fixing build errors general cleanup --- indra/newview/llinventoryfilter.cpp | 157 ++++++++++++++++++------------------ 1 file changed, 79 insertions(+), 78 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 1d25a7a1f9..9c9b04d03d 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -42,6 +42,8 @@ #include "llclipboard.h" #include "lltrans.h" +//TODO RN: fix use of static cast as much as possible + LLFastTimer::DeclareTimer FT_FILTER_CLIPBOARD("Filter Clipboard"); LLInventoryFilter::FilterOps::FilterOps(const Params& p) @@ -62,37 +64,27 @@ LLInventoryFilter::FilterOps::FilterOps(const Params& p) ///---------------------------------------------------------------------------- /// Class LLInventoryFilter ///---------------------------------------------------------------------------- -LLInventoryFilter::LLInventoryFilter(const std::string& name, const Params& p) -: mName(name), - mModified(FALSE), - mNeedTextRebuild(TRUE), +LLInventoryFilter::LLInventoryFilter(const Params& p) +: mFilterModified(FILTER_NONE), mEmptyLookupMessage("InventoryNoMatchingItems"), - mFilterOps(p.filter_ops) + mFilterOps(p.filter_ops), + mOrder(p.sort_order), + mFilterSubString(p.substring), + mLastSuccessGeneration(0), + mLastFailGeneration(S32_MAX), + mFirstSuccessGeneration(0), + mFilterCount(0) { - mOrder = p.sort_order; // This gets overridden by a pref immediately - - mFilterSubString(p.substring); - mLastSuccessGeneration = 0; - mLastFailGeneration = S32_MAX; - getFirstSuccessGeneration = 0; - mFilterCount = 0; mNextFilterGeneration = mLastSuccessGeneration + 1; - mLastLogoff = gSavedPerAccountSettings.getU32("LastLogoff"); - mFilterBehavior = FILTER_NONE; - // copy mFilterOps into mDefaultFilterOps markDefault(); } -LLInventoryFilter::~LLInventoryFilter() -{ -} - -BOOL LLInventoryFilter::check(const LLFolderViewItem* item) +bool LLInventoryFilter::check(const LLFolderViewItem* item) { // Clipboard cut items are *always* filtered so we need this value upfront - const LLFolderViewEventListener* listener = item->getViewModelItem(); + const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); // If it's a folder and we're showing all folders, return automatically. @@ -140,7 +132,7 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const return false; } - const LLFolderViewModelItemInventory* listener = folder->getViewModelItem(); + const LLFolderViewModelItemInventory* listener = static_cast(folder->getViewModelItem()); if (!listener) { llwarns << "Folder view event listener not found." << llendl; @@ -157,9 +149,9 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const { // when applying a filter, matching folders get their contents downloaded first if (isNotDefault() - && !gInventory.isCategoryComplete(getUUID()))) + && !gInventory.isCategoryComplete(folder_id)) { - LLInventoryModelBackgroundFetch::instance().start(getViewModelItem()->getUUID()); + LLInventoryModelBackgroundFetch::instance().start(folder_id); } // Always check against the clipboard @@ -186,9 +178,9 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const return passed_clipboard; } -BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const { - const LLFolderViewModelItemInventory* listener = item->getViewModelItem(); + const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return FALSE; LLInventoryType::EType object_type = listener->getInventoryType(); @@ -354,9 +346,9 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const return true; } -BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const { - const LLFolderViewModelItemInventory* listener = item->getViewModelItem(); + const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return FALSE; PermissionMask perm = listener->getPermissionMask(); @@ -382,9 +374,9 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) con return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions; } -BOOL LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const { - const LLFolderViewModelItemInventory* listener = item->getViewModelItem(); + const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return TRUE; const LLUUID object_id = listener->getUUID(); @@ -409,7 +401,7 @@ std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewIte return mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; } -BOOL LLInventoryFilter::isDefault() const +bool LLInventoryFilter::isDefault() const { return !isNotDefault(); } @@ -417,7 +409,7 @@ BOOL LLInventoryFilter::isDefault() const // has user modified default filter params? bool LLInventoryFilter::isNotDefault() const { - bool not_default = FALSE; + S32 not_default = 0; not_default |= (mFilterOps.mFilterObjectTypes != mDefaultFilterOps.mFilterObjectTypes); not_default |= (mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes); @@ -430,10 +422,10 @@ bool LLInventoryFilter::isNotDefault() const not_default |= (mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate); not_default |= (mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo); - return not_default; + return not_default != 0; } -BOOL LLInventoryFilter::isActive() const +bool LLInventoryFilter::isActive() const { return mFilterOps.mFilterObjectTypes != 0xffffffffffffffffULL || mFilterOps.mFilterCategoryTypes != 0xffffffffffffffffULL @@ -447,16 +439,9 @@ BOOL LLInventoryFilter::isActive() const || mFilterOps.mHoursAgo != 0; } -BOOL LLInventoryFilter::isModified() const -{ - return mModified; -} - -BOOL LLInventoryFilter::isModifiedAndClear() +bool LLInventoryFilter::isModified() const { - BOOL ret = mModified; - mModified = FALSE; - return ret; + return mFilterModified != FILTER_NONE; } void LLInventoryFilter::updateFilterTypes(U64 types, U64& current_types) @@ -620,9 +605,10 @@ void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date) void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) { + static LLCachedControl s_last_logoff(gSavedSettings, "LastLogoff", 0); if (sl && !isSinceLogoff()) { - setDateRange(mLastLogoff, time_max()); + setDateRange(s_last_logoff(), time_max()); setModified(); } if (!sl && isSinceLogoff()) @@ -641,17 +627,18 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) } } -BOOL LLInventoryFilter::isSinceLogoff() const +bool LLInventoryFilter::isSinceLogoff() const { - return (mFilterOps.mMinDate == (time_t)mLastLogoff) && + static LLCachedControl s_last_logoff(gSavedSettings, "LastLogoff", 0); + + return (mFilterOps.mMinDate == (time_t)s_last_logoff()) && (mFilterOps.mMaxDate == time_max()) && (mFilterOps.mFilterTypes & FILTERTYPE_DATE); } void LLInventoryFilter::clearModified() { - mModified = FALSE; - mFilterBehavior = FILTER_NONE; + mFilterModified = FILTER_NONE; } void LLInventoryFilter::setHoursAgo(U32 hours) @@ -749,27 +736,26 @@ void LLInventoryFilter::resetDefault() setModified(); } -void LLInventoryFilter::setModified(EFilterBehavior behavior) +void LLInventoryFilter::setModified(EFilterModified behavior) { - mModified = TRUE; - mNeedTextRebuild = TRUE; + mFilterText.clear(); mLastSuccessGeneration = mNextFilterGeneration++; - if (mFilterBehavior == FILTER_NONE) + if (mFilterModified == FILTER_NONE) { - mFilterBehavior = behavior; + mFilterModified = behavior; } - else if (mFilterBehavior != behavior) + else if (mFilterModified != behavior) { // trying to do both less restrictive and more restrictive filter // basically means restart from scratch - mFilterBehavior = FILTER_RESTART; + mFilterModified = FILTER_RESTART; } if (isNotDefault()) { // if not keeping current filter results, update last valid as well - switch(mFilterBehavior) + switch(mFilterModified) { case FILTER_RESTART: mLastFailGeneration = mLastSuccessGeneration; @@ -791,29 +777,29 @@ void LLInventoryFilter::setModified(EFilterBehavior behavior) else { // shortcut disabled filters to show everything immediately - mMinRequiredGeneration = 0; - mMustPassGeneration = S32_MAX; + mLastFailGeneration = 0; + mFirstSuccessGeneration = S32_MAX; } } -BOOL LLInventoryFilter::isFilterObjectTypesWith(LLInventoryType::EType t) const +bool LLInventoryFilter::isFilterObjectTypesWith(LLInventoryType::EType t) const { return mFilterOps.mFilterObjectTypes & (1LL << t); } const std::string& LLInventoryFilter::getFilterText() { - if (!mNeedTextRebuild) + if (!mFilterText.empty()) { return mFilterText; } - mNeedTextRebuild = FALSE; std::string filtered_types; std::string not_filtered_types; BOOL filtered_by_type = FALSE; BOOL filtered_by_all_types = TRUE; S32 num_filter_types = 0; + mFilterText.clear(); if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION)) @@ -998,9 +984,26 @@ const std::string& LLInventoryFilter::getFilterText() return mFilterText; } + +LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& other ) +{ + setFilterObjectTypes(other.getFilterObjectTypes()); + setDateRange(other.getMinDate(), other.getMaxDate()); + setHoursAgo(other.getHoursAgo()); + setShowFolderState(other.getShowFolderState()); + setFilterPermissions(other.getFilterPermissions()); + setFilterSubString(other.getFilterSubString()); + setSortOrder(other.getSortOrder()); + setDateRangeLastLogoff(other.isSinceLogoff()); + return *this; +} + + void LLInventoryFilter::toParams(Params& params) const - { +{ params.filter_ops.types = getFilterObjectTypes(); + params.filter_ops.category_types = getFilterCategoryTypes(); + params.filter_ops.wearable_types = getFilterWearableTypes(); params.filter_ops.date_range.min_date = getMinDate(); params.filter_ops.date_range.max_date = getMaxDate(); params.filter_ops.hours_ago = getHoursAgo(); @@ -1009,16 +1012,18 @@ void LLInventoryFilter::toParams(Params& params) const params.substring = getFilterSubString(); params.sort_order = getSortOrder(); params.since_logoff = isSinceLogoff(); - } +} -void LLInventoryFilter::fromParams(const Params& data) - { +void LLInventoryFilter::fromParams(const Params& params) +{ if (!params.validateBlock()) { return; } setFilterObjectTypes(params.filter_ops.types); + setFilterCategoryTypes(params.filter_ops.category_types); + setFilterWearableTypes(params.filter_ops.wearable_types); setDateRange(params.filter_ops.date_range.min_date, params.filter_ops.date_range.max_date); setHoursAgo(params.filter_ops.hours_ago); setShowFolderState(params.filter_ops.show_folder_state); @@ -1038,7 +1043,12 @@ U64 LLInventoryFilter::getFilterCategoryTypes() const return mFilterOps.mFilterCategoryTypes; } -BOOL LLInventoryFilter::hasFilterString() const +U64 LLInventoryFilter::getFilterWearableTypes() const +{ + return mFilterOps.mFilterWearableTypes; +} + +bool LLInventoryFilter::hasFilterString() const { return mFilterSubString.size() > 0; } @@ -1073,10 +1083,6 @@ U32 LLInventoryFilter::getSortOrder() const { return mOrder; } -const std::string& LLInventoryFilter::getName() const -{ - return mName; -} void LLInventoryFilter::setFilterCount(S32 count) { @@ -1110,8 +1116,8 @@ void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) mEmptyLookupMessage = message; } -RN: turn this into a param -const std::string& LLInventoryFilter::getEmptyLookupMessage() const +// TODO RN: turn this into a param and move to llfolderviewmodelinterface +std::string LLInventoryFilter::getEmptyLookupMessage() const { LLStringUtil::format_map_t args; args["[SEARCH_TERM]"] = LLURI::escape(getFilterSubStringOrig()); @@ -1127,11 +1133,6 @@ bool LLInventoryFilter::areDateLimitsSet() || mFilterOps.mHoursAgo != 0; } -LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& other ) -{ - fromParams(other.toParams()); -} - bool LLInventoryFilter::showAllResults() const { return hasFilterString(); @@ -1139,7 +1140,7 @@ bool LLInventoryFilter::showAllResults() const -bool LLInventoryFilter::FilterOps::DateRange::validateBlock( bool emit_errors /*= true*/ ) +bool LLInventoryFilter::FilterOps::DateRange::validateBlock( bool emit_errors /*= true*/ ) const { bool valid = LLInitParam::Block::validateBlock(emit_errors); if (valid) -- cgit v1.2.3 From 316d8fc875d54bfcc7e7eb8d215a4810947bcb71 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 20 Jun 2012 14:58:02 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose fixed final build errors --- indra/newview/llinventoryfilter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 9c9b04d03d..c13bb5123e 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -65,7 +65,8 @@ LLInventoryFilter::FilterOps::FilterOps(const Params& p) /// Class LLInventoryFilter ///---------------------------------------------------------------------------- LLInventoryFilter::LLInventoryFilter(const Params& p) -: mFilterModified(FILTER_NONE), +: mName(p.name), + mFilterModified(FILTER_NONE), mEmptyLookupMessage("InventoryNoMatchingItems"), mFilterOps(p.filter_ops), mOrder(p.sort_order), -- cgit v1.2.3 From cb865a7e1300d4ce0bedae7c856fb210b68a43f8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 27 Jun 2012 18:56:10 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose moved filtering logic to viewmodel --- indra/newview/llinventoryfilter.cpp | 97 ++++++++++++++----------------------- 1 file changed, 37 insertions(+), 60 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index c13bb5123e..c7e0136368 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -71,35 +71,35 @@ LLInventoryFilter::LLInventoryFilter(const Params& p) mFilterOps(p.filter_ops), mOrder(p.sort_order), mFilterSubString(p.substring), - mLastSuccessGeneration(0), - mLastFailGeneration(S32_MAX), + mCurrentGeneration(0), + mFirstRequiredGeneration(0), mFirstSuccessGeneration(0), mFilterCount(0) { - mNextFilterGeneration = mLastSuccessGeneration + 1; + mNextFilterGeneration = mCurrentGeneration + 1; // copy mFilterOps into mDefaultFilterOps markDefault(); } -bool LLInventoryFilter::check(const LLFolderViewItem* item) +bool LLInventoryFilter::check(const LLFolderViewModelItem* item) { + const LLFolderViewModelItemInventory* listener = static_cast(item); // Clipboard cut items are *always* filtered so we need this value upfront - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); // If it's a folder and we're showing all folders, return automatically. - const BOOL is_folder = (dynamic_cast(item) != NULL); + const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;; if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)) { return passed_clipboard; } - std::string::size_type string_offset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; - const BOOL passed_filtertype = checkAgainstFilterType(item); - const BOOL passed_permissions = checkAgainstPermissions(item); - const BOOL passed_filterlink = checkAgainstFilterLinks(item); + const BOOL passed_filtertype = checkAgainstFilterType(listener); + const BOOL passed_permissions = checkAgainstPermissions(listener); + const BOOL passed_filterlink = checkAgainstFilterLinks(listener); const BOOL passed = (passed_filtertype && passed_permissions && passed_filterlink && @@ -117,27 +117,19 @@ bool LLInventoryFilter::check(const LLInventoryItem* item) const bool passed_permissions = checkAgainstPermissions(item); const BOOL passed_clipboard = checkAgainstClipboard(item->getUUID()); const bool passed = (passed_filtertype - && passed_permissions - && passed_clipboard - && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); + && passed_permissions + && passed_clipboard + && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); return passed; } -bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const +bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const { - if (!folder) - { - llwarns << "The filter can not be checked on an invalid folder." << llendl; - llassert(false); // crash in development builds - return false; - } - - const LLFolderViewModelItemInventory* listener = static_cast(folder->getViewModelItem()); + const LLFolderViewModelItemInventory* listener = static_cast(item); if (!listener) { - llwarns << "Folder view event listener not found." << llendl; - llassert(false); // crash in development builds + llerrs << "Folder view event listener not found." << llendl; return false; } @@ -179,9 +171,8 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const return passed_clipboard; } -bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInventory* listener) const { - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return FALSE; LLInventoryType::EType object_type = listener->getInventoryType(); @@ -347,13 +338,12 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const return true; } -bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewModelItemInventory* listener) const { - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return FALSE; PermissionMask perm = listener->getPermissionMask(); - const LLInvFVBridge *bridge = dynamic_cast(item->getViewModelItem()); + const LLInvFVBridge *bridge = dynamic_cast(listener); if (bridge && bridge->isLink()) { const LLUUID& linked_uuid = gInventory.getLinkedItemID(bridge->getUUID()); @@ -375,9 +365,8 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) con return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions; } -bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewModelItemInventory* listener) const { - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return TRUE; const LLUUID object_id = listener->getUUID(); @@ -740,7 +729,7 @@ void LLInventoryFilter::resetDefault() void LLInventoryFilter::setModified(EFilterModified behavior) { mFilterText.clear(); - mLastSuccessGeneration = mNextFilterGeneration++; + mCurrentGeneration = mNextFilterGeneration++; if (mFilterModified == FILTER_NONE) { @@ -753,33 +742,21 @@ void LLInventoryFilter::setModified(EFilterModified behavior) mFilterModified = FILTER_RESTART; } - if (isNotDefault()) - { - // if not keeping current filter results, update last valid as well - switch(mFilterModified) - { - case FILTER_RESTART: - mLastFailGeneration = mLastSuccessGeneration; - mFirstSuccessGeneration = mLastSuccessGeneration; - break; - case FILTER_LESS_RESTRICTIVE: - mLastFailGeneration = mLastSuccessGeneration; - break; - case FILTER_MORE_RESTRICTIVE: - mFirstSuccessGeneration = mLastSuccessGeneration; - // must have passed either current filter generation (meaningless, as it hasn't been run yet) - // or some older generation, so keep the value - mLastFailGeneration = llmin(mLastFailGeneration, mLastSuccessGeneration); - break; - default: - llerrs << "Bad filter behavior specified" << llendl; - } - } - else + // if not keeping current filter results, update last valid as well + switch(mFilterModified) { - // shortcut disabled filters to show everything immediately - mLastFailGeneration = 0; - mFirstSuccessGeneration = S32_MAX; + case FILTER_RESTART: + mFirstRequiredGeneration = mCurrentGeneration; + mFirstSuccessGeneration = mCurrentGeneration; + break; + case FILTER_LESS_RESTRICTIVE: + mFirstRequiredGeneration = mCurrentGeneration; + break; + case FILTER_MORE_RESTRICTIVE: + mFirstSuccessGeneration = mCurrentGeneration; + break; + default: + llerrs << "Bad filter behavior specified" << llendl; } } @@ -1101,7 +1078,7 @@ void LLInventoryFilter::decrementFilterCount() S32 LLInventoryFilter::getCurrentGeneration() const { - return mLastSuccessGeneration; + return mCurrentGeneration; } S32 LLInventoryFilter::getFirstSuccessGeneration() const { @@ -1109,7 +1086,7 @@ S32 LLInventoryFilter::getFirstSuccessGeneration() const } S32 LLInventoryFilter::getFirstRequiredGeneration() const { - return mLastFailGeneration; + return mFirstRequiredGeneration; } void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) -- cgit v1.2.3 From 604bbb22783d2460384e340592ca1781908f6dd8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 28 Jun 2012 23:30:36 -0700 Subject: CHUI-101 WIP Make LLFolderview general purpose cleaned up ownership of viewmodel more filtering fixes --- indra/newview/llinventoryfilter.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index c7e0136368..08f1e541b5 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -95,16 +95,13 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) return passed_clipboard; } - std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : 0; - const BOOL passed_filtertype = checkAgainstFilterType(listener); - const BOOL passed_permissions = checkAgainstPermissions(listener); - const BOOL passed_filterlink = checkAgainstFilterLinks(listener); - const BOOL passed = (passed_filtertype && - passed_permissions && - passed_filterlink && - passed_clipboard && - (mFilterSubString.size() == 0 || string_offset != std::string::npos)); + BOOL passed = string_offset != std::string::npos; + passed = passed && checkAgainstFilterType(listener); + passed = passed && checkAgainstPermissions(listener); + passed = passed && checkAgainstFilterLinks(listener); + passed = passed && passed_clipboard; return passed; } @@ -595,7 +592,7 @@ void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date) void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) { - static LLCachedControl s_last_logoff(gSavedSettings, "LastLogoff", 0); + static LLCachedControl s_last_logoff(gSavedPerAccountSettings, "LastLogoff", 0); if (sl && !isSinceLogoff()) { setDateRange(s_last_logoff(), time_max()); -- cgit v1.2.3 From 062cae9a4880f7672df7f6189e01b2bff15f42f1 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 29 Jun 2012 15:44:08 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose cleaned up some stale TODOs worked on getting initial inventory display to work consistently --- indra/newview/llinventoryfilter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 08f1e541b5..6a33130322 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -159,7 +159,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const // (e.g. versus in-world object contents). const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id); if (!cat) - return false; + return folder_id.isNull(); LLFolderType::EType cat_type = cat->getPreferredType(); if (cat_type != LLFolderType::FT_NONE && (1LL << cat_type & mFilterOps.mFilterCategoryTypes) == U64(0)) return false; @@ -1091,7 +1091,6 @@ void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) mEmptyLookupMessage = message; } -// TODO RN: turn this into a param and move to llfolderviewmodelinterface std::string LLInventoryFilter::getEmptyLookupMessage() const { LLStringUtil::format_map_t args; -- cgit v1.2.3 From 1bd52dfbdc3607bbd9ea86c715ce63b17d5a557f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 2 Jul 2012 17:57:29 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose refactored source files, moving logic into llfolderviewmodel*.cpp filter logic tweaks purging and moving inventory now properly cleans up view model --- indra/newview/llinventoryfilter.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 6a33130322..3f38d80a39 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -779,14 +779,12 @@ const std::string& LLInventoryFilter::getFilterText() if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION)) { - //filtered_types += " Animations,"; filtered_types += LLTrans::getString("Animations"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Animations,"; not_filtered_types += LLTrans::getString("Animations"); filtered_by_all_types = FALSE; @@ -794,140 +792,120 @@ const std::string& LLInventoryFilter::getFilterText() if (isFilterObjectTypesWith(LLInventoryType::IT_CALLINGCARD)) { - //filtered_types += " Calling Cards,"; filtered_types += LLTrans::getString("Calling Cards"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Calling Cards,"; not_filtered_types += LLTrans::getString("Calling Cards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_WEARABLE)) { - //filtered_types += " Clothing,"; filtered_types += LLTrans::getString("Clothing"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Clothing,"; not_filtered_types += LLTrans::getString("Clothing"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_GESTURE)) { - //filtered_types += " Gestures,"; filtered_types += LLTrans::getString("Gestures"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Gestures,"; not_filtered_types += LLTrans::getString("Gestures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LANDMARK)) { - //filtered_types += " Landmarks,"; filtered_types += LLTrans::getString("Landmarks"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Landmarks,"; not_filtered_types += LLTrans::getString("Landmarks"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD)) { - //filtered_types += " Notecards,"; filtered_types += LLTrans::getString("Notecards"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Notecards,"; not_filtered_types += LLTrans::getString("Notecards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_OBJECT) && isFilterObjectTypesWith(LLInventoryType::IT_ATTACHMENT)) { - //filtered_types += " Objects,"; filtered_types += LLTrans::getString("Objects"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Objects,"; not_filtered_types += LLTrans::getString("Objects"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LSL)) { - //filtered_types += " Scripts,"; filtered_types += LLTrans::getString("Scripts"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Scripts,"; not_filtered_types += LLTrans::getString("Scripts"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SOUND)) { - //filtered_types += " Sounds,"; filtered_types += LLTrans::getString("Sounds"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Sounds,"; not_filtered_types += LLTrans::getString("Sounds"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_TEXTURE)) { - //filtered_types += " Textures,"; filtered_types += LLTrans::getString("Textures"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Textures,"; not_filtered_types += LLTrans::getString("Textures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SNAPSHOT)) { - //filtered_types += " Snapshots,"; filtered_types += LLTrans::getString("Snapshots"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Snapshots,"; not_filtered_types += LLTrans::getString("Snapshots"); filtered_by_all_types = FALSE; } @@ -943,7 +921,6 @@ const std::string& LLInventoryFilter::getFilterText() } else { - //mFilterText += "No "; mFilterText += LLTrans::getString("No Filters"); mFilterText += not_filtered_types; } @@ -953,7 +930,6 @@ const std::string& LLInventoryFilter::getFilterText() if (isSinceLogoff()) { - //mFilterText += " - Since Logoff"; mFilterText += LLTrans::getString("Since Logoff"); } return mFilterText; -- cgit v1.2.3 From 779d982717098e608285b171ac06f5b9f43a94a0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 26 Jul 2012 16:30:27 -0700 Subject: made Deprecated params write-only --- indra/newview/llinventoryfilter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 3f38d80a39..3e14faa55e 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -89,7 +89,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); // If it's a folder and we're showing all folders, return automatically. - const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;; + const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)) { return passed_clipboard; -- cgit v1.2.3 From e9a484f98d0376a5651d4f6eb5a692db4f77c800 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 31 Jul 2012 23:46:13 -0700 Subject: CHUI-254 : Fix Inventory filter and item draw() to highlight matching substrings in inventory --- indra/newview/llinventoryfilter.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index b4be927b09..4f4030550f 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -95,9 +95,9 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) return passed_clipboard; } - std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : 0; + std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; - BOOL passed = string_offset != std::string::npos; + BOOL passed = (mFilterSubString.size() == 0 || string_offset != std::string::npos); passed = passed && checkAgainstFilterType(listener); passed = passed && checkAgainstPermissions(listener); passed = passed && checkAgainstFilterLinks(listener); @@ -108,7 +108,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) bool LLInventoryFilter::check(const LLInventoryItem* item) { - std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; const bool passed_filtertype = checkAgainstFilterType(item); const bool passed_permissions = checkAgainstPermissions(item); @@ -116,7 +116,7 @@ bool LLInventoryFilter::check(const LLInventoryItem* item) const bool passed = (passed_filtertype && passed_permissions && passed_clipboard - && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); + && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); return passed; } @@ -383,9 +383,10 @@ const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const return mFilterSubString; } -std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewItem* item) const +std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewModelItem* item) const { - return mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; + const LLFolderViewModelItemInventory* listener = static_cast(item); + return mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; } bool LLInventoryFilter::isDefault() const @@ -1004,6 +1005,11 @@ bool LLInventoryFilter::hasFilterString() const return mFilterSubString.size() > 0; } +std::string::size_type LLInventoryFilter::getFilterStringSize() const +{ + return mFilterSubString.size(); +} + PermissionMask LLInventoryFilter::getFilterPermissions() const { return mFilterOps.mPermissions; -- cgit v1.2.3 From a204059d2e69fb33cb1a3c8d2fbed35d3967297c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 1 Aug 2012 01:14:27 -0700 Subject: CHUI-267 FIX Full inventory listing not always shown for test account changed LLFolderViewModelInterface::getFilter() to return a reference, since it is never NULL removed sort order from filter, which was causing unneeded filtering --- indra/newview/llinventoryfilter.cpp | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index b4be927b09..7993dd04c5 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -69,7 +69,6 @@ LLInventoryFilter::LLInventoryFilter(const Params& p) mFilterModified(FILTER_NONE), mEmptyLookupMessage("InventoryNoMatchingItems"), mFilterOps(p.filter_ops), - mOrder(p.sort_order), mFilterSubString(p.substring), mCurrentGeneration(0), mFirstRequiredGeneration(0), @@ -703,15 +702,6 @@ void LLInventoryFilter::setShowFolderState(EFolderShow state) } } -void LLInventoryFilter::setSortOrder(U32 order) -{ - if (mOrder != order) - { - mOrder = order; - setModified(); - } -} - void LLInventoryFilter::markDefault() { mDefaultFilterOps = mFilterOps; @@ -944,7 +934,6 @@ LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& othe setShowFolderState(other.getShowFolderState()); setFilterPermissions(other.getFilterPermissions()); setFilterSubString(other.getFilterSubString()); - setSortOrder(other.getSortOrder()); setDateRangeLastLogoff(other.isSinceLogoff()); return *this; } @@ -961,7 +950,6 @@ void LLInventoryFilter::toParams(Params& params) const params.filter_ops.show_folder_state = getShowFolderState(); params.filter_ops.permissions = getFilterPermissions(); params.substring = getFilterSubString(); - params.sort_order = getSortOrder(); params.since_logoff = isSinceLogoff(); } @@ -980,7 +968,6 @@ void LLInventoryFilter::fromParams(const Params& params) setShowFolderState(params.filter_ops.show_folder_state); setFilterPermissions(params.filter_ops.permissions); setFilterSubString(params.substring); - setSortOrder(params.sort_order); setDateRangeLastLogoff(params.since_logoff); } @@ -1030,10 +1017,6 @@ LLInventoryFilter::EFolderShow LLInventoryFilter::getShowFolderState() const { return mFilterOps.mShowFolderState; } -U32 LLInventoryFilter::getSortOrder() const -{ - return mOrder; -} void LLInventoryFilter::setFilterCount(S32 count) { -- cgit v1.2.3 From 3d0ec3da5baea6bb2b9b72707a884ac7b516c4fd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Jan 2013 15:32:47 -0800 Subject: CHUI-659 : WIP : Verified (tested) and cleaned up some CHUI-101 refactoring code. --- indra/newview/llinventoryfilter.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'indra/newview/llinventoryfilter.cpp') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index c913269aad..92f2d33073 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -42,8 +42,6 @@ #include "llclipboard.h" #include "lltrans.h" -//TODO RN: fix use of static cast as much as possible - LLFastTimer::DeclareTimer FT_FILTER_CLIPBOARD("Filter Clipboard"); LLInventoryFilter::FilterOps::FilterOps(const Params& p) @@ -83,7 +81,7 @@ LLInventoryFilter::LLInventoryFilter(const Params& p) bool LLInventoryFilter::check(const LLFolderViewModelItem* item) { - const LLFolderViewModelItemInventory* listener = static_cast(item); + const LLFolderViewModelItemInventory* listener = dynamic_cast(item); // Clipboard cut items are *always* filtered so we need this value upfront const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); @@ -122,7 +120,7 @@ bool LLInventoryFilter::check(const LLInventoryItem* item) bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const { - const LLFolderViewModelItemInventory* listener = static_cast(item); + const LLFolderViewModelItemInventory* listener = dynamic_cast(item); if (!listener) { llerrs << "Folder view event listener not found." << llendl; @@ -384,8 +382,7 @@ const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewModelItem* item) const { - const LLFolderViewModelItemInventory* listener = static_cast(item); - return mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; + return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; } bool LLInventoryFilter::isDefault() const -- cgit v1.2.3