Skip to content

Inventory favorites #1840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a220acb
viewer#1300 Inventory favorites basic framework
akleshchev Apr 22, 2024
7e536f4
viewer#1300 Rename landmark favorites tab
akleshchev Apr 22, 2024
a0b0f20
viewer#1300 Update Gear Menu Items
akleshchev Apr 22, 2024
384d694
viewer#1300 Inventory favorites context menu
akleshchev Apr 23, 2024
cea6eee
viewer#1300 'Star' favorites in inventory
akleshchev Apr 25, 2024
a0c4d81
viewer#1300 'Star' favorites in inventory #2
akleshchev Apr 27, 2024
2add3b4
viewer#1300 'Star' favorites in inventory #3
akleshchev Apr 29, 2024
1e7dc04
viewer#1300 'Star' favorites in inventory #4
akleshchev Apr 29, 2024
645811c
Viewer#1301 Implement Inventory Favorites Tab WIP
akleshchev May 1, 2024
fc5e532
Viewer#1301 Implement Inventory Favorites Tab WIP#2
akleshchev May 2, 2024
bbadb8b
Viewer#1301 Small cleanup
akleshchev May 2, 2024
db3e5af
Viewer#1301 Implement Inventory Favorites Tab
akleshchev May 2, 2024
1c17038
viewer#1300 Update Inventory Settings
akleshchev May 3, 2024
5c78396
viewer#1424 Favorites in Appearance floater #1
akleshchev May 8, 2024
a420e84
viewer#1424 Favorites in Appearance floater #2
akleshchev May 9, 2024
b6d195a
SL-20288 Fix renaming
akleshchev Mar 13, 2024
f8cc05a
viewer#1424 Colored Favorites in Appearance floater
akleshchev May 9, 2024
b9633c1
viewer#1424 Favorites in Appearance floater #3
akleshchev May 10, 2024
7d1597f
viewer#1424 Favorites in Appearance floater #4
akleshchev May 13, 2024
1eeecfa
viewer#1425 Sorting in Appearance floater
akleshchev May 14, 2024
50b93bd
viewer#1424 Favorite support in galleries
akleshchev May 14, 2024
738cf84
viewer#1424 Favorite support for items in outfits
akleshchev May 9, 2024
98f7d73
viewer#1424 Finish menus
akleshchev May 16, 2024
382b45c
viewer#1424 Favorite support in galleries #2
akleshchev May 16, 2024
3066cce
viewer#1300 Small menu adjustment
akleshchev May 17, 2024
f2358a2
viewer#1425 Sorting in Appearance floater #2
akleshchev May 17, 2024
4c676ac
viewer#1300 More favorite settings
akleshchev May 17, 2024
25b19eb
viewer#1424 Proper links support for favorites
akleshchev May 17, 2024
6f7e50e
viewer#1425 Fix missed 'static' declarations
akleshchev May 22, 2024
bd8438f
viewer#1619 Fix outfits search pulling up results sometimes
akleshchev Jun 7, 2024
0dcc912
Merge main into inventory_favorites
akleshchev Jun 10, 2024
d1cf13f
viewer#1673 Crash calling dirtyDescendantsFilter
akleshchev Jun 10, 2024
534605e
Merge branch 'main' (featurette) into inventory_favorites
akleshchev Jun 11, 2024
7ae63da
viewer#1300 Increment inventory cache for favorites
akleshchev Jun 14, 2024
6ee6d19
viewer#1005 Review fixes
akleshchev Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 122 additions & 3 deletions indra/llinventory/llinventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static const std::string INV_ITEM_ID_LABEL("item_id");
static const std::string INV_FOLDER_ID_LABEL("cat_id");
static const std::string INV_PARENT_ID_LABEL("parent_id");
static const std::string INV_THUMBNAIL_LABEL("thumbnail");
static const std::string INV_FAVORITE_LABEL("favorite");
static const std::string INV_THUMBNAIL_ID_LABEL("thumbnail_id");
static const std::string INV_ASSET_TYPE_LABEL("type");
static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type");
Expand All @@ -59,6 +60,7 @@ static const std::string INV_LINKED_ID_LABEL("linked_id");
static const std::string INV_SALE_INFO_LABEL("sale_info");
static const std::string INV_FLAGS_LABEL("flags");
static const std::string INV_CREATION_DATE_LABEL("created_at");
static const std::string INV_TOGGLED_LABEL("toggled");

