EXP-1498, EXP-1595, EXP-1596 : Hide empty system folders in a dynamic way, turn the setting ON by default
parent
df7f4f60b6
commit
7c2bbfc4fc
|
|
@ -1902,7 +1902,7 @@
|
|||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>DebugInventoryFilters</key>
|
||||
<map>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue