Sync LLInventoryModel and LLViewerInventory with upstream

This commit is contained in:
Liru Færs
2020-01-21 03:08:32 -05:00
parent 851b3659ee
commit 4b2e358783
5 changed files with 347 additions and 315 deletions

View File

@@ -4184,7 +4184,7 @@ LLUUID LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, L
// 2) Stuff with requests via makeLink and makeCopy // 2) Stuff with requests via makeLink and makeCopy
// 3) Call dispatch() // 3) Call dispatch()
// 4) Let the LLPointer go out of scope. // 4) Let the LLPointer go out of scope.
class LLCreateLegacyOutfit : public LLBoostFuncInventoryCallbackFireOnce class LLCreateLegacyOutfit final : public LLBoostFuncInventoryCallbackFireOnce
{ {
public: public:
LLCreateLegacyOutfit(const LLUUID& folder_id, inventory_func_type fire_func, nullary_func_type destroy_func = no_op) : LLCreateLegacyOutfit(const LLUUID& folder_id, inventory_func_type fire_func, nullary_func_type destroy_func = no_op) :

File diff suppressed because it is too large Load Diff

View File

@@ -192,14 +192,14 @@ private:
**/ **/
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Descendents // Descendants
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
// Make sure we have the descendents in the structure. Returns true // Make sure we have the descendants in the structure. Returns true
// if a fetch was performed. // if a fetch was performed.
bool fetchDescendentsOf(const LLUUID& folder_id) const; bool fetchDescendentsOf(const LLUUID& folder_id) const;
// Return the direct descendents of the id provided.Set passed // Return the direct descendants of the id provided.Set passed
// in values to NULL if the call fails. // in values to NULL if the call fails.
// NOTE: The array provided points straight into the guts of // NOTE: The array provided points straight into the guts of
// this object, and should only be used for read operations, since // this object, and should only be used for read operations, since
@@ -211,10 +211,10 @@ public:
void getDirectDescendentsOf(const LLUUID& cat_id, void getDirectDescendentsOf(const LLUUID& cat_id,
cat_array_t*& categories) const; cat_array_t*& categories) const;
// Compute a hash of direct descendent names (for detecting child name changes) // Compute a hash of direct descendant names (for detecting child name changes)
LLMD5 hashDirectDescendentNames(const LLUUID& cat_id) const; LLMD5 hashDirectDescendentNames(const LLUUID& cat_id) const;
// Starting with the object specified, add its descendents to the // Starting with the object specified, add its descendants to the
// array provided, but do not add the inventory object specified // array provided, but do not add the inventory object specified
// by id. There is no guaranteed order. // by id. There is no guaranteed order.
// NOTE: Neither array will be erased before adding objects to it. // NOTE: Neither array will be erased before adding objects to it.
@@ -340,7 +340,7 @@ public:
U32 updateItem(const LLViewerInventoryItem* item, U32 mask = 0); U32 updateItem(const LLViewerInventoryItem* item, U32 mask = 0);
// Change an existing item with the matching id or add // Change an existing item with the matching id or add
// the category. No notifcation will be sent to observers. This // the category. No notification will be sent to observers. This
// method will only generate network traffic if the item had to be // method will only generate network traffic if the item had to be
// reparented. // reparented.
// NOTE: In usage, you will want to perform cache accounting // NOTE: In usage, you will want to perform cache accounting
@@ -378,7 +378,7 @@ public:
bool update_parent_version = true, bool update_parent_version = true,
bool do_notify_observers = true); bool do_notify_observers = true);
// Update model after all descendents removed from server. // Update model after all descendants removed from server.
void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true); void onDescendentsPurgedFromServer(const LLUUID& object_id, bool fix_broken_links = true);
// Update model after an existing item gets updated on server. // Update model after an existing item gets updated on server.
@@ -499,10 +499,12 @@ public:
// Call to explicitly update everyone on a new state. // Call to explicitly update everyone on a new state.
void notifyObservers(); void notifyObservers();
// Allows outsiders to tell the inventory if something has // Allows outsiders to tell the inventory if something has
// been changed 'under the hood', but outside the control of the // been changed 'under the hood', but outside the control of the
// inventory. The next notify will include that notification. // inventory. The next notify will include that notification.
void addChangedMask(U32 mask, const LLUUID& referent); void addChangedMask(U32 mask, const LLUUID& referent);
const changed_items_t& getChangedIDs() const { return mChangedItemIDs; } const changed_items_t& getChangedIDs() const { return mChangedItemIDs; }
const changed_items_t& getAddedIDs() const { return mAddedItemIDs; } const changed_items_t& getAddedIDs() const { return mAddedItemIDs; }
protected: protected:
@@ -556,6 +558,7 @@ protected:
static bool loadFromFile(const std::string& filename, static bool loadFromFile(const std::string& filename,
cat_array_t& categories, cat_array_t& categories,
item_array_t& items, item_array_t& items,
changed_items_t& cats_to_update,
bool& is_cache_obsolete); bool& is_cache_obsolete);
static bool saveToFile(const std::string& filename, static bool saveToFile(const std::string& filename,
const cat_array_t& categories, const cat_array_t& categories,

View File

@@ -4,7 +4,7 @@
* *
* $LicenseInfo:firstyear=2002&license=viewerlgpl$ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code * Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc. * Copyright (C) 2014, Linden Research, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@@ -84,20 +84,44 @@ static const char * const LOG_INV("Inventory");
static const char * const LOG_LOCAL("InventoryLocalize"); static const char * const LOG_LOCAL("InventoryLocalize");
static const char * const LOG_NOTECARD("copy_inventory_from_notecard"); static const char * const LOG_NOTECARD("copy_inventory_from_notecard");
#if 1
// *TODO$: LLInventoryCallback should be deprecated to conform to the new boost::bind/coroutine model.
// temp code in transition
void doInventoryCb(LLPointer<LLInventoryCallback> cb, LLUUID id) void doInventoryCb(LLPointer<LLInventoryCallback> cb, LLUUID id)
{ {
if (cb.notNull()) if (cb.notNull())
cb->fire(id); cb->fire(id);
} }
#endif
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Helper class to store special inventory item names and their localized values. /// Helper class to store special inventory item names and their localized values.
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
class LLLocalizedInventoryItemsDictionary : public LLSingleton<LLLocalizedInventoryItemsDictionary> class LLLocalizedInventoryItemsDictionary final : public LLSingleton<LLLocalizedInventoryItemsDictionary>
{ {
public: public:
std::map<std::string, std::string> mInventoryItemsDict; std::map<std::string, std::string> mInventoryItemsDict;
/**
* Finds passed name in dictionary and replaces it with found localized value.
*
* @param object_name - string to be localized.
* @return true if passed name was found and localized, false otherwise.
*/
bool localizeInventoryObjectName(std::string& object_name)
{
LL_DEBUGS(LOG_LOCAL) << "Searching for localization: " << object_name << LL_ENDL;
std::map<std::string, std::string>::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name);
bool found = dictionary_iter != mInventoryItemsDict.end();
if(found)
{
object_name = dictionary_iter->second;
LL_DEBUGS(LOG_LOCAL) << "Found, new name is: " << object_name << LL_ENDL;
}
return found;
}
LLLocalizedInventoryItemsDictionary() LLLocalizedInventoryItemsDictionary()
{ {
mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape"); mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape");
@@ -196,27 +220,6 @@ public:
mInventoryItemsDict["dance7"] = LLTrans::getString("dance7"); mInventoryItemsDict["dance7"] = LLTrans::getString("dance7");
mInventoryItemsDict["dance8"] = LLTrans::getString("dance8"); mInventoryItemsDict["dance8"] = LLTrans::getString("dance8");
} }
/**
* Finds passed name in dictionary and replaces it with found localized value.
*
* @param object_name - string to be localized.
* @return true if passed name was found and localized, false otherwise.
*/
bool localizeInventoryObjectName(std::string& object_name)
{
LL_DEBUGS(LOG_LOCAL) << "Searching for localization: " << object_name << LL_ENDL;
std::map<std::string, std::string>::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name);
bool found = dictionary_iter != mInventoryItemsDict.end();
if(found)
{
object_name = dictionary_iter->second;
LL_DEBUGS(LOG_LOCAL) << "Found, new name is: " << object_name << LL_ENDL;
}
return found;
}
}; };
@@ -324,6 +327,7 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const
if(!mIsComplete) if(!mIsComplete)
{ {
// *FIX: deal with this better. // *FIX: deal with this better.
// If we're crashing here then the UI is incorrectly enabled.
LL_ERRS(LOG_INV) << "LLViewerInventoryItem::updateServer() - for incomplete item" LL_ERRS(LOG_INV) << "LLViewerInventoryItem::updateServer() - for incomplete item"
<< LL_ENDL; << LL_ENDL;
LLNotificationsUtil::add("IncompleteInventoryItem"); LLNotificationsUtil::add("IncompleteInventoryItem");
@@ -455,7 +459,7 @@ void LLViewerInventoryItem::setTransactionID(const LLTransactionID& transaction_
{ {
mTransactionID = transaction_id; mTransactionID = transaction_id;
} }
// virtual
void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const
{ {
msg->addUUIDFast(_PREHASH_ItemID, mUUID); msg->addUUIDFast(_PREHASH_ItemID, mUUID);
@@ -474,6 +478,7 @@ void LLViewerInventoryItem::packMessage(LLMessageSystem* msg) const
U32 crc = getCRC32(); U32 crc = getCRC32();
msg->addU32Fast(_PREHASH_CRC, crc); msg->addU32Fast(_PREHASH_CRC, crc);
} }
// virtual // virtual
BOOL LLViewerInventoryItem::importFile(LLFILE* fp) BOOL LLViewerInventoryItem::importFile(LLFILE* fp)
{ {
@@ -621,7 +626,7 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const
if (AISAPI::isAvailable()) if (AISAPI::isAvailable())
{ {
LLSD new_llsd = asLLSD(); LLSD new_llsd = asLLSD();
AISAPI::completion_t cr = boost::bind(&doInventoryCb, (LLPointer<LLInventoryCallback>)NULL, _1); AISAPI::completion_t cr = boost::bind(&doInventoryCb, LLPointer<LLInventoryCallback>(NULL), _1);
AISAPI::UpdateCategory(getUUID(), new_llsd, cr); AISAPI::UpdateCategory(getUUID(), new_llsd, cr);
} }
else else
@@ -833,7 +838,7 @@ bool LLViewerInventoryCategory::acceptItem(LLInventoryItem* inv_item)
LLInventoryModel::item_array_t* item_array; LLInventoryModel::item_array_t* item_array;
gInventory.getDirectDescendentsOf(getUUID(),cat_array,item_array); gInventory.getDirectDescendentsOf(getUUID(),cat_array,item_array);
// Destination stock folder must be empty OR types of incoming and existing items must be identical and have the same permissions // Destination stock folder must be empty OR types of incoming and existing items must be identical and have the same permissions
accept = (!item_array->size() || accept = (item_array->empty() ||
((item_array->at(0)->getInventoryType() == inv_item->getInventoryType()) && ((item_array->at(0)->getInventoryType() == inv_item->getInventoryType()) &&
(item_array->at(0)->getPermissions().getMaskNextOwner() == inv_item->getPermissions().getMaskNextOwner()))); (item_array->at(0)->getPermissions().getMaskNextOwner() == inv_item->getPermissions().getMaskNextOwner())));
} }
@@ -981,10 +986,10 @@ void LLInventoryCallbackManager::destroyClass()
{ {
if (sInstance) if (sInstance)
{ {
for (callback_map_t::iterator it = sInstance->mMap.begin(), end_it = sInstance->mMap.end(); it != end_it; ++it) for (auto& it : sInstance->mMap)
{ {
// drop LLPointer reference to callback // drop LLPointer reference to callback
it->second = NULL; it.second = NULL;
} }
sInstance->mMap.clear(); sInstance->mMap.clear();
} }
@@ -1020,7 +1025,7 @@ void LLInventoryCallbackManager::fire(U32 callback_id, const LLUUID& item_id)
} }
//void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp) //void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp)
// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a // [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.4)
void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace) void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace)
// [/SL:KB] // [/SL:KB]
{ {
@@ -1107,6 +1112,7 @@ void create_gesture_cb(const LLUUID& inv_item)
} }
} }
void create_notecard_cb(const LLUUID& inv_item) void create_notecard_cb(const LLUUID& inv_item)
{ {
if (!inv_item.isNull()) if (!inv_item.isNull())
@@ -1173,10 +1179,10 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent /*= LLUUID::null*/, LLPointer<LLInventoryCallback> cb/*=NULL*/) void create_inventory_callingcard(const LLUUID& avatar_id, const LLUUID& parent /*= LLUUID::null*/, LLPointer<LLInventoryCallback> cb/*=NULL*/)
{ {
std::string item_desc = avatar_id.asString(); std::string item_desc = avatar_id.asString();
std::string item_name; LLAvatarName av_name;
gCacheName->getFullName(avatar_id, item_name); LLAvatarNameCache::get(avatar_id, &av_name);
create_inventory_item(gAgent.getID(), gAgent.getSessionID(), create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
parent, LLTransactionID::tnull, item_name, item_desc, LLAssetType::AT_CALLINGCARD, parent, LLTransactionID::tnull, av_name.getLegacyName(), item_desc, LLAssetType::AT_CALLINGCARD,
LLInventoryType::IT_CALLINGCARD, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); LLInventoryType::IT_CALLINGCARD, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb);
} }
@@ -1432,11 +1438,6 @@ void update_inventory_item(
const LLSD& updates, const LLSD& updates,
LLPointer<LLInventoryCallback> cb) LLPointer<LLInventoryCallback> cb)
{ {
//Singu Note:
// There was some rlva-specific code here, however it adversely affected serverside
// baking when using AISv3. Its omission looks likeley to be inconsequental, but if that's incorrect
// any bugs introduced by its removal are minor compared to non-functional serverside baking.
if (AISAPI::isAvailable()) if (AISAPI::isAvailable())
{ {
AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1); AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1);
@@ -1466,7 +1467,6 @@ void update_inventory_item(
LLInventoryModel::LLCategoryUpdate up(new_item->getParentUUID(), 0); LLInventoryModel::LLCategoryUpdate up(new_item->getParentUUID(), 0);
gInventory.accountForUpdate(up); gInventory.accountForUpdate(up);
gInventory.updateItem(new_item); gInventory.updateItem(new_item);
if (cb) if (cb)
{ {
cb->fire(item_id); cb->fire(item_id);
@@ -1525,11 +1525,9 @@ void remove_inventory_items(
LLPointer<LLInventoryCallback> cb LLPointer<LLInventoryCallback> cb
) )
{ {
for (LLInventoryObject::object_list_t::iterator it = items_to_kill.begin(); for (auto& it : items_to_kill)
it != items_to_kill.end();
++it)
{ {
remove_inventory_item(*it, cb); remove_inventory_item(it, cb);
} }
} }
@@ -1603,7 +1601,7 @@ public:
mCB(cb) mCB(cb)
{ {
} }
/* virtual */ void fire(const LLUUID& item_id) {} /* virtual */ void fire(const LLUUID& item_id) override {}
~LLRemoveCategoryOnDestroy() ~LLRemoveCategoryOnDestroy()
{ {
LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID); LLInventoryModel::EHasChildren children = gInventory.categoryHasChildren(mID);
@@ -1629,6 +1627,10 @@ void remove_inventory_category(
LLPointer<LLViewerInventoryCategory> obj = gInventory.getCategory(cat_id); LLPointer<LLViewerInventoryCategory> obj = gInventory.getCategory(cat_id);
if(obj) if(obj)
{ {
if (!gInventory.isCategoryComplete(cat_id))
{
LL_WARNS() << "Removing (purging) incomplete category " << obj->getName() << LL_ENDL;
}
if(LLFolderType::lookupIsProtectedType(obj->getPreferredType())) if(LLFolderType::lookupIsProtectedType(obj->getPreferredType()))
{ {
LLNotificationsUtil::add("CannotRemoveProtectedCategories"); LLNotificationsUtil::add("CannotRemoveProtectedCategories");
@@ -1849,9 +1851,9 @@ void create_new_item(const std::string& name,
LLViewerAssetType::generateDescriptionFor(asset_type, desc); LLViewerAssetType::generateDescriptionFor(asset_type, desc);
next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER;
LLPointer<LLInventoryCallback> cb = NULL; LLPointer<LLInventoryCallback> cb = nullptr;
switch(inv_type) switch (inv_type)
{ {
case LLInventoryType::IT_LSL: case LLInventoryType::IT_LSL:
{ {
@@ -2003,9 +2005,9 @@ void remove_folder_contents(const LLUUID& category, bool keep_outfit_links,
LLInventoryModel::item_array_t items; LLInventoryModel::item_array_t items;
gInventory.collectDescendents(category, cats, items, gInventory.collectDescendents(category, cats, items,
LLInventoryModel::EXCLUDE_TRASH); LLInventoryModel::EXCLUDE_TRASH);
for (U32 i = 0; i < items.size(); ++i) for (auto& i : items)
{ {
LLViewerInventoryItem *item = items.at(i); LLViewerInventoryItem *item = i;
if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER))
continue; continue;
if (item->getIsLinkType()) if (item->getIsLinkType())
@@ -2084,7 +2086,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl
} }
else else
{ {
LL_WARNS() << "Can't create unrecognized type " << type_name << LL_ENDL; LL_WARNS(LOG_INV) << "Can't create unrecognized type " << type_name << LL_ENDL;
} }
} }
root->setNeedsAutoRename(TRUE); root->setNeedsAutoRename(TRUE);
@@ -2371,9 +2373,9 @@ PermissionMask LLViewerInventoryItem::getPermissionMask() const
//---------- //----------
void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group) void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name)
{ {
rename(name); rename(name.getLegacyName());
gInventory.addChangedMask(LLInventoryObserver::LABEL, getUUID()); gInventory.addChangedMask(LLInventoryObserver::LABEL, getUUID());
gInventory.notifyObservers(); gInventory.notifyObservers();
} }
@@ -2382,9 +2384,10 @@ class LLRegenerateLinkCollector : public LLInventoryCollectFunctor
{ {
public: public:
LLRegenerateLinkCollector(const LLViewerInventoryItem *target_item) : mTargetItem(target_item) {} LLRegenerateLinkCollector(const LLViewerInventoryItem *target_item) : mTargetItem(target_item) {}
virtual ~LLRegenerateLinkCollector() {} virtual ~LLRegenerateLinkCollector() = default;
virtual bool operator()(LLInventoryCategory* cat,
LLInventoryItem* item) bool operator()(LLInventoryCategory* cat,
LLInventoryItem* item) override
{ {
if (item) if (item)
{ {
@@ -2412,11 +2415,8 @@ LLUUID find_possible_item_for_regeneration(const LLViewerInventoryItem *target_i
items, items,
LLInventoryModel::EXCLUDE_TRASH, LLInventoryModel::EXCLUDE_TRASH,
candidate_matches); candidate_matches);
for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items.begin(); for (const LLViewerInventoryItem* item : items)
item_iter != items.end();
++item_iter)
{ {
const LLViewerInventoryItem *item = (*item_iter);
if(item) if(item)
return item->getUUID(); return item->getUUID();
} }
@@ -2438,11 +2438,9 @@ BOOL LLViewerInventoryItem::regenerateLink()
items, items,
LLInventoryModel::EXCLUDE_TRASH, LLInventoryModel::EXCLUDE_TRASH,
asset_id_matches); asset_id_matches);
for (LLViewerInventoryItem::item_array_t::iterator item_iter = items.begin(); for (auto& item_iter : items)
item_iter != items.end();
item_iter++)
{ {
LLViewerInventoryItem *item = (*item_iter); LLViewerInventoryItem *item = item_iter;
item->setAssetUUID(target_item_id); item->setAssetUUID(target_item_id);
item->updateServer(FALSE); item->updateServer(FALSE);
gInventory.addChangedMask(LLInventoryObserver::REBUILD, item->getUUID()); gInventory.addChangedMask(LLInventoryObserver::REBUILD, item->getUUID());

View File

@@ -42,6 +42,7 @@
class LLFolderView; class LLFolderView;
class LLFolderBridge; class LLFolderBridge;
class LLViewerInventoryCategory; class LLViewerInventoryCategory;
class LLAvatarName;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLViewerInventoryItem // Class LLViewerInventoryItem
@@ -50,7 +51,7 @@ class LLViewerInventoryCategory;
// their inventory. // their inventory.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::trackable class LLViewerInventoryItem final : public LLInventoryItem, public boost::signals2::trackable
{ {
public: public:
typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t; typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
@@ -59,24 +60,24 @@ protected:
~LLViewerInventoryItem( void ); // ref counted ~LLViewerInventoryItem( void ); // ref counted
public: public:
virtual LLAssetType::EType getType() const; LLAssetType::EType getType() const override;
virtual const LLUUID& getAssetUUID() const; const LLUUID& getAssetUUID() const override;
virtual const LLUUID& getProtectedAssetUUID() const; // returns LLUUID::null if current agent does not have permission to expose this asset's UUID to the user virtual const LLUUID& getProtectedAssetUUID() const; // returns LLUUID::null if current agent does not have permission to expose this asset's UUID to the user
virtual const std::string& getName() const; const std::string& getName() const override;
virtual S32 getSortField() const; virtual S32 getSortField() const;
//virtual void setSortField(S32 sortField); //virtual void setSortField(S32 sortField);
virtual void getSLURL(); //Caches SLURL for landmark. //*TODO: Find a better way to do it and remove this method from here. virtual void getSLURL(); //Caches SLURL for landmark. //*TODO: Find a better way to do it and remove this method from here.
virtual const LLPermissions& getPermissions() const; const LLPermissions& getPermissions() const override;
virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied
virtual const LLUUID& getCreatorUUID() const; const LLUUID& getCreatorUUID() const override;
virtual const std::string& getDescription() const; const std::string& getDescription() const override;
virtual const LLSaleInfo& getSaleInfo() const; const LLSaleInfo& getSaleInfo() const override;
virtual LLInventoryType::EType getInventoryType() const; LLInventoryType::EType getInventoryType() const override;
virtual bool isWearableType() const; virtual bool isWearableType() const;
virtual LLWearableType::EType getWearableType() const; virtual LLWearableType::EType getWearableType() const;
virtual U32 getFlags() const; U32 getFlags() const override;
virtual time_t getCreationDate() const; time_t getCreationDate() const override;
virtual U32 getCRC32() const; // really more of a checksum. U32 getCRC32() const override; // really more of a checksum.
static BOOL extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName); static BOOL extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName);
@@ -112,7 +113,7 @@ public:
LLViewerInventoryItem(const LLInventoryItem* other); LLViewerInventoryItem(const LLInventoryItem* other);
void copyViewerItem(const LLViewerInventoryItem* other); void copyViewerItem(const LLViewerInventoryItem* other);
/*virtual*/ void copyItem(const LLInventoryItem* other); /*virtual*/ void copyItem(const LLInventoryItem* other) override;
// construct a new clone of this item - it creates a new viewer // construct a new clone of this item - it creates a new viewer
// inventory item using the copy constructor, and returns it. // inventory item using the copy constructor, and returns it.
@@ -120,15 +121,15 @@ public:
void cloneViewerItem(LLPointer<LLViewerInventoryItem>& newitem) const; void cloneViewerItem(LLPointer<LLViewerInventoryItem>& newitem) const;
// virtual methods // virtual methods
virtual void updateParentOnServer(BOOL restamp) const; void updateParentOnServer(BOOL restamp) const override;
virtual void updateServer(BOOL is_new) const; void updateServer(BOOL is_new) const override;
void fetchFromServer(void) const; void fetchFromServer(void) const;
virtual void packMessage(LLMessageSystem* msg) const; void packMessage(LLMessageSystem* msg) const override;
virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0) override;
virtual BOOL unpackMessage(const LLSD& item); virtual BOOL unpackMessage(const LLSD& item);
virtual BOOL importFile(LLFILE* fp); BOOL importFile(LLFILE* fp) override;
virtual BOOL importLegacyStream(std::istream& input_stream); BOOL importLegacyStream(std::istream& input_stream) override;
// file handling on the viewer. These are not meant for anything // file handling on the viewer. These are not meant for anything
// other than cacheing. // other than cacheing.
@@ -160,7 +161,7 @@ public:
PermissionMask getPermissionMask() const; PermissionMask getPermissionMask() const;
// callback // callback
void onCallingCardNameLookup(const LLUUID& id, const std::string& name, bool is_group); void onCallingCardNameLookup(const LLUUID& id, const LLAvatarName& name);
// If this is a broken link, try to fix it and any other identical link. // If this is a broken link, try to fix it and any other identical link.
BOOL regenerateLink(); BOOL regenerateLink();
@@ -184,7 +185,7 @@ public:
// new ones as needed. // new ones as needed.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLViewerInventoryCategory : public LLInventoryCategory class LLViewerInventoryCategory final : public LLInventoryCategory
{ {
public: public:
typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t; typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t;
@@ -204,10 +205,10 @@ public:
LLViewerInventoryCategory(const LLViewerInventoryCategory* other); LLViewerInventoryCategory(const LLViewerInventoryCategory* other);
void copyViewerCategory(const LLViewerInventoryCategory* other); void copyViewerCategory(const LLViewerInventoryCategory* other);
virtual void updateParentOnServer(BOOL restamp_children) const; void updateParentOnServer(BOOL restamp_children) const override;
virtual void updateServer(BOOL is_new) const; void updateServer(BOOL is_new) const override;
virtual void packMessage(LLMessageSystem* msg) const; void packMessage(LLMessageSystem* msg) const override;
const LLUUID& getOwnerID() const { return mOwnerID; } const LLUUID& getOwnerID() const { return mOwnerID; }
@@ -234,7 +235,7 @@ public:
bool importFileLocal(LLFILE* fp); bool importFileLocal(LLFILE* fp);
void determineFolderType(); void determineFolderType();
void changeType(LLFolderType::EType new_folder_type); void changeType(LLFolderType::EType new_folder_type);
virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0) override;
virtual BOOL unpackMessage(const LLSD& category); virtual BOOL unpackMessage(const LLSD& category);
// returns true if the category object will accept the incoming item // returns true if the category object will accept the incoming item
@@ -259,37 +260,37 @@ public:
class LLViewerJointAttachment; class LLViewerJointAttachment;
//void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp); // [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.4)
// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2010-09-28 (Catznip-3.0.0a) | Added: Catznip-2.2.0a
void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace = false); void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace = false);
// [/SL:KB] // [/SL:KB]
//void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp);
void activate_gesture_cb(const LLUUID& inv_item); void activate_gesture_cb(const LLUUID& inv_item);
void create_gesture_cb(const LLUUID& inv_item); void create_gesture_cb(const LLUUID& inv_item);
class AddFavoriteLandmarkCallback : public LLInventoryCallback class AddFavoriteLandmarkCallback final : public LLInventoryCallback
{ {
public: public:
AddFavoriteLandmarkCallback() : mTargetLandmarkId(LLUUID::null) {} AddFavoriteLandmarkCallback() : mTargetLandmarkId(LLUUID::null) {}
void setTargetLandmarkId(const LLUUID& target_uuid) { mTargetLandmarkId = target_uuid; } void setTargetLandmarkId(const LLUUID& target_uuid) { mTargetLandmarkId = target_uuid; }
private: private:
void fire(const LLUUID& inv_item); void fire(const LLUUID& inv_item) override;
LLUUID mTargetLandmarkId; LLUUID mTargetLandmarkId;
}; };
typedef boost::function<void(const LLUUID&)> inventory_func_type; typedef std::function<void(const LLUUID&)> inventory_func_type;
typedef boost::function<void(const LLSD&)> llsd_func_type; typedef std::function<void(const LLSD&)> llsd_func_type;
typedef boost::function<void()> nullary_func_type; typedef std::function<void()> nullary_func_type;
void no_op_inventory_func(const LLUUID&); // A do-nothing inventory_func void no_op_inventory_func(const LLUUID&); // A do-nothing inventory_func
void no_op_llsd_func(const LLSD&); // likewise for LLSD void no_op_llsd_func(const LLSD&); // likewise for LLSD
void no_op(); // A do-nothing nullary func. void no_op(); // A do-nothing nullary func.
// Shim between inventory callback and boost function/callable // Shim between inventory callback and boost function/callable
class LLBoostFuncInventoryCallback: public LLInventoryCallback class LLBoostFuncInventoryCallback : public LLInventoryCallback
{ {
public: public:
@@ -301,7 +302,7 @@ public:
} }
// virtual // virtual
void fire(const LLUUID& item_id) void fire(const LLUUID& item_id) override
{ {
mFireFunc(item_id); mFireFunc(item_id);
} }