// key used by agent-inventory-service
static const std::string INV_ASSET_TYPE_LABEL_WS("type_default");
Expand All @@ -82,14 +84,16 @@ LLInventoryObject::LLInventoryObject(const LLUUID& uuid,
mParentUUID(parent_uuid),
mType(type),
mName(name),
mCreationDate(0)
mCreationDate(0),
mFavorite(false)
{
correctInventoryName(mName);
}

LLInventoryObject::LLInventoryObject()
: mType(LLAssetType::AT_NONE),
mCreationDate(0)
mCreationDate(0),
mFavorite(false)
{
}

Expand All @@ -104,6 +108,7 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other)
mType = other->mType;
mName = other->mName;
mThumbnailUUID = other->mThumbnailUUID;
mFavorite = other->mFavorite;
}

const LLUUID& LLInventoryObject::getUUID() const
Expand All @@ -121,6 +126,11 @@ const LLUUID& LLInventoryObject::getThumbnailUUID() const
return mThumbnailUUID;
}

bool LLInventoryObject::getIsFavorite() const
{
return mFavorite;
}

const std::string& LLInventoryObject::getName() const
{
return mName;
Expand Down Expand Up @@ -175,6 +185,11 @@ void LLInventoryObject::setThumbnailUUID(const LLUUID& thumbnail_uuid)
mThumbnailUUID = thumbnail_uuid;
}

void LLInventoryObject::setFavorite(bool favorite)
{
mFavorite = favorite;
}

void LLInventoryObject::setType(LLAssetType::EType type)
{
mType = type;
Expand Down Expand Up @@ -247,6 +262,23 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
{
setThumbnailUUID(LLUUID::null);
}

if (metadata.has("favorite"))
{
const LLSD& favorite = metadata["favorite"];
if (favorite.has("toggled"))
{
setFavorite(favorite["toggled"].asBoolean());
}
else
{
setFavorite(false);
}
}
else
{
setFavorite(false);
}
}
else if(0 == strcmp("name", keyword))
{
Expand Down Expand Up @@ -735,6 +767,23 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
{
setThumbnailUUID(LLUUID::null);
}

if (metadata.has("favorite"))
{
const LLSD& favorite = metadata["favorite"];
if (favorite.has("toggled"))
{
setFavorite(favorite["toggled"].asBoolean());
}
else
{
setFavorite(false);
}
}
else
{
setFavorite(false);
}
}
else if(0 == strcmp("inv_type", keyword))
{
Expand Down Expand Up @@ -895,6 +944,11 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const
sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
}

if (mFavorite)
{
sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
}

U32 mask = mPermissions.getMaskBase();
if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
|| (mAssetUUID.isNull()))
Expand Down Expand Up @@ -937,6 +991,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new)

// TODO - figure out if this should be moved into the noclobber fields above
mThumbnailUUID.setNull();
mFavorite = false;

// iterate as map to avoid making unnecessary temp copies of everything
LLSD::map_const_iterator i, end;
Expand Down Expand Up @@ -974,14 +1029,25 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new)
<integer> 1 </key>
*/
continue;
}
}

if (i->first == INV_THUMBNAIL_ID_LABEL)
{
mThumbnailUUID = i->second.asUUID();
continue;
}

if (i->first == INV_FAVORITE_LABEL)
{
const LLSD& favorite_map = i->second;
const std::string w = INV_TOGGLED_LABEL;
if (favorite_map.has(w))
{
mFavorite = favorite_map[w].asBoolean();
}
continue;
}

if (i->first == INV_PERMISSIONS_LABEL)
{
mPermissions = ll_permissions_from_sd(i->second);
Expand Down Expand Up @@ -1177,6 +1243,11 @@ LLSD LLInventoryCategory::asLLSD() const
sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
}

if (mFavorite)
{
sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
}

return sd;
}

Expand All @@ -1188,11 +1259,17 @@ LLSD LLInventoryCategory::asAISCreateCatLLSD() const
S8 type = static_cast<S8>(mPreferredType);
sd[INV_ASSET_TYPE_LABEL_WS] = type;
sd[INV_NAME_LABEL] = mName;

if (mThumbnailUUID.notNull())
{
sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
}

if (mFavorite)
{
sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
}

return sd;
}

