diff options
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 373 |
1 files changed, 129 insertions, 244 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 44943d8722..5df28ccb73 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -70,6 +70,7 @@ #include "llviewermenu.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" +#include "llviewerregion.h" #include "llviewerwindow.h" #include "llvoavatarself.h" #include "llwearablelist.h" @@ -201,6 +202,7 @@ const std::string& LLInvFVBridge::getDisplayName() const { buildDisplayName(); } + return mDisplayName; } @@ -328,7 +330,7 @@ void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch) if (cat) { gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE ); - for (j=0; j<descendent_items.count(); j++) + for (j=0; j<descendent_items.size(); j++) { if(LLAssetType::AT_GESTURE == descendent_items[j]->getType()) { @@ -490,12 +492,12 @@ BOOL LLInvFVBridge::isClipboardPasteable() const } // In normal mode, we need to check each element of the clipboard to know if we can paste or not - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); for(S32 i = 0; i < count; i++) { - const LLUUID &item_id = objects.get(i); + const LLUUID &item_id = objects.at(i); // Folders are pastable if all items in there are copyable const LLInventoryCategory *cat = model->getCategory(item_id); @@ -530,12 +532,12 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const return FALSE; } - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); for(S32 i = 0; i < count; i++) { - const LLInventoryItem *item = model->getItem(objects.get(i)); + const LLInventoryItem *item = model->getItem(objects.at(i)); if (item) { if (!LLAssetType::lookupCanLink(item->getActualType())) @@ -543,7 +545,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const return FALSE; } } - const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i)); + const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i)); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return FALSE; @@ -733,7 +735,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLInvFVBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -861,7 +863,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const } *id = obj->getUUID(); - //object_ids.put(obj->getUUID()); + //object_ids.push_back(obj->getUUID()); if (*type == DAD_CATEGORY) { @@ -1032,7 +1034,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_TEXTURE: if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLTextureBridge(inventory, root, uuid, inv_type); break; @@ -1040,7 +1042,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_SOUND: if(!(inv_type == LLInventoryType::IT_SOUND)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLSoundBridge(inventory, root, uuid); break; @@ -1048,7 +1050,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_LANDMARK: if(!(inv_type == LLInventoryType::IT_LANDMARK)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLLandmarkBridge(inventory, root, uuid, flags); break; @@ -1056,7 +1058,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_CALLINGCARD: if(!(inv_type == LLInventoryType::IT_CALLINGCARD)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLCallingCardBridge(inventory, root, uuid); break; @@ -1064,7 +1066,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_SCRIPT: if(!(inv_type == LLInventoryType::IT_LSL)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLItemBridge(inventory, root, uuid); break; @@ -1072,7 +1074,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_OBJECT: if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLObjectBridge(inventory, root, uuid, inv_type, flags); break; @@ -1080,7 +1082,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_NOTECARD: if(!(inv_type == LLInventoryType::IT_NOTECARD)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLNotecardBridge(inventory, root, uuid); break; @@ -1088,7 +1090,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_ANIMATION: if(!(inv_type == LLInventoryType::IT_ANIMATION)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLAnimationBridge(inventory, root, uuid); break; @@ -1096,7 +1098,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_GESTURE: if(!(inv_type == LLInventoryType::IT_GESTURE)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLGestureBridge(inventory, root, uuid); break; @@ -1104,7 +1106,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_LSL_TEXT: if(!(inv_type == LLInventoryType::IT_LSL)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLLSLTextBridge(inventory, root, uuid); break; @@ -1113,7 +1115,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_BODYPART: if(!(inv_type == LLInventoryType::IT_WEARABLE)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (LLWearableType::EType)flags); break; @@ -1134,19 +1136,19 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_MESH: if(!(inv_type == LLInventoryType::IT_MESH)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLMeshBridge(inventory, root, uuid); break; case LLAssetType::AT_IMAGE_TGA: case LLAssetType::AT_IMAGE_JPEG: - //llwarns << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << llendl; + //LL_WARNS() << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << LL_ENDL; break; default: - llinfos << "Unhandled asset type (llassetstorage.h): " - << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << llendl; + LL_INFOS() << "Unhandled asset type (llassetstorage.h): " + << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << LL_ENDL; break; } @@ -1160,17 +1162,10 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid) { - LLInventoryCategory* cat = model->getCategory(uuid); - if (cat) - { - model->purgeDescendentsOf(uuid); - model->notifyObservers(); - } LLInventoryObject* obj = model->getObject(uuid); if (obj) { - model->purgeObject(uuid); - model->notifyObservers(); + remove_inventory_object(uuid, NULL); } } @@ -1427,7 +1422,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) } else if (isMarketplaceCopyAction(action)) { - llinfos << "Copy item to marketplace action!" << llendl; + LL_INFOS() << "Copy item to marketplace action!" << LL_ENDL; LLInventoryItem* itemp = model->getItem(mUUID); if (!itemp) return; @@ -1606,18 +1601,18 @@ void LLItemBridge::buildDisplayName() const else { mDisplayName.assign(LLStringUtil::null); -} - + } + mSearchableName.assign(mDisplayName); mSearchableName.append(getLabelSuffix()); LLStringUtil::toUpper(mSearchableName); - + //Name set, so trigger a sort if(mParent) -{ - mParent->requestSort(); - } + { + mParent->requestSort(); } +} LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const { @@ -1626,7 +1621,7 @@ LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const if (get_is_item_worn(mUUID)) { - // llinfos << "BOLD" << llendl; + // LL_INFOS() << "BOLD" << LL_ENDL; font |= LLFontGL::BOLD; } else if(item && item->getIsLinkType()) @@ -1731,13 +1726,9 @@ BOOL LLItemBridge::renameItem(const std::string& new_name) LLViewerInventoryItem* item = getItem(); if(item && (item->getName() != new_name)) { - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - new_item->rename(new_name); - new_item->updateServer(FALSE); - model->updateItem(new_item); - - model->notifyObservers(); - buildDisplayName(); + LLSD updates; + updates["name"] = new_name; + update_inventory_item(item->getUUID(),updates, NULL); } // return FALSE because we either notified observers (& therefore // rebuilt) or we didn't update. @@ -1773,16 +1764,8 @@ BOOL LLItemBridge::removeItem() { if (!item->getIsLinkType()) { - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - LLLinkedItemIDMatches is_linked_item_match(mUUID); - gInventory.collectDescendentsIf(gInventory.getRootFolderID(), - cat_array, - item_array, - LLInventoryModel::INCLUDE_TRASH, - is_linked_item_match); - - const U32 num_links = cat_array.size() + item_array.size(); + LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); + const U32 num_links = item_array.size(); if (num_links > 0) { // Warn if the user is will break any links when deleting this item. @@ -1934,49 +1917,19 @@ void LLFolderBridge::buildDisplayName() const void LLFolderBridge::update() { - bool possibly_has_children = false; - bool up_to_date = isUpToDate(); - if(!up_to_date && hasChildren()) // we know we have children but haven't fetched them (doesn't obey filter) - { - possibly_has_children = true; - } - - bool loading = (possibly_has_children - && !up_to_date ); + // we know we have children but haven't fetched them (doesn't obey filter) + bool loading = !isUpToDate() && hasChildren() && mFolderViewItem->isOpen(); if (loading != mIsLoading) { - if ( loading && !mIsLoading ) + if ( loading ) { // Measure how long we've been in the loading state mTimeSinceRequestStart.reset(); } + mIsLoading = loading; - const BOOL in_inventory = gInventory.isObjectDescendentOf(getUUID(), gInventory.getRootFolderID()); - const BOOL in_library = gInventory.isObjectDescendentOf(getUUID(), gInventory.getLibraryRootFolderID()); - - bool root_is_loading = false; - if (in_inventory) - { - root_is_loading = LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress(); - } - if (in_library) - { - root_is_loading = LLInventoryModelBackgroundFetch::instance().libraryFetchInProgress(); - } - if ((mIsLoading - && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime")) - || (LLInventoryModelBackgroundFetch::instance().folderFetchActive() - && root_is_loading)) - { - mDisplayName = LLInvFVBridge::getDisplayName() + " ( " + LLTrans::getString("LoadingData") + " ) "; - mIsLoading = true; - } - else - { - mDisplayName = LLInvFVBridge::getDisplayName(); - mIsLoading = false; - } + mFolderViewItem->refresh(); } } @@ -2080,15 +2033,15 @@ BOOL LLFolderBridge::isClipboardPasteable() const return FALSE; } - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); const LLViewerInventoryCategory *current_cat = getCategory(); // Search for the direct descendent of current Friends subfolder among all pasted items, // and return false if is found. - for(S32 i = objects.count() - 1; i >= 0; --i) + for(S32 i = objects.size() - 1; i >= 0; --i) { - const LLUUID &obj_id = objects.get(i); + const LLUUID &obj_id = objects.at(i); if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) { return FALSE; @@ -2118,12 +2071,12 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const { const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); const LLUUID ¤t_cat_id = current_cat->getUUID(); - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); for(S32 i = 0; i < count; i++) { - const LLUUID &obj_id = objects.get(i); + const LLUUID &obj_id = objects.at(i); const LLInventoryCategory *cat = model->getCategory(obj_id); if (cat) { @@ -2197,9 +2150,9 @@ int get_folder_levels(LLInventoryCategory* inv_cat) int max_child_levels = 0; - for (S32 i=0; i < cats->count(); ++i) + for (S32 i=0; i < cats->size(); ++i) { - LLInventoryCategory* category = cats->get(i); + LLInventoryCategory* category = cats->at(i); max_child_levels = llmax(max_child_levels, get_folder_levels(category)); } @@ -2227,7 +2180,7 @@ int get_folder_path_length(const LLUUID& ancestor_id, const LLUUID& descendant_i category = gInventory.getCategory(parent_id); } - llwarns << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << llendl; + LL_WARNS() << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << LL_ENDL; return -1; } @@ -2309,7 +2262,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (is_movable) { model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); - for (S32 i=0; i < descendent_categories.count(); ++i) + for (S32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) @@ -2322,7 +2275,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_trash) { - for (S32 i=0; i < descendent_items.count(); ++i) + for (S32 i=0; i < descendent_items.size(); ++i) { LLInventoryItem* item = descendent_items[i]; if (get_is_item_worn(item->getUUID())) @@ -2334,7 +2287,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_landmarks) { - for (S32 i=0; i < descendent_items.count(); ++i) + for (S32 i=0; i < descendent_items.size(); ++i) { LLViewerInventoryItem* item = descendent_items[i]; @@ -2358,7 +2311,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else { - int dragged_folder_count = descendent_categories.count(); + int dragged_folder_count = descendent_categories.size(); int existing_item_count = 0; int existing_folder_count = 0; @@ -2397,8 +2350,8 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, model->collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE); - existing_folder_count += existing_categories.count(); - existing_item_count += existing_items.count(); + existing_folder_count += existing_categories.size(); + existing_item_count += existing_items.size(); } else { @@ -2408,7 +2361,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } const int nested_folder_count = existing_folder_count + dragged_folder_count; - const int nested_item_count = existing_item_count + descendent_items.count(); + const int nested_item_count = existing_item_count + descendent_items.size(); if (nested_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount")) { @@ -2423,7 +2376,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (is_movable == TRUE) { - for (S32 i=0; i < descendent_items.count(); ++i) + for (S32 i=0; i < descendent_items.size(); ++i) { LLInventoryItem* item = descendent_items[i]; if (!can_move_to_outbox(item, tooltip_msg)) @@ -2479,7 +2432,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // Look for any gestures and deactivate them if (move_is_into_trash) { - for (S32 i=0; i < descendent_items.count(); i++) + for (S32 i=0; i < descendent_items.size(); i++) { LLInventoryItem* item = descendent_items[i]; if (item->getType() == LLAssetType::AT_GESTURE @@ -2489,49 +2442,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } } } - // if target is an outfit or current outfit folder we use link - if (move_is_into_current_outfit || move_is_into_outfit) + // if target is current outfit folder we use link + if (move_is_into_current_outfit && + inv_cat->getPreferredType() == LLFolderType::FT_NONE) { - if (inv_cat->getPreferredType() == LLFolderType::FT_NONE) - { - if (move_is_into_current_outfit) - { - // traverse category and add all contents to currently worn. - BOOL append = true; - LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append); - } - else - { - // Recursively create links in target outfit. - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - model->collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); - LLAppearanceMgr::instance().linkAll(mUUID,items,NULL); - } - } - else - { -#if SUPPORT_ENSEMBLES - // BAP - should skip if dup. - if (move_is_into_current_outfit) - { - LLAppearanceMgr::instance().addEnsembleLink(inv_cat); - } - else - { - LLPointer<LLInventoryCallback> cb = NULL; - const std::string empty_description = ""; - link_inventory_item( - gAgent.getID(), - cat_id, - mUUID, - inv_cat->getName(), - empty_description, - LLAssetType::AT_LINK_FOLDER, - cb); - } -#endif - } + // traverse category and add all contents to currently worn. + BOOL append = true; + LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append); } else if (move_is_into_outbox && !move_is_from_outbox) { @@ -2618,7 +2535,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, LLViewerObject* object = gObjectList.findObject(object_id); if(!object) { - llinfos << "Object not found for drop." << llendl; + LL_INFOS() << "Object not found for drop." << LL_ENDL; return FALSE; } @@ -2629,7 +2546,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, if (inventory_objects.empty()) { - llinfos << "Object contents not found for drop." << llendl; + LL_INFOS() << "Object contents not found for drop." << LL_ENDL; return FALSE; } @@ -2645,7 +2562,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(it->get()); if (!item) { - llwarns << "Invalid inventory item for drop" << llendl; + LL_WARNS() << "Invalid inventory item for drop" << LL_ENDL; continue; } @@ -2713,7 +2630,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Bail out immediately if no descendents if( mComplete.empty() ) { - llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl; + LL_WARNS() << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << LL_ENDL; if (clear_observer) { gInventory.removeObserver(this); @@ -2743,13 +2660,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) S32 item_count(0); if( item_array ) { - item_count = item_array->count(); + item_count = item_array->size(); } S32 cat_count(0); if( cat_array ) { - cat_count = cat_array->count(); + cat_count = cat_array->size(); } // Move to next if current folder empty @@ -2767,7 +2684,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) { for (S32 i = 0; i < item_count; ++i) { - ids.push_back(item_array->get(i)->getUUID()); + ids.push_back(item_array->at(i)->getUUID()); } outfit = new LLRightClickInventoryFetchObserver(ids); } @@ -2776,7 +2693,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) { for (S32 i = 0; i < cat_count; ++i) { - ids.push_back(cat_array->get(i)->getUUID()); + ids.push_back(cat_array->at(i)->getUUID()); } categories = new LLRightClickInventoryFetchDescendentsObserver(ids); } @@ -2871,8 +2788,8 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) LLViewerInventoryCategory* category = gInventory.getCategory(mCatID); if (NULL == category) { - llwarns << "gInventory.getCategory(" << mCatID - << ") was NULL" << llendl; + LL_WARNS() << "gInventory.getCategory(" << mCatID + << ") was NULL" << LL_ENDL; } else { @@ -2923,17 +2840,6 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) modifyOutfit(FALSE); return; } -#if SUPPORT_ENSEMBLES - else if ("wearasensemble" == action) - { - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - LLViewerInventoryCategory* cat = getCategory(); - if(!cat) return; - LLAppearanceMgr::instance().addEnsembleLink(cat,true); - return; - } -#endif else if ("addtooutfit" == action) { modifyOutfit(TRUE); @@ -2978,7 +2884,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) #endif else if (isMarketplaceCopyAction(action)) { - llinfos << "Copy folder to marketplace action!" << llendl; + LL_INFOS() << "Copy folder to marketplace action!" << LL_ENDL; LLInventoryCategory * cat = gInventory.getCategory(mUUID); if (!cat) return; @@ -2989,7 +2895,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) #if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU else if (isMarketplaceSendAction(action)) { - llinfos << "Send to marketplace action!" << llendl; + LL_INFOS() << "Send to marketplace action!" << LL_ENDL; LLInventoryCategory * cat = gInventory.getCategory(mUUID); if (!cat) return; @@ -3001,7 +2907,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) void LLFolderBridge::openItem() { - lldebugs << "LLFolderBridge::openItem()" << llendl; + LL_DEBUGS() << "LLFolderBridge::openItem()" << LL_ENDL; LLInventoryModel* model = getInventoryModel(); if(!model) return; if(mUUID.isNull()) return; @@ -3096,9 +3002,20 @@ LLUIImagePtr LLFolderBridge::getIconOverlay() const return NULL; } +std::string LLFolderBridge::getLabelSuffix() const +{ + static LLCachedControl<F32> folder_loading_message_delay(gSavedSettings, "FolderLoadingMessageWaitTime", 0.5f); + return mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= folder_loading_message_delay() + ? llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str()) + : LLStringUtil::null; +} BOOL LLFolderBridge::renameItem(const std::string& new_name) { + + LLScrollOnRenameObserver *observer = new LLScrollOnRenameObserver(mUUID, mRoot); + gInventory.addObserver(observer); + rename_category(getInventoryModel(), mUUID, new_name); // return FALSE because we either notified observers (& therefore @@ -3185,7 +3102,7 @@ void LLFolderBridge::pasteFromClipboard() const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); if (move_is_into_outbox) @@ -3198,7 +3115,7 @@ void LLFolderBridge::pasteFromClipboard() BOOL can_list = TRUE; - for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); + for (std::vector<LLUUID>::const_iterator iter = objects.begin(); (iter != objects.end()) && (can_list == TRUE); ++iter) { @@ -3229,7 +3146,7 @@ void LLFolderBridge::pasteFromClipboard() const LLUUID parent_id(mUUID); - for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); + for (std::vector<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) { @@ -3321,9 +3238,9 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID parent_id(mUUID); - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); + for (std::vector<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) { @@ -3336,28 +3253,9 @@ void LLFolderBridge::pasteLinkFromClipboard() dropToOutfit(item, move_is_into_current_outfit); } } - else if (LLInventoryCategory *cat = model->getCategory(object_id)) + else if (LLConstPointer<LLInventoryObject> obj = model->getObject(object_id)) { - const std::string empty_description = ""; - link_inventory_item( - gAgent.getID(), - cat->getUUID(), - parent_id, - cat->getName(), - empty_description, - LLAssetType::AT_LINK_FOLDER, - LLPointer<LLInventoryCallback>(NULL)); - } - else if (LLInventoryItem *item = model->getItem(object_id)) - { - link_inventory_item( - gAgent.getID(), - item->getLinkedUUID(), - parent_id, - item->getName(), - item->getDescription(), - LLAssetType::AT_LINK, - LLPointer<LLInventoryCallback>(NULL)); + link_inventory_object(parent_id, obj, LLPointer<LLInventoryCallback>(NULL)); } } // Change mode to paste for next paste @@ -3384,7 +3282,7 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv item_array, LLInventoryModel::EXCLUDE_TRASH, is_type); - return ((item_array.count() > 0) ? TRUE : FALSE ); + return ((item_array.size() > 0) ? TRUE : FALSE ); } void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items) @@ -3448,16 +3346,6 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items items.push_back(std::string("New Clothes")); items.push_back(std::string("New Body Parts")); } -#if SUPPORT_ENSEMBLES - // Changing folder types is an unfinished unsupported feature - // and can lead to unexpected behavior if enabled. - items.push_back(std::string("Change Type")); - const LLViewerInventoryCategory *cat = getCategory(); - if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) - { - disabled_items.push_back(std::string("Change Type")); - } -#endif getClipboardEntries(false, items, disabled_items, flags); } else @@ -3619,6 +3507,10 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& { disabled_items.push_back(std::string("Replace Outfit")); } + if (!LLAppearanceMgr::instance().getCanAddToCOF(mUUID)) + { + disabled_items.push_back(std::string("Add To Outfit")); + } items.push_back(std::string("Outfit Separator")); } } @@ -3636,7 +3528,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLFolderBridge::buildContextMenu()" << LL_ENDL; LLInventoryModel* model = getInventoryModel(); if(!model) return; @@ -3665,7 +3557,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, { LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; - //llinfos << "LLFolderBridge::dragOrDrop()" << llendl; + //LL_INFOS() << "LLFolderBridge::dragOrDrop()" << LL_ENDL; BOOL accept = FALSE; switch(cargo_type) { @@ -3714,7 +3606,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, case DAD_NONE: break; default: - llwarns << "Unhandled cargo type for drag&drop " << cargo_type << llendl; + LL_WARNS() << "Unhandled cargo type for drag&drop " << cargo_type << LL_ENDL; break; } return accept; @@ -3949,14 +3841,7 @@ void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_c else { LLPointer<LLInventoryCallback> cb = NULL; - link_inventory_item( - gAgent.getID(), - inv_item->getLinkedUUID(), - mUUID, - inv_item->getName(), - inv_item->getDescription(), - LLAssetType::AT_LINK, - cb); + link_inventory_object(mUUID, LLConstPointer<LLInventoryObject>(inv_item), cb); } } @@ -4076,7 +3961,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, gInventory.collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE); - existing_item_count += existing_items.count(); + existing_item_count += existing_items.size(); } if (existing_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount")) @@ -4184,7 +4069,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, object = gObjectList.findObject(inv_item->getParentUUID()); if (!object) { - llinfos << "Object not found for drop." << llendl; + LL_INFOS() << "Object not found for drop." << LL_ENDL; return FALSE; } @@ -4350,7 +4235,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else { - llwarns << "unhandled drag source" << llendl; + LL_WARNS() << "unhandled drag source" << LL_ENDL; } return accept; } @@ -4373,8 +4258,8 @@ bool check_category(LLInventoryModel* model, LLInventoryModel::item_array_t descendent_items; model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE); - S32 num_descendent_categories = descendent_categories.count(); - S32 num_descendent_items = descendent_items.count(); + S32 num_descendent_categories = descendent_categories.size(); + S32 num_descendent_items = descendent_items.size(); if (num_descendent_categories + num_descendent_items == 0) { @@ -4455,7 +4340,7 @@ bool LLTextureBridge::canSaveTexture(void) void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLTextureBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -4525,7 +4410,7 @@ void LLSoundBridge::openSoundPreview(void* which) void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLSoundBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLSoundBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -4586,7 +4471,7 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - lldebugs << "LLLandmarkBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLLandmarkBridge::buildContextMenu()" << LL_ENDL; if(isOutboxFolder()) { addOutboxContextMenuOptions(flags, items, disabled_items); @@ -4829,7 +4714,7 @@ void LLCallingCardBridge::openItem() void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLCallingCardBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5097,7 +4982,7 @@ BOOL LLGestureBridge::removeItem() void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLGestureBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLGestureBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -5157,7 +5042,7 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - lldebugs << "LLAnimationBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLAnimationBridge::buildContextMenu()" << LL_ENDL; if(isOutboxFolder()) { items.push_back(std::string("Delete")); @@ -5340,7 +5225,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach (gAgentAvatarp->attachmentWasRequested(item_id) || gAgentAvatarp->isWearingAttachment(item_id))) { - llwarns << "duplicate attachment request, ignoring" << llendl; + LL_WARNS() << "duplicate attachment request, ignoring" << LL_ENDL; return; } gAgentAvatarp->addAttachmentRequest(item_id); @@ -5652,7 +5537,7 @@ void LLWearableBridge::openItem() void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLWearableBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLWearableBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -5816,7 +5701,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLViewerWearable* wearable, void* } else { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; + LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL; } } } @@ -5843,7 +5728,7 @@ void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, voi } else { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; + LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL; } } } @@ -5887,7 +5772,7 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) void LLWearableBridge::removeFromAvatar() { - llwarns << "safe to remove?" << llendl; + LL_WARNS() << "safe to remove?" << LL_ENDL; if (get_is_item_worn(mUUID)) { LLAppearanceMgr::instance().removeItemFromAvatar(mUUID); @@ -5905,7 +5790,7 @@ std::string LLLinkItemBridge::sPrefix("Link: "); void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5945,7 +5830,7 @@ void LLMeshBridge::openItem() void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLMeshBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLMeshBridge::buildContextMenu()" << LL_ENDL; std::vector<std::string> items; std::vector<std::string> disabled_items; @@ -6002,7 +5887,7 @@ LLUIImagePtr LLLinkFolderBridge::getIcon() const void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; |