diff options
author | Merov Linden <merov@lindenlab.com> | 2011-11-18 17:22:40 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2011-11-18 17:22:40 -0800 |
commit | 7c2bbfc4fc905e8fff63d58f19f5e22cd755281c (patch) | |
tree | edf36c59ea7e9fbee610d7685e753be701754382 /indra/newview | |
parent | df7f4f60b60e7d53060e4d8e3d0ca03bf74bf24e (diff) |
EXP-1498, EXP-1595, EXP-1596 : Hide empty system folders in a dynamic way, turn the setting ON by default
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 2 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.h | 1 | ||||
-rw-r--r-- | indra/newview/llinventoryfilter.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llinventoryfilter.h | 4 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerfoldertype.cpp | 3 |
7 files changed, 31 insertions, 29 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e9b4d4d96d..8138643385 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1902,7 +1902,7 @@ <key>Type</key> <string>Boolean</string> <key>Value</key> - <integer>0</integer> + <integer>1</integer> </map> <key>DebugInventoryFilters</key> <map> diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 244b001adb..0c092e9a56 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -195,20 +195,6 @@ BOOL LLInvFVBridge::isLink() const return mIsLink; } -// Is a "System" folder -// System folders are predefined named folders that have a specific preferred type -// e.g. "Textures" which has an FT_TEXTURE preferred type. -// Those are folders used to route incoming items in the current (soon to be obsolete) inventory -// asset routing. -// If a folder uses the same name as a predefined folder but is not of the same preferred type -// or if it has a preferred type but a different name, it will not be considered a system folder. -// *TODO: Test that logic in all languages -bool LLInvFVBridge::isSystemFolder() const -{ - LLFolderType::EType preferred_type = getPreferredType(); - return (preferred_type == LLFolderType::FT_NONE ? false : LLViewerFolderType::lookupTypeFromNewCategoryName(getDisplayName()) == preferred_type); -} - /*virtual*/ /** * @brief Adds this item into clipboard storage diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 9832c683c6..2d625befb4 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -72,7 +72,6 @@ public: BOOL canShare() const; BOOL canListOnMarketplace() const; BOOL canListOnMarketplaceNow() const; - bool isSystemFolder() const; // true if is a "System" folder //-------------------------------------------------------------------- // LLInvFVBridge functionality diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 438081c177..bc02540281 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -119,16 +119,6 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const LLFolderViewEventListener* listener = folder->getListener(); const LLUUID folder_id = listener->getUUID(); - const LLInvFVBridge *bridge = dynamic_cast<const LLInvFVBridge *>(folder->getListener()); - bool is_system_folder = bridge->isSystemFolder(); - bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(listener->getPreferredType()); - bool is_empty = (gInventory.categoryHasChildren(folder_id) != LLInventoryModel::CHILDREN_YES); - - if (is_system_folder && is_empty && is_hidden_if_empty) - { - return false; - } - if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY) { // Can only filter categories for items in your inventory @@ -217,6 +207,21 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con } } + //////////////////////////////////////////////////////////////////////////////// + // FILTERTYPE_EMPTYFOLDERS + // Pass if this item is a folder and is not a system folder that should be hidden + if (filterTypes & FILTERTYPE_EMPTYFOLDERS) + { + if (object_type == LLInventoryType::IT_CATEGORY) + { + bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(listener->getPreferredType()); + if (is_hidden_if_empty) + { + return FALSE; + } + } + } + return TRUE; } @@ -354,6 +359,11 @@ void LLInventoryFilter::setFilterWearableTypes(U64 types) mFilterOps.mFilterTypes |= FILTERTYPE_WEARABLE; } +void LLInventoryFilter::setFilterEmptySystemFolders() +{ + mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS; +} + void LLInventoryFilter::setFilterUUID(const LLUUID& object_id) { if (mFilterOps.mFilterUUID == LLUUID::null) diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index f9460822f7..bba24ac652 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -57,7 +57,8 @@ public: FILTERTYPE_CATEGORY = 0x1 << 1, // search by folder type FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it FILTERTYPE_DATE = 0x1 << 3, // search by date range - FILTERTYPE_WEARABLE = 0x1 << 4 // search by wearable type + FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type + FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if empty }; enum EFilterLink @@ -88,6 +89,7 @@ public: void setFilterCategoryTypes(U64 types); void setFilterUUID(const LLUUID &object_id); void setFilterWearableTypes(U64 types); + void setFilterEmptySystemFolders(); void updateFilterTypes(U64 types, U64& current_types); void setFilterSubString(const std::string& string); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index a9ec4af4f3..d06374d232 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -240,6 +240,12 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) getFilter()->setFilterCategoryTypes(getFilter()->getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX)); getFilter()->setFilterCategoryTypes(getFilter()->getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_OUTBOX)); + // set the filter for the empty folder if the debug setting is on + if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders")) + { + getFilter()->setFilterEmptySystemFolders(); + } + // Initialize base class params. LLPanel::initFromParams(params); } diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index c39df7efce..a179b61cff 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -30,7 +30,6 @@ #include "lldictionary.h" #include "llmemory.h" #include "llvisualparam.h" -#include "llviewercontrol.h" static const std::string empty_string; @@ -267,7 +266,7 @@ BOOL LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type) bool LLViewerFolderType::lookupIsHiddenIfEmpty(LLFolderType::EType folder_type) { const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); - if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders") && entry) + if (entry) { return entry->mHideIfEmpty; } |