Expand Down Expand Up @@ -1240,6 +1317,17 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd)
mThumbnailUUID = sd[w];
}
}
mFavorite = false;
w = INV_FAVORITE_LABEL;
if (sd.has(w))
{
const LLSD& favorite_map = sd[w];
w = INV_TOGGLED_LABEL;
if (favorite_map.has(w))
{
mFavorite = favorite_map[w].asBoolean();
}
}
w = INV_ASSET_TYPE_LABEL;
if (sd.has(w))
{
Expand Down Expand Up @@ -1362,6 +1450,23 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
{
setThumbnailUUID(LLUUID::null);
}

if (metadata.has("favorite"))
{
const LLSD& favorite = metadata["favorite"];
if (favorite.has("toggled"))
{
setFavorite(favorite["toggled"].asBoolean());
}
else
{
setFavorite(false);
}
}
else
{
setFavorite(false);
}
}
else
{
Expand Down Expand Up @@ -1409,6 +1514,10 @@ LLSD LLInventoryCategory::exportLLSD() const
{
cat_data[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID);
}
if (mFavorite)
{
cat_data[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
}

return cat_data;
}
Expand Down Expand Up @@ -1441,6 +1550,16 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data)
}
setThumbnailUUID(thumbnail_uuid);
}
if (cat_data.has(INV_FAVORITE_LABEL))
{
bool favorite = false;
const LLSD& favorite_data = cat_data[INV_FAVORITE_LABEL];
if (favorite_data.has(INV_TOGGLED_LABEL))
{
favorite = favorite_data[INV_TOGGLED_LABEL].asBoolean();
}
setFavorite(favorite);
}
if (cat_data.has(INV_NAME_LABEL))
{
mName = cat_data[INV_NAME_LABEL].asString();
Expand Down
3 changes: 3 additions & 0 deletions indra/llinventory/llinventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class LLInventoryObject : public LLRefCount
virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID
const LLUUID& getParentUUID() const;
virtual const LLUUID& getThumbnailUUID() const;
virtual bool getIsFavorite() const;
virtual const std::string& getName() const;
virtual LLAssetType::EType getType() const;
LLAssetType::EType getActualType() const; // bypasses indirection for linked items
Expand All @@ -86,6 +87,7 @@ class LLInventoryObject : public LLRefCount
virtual void rename(const std::string& new_name);
void setParent(const LLUUID& new_parent);
virtual void setThumbnailUUID(const LLUUID& thumbnail_uuid);
virtual void setFavorite(bool favorite);
void setType(LLAssetType::EType type);
virtual void setCreationDate(time_t creation_date_utc); // only stored for items

Expand All @@ -111,6 +113,7 @@ class LLInventoryObject : public LLRefCount
LLUUID mUUID;
LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL.
LLUUID mThumbnailUUID;
bool mFavorite;
LLAssetType::EType mType;
std::string mName;
time_t mCreationDate; // seconds from 1/1/1970, UTC
Expand Down
2 changes: 1 addition & 1 deletion indra/llui/llaccordionctrltab.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class LLAccordionCtrlTab : public LLUICtrl
S32 notify(const LLSD& info);
bool notifyChildren(const LLSD& info);

void draw();
virtual void draw();

void storeOpenCloseState();
void restoreOpenCloseState();
Expand Down
13 changes: 11 additions & 2 deletions indra/llui/llflatlistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,9 +1356,17 @@ bool LLFlatListViewEx::getForceShowingUnmatchedItems()
return mForceShowingUnmatchedItems;
}

void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show)
void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show, bool notify_parent)
{
mForceShowingUnmatchedItems = show;
if (mForceShowingUnmatchedItems != show)
{
mForceShowingUnmatchedItems = show;
if (!mFilterSubString.empty())
{
updateNoItemsMessage(mFilterSubString);
filterItems(false, true);
}
}
}

void LLFlatListViewEx::setFilterSubString(const std::string& filter_str, bool notify_parent)
Expand Down Expand Up @@ -1427,6 +1435,7 @@ void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent)

if (visibility_changed && notify_parent)
{
rearrangeItems();
notifyParentItemsRectChanged();
}
}
Expand Down
6 changes: 5 additions & 1 deletion indra/llui/llflatlistview.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,11 @@ class LLFlatListViewEx : public LLFlatListView

bool getForceShowingUnmatchedItems();

void setForceShowingUnmatchedItems(bool show);
/**
* Sets filtered out items to stay visible. Can result in rect changes,
* so can notify_parent if rect changes
*/
void setForceShowingUnmatchedItems(bool show, bool notify_parent);

/**
* Sets up new filter string and filters the list.
Expand Down
Loading
Loading