From 126eeb92446fed81eb6edfe7d05c9566ed20e411 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 29 Mar 2013 03:25:03 -0400 Subject: [PATCH] Inventory Updates and Clean Up Better viewed without space changes Adds translatable inventory strings --- indra/newview/llinventorybridge.cpp | 427 +++++++----------- indra/newview/llinventorymodel.cpp | 113 +---- indra/newview/llviewerinventory.cpp | 189 +++++++- indra/newview/llviewerinventory.h | 9 +- .../default/xui/en-us/menu_inventory.xml | 4 - .../skins/default/xui/en-us/strings.xml | 66 +++ .../skins/default/xui/es/menu_inventory.xml | 1 - .../skins/default/xui/fr/menu_inventory.xml | 1 - 8 files changed, 420 insertions(+), 390 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index be690021f..a68754942 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3,10 +3,9 @@ * @brief Implementation of the Inventory-Folder-View-Bridge classes. * * $LicenseInfo:firstyear=2001&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2001-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -31,18 +30,8 @@ */ #include "llviewerprecompiledheaders.h" - -#include // for std::pair<> - #include "llinventorybridge.h" -#include "message.h" - -#include "llcheckboxctrl.h" // for radio buttons -#include "llradiogroup.h" -#include "llspinctrl.h" -#include "lltextbox.h" -#include "llui.h" #include "lluictrlfactory.h" #include "llagent.h" @@ -55,15 +44,12 @@ #include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" -#include "llfloaterinventory.h" #include "llfloateropenobject.h" #include "llfloaterproperties.h" #include "llfloaterworldmap.h" -#include "llfocusmgr.h" #include "llfolderview.h" #include "llgesturemgr.h" #include "llgiveinventory.h" -#include "lliconctrl.h" #include "llimview.h" #include "llinventoryclipboard.h" #include "llinventorydefines.h" @@ -72,9 +58,7 @@ #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" -#include "lllineeditor.h" #include "llmarketplacefunctions.h" -#include "llmenugl.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpreviewanim.h" @@ -84,40 +68,19 @@ #include "llpreviewscript.h" #include "llpreviewsound.h" #include "llpreviewtexture.h" -#include "llresmgr.h" #include "llselectmgr.h" -#include "llscrollcontainer.h" #include "lltooldraganddrop.h" -#include "lltabcontainer.h" #include "lltrans.h" #include "llviewerassettype.h" -#include "llviewercontrol.h" #include "llviewerfoldertype.h" -#include "llviewerinventory.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "llviewertexturelist.h" #include "llviewerwindow.h" #include "llvoavatar.h" -#include "llfoldertype.h" #include "llwearable.h" #include "llwearablelist.h" -// -#include "llappviewer.h" // System Folders -#include "llfloateranimpreview.h" // for reuploads -#include "llfloaterimagepreview.h" // for reuploads -#include "statemachine/aifilepicker.h" -// - -// Editing wearables from inventory is an include-hungry feature -.- -SG -#include "llviewerparcelmgr.h" -#include "llfloatertools.h" -#include "lltoolcomp.h" -#include "llviewerjoystick.h" -#include "lltoolmgr.h" - #include "hippogridmanager.h" // [RLVa:KB] @@ -125,6 +88,8 @@ #include "rlvlocks.h" // [/RLVa:KB] +extern LLUUID gSystemFolderRoot; + // Marketplace outbox current disabled #define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1 #define ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU 1 @@ -229,22 +194,6 @@ public: } }; -// -void gotImageForSaveItemAs(BOOL success, - LLViewerTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata); -void gotAssetForSaveItemAs(LLVFS *vfs, - const LLUUID& asset_uuid, - LLAssetType::EType type, - void* user_data, S32 status, LLExtStat ext_status); -// - - - // +=================================================+ // | LLInvFVBridge | // +=================================================+ @@ -434,9 +383,6 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArraygetParentUUID() == trash_id) continue; move_ids.push_back(item->getUUID()); - // don't do stuff that messes with gMessageSystem - //LLPreview::hide(item->getUUID()); - // --update[item->getParentUUID()]; ++update[trash_id]; // @@ -475,6 +421,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArraysetEnabled(enabled); } } @@ -893,7 +841,6 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -1556,19 +1503,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) folder_view_itemp->getListener()->pasteLinkFromClipboard(); return; } - - // - else if("reupload" == action) - { - LLInventoryItem* item = model->getItem(mUUID); - if (item && item->getType() == LLAssetType::AT_TEXTURE) - { - AIFilePicker* filepicker = AIFilePicker::create(); - filepicker->open(FFLOAD_IMAGE, "", "image"); - filepicker->run(boost::bind(&LLItemBridge::showFloaterImagePreview, item, filepicker)); - } - } - // else if (isMarketplaceCopyAction(action)) { llinfos << "Copy item to marketplace action!" << llendl; @@ -1581,16 +1515,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) } } -// static -void LLItemBridge::showFloaterImagePreview(LLInventoryItem* item, AIFilePicker* filepicker) -{ - if (filepicker->hasFilename()) - { - LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filepicker->getFilename(), item); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml"); - } -} - void LLItemBridge::selectItem() { LLViewerInventoryItem* item = static_cast(getItem()); @@ -1634,17 +1558,17 @@ void LLItemBridge::restoreToWorld() itemp->packMessage(msg); msg->sendReliable(gAgent.getRegion()->getHost()); - //remove local inventory copy, sim will deal with permissions and removing the item - //from the actual inventory if its a no-copy etc - if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) - { + //remove local inventory copy, sim will deal with permissions and removing the item + //from the actual inventory if its a no-copy etc + if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) + { remove_from_inventory = true; - } + } - // Check if it's in the trash. (again similar to the normal rez logic) + // Check if it's in the trash. (again similar to the normal rez logic) const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) - { + if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) + { remove_from_inventory = true; } } @@ -1689,7 +1613,7 @@ PermissionMask LLItemBridge::getPermissionMask() const if (item) perm_mask = item->getPermissionMask(); return perm_mask; } - + const std::string& LLItemBridge::getDisplayName() const { if(mDisplayName.empty()) @@ -1701,9 +1625,9 @@ const std::string& LLItemBridge::getDisplayName() const void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name) { - if(item) + if(item) { - name.assign(item->getName()); + name.assign(item->getName()); } else { @@ -1741,7 +1665,7 @@ std::string LLItemBridge::getLabelSuffix() const static std::string BROKEN_LINK = LLTrans::getString("broken_link"); std::string suffix; LLInventoryItem* item = getItem(); - if(item) + if(item) { // Any type can have the link suffix... BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType()); @@ -1770,7 +1694,7 @@ std::string LLItemBridge::getLabelSuffix() const { suffix += NO_XFER; } - + BOOL temp = item->getPermissions().getGroup() == gAgent.getID(); if (temp) @@ -2017,7 +1941,6 @@ void LLFolderBridge::selectItem() { } - // Iterate through a folder's children to determine if // all the children are removable. class LLIsItemRemovable : public LLFolderViewFunctor @@ -2147,7 +2070,6 @@ BOOL LLFolderBridge::isClipboardPasteable() const } - BOOL LLFolderBridge::isClipboardPasteableAsLink() const { // Check normal paste-as-link permissions @@ -2288,7 +2210,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel* model = getInventoryModel(); if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL - if(!model) return FALSE; + if (!model) return FALSE; if (!isAgentAvatarValid()) return FALSE; if (!isAgentInventory()) return FALSE; // cannot drag categories into library @@ -2759,9 +2681,9 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Move to next if current folder empty if ((item_count == 0) && (cat_count == 0)) - { + { continue; - } + } uuid_vec_t ids; LLRightClickInventoryFetchObserver* outfit = NULL; @@ -2834,7 +2756,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryWearObserver // -// Observer for "copy and wear" operation to support knowing +// Observer for "copy and wear" operation to support knowing // when the all of the contents have been added to inventory. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLInventoryCopyAndWearObserver : public LLInventoryObserver @@ -2857,7 +2779,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) { if((mask & (LLInventoryObserver::ADD)) != 0) { - if (!mFolderAdded) + if (!mFolderAdded) { const std::set& changed_items = gInventory.getChangedIDs(); @@ -2865,7 +2787,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) std::set::const_iterator id_end = changed_items.end(); for (;id_it != id_end; ++id_it) { - if ((*id_it) == mCatID) + if ((*id_it) == mCatID) { mFolderAdded = TRUE; break; @@ -2873,13 +2795,13 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) } } - if (mFolderAdded) + if (mFolderAdded) { LLViewerInventoryCategory* category = gInventory.getCategory(mCatID); if (NULL == category) { llwarns << "gInventory.getCategory(" << mCatID - << ") was NULL" << llendl; + << ") was NULL" << llendl; } else { @@ -2890,7 +2812,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, FALSE); delete this; } - } + } } } @@ -2961,10 +2883,10 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) if(!model) return; LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; - - remove_inventory_category_from_avatar ( cat ); + + remove_inventory_category_from_avatar( cat ); return; - } + } else if ("purge" == action) { purgeItem(model, mUUID); @@ -3123,6 +3045,7 @@ BOOL LLFolderBridge::removeItem() return TRUE; } + BOOL LLFolderBridge::removeSystemFolder() { const LLViewerInventoryCategory *cat = getCategory(); @@ -3405,7 +3328,7 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) { // This is the lost+found folder. mItems.push_back(std::string("Empty Lost And Found")); - + mDisabledItems.push_back(std::string("New Folder")); mDisabledItems.push_back(std::string("New Script")); mDisabledItems.push_back(std::string("New Note")); @@ -3413,7 +3336,6 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) mDisabledItems.push_back(std::string("New Clothes")); mDisabledItems.push_back(std::string("New Body Parts")); } - if(trash_id == mUUID) { // This is the trash. @@ -3431,7 +3353,7 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) } else if(isAgentInventory()) // do not allow creating in library { - LLViewerInventoryCategory *cat = getCategory(); + LLViewerInventoryCategory *cat = getCategory(); // BAP removed protected check to re-enable standard ops in untyped folders. // Not sure what the right thing is to do here. if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT)) @@ -3475,7 +3397,7 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) { mCallingCards=TRUE; } - + LLFindWearables is_wearable; LLIsType is_object( LLAssetType::AT_OBJECT ); LLIsType is_gesture( LLAssetType::AT_GESTURE ); @@ -3497,14 +3419,13 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags) void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) { - // *TODO: Translate - + // Build folder specific options back up LLInventoryModel* model = getInventoryModel(); if(!model) return; const LLInventoryCategory* category = model->getCategory(mUUID); if(!category) return; - + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); if (trash_id == mUUID) return; if (isItemInTrash()) return; @@ -3518,7 +3439,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) const bool is_outfit = (type == LLFolderType::FT_OUTFIT); // [/SL:KB] - // Only enable calling-card related options for non-default folders. + // Only enable calling-card related options for non-system folders. if (!is_system_folder) { LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); @@ -3555,7 +3476,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) { mItems.push_back(std::string("Folder Wearables Separator")); - // Only enable add/replace outfit for non-default folders. + // Only enable add/replace outfit for non-system folders. if (!is_system_folder) { if (InventoryLinksEnabled() && @@ -3565,7 +3486,8 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) mItems.push_back(std::string("Add To Outfit")); } else if(!InventoryLinksEnabled()) - mItems.push_back(std::string("Wearable And Object Wear")); + mItems.push_back(std::string("Wearable And Object Wear")); + mItems.push_back(std::string("Replace Outfit")); } mItems.push_back(std::string("Remove From Outfit")); @@ -3597,7 +3519,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryModel* model = getInventoryModel(); if(!model) return; - + buildContextMenuBaseOptions(flags); // Add menu items that are dependent on the contents of the folder. @@ -3849,9 +3771,9 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response } two_uuids_list_t::iterator move_it; - for (move_it = move_inv->mMoveList.begin(); - move_it != move_inv->mMoveList.end(); - ++move_it) + for (move_it = move_inv->mMoveList.begin(); + move_it != move_inv->mMoveList.end(); + ++move_it) { object->moveInventory(move_it->first, move_it->second); } @@ -3956,8 +3878,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { LLInventoryModel* model = getInventoryModel(); - if(!model || !inv_item) return FALSE; - if(!isAgentInventory()) return FALSE; // cannot drag into library + if (!model || !inv_item) return FALSE; + if (!isAgentInventory()) return FALSE; // cannot drag into library if (!isAgentAvatarValid()) return FALSE; LLInventoryPanel* destination_panel = mInventoryPanel.get(); @@ -3993,22 +3915,22 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, switch (inv_item->getActualType()) { - //case LLFolderType::FT_ROOT_CATEGORY: - // is_movable = FALSE; - // break; + //case LLFolderType::FT_ROOT_CATEGORY: + // is_movable = FALSE; + // break; - case LLAssetType::AT_CATEGORY: - is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); - break; - default: - break; + case LLAssetType::AT_CATEGORY: + is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); + break; + default: + break; } - + // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) { is_movable = FALSE; } - + // [RLVa:KB] - Checked: 2011-03-29 (RLVa-1.3.0g) | Modified: RLVa-1.3.0g if ( (rlv_handler_t::isEnabled()) && (is_movable) ) { @@ -4103,7 +4025,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (!active_folder_view) return false; } - if(accept && drop) + if (accept && drop) { if (inv_item->getType() == LLAssetType::AT_GESTURE && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) @@ -4117,9 +4039,27 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, active_panel->unSelectAll(); } + //-------------------------------------------------------------------------------- + // Destination folder logic + // + + /* Singu TODO: Favorites + // REORDER + // (only reorder the item in Favorites folder) + if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites) + { + LLFolderViewItem* itemp = destination_panel->getRootFolder()->getDraggingOverItem(); + if (itemp) + { + LLUUID srcItemId = inv_item->getUUID(); + LLUUID destItemId = itemp->getListener()->getUUID(); + gInventory.rearrangeFavoriteLandmarks(srcItemId, destItemId); + } + } + // FAVORITES folder // (copy the item) - if (move_is_into_favorites) + else */if (move_is_into_favorites) { dropToFavorites(inv_item); } @@ -4161,13 +4101,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, //-------------------------------------------------------------------------------- } } - else if(LLToolDragAndDrop::SOURCE_WORLD == source) + else if (LLToolDragAndDrop::SOURCE_WORLD == source) { // Make sure the object exists. If we allowed dragging from // anonymous objects, it would be possible to bypass // permissions. object = gObjectList.findObject(inv_item->getParentUUID()); - if(!object) + if (!object) { llinfos << "Object not found for drop." << llendl; return FALSE; @@ -4177,7 +4117,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // move/copy this item. LLPermissions perm(inv_item->getPermissions()); BOOL is_move = FALSE; - if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) + if ((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID()))) // || gAgent.isGodlike()) { @@ -4227,12 +4167,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { // store dad inventory item to select added one later. See EXT-4347 set_dad_inventory_item(inv_item, mUUID); + LLNotification::Params params("MoveInventoryFromObject"); params.functor(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); LLNotifications::instance().forceResponse(params, 0); } } - } else if(LLToolDragAndDrop::SOURCE_NOTECARD == source) { @@ -4376,23 +4316,6 @@ void LLTextureBridge::openItem() } } -// virtual -void LLTextureBridge::performAction(LLInventoryModel* model, std::string action) -{ - // TODO - /*if ("save_as" == action) - { - LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); - LLPreviewTexture* preview_texture = LLFloaterReg::findTypedInstance("preview_texture", mUUID); - if (preview_texture) - { - preview_texture->openToSave(); - } - } - else*/ - LLItemBridge::performAction(model, action); -} - void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; @@ -4412,8 +4335,9 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Properties")); getClipboardEntries(true, items, disabled_items, flags); - //TODO - /*items.push_back(std::string("Texture Separator")); + + /* Singu TODO + items.push_back(std::string("Texture Separator")); items.push_back(std::string("Save As")); if (!canSaveTexture()) { @@ -4423,6 +4347,21 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) hide_context_entries(menu, items, disabled_items); } +// virtual +void LLTextureBridge::performAction(LLInventoryModel* model, std::string action) +{ + /* Singu TODO + if ("save_as" == action) + { + LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); + LLPreviewTexture* preview_texture = LLFloaterReg::findTypedInstance("preview_texture", mUUID); + if (preview_texture) + { + preview_texture->openToSave(); + } + } + else*/ LLItemBridge::performAction(model, action); +} // +=================================================+ // | LLSoundBridge | @@ -4430,8 +4369,8 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) void LLSoundBridge::openItem() { - LLViewerInventoryItem* item = getItem(); - if(item) + const LLViewerInventoryItem* item = getItem(); + if (item) { LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } @@ -4553,6 +4492,7 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { disabled_items.push_back(std::string("Teleport To Landmark")); } + hide_context_entries(menu, items, disabled_items); } @@ -4590,7 +4530,7 @@ void LLLandmarkBridge::performAction(LLInventoryModel* model, std::string action open_landmark(item, std::string(" Landmark: ") + item->getName(), FALSE); } } - else + else { LLItemBridge::performAction(model, action); } @@ -4660,9 +4600,9 @@ public: LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {} virtual ~LLCallingCardObserver() { mBridgep = NULL; } virtual void changed(U32 mask) -{ - mBridgep->refreshFolderViewItem(); -} + { + mBridgep->refreshFolderViewItem(); + } protected: LLCallingCardBridge* mBridgep; }; @@ -4764,7 +4704,6 @@ void LLCallingCardBridge::openItem() void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -4861,7 +4800,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, } break; } - case DAD_CATEGORY: + case DAD_CATEGORY: { LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data; if( gInventory.getCategory( inv_cat->getUUID() ) ) @@ -4883,8 +4822,8 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, } break; } - default: - break; + default: + break; } } return rv; @@ -4958,7 +4897,6 @@ void LLNotecardBridge::openItem() } } - // +=================================================+ // | LLGestureBridge | // +=================================================+ @@ -5088,7 +5026,6 @@ BOOL LLGestureBridge::removeItem() void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLGestureBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5141,7 +5078,6 @@ void LLGestureBridge::playGesture(const LLUUID& item_id) void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5170,7 +5106,6 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } hide_context_entries(menu, items, disabled_items); - } // virtual @@ -5179,28 +5114,28 @@ void LLAnimationBridge::performAction(LLInventoryModel* model, std::string actio if ((action == "playworld") || (action == "playlocal")) { // See if we can bring an existing preview to the front - if(LLPreview::show( mUUID )) + if (LLPreview::show(mUUID)) return; - if( getItem() ) + if (getItem()) { LLPreviewAnim::e_activation_type activate = LLPreviewAnim::NONE; if ("playworld" == action) activate = LLPreviewAnim::PLAY; if ("playlocal" == action) activate = LLPreviewAnim::AUDITION; - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - LLPreviewAnim* preview = new LLPreviewAnim("preview anim", - rect, - "Animations: " + getItem()->getName(), - mUUID, - activate); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - } + S32 left, top; + gFloaterView->getNewFloaterPosition(&left, &top); + LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); + rect.translate( left - rect.mLeft, top - rect.mTop ); + LLPreviewAnim* preview = new LLPreviewAnim("preview anim", + rect, + "Animations: " + getItem()->getName(), + mUUID, + activate); + // Force to be entirely onscreen. + gFloaterView->adjustToFitScreen(preview, FALSE); } + } else { LLItemBridge::performAction(model, action); @@ -5245,7 +5180,7 @@ LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, LLUIImagePtr LLObjectBridge::getIcon() const { - return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject ); + return LLInventoryIcon::getIcon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject); } LLInventoryObject* LLObjectBridge::getObject() const @@ -5269,7 +5204,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) item = (LLViewerInventoryItem*)gInventory.getItem(object_id); if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID())) { - rez_attachment(item, NULL, true); + rez_attachment(item, NULL, true); // Replace if "Wear"ing. } else if(item && item->isFinished()) { @@ -5295,52 +5230,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) } else if ("edit" == action) { - if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) - return; - LLVOAvatar* avatarp = gAgentAvatarp; - if (!avatarp) - return; - LLViewerObject* objectp = avatarp->getWornAttachment(mUUID); - if (!objectp) - return; - - // [Selective copy/paste from LLObjectEdit::handleEvent()] - LLViewerParcelMgr::getInstance()->deselectLand(); - LLSelectMgr::getInstance()->deselectAll(); - - if (gAgentCamera.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) - { - if (objectp->isHUDAttachment() || !gSavedSettings.getBOOL("EditCameraMovement")) - { - // always freeze camera in space, even if camera doesn't move - // so, for example, follow cam scripts can't affect you when in build mode - gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null); - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); - } - else - { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); - - // zoom in on object center instead of where we clicked, as we need to see the manipulator handles - gAgentCamera.setFocusGlobal(objectp->getPositionGlobal(), objectp->getID()); - gAgentCamera.cameraZoomIn(0.666f); - gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD ); - gViewerWindow->moveCursorToCenter(); - } - } - - gFloaterTools->open(); - - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); - - LLViewerJoystick::getInstance()->moveObjects(true); - LLViewerJoystick::getInstance()->setNeedsReset(true); - - LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); - - // Could be first use - LLFirstUse::useBuild(); + handle_attachment_edit(mUUID); } else LLItemBridge::performAction(model, action); } @@ -5361,9 +5251,14 @@ std::string LLObjectBridge::getLabelSuffix() const { return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn"); } + std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID); + if (attachment_point_name == LLStringUtil::null) // Error condition, invalid attach point + { + attachment_point_name = "Invalid Attachment"; + } // e.g. "(worn on ...)" / "(attached to ...)" LLStringUtil::format_map_t args; - args["[ATTACHMENT_POINT]"] = LLTrans::getString(gAgentAvatarp->getAttachedPointName(mUUID)); + args["[ATTACHMENT_POINT]"] = LLTrans::getString(attachment_point_name); if(gRlvAttachmentLocks.canDetach(getItem())) return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args); @@ -5450,7 +5345,7 @@ bool confirm_attachment_rez(const LLSD& notification, const LLSD& response) { LLUUID item_id = notification["payload"]["item_id"].asUUID(); LLViewerInventoryItem* itemp = gInventory.getItem(item_id); - + if (itemp) { /* @@ -5541,7 +5436,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Attach To HUD")); // commented out for DEV-32347 - AND Commented back in for non-morons. -HgB items.push_back(std::string("Restore to Last Position")); - + if (!gAgentAvatarp->canAttachMoreObjects()) { disabled_items.push_back(std::string("Wearable And Object Wear")); @@ -5617,7 +5512,6 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) buildDisplayName(new_item, mDisplayName); new_item->updateServer(FALSE); model->updateItem(new_item); - model->notifyObservers(); if (isAgentAvatarValid()) @@ -5803,6 +5697,7 @@ std::string LLWearableBridge::getLabelSuffix() const { return LLItemBridge::getLabelSuffix() + LLTrans::getString("locked"); } + // e.g. "(worn)" return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn"); } else @@ -5890,7 +5785,6 @@ void LLWearableBridge::openItem() void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLWearableBridge::buildContextMenu()" << llendl; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5932,7 +5826,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) getClipboardEntries(true, items, disabled_items, flags); items.push_back(std::string("Wearable And Object Separator")); - + items.push_back(std::string("Wearable Edit")); /*// [RLVa:KB] - Checked: 2011-09-16 (RLVa-1.1.4a) | Added: RLVa-1.1.4a if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) ) @@ -6050,6 +5944,7 @@ void LLWearableBridge::onWearOnAvatar(void* user_data) void LLWearableBridge::wearOnAvatar() { + // TODO: investigate wearables may not be loaded at this point EXT-8231 // Don't wear anything until initial wearables are loaded, can // destroy clothing items. if (!gAgentWearables.areWearablesLoaded()) @@ -6144,7 +6039,7 @@ BOOL LLWearableBridge::canEditOnAvatar(void* user_data) return (get_is_item_worn(self->mUUID)); } -// static +// static void LLWearableBridge::onEditOnAvatar(void* user_data) { LLWearableBridge* self = (LLWearableBridge*)user_data; @@ -6238,7 +6133,7 @@ void LLWearableBridge::removeFromAvatar() // +=================================================+ // | LLLinkItemBridge | // +=================================================+ -// For broken links +// For broken item links std::string LLLinkItemBridge::sPrefix("Link: "); @@ -6305,7 +6200,6 @@ void LLMeshBridge::previewItem() } } - void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { lldebugs << "LLMeshBridge::buildContextMenu()" << llendl; @@ -6377,7 +6271,7 @@ void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("Find Original")); addDeleteContextMenuOptions(items, disabled_items); - } + } hide_context_entries(menu, items, disabled_items); } void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string action) @@ -6471,8 +6365,7 @@ class LLTextureBridgeAction: public LLInvFVBridgeAction public: virtual void doIt() { - LLViewerInventoryItem* item = getItem(); - if (item) + if (const LLViewerInventoryItem* item = getItem()) { open_texture(mUUID, std::string("Texture: ") + item->getName(), FALSE); } @@ -6529,7 +6422,7 @@ public: payload["asset_id"] = item->getAssetUUID(); payload["item_id"] = item->getUUID(); - + LLSD args; args["LOCATION"] = item->getName(); @@ -6620,7 +6513,6 @@ public: // See if we can bring an existing preview to the front if(!LLPreview::show( mUUID )) { - S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); @@ -6740,14 +6632,18 @@ void LLWearableBridgeAction::wearOnAvatar() { // TODO: investigate wearables may not be loaded at this point EXT-8231 - static LLCachedControl add(gSavedSettings, "LiruAddNotReplace"); LLViewerInventoryItem* item = getItem(); if(item) { if (get_is_item_worn(item)) + { LLAppearanceMgr::instance().removeItemFromAvatar(item->getUUID()); + } else + { + static LLCachedControl add(gSavedSettings, "LiruAddNotReplace"); LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, !add); + } } } @@ -6795,6 +6691,10 @@ LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_ return action; } +/** Bridge Actions + ** + ********************************************************************************/ + /************************************************************************/ /* Recent Inventory Panel related classes */ /************************************************************************/ @@ -6819,27 +6719,14 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( U32 flags /*= 0x00*/ ) const { LLInvFVBridge* new_listener = NULL; - switch(asset_type) + if (asset_type == LLAssetType::AT_CATEGORY + && actual_asset_type != LLAssetType::AT_LINK_FOLDER) { - case LLAssetType::AT_CATEGORY: - if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) - { - // *TODO: Create a link folder handler instead if it is necessary - new_listener = LLInventoryFVBridgeBuilder::createBridge( - asset_type, - actual_asset_type, - inv_type, - inventory, - root, - uuid, - flags); - break; - } new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid); - break; - default: - new_listener = LLInventoryFVBridgeBuilder::createBridge( - asset_type, + } + else + { + new_listener = LLInventoryFVBridgeBuilder::createBridge(asset_type, actual_asset_type, inv_type, inventory, @@ -6848,8 +6735,6 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( flags); } return new_listener; - } - // EOF diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index c795e6c57..fdcfac11c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -74,7 +74,6 @@ BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE; ///---------------------------------------------------------------------------- //BOOL decompress_file(const char* src_filename, const char* dst_filename); - const char CACHE_FORMAT_STRING[] = "%s.inv"; struct InventoryIDPtrLess @@ -531,8 +530,8 @@ private: LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLFolderType::EType preferred_type, const std::string& pname, - void (*callback)(const LLSD&, void*)/*=NULL*/, - void* user_data/*=NULL*/) + void (*callback)(const LLSD&, void*), //Default to NULL + void* user_data) //Default to NULL { LLUUID id; if(!isInventoryUsable()) @@ -1100,9 +1099,6 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item, const LLUUID& new_parent_id, BOOL restamp) { - // - bool send_parent_update = gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getRootFolderID()); - // if (item->getParentUUID() == new_parent_id) { LL_DEBUGS("Inventory") << "'" << item->getName() << "' (" << item->getUUID() @@ -1123,7 +1119,7 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item, LLPointer new_item = new LLViewerInventoryItem(item); new_item->setParent(new_parent_id); // - if(send_parent_update) + if(gInventory.isObjectDescendentOf(item->getUUID(), gInventory.getRootFolderID())) // new_item->updateParentOnServer(restamp); updateItem(new_item); @@ -1254,7 +1250,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) return; } LLPointer cat = getCategory(id); - if(cat.notNull()) + if (cat.notNull()) { if (LLInventoryClipboard::instance().hasContents() && LLInventoryClipboard::instance().isCutMode()) { @@ -1290,7 +1286,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) // Fast purge // do the cache accounting llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName() - << llendl; + << llendl; S32 descendents = cat->getDescendentCount(); if(descendents > 0) { @@ -1325,6 +1321,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) { deleteObject(items.get(i)->getUUID()); } + count = categories.count(); for(S32 i = 0; i < count; ++i) { @@ -1377,7 +1374,6 @@ void LLInventoryModel::notifyObservers() iter != mObservers.end(); ) { LLInventoryObserver* observer = *iter; - observer->changed(mModifyMask); // safe way to increment since changed may delete entries! (@!##%@!@&*!) @@ -1563,7 +1559,7 @@ void LLInventoryModel::addCategory(LLViewerInventoryCategory* category) } // try to localize default names first. See EXT-8319, EXT-7051. - //category->localizeName(); + category->localizeName(); // Insert category uniquely into the map mCategoryMap[category->getUUID()] = category; // LLPointer will deref and delete the old one @@ -1643,7 +1639,7 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const cat->setVersion(++version); lldebugs << "accounted: '" << cat->getName() << "' " << version << " with " << descendents_actual - << " descendents." << llendl; + << " descendents." << llendl; } } if(!accounted) @@ -1890,7 +1886,7 @@ bool LLInventoryModel::loadSkeleton( LLViewerInventoryCategory* tcat = *cit; // we can safely ignore anything loaded from file, but - // not sent down in the skeleton. + // not sent down in the skeleton. Must have been removed from inventory. if (cit == not_cached) { continue; @@ -2351,73 +2347,6 @@ bool LLUUIDAndName::operator>(const LLUUIDAndName& rhs) const return (mID > rhs.mID); } -// Given the current state of the inventory items, figure out the -// clone information. *FIX: This is sub-optimal, since we can insert -// this information snurgically, but this makes sure the implementation -// works before we worry about optimization. -//void LLInventoryModel::recalculateCloneInformation() -//{ -// //dumpInventory(); -// -// // This implements a 'multi-map' like structure to keep track of -// // how many clones we find. -// typedef LLDynamicArray viewer_item_array_t; -// typedef std::map clone_map_t; -// clone_map_t clone_map; -// LLUUIDAndName id_and_name; -// viewer_item_array_t* clones = NULL; -// LLViewerInventoryItem* item = NULL; -// for(item = (LLViewerInventoryItem*)mItemMap.getFirstData(); -// item != NULL; -// item = (LLViewerInventoryItem*)mItemMap.getNextData()) -// { -// if(item->getType() == LLAssetType::AT_CALLINGCARD) -// { -// // if it's a calling card, we key off of the creator id, not -// // the asset id. -// id_and_name.mID = item->getCreatorUUID(); -// } -// else -// { -// // if it's not a calling card, we key clones from the -// // asset id. -// id_and_name.mID = item->getAssetUUID(); -// } -// if(id_and_name.mID == LLUUID::null) -// { -// continue; -// } -// id_and_name.mName = item->getName(); -// if(clone_map.checkData(id_and_name)) -// { -// clones = clone_map.getData(id_and_name); -// } -// else -// { -// clones = new viewer_item_array_t; -// clone_map.addData(id_and_name, clones); -// } -// clones->put(item); -// } -// -// S32 count = 0; -// for(clones = clone_map.getFirstData(); -// clones != NULL; -// clones = clone_map.getNextData()) -// { -// count = clones->count(); -// for(S32 i = 0; i < count; i++) -// { -// item = clones->get(i); -// item->setCloneCount(count - 1); -// //clones[i] = NULL; -// } -// delete clones; -// } -// clone_map.removeAllData(); -// //dumpInventory(); -//} - // static bool LLInventoryModel::loadFromFile(const std::string& filename, LLInventoryModel::cat_array_t& categories, @@ -2480,7 +2409,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, { if (is_cache_obsolete) break; - + LLPointer inv_item = new LLViewerInventoryItem; if( inv_item->importFileLocal(file) ) { @@ -3002,7 +2931,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // << titem->getParentUUID() << llendl; U32 callback_id; msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id); - if(titem->getUUID().notNull()) + if(titem->getUUID().notNull() ) // && callback_id.notNull() ) { items.push_back(titem); cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID())); @@ -3116,6 +3045,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) msg->getS32("AgentData", "Version", version); S32 descendents; msg->getS32("AgentData", "Descendents", descendents); + S32 i; S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); LLPointer tcategory = new LLViewerInventoryCategory(owner_id); @@ -3421,7 +3351,8 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c } //* @param[in] items vector of items in order to be saved. -/*void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items) +/* +void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items) { int sortField = 0; @@ -3441,8 +3372,8 @@ void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, c } notifyObservers(); -}*/ - +} +*/ // See also LLInventorySort where landmarks in the Favorites folder are sorted. /*class LLViewerInventoryItemSort { @@ -3466,7 +3397,8 @@ public: // * @param source_item_id - LLUUID of the source item to be moved into new position // * @param target_item_id - LLUUID of the target item before which source item should be placed. -/*void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id) +/* +void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -3481,7 +3413,10 @@ public: updateItemsOrder(items, source_item_id, target_item_id); saveItemsOrder(items); -}*/ +} +*/ +//---------------------------------------------------------------------------- + // *NOTE: DEBUG functionality void LLInventoryModel::dumpInventory() const { @@ -3493,8 +3428,8 @@ void LLInventoryModel::dumpInventory() const if(cat) { llinfos << " " << cat->getUUID() << " '" << cat->getName() << "' " - << cat->getVersion() << " " << cat->getDescendentCount() << " parent: " << cat->getParentUUID() - << LL_ENDL; + << cat->getVersion() << " " << cat->getDescendentCount() << " parent: " << cat->getParentUUID() + << llendl; } else { diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 0063c9073..eb3e35997 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -63,11 +63,140 @@ #include "llfloatercustomize.h" // #include "llappviewer.h" // System Folders +// // Two do-nothing ops for use in callbacks. void no_op_inventory_func(const LLUUID&) {} void no_op() {} -// + +///---------------------------------------------------------------------------- +/// Helper class to store special inventory item names and their localized values. +///---------------------------------------------------------------------------- +class LLLocalizedInventoryItemsDictionary : public LLSingleton +{ +public: + std::map mInventoryItemsDict; + + LLLocalizedInventoryItemsDictionary() + { + mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape"); + mInventoryItemsDict["New Skin"] = LLTrans::getString("New Skin"); + mInventoryItemsDict["New Hair"] = LLTrans::getString("New Hair"); + mInventoryItemsDict["New Eyes"] = LLTrans::getString("New Eyes"); + mInventoryItemsDict["New Shirt"] = LLTrans::getString("New Shirt"); + mInventoryItemsDict["New Pants"] = LLTrans::getString("New Pants"); + mInventoryItemsDict["New Shoes"] = LLTrans::getString("New Shoes"); + mInventoryItemsDict["New Socks"] = LLTrans::getString("New Socks"); + mInventoryItemsDict["New Jacket"] = LLTrans::getString("New Jacket"); + mInventoryItemsDict["New Gloves"] = LLTrans::getString("New Gloves"); + mInventoryItemsDict["New Undershirt"] = LLTrans::getString("New Undershirt"); + mInventoryItemsDict["New Underpants"] = LLTrans::getString("New Underpants"); + mInventoryItemsDict["New Skirt"] = LLTrans::getString("New Skirt"); + mInventoryItemsDict["New Alpha"] = LLTrans::getString("New Alpha"); + mInventoryItemsDict["New Tattoo"] = LLTrans::getString("New Tattoo"); + mInventoryItemsDict["New Physics"] = LLTrans::getString("New Physics"); + mInventoryItemsDict["Invalid Wearable"] = LLTrans::getString("Invalid Wearable"); + + mInventoryItemsDict["New Gesture"] = LLTrans::getString("New Gesture"); + mInventoryItemsDict["New Script"] = LLTrans::getString("New Script"); + mInventoryItemsDict["New Folder"] = LLTrans::getString("New Folder"); + mInventoryItemsDict["New Note"] = LLTrans::getString("New Note"); + mInventoryItemsDict["Contents"] = LLTrans::getString("Contents"); + + mInventoryItemsDict["Gesture"] = LLTrans::getString("Gesture"); + mInventoryItemsDict["Male Gestures"] = LLTrans::getString("Male Gestures"); + mInventoryItemsDict["Female Gestures"] = LLTrans::getString("Female Gestures"); + mInventoryItemsDict["Other Gestures"] = LLTrans::getString("Other Gestures"); + mInventoryItemsDict["Speech Gestures"] = LLTrans::getString("Speech Gestures"); + mInventoryItemsDict["Common Gestures"] = LLTrans::getString("Common Gestures"); + + //predefined gestures + + //male + mInventoryItemsDict["Male - Excuse me"] = LLTrans::getString("Male - Excuse me"); + mInventoryItemsDict["Male - Get lost"] = LLTrans::getString("Male - Get lost"); // double space after Male. EXT-8319 + mInventoryItemsDict["Male - Blow kiss"] = LLTrans::getString("Male - Blow kiss"); + mInventoryItemsDict["Male - Boo"] = LLTrans::getString("Male - Boo"); + mInventoryItemsDict["Male - Bored"] = LLTrans::getString("Male - Bored"); + mInventoryItemsDict["Male - Hey"] = LLTrans::getString("Male - Hey"); + mInventoryItemsDict["Male - Laugh"] = LLTrans::getString("Male - Laugh"); + mInventoryItemsDict["Male - Repulsed"] = LLTrans::getString("Male - Repulsed"); + mInventoryItemsDict["Male - Shrug"] = LLTrans::getString("Male - Shrug"); + mInventoryItemsDict["Male - Stick tougue out"] = LLTrans::getString("Male - Stick tougue out"); + mInventoryItemsDict["Male - Wow"] = LLTrans::getString("Male - Wow"); + + //female + mInventoryItemsDict["Female - Chuckle"] = LLTrans::getString("Female - Chuckle"); + mInventoryItemsDict["Female - Cry"] = LLTrans::getString("Female - Cry"); + mInventoryItemsDict["Female - Embarrassed"] = LLTrans::getString("Female - Embarrassed"); + mInventoryItemsDict["Female - Excuse me"] = LLTrans::getString("Female - Excuse me"); + mInventoryItemsDict["Female - Get lost"] = LLTrans::getString("Female - Get lost"); // double space after Female. EXT-8319 + mInventoryItemsDict["Female - Blow kiss"] = LLTrans::getString("Female - Blow kiss"); + mInventoryItemsDict["Female - Boo"] = LLTrans::getString("Female - Boo"); + mInventoryItemsDict["Female - Bored"] = LLTrans::getString("Female - Bored"); + mInventoryItemsDict["Female - Hey"] = LLTrans::getString("Female - Hey"); + mInventoryItemsDict["Female - Hey baby"] = LLTrans::getString("Female - Hey baby"); + mInventoryItemsDict["Female - Laugh"] = LLTrans::getString("Female - Laugh"); + mInventoryItemsDict["Female - Looking good"] = LLTrans::getString("Female - Looking good"); + mInventoryItemsDict["Female - Over here"] = LLTrans::getString("Female - Over here"); + mInventoryItemsDict["Female - Please"] = LLTrans::getString("Female - Please"); + mInventoryItemsDict["Female - Repulsed"] = LLTrans::getString("Female - Repulsed"); + mInventoryItemsDict["Female - Shrug"] = LLTrans::getString("Female - Shrug"); + mInventoryItemsDict["Female - Stick tougue out"]= LLTrans::getString("Female - Stick tougue out"); + mInventoryItemsDict["Female - Wow"] = LLTrans::getString("Female - Wow"); + + //common + mInventoryItemsDict["/bow"] = LLTrans::getString("/bow"); + mInventoryItemsDict["/clap"] = LLTrans::getString("/clap"); + mInventoryItemsDict["/count"] = LLTrans::getString("/count"); + mInventoryItemsDict["/extinguish"] = LLTrans::getString("/extinguish"); + mInventoryItemsDict["/kmb"] = LLTrans::getString("/kmb"); + mInventoryItemsDict["/muscle"] = LLTrans::getString("/muscle"); + mInventoryItemsDict["/no"] = LLTrans::getString("/no"); + mInventoryItemsDict["/no!"] = LLTrans::getString("/no!"); + mInventoryItemsDict["/paper"] = LLTrans::getString("/paper"); + mInventoryItemsDict["/pointme"] = LLTrans::getString("/pointme"); + mInventoryItemsDict["/pointyou"] = LLTrans::getString("/pointyou"); + mInventoryItemsDict["/rock"] = LLTrans::getString("/rock"); + mInventoryItemsDict["/scissor"] = LLTrans::getString("/scissor"); + mInventoryItemsDict["/smoke"] = LLTrans::getString("/smoke"); + mInventoryItemsDict["/stretch"] = LLTrans::getString("/stretch"); + mInventoryItemsDict["/whistle"] = LLTrans::getString("/whistle"); + mInventoryItemsDict["/yes"] = LLTrans::getString("/yes"); + mInventoryItemsDict["/yes!"] = LLTrans::getString("/yes!"); + mInventoryItemsDict["afk"] = LLTrans::getString("afk"); + mInventoryItemsDict["dance1"] = LLTrans::getString("dance1"); + mInventoryItemsDict["dance2"] = LLTrans::getString("dance2"); + mInventoryItemsDict["dance3"] = LLTrans::getString("dance3"); + mInventoryItemsDict["dance4"] = LLTrans::getString("dance4"); + mInventoryItemsDict["dance5"] = LLTrans::getString("dance5"); + mInventoryItemsDict["dance6"] = LLTrans::getString("dance6"); + mInventoryItemsDict["dance7"] = LLTrans::getString("dance7"); + 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("InventoryLocalize") << "Searching for localization: " << object_name << LL_ENDL; + + std::map::const_iterator dictionary_iter = mInventoryItemsDict.find(object_name); + + bool found = dictionary_iter != mInventoryItemsDict.end(); + if(found) + { + object_name = dictionary_iter->second; + LL_DEBUGS("InventoryLocalize") << "Found, new name is: " << object_name << LL_ENDL; + } + return found; + } +}; + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -165,13 +294,10 @@ void LLViewerInventoryItem::cloneViewerItem(LLPointer& ne void LLViewerInventoryItem::removeFromServer() { // this check is ghetto - if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) - { - return; - } + if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return; // - llinfos << "Removing inventory item " << mUUID << " from server." - << llendl; + lldebugs << "Removing inventory item " << mUUID << " from server." + << llendl; LLInventoryModel::LLCategoryUpdate up(mParentUUID, -1); gInventory.accountForUpdate(up); @@ -189,22 +315,14 @@ void LLViewerInventoryItem::removeFromServer() void LLViewerInventoryItem::updateServer(BOOL is_new) const { // - //if(gAgent.getID() != mPermissions.getOwner()) - //{ - // // *FIX: deal with this better. - // llwarns << "LLViewerInventoryItem::updateServer() - for unowned item" - // << llendl; - if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) - { + if((mParentUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return; // - return; - } if(!mIsComplete) { // *FIX: deal with this better. llwarns << "LLViewerInventoryItem::updateServer() - for incomplete item" << llendl; - LLNotificationsUtil::add("IncompleteInventoryItem"); + LLNotificationsUtil::add("IncompleteInventoryItem"); return; } if(gAgent.getID() != mPermissions.getOwner()) @@ -286,6 +404,9 @@ void LLViewerInventoryItem::fetchFromServer(void) const BOOL LLViewerInventoryItem::unpackMessage(LLSD item) { BOOL rv = LLInventoryItem::fromLLSD(item); + + LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); + mIsComplete = TRUE; return rv; } @@ -294,6 +415,9 @@ BOOL LLViewerInventoryItem::unpackMessage(LLSD item) BOOL LLViewerInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) { BOOL rv = LLInventoryItem::unpackMessage(msg, block, block_num); + + LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); + mIsComplete = TRUE; return rv; } @@ -429,7 +553,7 @@ void LLViewerInventoryCategory::copyViewerCategory(const LLViewerInventoryCatego { copyCategory(other); mOwnerID = other->mOwnerID; - mVersion = other->mVersion; + setVersion(other->getVersion()); mDescendentCount = other->mDescendentCount; mDescendentsRequested = other->mDescendentsRequested; } @@ -505,7 +629,7 @@ bool LLViewerInventoryCategory::fetch() // if((mUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return false; // - if((VERSION_UNKNOWN == mVersion) && + if((VERSION_UNKNOWN == getVersion()) && (!mDescendentsRequested.getStarted() || mDescendentsRequested.hasExpired())) //Expired check prevents multiple downloads. { @@ -720,6 +844,12 @@ void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type) setPreferredType(new_folder_type); gInventory.addChangedMask(LLInventoryObserver::LABEL, folder_id); } + +void LLViewerInventoryCategory::localizeName() +{ + LLLocalizedInventoryItemsDictionary::getInstance()->localizeInventoryObjectName(mName); +} + ///---------------------------------------------------------------------------- /// Local function definitions ///---------------------------------------------------------------------------- @@ -858,6 +988,25 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, U32 next_owner_perm, LLPointer cb) { + //check if name is equal to one of special inventory items names + //EXT-5839 + std::string server_name = name; + + { + std::map::const_iterator dictionary_iter; + + for (dictionary_iter = LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.begin(); + dictionary_iter != LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.end(); + dictionary_iter++) + { + const std::string& localized_name = dictionary_iter->second; + if(localized_name == name) + { + server_name = dictionary_iter->first; + } + } + } + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_CreateInventoryItem); msg->nextBlock(_PREHASH_AgentData); @@ -871,7 +1020,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, msg->addS8Fast(_PREHASH_Type, (S8)asset_type); msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); msg->addU8Fast(_PREHASH_WearableType, (U8)wtype); - msg->addStringFast(_PREHASH_Name, name); + msg->addStringFast(_PREHASH_Name, server_name); msg->addStringFast(_PREHASH_Description, desc); gAgent.sendReliableMessage(); diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 7c9e0652f..18c57f2a3 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -3,10 +3,9 @@ * @brief Declaration of the inventory bits that only used on the viewer. * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2002-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -211,7 +210,7 @@ public: // Returns true if a fetch was issued. bool fetch(); - // used to help make cacheing more robust - for example, if + // used to help make caching more robust - for example, if // someone is getting 4 packets but logs out after 3. the viewer // may never know the cache is wrong. enum { DESCENDENT_COUNT_UNKNOWN = -1 }; @@ -219,7 +218,7 @@ public: void setDescendentCount(S32 descendents) { mDescendentCount = descendents; } // file handling on the viewer. These are not meant for anything - // other than cacheing. + // other than caching. bool exportFileLocal(LLFILE* fp) const; bool importFileLocal(LLFILE* fp); void determineFolderType(); @@ -227,6 +226,7 @@ public: private: friend class LLInventoryModel; + void localizeName(); // intended to be called from the LLInventoryModel protected: LLUUID mOwnerID; @@ -327,6 +327,7 @@ extern LLInventoryCallbackManager gInventoryCallbacks; #define NOT_WEARABLE (LLWearableType::EType)0 +// *TODO: Find a home for these void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& parent, const LLTransactionID& transaction_id, const std::string& name, diff --git a/indra/newview/skins/default/xui/en-us/menu_inventory.xml b/indra/newview/skins/default/xui/en-us/menu_inventory.xml index ee207769a..cf35443f3 100644 --- a/indra/newview/skins/default/xui/en-us/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en-us/menu_inventory.xml @@ -177,10 +177,6 @@ mouse_opaque="true" name="Copy Asset UUID" width="128"> - - - diff --git a/indra/newview/skins/default/xui/en-us/strings.xml b/indra/newview/skins/default/xui/en-us/strings.xml index 22318c962..9749193f3 100644 --- a/indra/newview/skins/default/xui/en-us/strings.xml +++ b/indra/newview/skins/default/xui/en-us/strings.xml @@ -4121,6 +4121,72 @@ Abuse Report New Script New Note New Folder + Contents + Gesture + Male Gestures + Female Gestures + Other Gestures + Speech Gestures + Common Gestures + + Male - Excuse me + Male - Get lost + Male - Blow kiss + Male - Boo + Male - Bored + Male - Hey + Male - Laugh + Male - Repulsed + Male - Shrug + Male - Stick tongue out + Male - Wow + + Female - Chuckle + Female - Cry + Female - Embarrassed + Female - Excuse me + Female - Get lost + Female - Blow kiss + Female - Boo + Female - Bored + Female - Hey + Female - Hey baby + Female - Laugh + Female - Looking good + Female - Over here + Female - Please + Female - Repulsed + Female - Shrug + Female - Stick tongue out + Female - Wow + + /bow + /clap + /count + /extinguish + /kmb + /muscle + /no + /no! + /paper + /pointme + /pointyou + /rock + /scissor + /smoke + /stretch + /whistle + /yes + /yes! + afk + dance1 + dance2 + dance3 + dance4 + dance5 + dance6 + dance7 + dance8 none/none Chat diff --git a/indra/newview/skins/default/xui/es/menu_inventory.xml b/indra/newview/skins/default/xui/es/menu_inventory.xml index f6d662887..3662527b9 100644 --- a/indra/newview/skins/default/xui/es/menu_inventory.xml +++ b/indra/newview/skins/default/xui/es/menu_inventory.xml @@ -47,7 +47,6 @@ - diff --git a/indra/newview/skins/default/xui/fr/menu_inventory.xml b/indra/newview/skins/default/xui/fr/menu_inventory.xml index f90505134..8e7061632 100644 --- a/indra/newview/skins/default/xui/fr/menu_inventory.xml +++ b/indra/newview/skins/default/xui/fr/menu_inventory.xml @@ -47,7 +47,6 @@ -