summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorypanel.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-05-02 03:05:41 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-05-02 03:05:41 +0300
commitfc5e5327bca83846bb97cb7ff578b0dcb3a8892e (patch)
treed2e36fb29bcbfaf0c7e726fc127e878e6b728c1f /indra/newview/llinventorypanel.cpp
parent645811c6ef3134a540fc1bc7d32d7bdb8fa35046 (diff)
Viewer#1301 Implement Inventory Favorites Tab WIP#2
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r--indra/newview/llinventorypanel.cpp93
1 files changed, 81 insertions, 12 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index bdf9e87e60..f22ac6f775 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -947,18 +947,7 @@ void LLInventoryPanel::initializeViews(F64 max_time)
mBuildViewsEndTime = curent_time + max_time;
// init everything
- LLUUID root_id = getRootFolderID();
- if (root_id.notNull())
- {
- buildNewViews(getRootFolderID());
- }
- else
- {
- // Default case: always add "My Inventory" root first, "Library" root second
- // If we run out of time, this still should create root folders
- buildNewViews(gInventory.getRootFolderID()); // My Inventory
- buildNewViews(gInventory.getLibraryRootFolderID()); // Library
- }
+ initRootContent();
if (mBuildViewsQueue.empty())
{
@@ -991,6 +980,22 @@ void LLInventoryPanel::initializeViews(F64 max_time)
}
}
+void LLInventoryPanel::initRootContent()
+{
+ LLUUID root_id = getRootFolderID();
+ if (root_id.notNull())
+ {
+ buildNewViews(getRootFolderID());
+ }
+ else
+ {
+ // Default case: always add "My Inventory" root first, "Library" root second
+ // If we run out of time, this still should create root folders
+ buildNewViews(gInventory.getRootFolderID()); // My Inventory
+ buildNewViews(gInventory.getLibraryRootFolderID()); // Library
+ }
+}
+
LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop)
{
@@ -1248,6 +1253,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
{
LLViewerInventoryCategory::cat_array_t* categories;
LLViewerInventoryItem::item_array_t* items;
+ //collectInventoryDescendants(id, categories, items);
mInventory->lockDirectDescendentArrays(id, categories, items);
// Make sure panel won't lock in a loop over existing items if
@@ -1348,6 +1354,14 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id,
return folder_view_item;
}
+
+/*void LLInventoryPanel::collectInventoryDescendants(const LLUUID& id,
+ LLViewerInventoryCategory::cat_array_t*& categories,
+ LLViewerInventoryItem::item_array_t*& items);
+{
+ mInventory->lockDirectDescendentArrays(id, categories, items);
+}*/
+
// bit of a hack to make sure the inventory is open.
void LLInventoryPanel::openStartFolderOrMyInventory()
{
@@ -2250,6 +2264,9 @@ public:
protected:
LLInventoryFavoritesItemsPanel(const Params&);
friend class LLUICtrlFactory;
+
+ void initRootContent(const LLUUID& id);
+ void initRootContent() override;
};
LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& params)
@@ -2259,6 +2276,58 @@ LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& par
mInvFVBridgeBuilder = &FAVORITES_BUILDER;
}
+void LLInventoryFavoritesItemsPanel::initRootContent(const LLUUID& id)
+{
+ LLViewerInventoryCategory::cat_array_t* categories;
+ LLViewerInventoryItem::item_array_t* items;
+ mInventory->lockDirectDescendentArrays(id, categories, items);
+
+ if (categories)
+ {
+ S32 count = categories->size();
+ for (S32 i = 0; i < count; ++i)
+ {
+ LLViewerInventoryCategory* cat = categories->at(i);
+ if (cat->getPreferredType() == LLFolderType::FT_TRASH)
+ {
+ continue;
+ }
+ else if (cat->getIsFavorite())
+ {
+ const LLUUID& parent_id = cat->getParentUUID();
+ LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); // Should be NULL
+
+ buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT);
+ }
+ else // Todo: timelimits
+ {
+ initRootContent(cat->getUUID());
+ }
+ }
+ }
+
+ if (items)
+ {
+ S32 count = items->size();
+ for (S32 i = 0; i < count; ++i)
+ {
+ LLViewerInventoryItem* item = items->at(i);
+ if (item->getIsFavorite() && typedViewsFilter(id, item))
+ {
+ const LLUUID& parent_id = item->getParentUUID();
+ LLFolderViewItem* folder_view_item = getItemByID(id); // Should be NULL
+
+ buildViewsTree(item->getUUID(), parent_id, item, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT);
+ }
+ }
+ }
+}
+
+void LLInventoryFavoritesItemsPanel::initRootContent()
+{
+ initRootContent(gInventory.getRootFolderID()); // My Inventory
+}
+
/************************************************************************/
/* LLInventorySingleFolderPanel */
/************************************************************************/