diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-10-12 13:34:06 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-10-12 13:34:06 +0300 |
commit | dcb5cf5bc21ba2e316cc2889b2c1371860b0348d (patch) | |
tree | 2ccd2671ce46abb8bf12786ccf53e597e6a0049d /indra/llinventory/llinventory.cpp | |
parent | 1b19919eff1104f9f1ee97004420e91c45349e29 (diff) | |
parent | 738cf84c340d8ade3ab462340d1444c4e70ef9f5 (diff) |
Merge commit '738cf84c34' into marchcat/c-develop
# Conflicts:
# indra/llui/llfolderviewitem.cpp
# indra/llui/llfolderviewitem.h
# indra/llui/llfolderviewmodel.h
# indra/newview/llconversationmodel.h
# indra/newview/llfloaterinventorysettings.cpp
# indra/newview/llfolderviewmodelinventory.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventorygallery.h
# indra/newview/llinventorygallerymenu.cpp
# indra/newview/llinventorypanel.cpp
# indra/newview/llinventorypanel.h
# indra/newview/lloutfitgallery.cpp
# indra/newview/lloutfitgallery.h
# indra/newview/lloutfitslist.cpp
# indra/newview/lloutfitslist.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpaneloutfitsinventory.h
# indra/newview/llpanelwearing.cpp
# indra/newview/llsidepanelappearance.cpp
# indra/newview/llwearableitemslist.cpp
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
-rw-r--r-- | indra/llinventory/llinventory.cpp | 68 |
1 files changed, 58 insertions, 10 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 48cb55e3e3..14abf76eb9 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -60,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"); @@ -261,9 +262,18 @@ bool LLInventoryObject::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } + if (metadata.has("favorite")) { - setFavorite(metadata["favorite"].asBoolean()); + const LLSD& favorite = metadata["favorite"]; + if (favorite.has("toggled")) + { + setFavorite(favorite["toggled"].asBoolean()); + } + else + { + setFavorite(false); + } } else { @@ -757,9 +767,18 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } + if (metadata.has("favorite")) { - setFavorite(metadata["favorite"].asBoolean()); + const LLSD& favorite = metadata["favorite"]; + if (favorite.has("toggled")) + { + setFavorite(favorite["toggled"].asBoolean()); + } + else + { + setFavorite(false); + } } else { @@ -927,7 +946,7 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const if (mFavorite) { - sd[INV_FAVORITE_LABEL] = mFavorite; + sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); } U32 mask = mPermissions.getMaskBase(); @@ -972,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; @@ -1019,7 +1039,12 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) if (i->first == INV_FAVORITE_LABEL) { - mFavorite = i->second.asBoolean(); + const LLSD& favorite_map = i->second; + const std::string w = INV_TOGGLED_LABEL; + if (favorite_map.has(w)) + { + mFavorite = favorite_map[w].asBoolean(); + } continue; } @@ -1220,7 +1245,7 @@ LLSD LLInventoryCategory::asLLSD() const if (mFavorite) { - sd[INV_FAVORITE_LABEL] = mFavorite; + sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); } return sd; @@ -1234,13 +1259,15 @@ 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] = mFavorite; + sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); } return sd; @@ -1290,10 +1317,16 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) mThumbnailUUID = sd[w]; } } + mFavorite = false; w = INV_FAVORITE_LABEL; if (sd.has(w)) { - mFavorite = sd[w].asBoolean(); + 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)) @@ -1417,9 +1450,18 @@ bool LLInventoryCategory::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } + if (metadata.has("favorite")) { - setFavorite(metadata["favorite"].asBoolean()); + const LLSD& favorite = metadata["favorite"]; + if (favorite.has("toggled")) + { + setFavorite(favorite["toggled"].asBoolean()); + } + else + { + setFavorite(false); + } } else { @@ -1474,7 +1516,7 @@ LLSD LLInventoryCategory::exportLLSD() const } if (mFavorite) { - cat_data[INV_FAVORITE_LABEL] = mFavorite; + cat_data[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); } return cat_data; @@ -1510,7 +1552,13 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data) } if (cat_data.has(INV_FAVORITE_LABEL)) { - setFavorite(cat_data[INV_FAVORITE_LABEL].asBoolean()); + 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)) { |