summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-04-25 04:46:42 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-04-27 00:39:50 +0300
commitcea6eeeede9f687ca195cc9b9e778fd6784afbe2 (patch)
treee3cf8984becf11665feef60c2dae7a57894f955c /indra/newview
parent384d694aba523218490ec48c22d97b63acbffd6f (diff)
viewer#1300 'Star' favorites in inventory
image is WIP
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappearancemgr.cpp11
-rw-r--r--indra/newview/llappearancemgr.h2
-rw-r--r--indra/newview/llconversationmodel.h3
-rw-r--r--indra/newview/llfolderviewmodelinventory.cpp28
-rw-r--r--indra/newview/llinventorybridge.cpp18
-rw-r--r--indra/newview/llinventorybridge.h12
-rw-r--r--indra/newview/llpanelobjectinventory.cpp3
-rw-r--r--indra/newview/skins/default/xui/en/floater_preview_trash.xml2
-rw-r--r--indra/newview/skins/default/xui/en/widgets/folder_view_item.xml2
-rw-r--r--indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml2
10 files changed, 63 insertions, 20 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index c84657cf7a..13f56de60d 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2037,7 +2037,7 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id)
}
// Moved from LLWearableList::ContextMenu for wider utility.
-bool LLAppearanceMgr::canAddWearables(const uuid_vec_t& item_ids) const
+bool LLAppearanceMgr::canAddWearables(const uuid_vec_t& item_ids, bool warn_on_type_mismarch) const
{
// TODO: investigate wearables may not be loaded at this point EXT-8231
@@ -2065,9 +2065,12 @@ bool LLAppearanceMgr::canAddWearables(const uuid_vec_t& item_ids) const
{
return isAgentAvatarValid();
}
- else
- {
- LL_WARNS() << "Unexpected wearable type" << LL_ENDL;
+ else
+ {
+ if (warn_on_type_mismarch)
+ {
+ LL_WARNS() << "Unexpected wearable type" << LL_ENDL;
+ }
return false;
}
}
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index da29ceee3a..569fc90e93 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -102,7 +102,7 @@ public:
bool getCanReplaceCOF(const LLUUID& outfit_cat_id);
// Can we add all referenced items to the avatar?
- bool canAddWearables(const uuid_vec_t& item_ids) const;
+ bool canAddWearables(const uuid_vec_t& item_ids, bool warn_on_type_mismarch = true) const;
// Copy all items in a category.
void shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index 436c9c00ab..e2eaff12e5 100644
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -79,6 +79,9 @@ public:
virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
+ virtual bool isFavorite() const { return false; }
+ virtual bool hasFavorites() const { return false; }
+ virtual void setHasFavorites(bool val) {}
virtual BOOL isItemRenameable() const { return TRUE; }
virtual BOOL renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return TRUE; }
virtual BOOL isItemMovable( void ) const { return FALSE; }
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index 241aa96bc8..bc5a07abf2 100644
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -68,9 +68,10 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder )
if (!folder->areChildrenInited() || !needsSort(folder->getViewModelItem())) return;
- LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
- if (modelp->getUUID().isNull()) return;
+ LLFolderViewModelItemInventory* sort_modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
+ if (sort_modelp->getUUID().isNull()) return;
+ bool has_favorites = false;
for (std::list<LLFolderViewFolder*>::iterator it = folder->getFoldersBegin(), end_it = folder->getFoldersEnd();
it != end_it;
++it)
@@ -79,11 +80,14 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder )
LLFolderViewFolder* child_folderp = *it;
sort(child_folderp);
+ LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem());
+ has_favorites |= child_folderp->isFavorite() || child_folderp->hasFavorites();
+
if (child_folderp->getFoldersCount() > 0)
{
- time_t most_recent_folder_time =
- static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getFoldersBegin())->getViewModelItem())->getCreationDate();
- LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem());
+ LLFolderViewModelItemInventory* folderp = static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getFoldersBegin())->getViewModelItem());
+ time_t most_recent_folder_time = folderp->getCreationDate();
+
if (most_recent_folder_time > modelp->getCreationDate())
{
modelp->setCreationDate(most_recent_folder_time);
@@ -91,16 +95,24 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder )
}
if (child_folderp->getItemsCount() > 0)
{
- time_t most_recent_item_time =
- static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getItemsBegin())->getViewModelItem())->getCreationDate();
+ LLFolderViewModelItemInventory* itemp = static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getItemsBegin())->getViewModelItem());
+ time_t most_recent_item_time = itemp->getCreationDate();
- LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem());
if (most_recent_item_time > modelp->getCreationDate())
{
modelp->setCreationDate(most_recent_item_time);
}
}
}
+ for (std::list<LLFolderViewItem*>::const_iterator it = folder->getItemsBegin(), end_it = folder->getItemsEnd();
+ it != end_it && !has_favorites;
+ ++it)
+ {
+ LLFolderViewItem* child_itemp = *it;
+ has_favorites |= child_itemp->isFavorite();
+ }
+ folder->setHasFavorites(has_favorites);
+ sort_modelp->setHasFavorites(has_favorites);
base_t::sort(folder);
}
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 17f7f33891..560a2f265a 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -866,7 +866,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
}
}
- if (getIsFavorite())
+ if (isFavorite())
{
items.push_back(std::string("Remove from Favorites"));
}
@@ -2264,7 +2264,7 @@ const LLUUID& LLItemBridge::getThumbnailUUID() const
return LLUUID::null;
}
-bool LLItemBridge::getIsFavorite() const
+bool LLItemBridge::isFavorite() const
{
LLViewerInventoryItem* item = NULL;
LLInventoryModel* model = getInventoryModel();
@@ -2424,7 +2424,7 @@ const LLUUID& LLFolderBridge::getThumbnailUUID() const
return LLUUID::null;
}
-bool LLFolderBridge::getIsFavorite() const
+bool LLFolderBridge::isFavorite() const
{
LLViewerInventoryCategory* cat = getCategory();
if (cat)
@@ -2434,6 +2434,16 @@ bool LLFolderBridge::getIsFavorite() const
return false;
}
+bool LLFolderBridge::hasFavorites() const
+{
+ return mHasFavorites;
+}
+
+void LLFolderBridge::setHasFavorites(bool val)
+{
+ mHasFavorites = val;
+}
+
void LLFolderBridge::update()
{
// we know we have children but haven't fetched them (doesn't obey filter)
@@ -8066,7 +8076,7 @@ void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_dequ
menuentry_vec_t disabled_items;
if (get_selection_item_uuids(selected_items, ids))
{
- if (!LLAppearanceMgr::instance().canAddWearables(ids) && canWearSelected(ids))
+ if (!LLAppearanceMgr::instance().canAddWearables(ids, false) && canWearSelected(ids))
{
disabled_items.push_back(std::string("Wearable And Object Wear"));
disabled_items.push_back(std::string("Wearable Add"));
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index bbc601b34d..8bb4e188e6 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -86,7 +86,7 @@ public:
//--------------------------------------------------------------------
virtual const LLUUID& getUUID() const { return mUUID; }
virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null; }
- virtual bool getIsFavorite() const { return false; }
+ virtual bool isFavorite() const { return false; }
virtual void clearDisplayName() { mDisplayName.clear(); }
virtual void restoreItem() {}
virtual void restoreToWorld() {}
@@ -257,7 +257,9 @@ public:
LLViewerInventoryItem* getItem() const;
virtual const LLUUID& getThumbnailUUID() const;
- virtual bool getIsFavorite() const;
+ virtual bool isFavorite() const;
+ virtual bool hasFavorites() const { return false; }
+ virtual void setHasFavorites(bool val) {}
protected:
BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);
@@ -279,6 +281,7 @@ public:
mCallingCards(FALSE),
mWearables(FALSE),
mIsLoading(false),
+ mHasFavorites(false),
mShowDescendantsCount(false)
{}
@@ -304,7 +307,9 @@ public:
virtual std::string getLabelSuffix() const;
virtual LLFontGL::StyleFlags getLabelStyle() const;
virtual const LLUUID& getThumbnailUUID() const;
- virtual bool getIsFavorite() const;
+ virtual bool isFavorite() const;
+ virtual bool hasFavorites() const;
+ virtual void setHasFavorites(bool val);
void setShowDescendantsCount(bool show_count) {mShowDescendantsCount = show_count;}
@@ -392,6 +397,7 @@ protected:
bool mWearables;
bool mIsLoading;
bool mShowDescendantsCount;
+ bool mHasFavorites;
LLTimer mTimeSinceRequestStart;
std::string mMessage;
LLRootHandle<LLFolderBridge> mHandle;
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 632e902d70..e38e2622c9 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -129,6 +129,9 @@ public:
virtual void navigateToFolder(bool new_window = false, bool change_mode = false) {}
virtual BOOL isItemRenameable() const;
virtual BOOL renameItem(const std::string& new_name);
+ virtual bool isFavorite() const { return false; }
+ virtual bool hasFavorites() const { return false; }
+ virtual void setHasFavorites(bool val) {};
virtual BOOL isItemMovable() const;
virtual BOOL isItemRemovable() const;
virtual BOOL removeItem();
diff --git a/indra/newview/skins/default/xui/en/floater_preview_trash.xml b/indra/newview/skins/default/xui/en/floater_preview_trash.xml
index f1c87c8c5a..f62e04baf2 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_trash.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_trash.xml
@@ -29,6 +29,8 @@
bevel_style="none"
scroll.reserve_scroll_corner="false">
<folder folder_arrow_image="Folder_Arrow"
+ favorite_image="Favorite_Star_Active"
+ favorite_content_image="Favorite_Star_Off"
folder_indentation="8"
item_height="20"
item_top_pad="4"
diff --git a/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml b/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml
index b598bbccd8..1bcd8886b4 100644
--- a/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml
+++ b/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<folder_view_item
folder_arrow_image="Folder_Arrow"
+ favorite_image="Favorite_Star_Active"
+ favorite_content_image="Favorite_Star_Off"
folder_indentation="8"
item_height="20"
item_top_pad="4"
diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml
index 27ec6ded81..8f9017f9ce 100644
--- a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml
+++ b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<inbox_folder_view_folder
folder_arrow_image="Folder_Arrow"
+ favorite_image="Favorite_Star_Active"
+ favorite_content_image="Favorite_Star_Off"
folder_indentation="8"
item_height="20"
item_top_pad="4"