From 2f2bdd83d6e078fb6cdcbb0ba0a9eaa38d45cc90 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 3 Nov 2009 00:47:23 +0000 Subject: For QAR-2014 : Sandbox for testing FolderTypes [VIEWER] svn merge -r136068:136089 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/folder-types__merge__viewer2.0.0-3-r135948 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3 Infrastructure changes for cleaning up Asset/Folder types. Associated sim changes are only so that the sim still compiles. --- indra/llcommon/CMakeLists.txt | 2 + indra/llcommon/llassettype.cpp | 154 +++--------- indra/llcommon/llassettype.h | 62 +---- indra/llcommon/llfoldertype.cpp | 165 +++++++++++++ indra/llcommon/llfoldertype.h | 123 ++++++++++ indra/llinventory/llinventory.cpp | 62 ++--- indra/llinventory/llinventory.h | 13 +- indra/llinventory/llinventorytype.cpp | 34 --- indra/llinventory/llinventorytype.h | 3 +- indra/llinventory/tests/inventorymisc_test.cpp | 4 +- indra/llmessage/lltransfersourceasset.cpp | 2 - indra/newview/CMakeLists.txt | 6 +- indra/newview/app_settings/foldertypes.xml | 25 +- indra/newview/llagentwearables.cpp | 17 +- indra/newview/llappearancemgr.cpp | 22 +- indra/newview/llassetuploadresponders.cpp | 2 +- indra/newview/llavataractions.cpp | 4 +- indra/newview/llfavoritesbar.cpp | 4 +- indra/newview/llfloateranimpreview.cpp | 2 +- indra/newview/llfloaterbulkpermission.cpp | 1 - indra/newview/llfloaterbuy.cpp | 2 +- indra/newview/llfloaterbuycontents.cpp | 2 +- indra/newview/llfloaterinventory.cpp | 27 +-- indra/newview/llfloaterinventory.h | 5 +- indra/newview/llfloaternamedesc.cpp | 2 +- indra/newview/llfloateropenobject.cpp | 4 +- indra/newview/llfloaterreporter.cpp | 4 +- indra/newview/llfloatersnapshot.cpp | 2 +- indra/newview/llfloaterworldmap.cpp | 2 +- indra/newview/llfolderview.cpp | 5 +- indra/newview/llfolderview.h | 2 +- indra/newview/llfoldervieweventlistener.h | 3 +- indra/newview/llfolderviewitem.cpp | 10 +- indra/newview/llfriendcard.cpp | 8 +- indra/newview/llinventorybridge.cpp | 96 ++++---- indra/newview/llinventorybridge.h | 8 +- indra/newview/llinventorymodel.cpp | 65 ++--- indra/newview/llinventorymodel.h | 13 +- indra/newview/lllandmarkactions.cpp | 8 +- indra/newview/llpanelcontents.cpp | 3 +- indra/newview/llpanellandmarks.cpp | 2 +- indra/newview/llpanelplaceinfo.cpp | 8 +- indra/newview/llpanelplaces.cpp | 4 +- indra/newview/llpreview.cpp | 5 +- indra/newview/llpreviewgesture.cpp | 4 +- indra/newview/llresourcedata.h | 3 +- indra/newview/llselectmgr.cpp | 2 +- indra/newview/llstartup.cpp | 6 +- indra/newview/lltexturectrl.cpp | 4 +- indra/newview/lltoastgroupnotifypanel.cpp | 1 - indra/newview/lltooldraganddrop.cpp | 21 +- indra/newview/llviewerassettype.cpp | 114 +++++++++ indra/newview/llviewerassettype.h | 54 +++++ indra/newview/llviewerfoldertype.cpp | 263 +++++++++++++++++++++ indra/newview/llviewerfoldertype.h | 57 +++++ indra/newview/llviewerinventory.cpp | 112 +++++---- indra/newview/llviewerinventory.h | 4 +- indra/newview/llviewermenu.cpp | 13 +- indra/newview/llviewermenufile.cpp | 16 +- indra/newview/llviewermenufile.h | 6 +- indra/newview/llviewermessage.cpp | 36 +-- indra/newview/llviewertexteditor.cpp | 20 +- indra/newview/llvoavatarself.cpp | 35 +-- indra/newview/llwearable.cpp | 2 +- .../skins/default/textures/inv_folder_inbox.tga | Bin 0 -> 2085 bytes .../skins/default/xui/en/panel_landmarks.xml | 18 +- 66 files changed, 1164 insertions(+), 624 deletions(-) create mode 100644 indra/llcommon/llfoldertype.cpp create mode 100644 indra/llcommon/llfoldertype.h create mode 100644 indra/newview/llviewerassettype.cpp create mode 100644 indra/newview/llviewerassettype.h create mode 100644 indra/newview/llviewerfoldertype.cpp create mode 100644 indra/newview/llviewerfoldertype.h create mode 100644 indra/newview/skins/default/textures/inv_folder_inbox.tga diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 7468e3dde4..910ba958f6 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -39,6 +39,7 @@ set(llcommon_SOURCE_FILES llfile.cpp llfindlocale.cpp llfixedbuffer.cpp + llfoldertype.cpp llformat.cpp llframetimer.cpp llheartbeat.cpp @@ -134,6 +135,7 @@ set(llcommon_HEADER_FILES llfile.h llfindlocale.h llfixedbuffer.h + llfoldertype.h llformat.h llframetimer.h llhash.h diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 0b016b81fb..41f0a46115 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -43,30 +43,21 @@ struct AssetEntry : public LLDictionaryEntry { AssetEntry(const char *desc_name, - const char *type_name, // 8 character limit! - const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one - const char *category_name, // used by llinventorymodel when creating new categories - EDragAndDropType dad_type, - bool can_link, // can you create a link to this type? - bool is_protected) // can the viewer change categories of this type? + const char *type_name, // 8 character limit! + const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one + bool can_link) // can you create a link to this type? : LLDictionaryEntry(desc_name), mTypeName(type_name), mHumanName(human_name), - mCategoryName(category_name), - mDadType(dad_type), - mCanLink(can_link), - mIsProtected(is_protected) + mCanLink(can_link) { llassert(strlen(mTypeName) <= 8); } const char *mTypeName; const char *mHumanName; - const char *mCategoryName; - EDragAndDropType mDadType; bool mCanLink; - bool mIsProtected; }; class LLAssetDictionary : public LLSingleton, @@ -78,48 +69,32 @@ public: LLAssetDictionary::LLAssetDictionary() { - // DESCRIPTION TYPE NAME HUMAN NAME CATEGORY NAME DRAG&DROP CAN LINK? PROTECTED? - // |--------------------|-----------|-------------------|-------------------|---------------|-----------|-----------| - addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", "Textures", DAD_TEXTURE, TRUE, TRUE)); - addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", "Sounds", DAD_SOUND, TRUE, TRUE)); - addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", "Calling Cards", DAD_CALLINGCARD, TRUE, TRUE)); - addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", "Landmarks", DAD_LANDMARK, TRUE, TRUE)); - addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", "Scripts", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", "Clothing", DAD_CLOTHING, TRUE, TRUE)); - addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", "Objects", DAD_OBJECT, TRUE, TRUE)); - addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", "Notecards", DAD_NOTECARD, TRUE, TRUE)); - addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", "New Folder", DAD_CATEGORY, TRUE, TRUE)); - addEntry(LLAssetType::AT_ROOT_CATEGORY, new AssetEntry("ROOT_CATEGORY", "root", "root", "Inventory", DAD_ROOT_CATEGORY, TRUE, TRUE)); - addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", "Scripts", DAD_SCRIPT, TRUE, TRUE)); - addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", "Scripts", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", "Body Parts", DAD_BODYPART, TRUE, TRUE)); - addEntry(LLAssetType::AT_TRASH, new AssetEntry("TRASH", "trash", "trash", "Trash", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_SNAPSHOT_CATEGORY, new AssetEntry("SNAPSHOT_CATEGORY", "snapshot", "snapshot", "Photo Album", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_LOST_AND_FOUND, new AssetEntry("LOST_AND_FOUND", "lstndfnd", "lost and found", "Lost And Found", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", "Uncompressed SoundS", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", "Animations", DAD_ANIMATION, TRUE, TRUE)); - addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", "Gestures", DAD_GESTURE, TRUE, TRUE)); - addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", "New Folder", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_FAVORITE, new AssetEntry("FAVORITE", "favorite", "favorite", "favorite", DAD_NONE, FALSE, TRUE)); - - addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", "Link", DAD_LINK, FALSE, TRUE)); - addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", "New Folder", DAD_LINK, FALSE, TRUE)); - - for (S32 ensemble_num = S32(LLAssetType::AT_FOLDER_ENSEMBLE_START); - ensemble_num <= S32(LLAssetType::AT_FOLDER_ENSEMBLE_END); - ensemble_num++) - { - addEntry(LLAssetType::EType(ensemble_num), new AssetEntry("ENSEMBLE", "ensemble", "ensemble", "New Folder", DAD_CATEGORY, FALSE, FALSE)); - } - - addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("CURRENT", "current", "current outfit", "Current Look", DAD_CATEGORY, FALSE, TRUE)); - addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", "New Look", DAD_CATEGORY, FALSE, FALSE)); - addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", "My Looks", DAD_CATEGORY, FALSE, TRUE)); - - addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, "New Folder", DAD_NONE, FALSE, FALSE)); + // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK? + // |--------------------|-----------|-------------------|-----------| + addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", FALSE)); + addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", FALSE)); + addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", FALSE)); + addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", FALSE)); + addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", FALSE)); + addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", TRUE)); + addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", TRUE)); + addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", FALSE)); + addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", TRUE)); + addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", FALSE)); + addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", FALSE)); + addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", FALSE)); + addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", TRUE)); + addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", FALSE)); + addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", FALSE)); + addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", FALSE)); + addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", FALSE)); + addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", TRUE)); + addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", FALSE)); + + addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", FALSE)); + addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", FALSE)); + + addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE)); }; // static @@ -140,8 +115,7 @@ const std::string &LLAssetType::getDesc(LLAssetType::EType asset_type) } else { - static const std::string error_string = "BAD TYPE"; - return error_string; + return badLookup(); } } @@ -156,7 +130,7 @@ const char *LLAssetType::lookup(LLAssetType::EType asset_type) } else { - return "-1"; + return badLookup().c_str(); } } @@ -166,6 +140,7 @@ LLAssetType::EType LLAssetType::lookup(const char* name) return lookup(ll_safe_string(name)); } +// static LLAssetType::EType LLAssetType::lookup(const std::string& type_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); @@ -193,7 +168,7 @@ const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type) } else { - return NULL; + return badLookup().c_str(); } } @@ -203,6 +178,7 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name) return lookupHumanReadable(ll_safe_string(name)); } +// static LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); @@ -219,32 +195,6 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_ return AT_NONE; } -// static -const char *LLAssetType::lookupCategoryName(LLAssetType::EType asset_type) -{ - const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - const AssetEntry *entry = dict->lookup(asset_type); - if (entry) - { - return entry->mCategoryName; - } - else - { - return "New Folder"; - } -} - -// static -EDragAndDropType LLAssetType::lookupDragAndDropType(EType asset_type) -{ - const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - const AssetEntry *entry = dict->lookup(asset_type); - if (entry) - return entry->mDadType; - else - return DAD_NONE; -} - // static bool LLAssetType::lookupCanLink(EType asset_type) { @@ -269,36 +219,8 @@ bool LLAssetType::lookupIsLinkType(EType asset_type) } // static -// Only ensembles and plain folders aren't protected. "Protected" means -// you can't change certain properties such as their type. -bool LLAssetType::lookupIsProtectedCategoryType(EType asset_type) -{ - const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - const AssetEntry *entry = dict->lookup(asset_type); - if (entry) - { - return entry->mIsProtected; - } - return true; -} - -// static -bool LLAssetType::lookupIsEnsembleCategoryType(EType asset_type) -{ - return (asset_type >= AT_FOLDER_ENSEMBLE_START && - asset_type <= AT_FOLDER_ENSEMBLE_END); -} - -// static. Generate a good default description -void LLAssetType::generateDescriptionFor(LLAssetType::EType asset_type, - std::string& description) +const std::string &LLAssetType::badLookup() { - const S32 BUF_SIZE = 30; - char time_str[BUF_SIZE]; /* Flawfinder: ignore */ - time_t now; - time(&now); - memset(time_str, '\0', BUF_SIZE); - strftime(time_str, BUF_SIZE - 1, "%Y-%m-%d %H:%M:%S ", localtime(&now)); - description.assign(time_str); - description.append(LLAssetType::lookupHumanReadable(asset_type)); + static const std::string sBadLookup = "llassettype_bad_lookup"; + return sBadLookup; } diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 5e51188541..10e21b4d1f 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -94,18 +94,6 @@ public: AT_BODYPART = 13, // A collection of textures and parameters that can be worn by an avatar. - AT_TRASH = 14, - // Only to be used as a marker for a category preferred type. - // Using this, we can throw things in the trash before completely deleting. - - AT_SNAPSHOT_CATEGORY = 15, - // A marker for a folder meant for snapshots. - // No actual assets will be snapshots, though if there were, you - // could interpret them as textures. - - AT_LOST_AND_FOUND = 16, - // Used to stuff lost&found items into. - AT_SOUND_WAV = 17, // Uncompressed sound. @@ -126,37 +114,21 @@ public: AT_SIMSTATE = 22, // Simstate file. - AT_FAVORITE = 23, - // favorite items - AT_LINK = 24, // Inventory symbolic link AT_LINK_FOLDER = 25, // Inventory folder link - - AT_FOLDER_ENSEMBLE_START = 26, - AT_FOLDER_ENSEMBLE_END = 45, - // This range is reserved for special clothing folder types. - - AT_CURRENT_OUTFIT = 46, - // Current outfit - - AT_OUTFIT = 47, - // Predefined outfit ("look") - - AT_MY_OUTFITS = 48, - // Folder that holds your outfits. - - AT_COUNT = 49, + AT_COUNT = 26, // +*********************************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | // +*********************************************************+ // | 1. INSERT BEFORE AT_COUNT | // | 2. INCREMENT AT_COUNT BY 1 | - // | 3. ADD TO LLAssetDictionary in LLAssetType.cpp | - // | 3. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp | + // | 3. ADD TO LLAssetType.cpp | + // | 4. ADD TO LLViewerAssetType.cpp | + // | 5. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp | // +*********************************************************+ AT_NONE = -1 @@ -172,33 +144,17 @@ public: static EType lookupHumanReadable(const std::string& readable_name); static const char* lookupHumanReadable(EType asset_type); - // Generate a good default description. You may want to add a verb - // or agent name after this depending on your application. - static void generateDescriptionFor(LLAssetType::EType asset_type, - std::string& description); - static EType getType(const std::string& desc_name); static const std::string& getDesc(EType asset_type); - static EDragAndDropType lookupDragAndDropType(EType asset_type); static bool lookupCanLink(EType asset_type); static bool lookupIsLinkType(EType asset_type); - static const char* lookupCategoryName(EType asset_type); - static bool lookupIsProtectedCategoryType(EType asset_type); - static bool lookupIsEnsembleCategoryType(EType asset_type); - - /* TODO: Change return types from "const char *" to "const std::string &". - This is fairly straightforward, but requires changing some calls to use .c_str(). - e.g.: - - fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); - + fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType).c_str()); - */ - -private: - // don't instantiate or derive one of these objects - LLAssetType( void ) {} - ~LLAssetType( void ) {} + static const std::string& badLookup(); // error string when a lookup fails + +protected: + LLAssetType() {} + ~LLAssetType() {} }; #endif // LL_LLASSETTYPE_H diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp new file mode 100644 index 0000000000..9107b11597 --- /dev/null +++ b/indra/llcommon/llfoldertype.cpp @@ -0,0 +1,165 @@ +/** + * @file llfoldertype.cpp + * @brief Implementatino of LLFolderType functionality. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * 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 + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llfoldertype.h" +#include "lldictionary.h" +#include "llmemory.h" +#include "llsingleton.h" + +///---------------------------------------------------------------------------- +/// Class LLFolderType +///---------------------------------------------------------------------------- +struct FolderEntry : public LLDictionaryEntry +{ + FolderEntry(const std::string &type_name, // 8 character limit! + bool is_protected) // can the viewer change categories of this type? + : + LLDictionaryEntry(type_name), + mIsProtected(is_protected) + { + llassert(type_name.length() <= 8); + } + + const bool mIsProtected; +}; + +class LLFolderDictionary : public LLSingleton, + public LLDictionary +{ +public: + LLFolderDictionary(); +}; + +LLFolderDictionary::LLFolderDictionary() +{ + // TYPE NAME PROTECTED + // |-----------|---------| + addEntry(LLFolderType::FT_TEXTURE, new FolderEntry("texture", TRUE)); + addEntry(LLFolderType::FT_SOUND, new FolderEntry("sound", TRUE)); + addEntry(LLFolderType::FT_CALLINGCARD, new FolderEntry("callcard", TRUE)); + addEntry(LLFolderType::FT_LANDMARK, new FolderEntry("landmark", TRUE)); + addEntry(LLFolderType::FT_CLOTHING, new FolderEntry("clothing", TRUE)); + addEntry(LLFolderType::FT_OBJECT, new FolderEntry("object", TRUE)); + addEntry(LLFolderType::FT_NOTECARD, new FolderEntry("notecard", TRUE)); + addEntry(LLFolderType::FT_CATEGORY, new FolderEntry("category", TRUE)); + addEntry(LLFolderType::FT_ROOT_CATEGORY, new FolderEntry("root", TRUE)); + addEntry(LLFolderType::FT_LSL_TEXT, new FolderEntry("lsltext", TRUE)); + addEntry(LLFolderType::FT_BODYPART, new FolderEntry("bodypart", TRUE)); + addEntry(LLFolderType::FT_TRASH, new FolderEntry("trash", TRUE)); + addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new FolderEntry("snapshot", TRUE)); + addEntry(LLFolderType::FT_LOST_AND_FOUND, new FolderEntry("lstndfnd", TRUE)); + addEntry(LLFolderType::FT_ANIMATION, new FolderEntry("animatn", TRUE)); + addEntry(LLFolderType::FT_GESTURE, new FolderEntry("gesture", TRUE)); + addEntry(LLFolderType::FT_FAVORITE, new FolderEntry("favorite", TRUE)); + + for (S32 ensemble_num = S32(LLFolderType::FT_ENSEMBLE_START); ensemble_num <= S32(LLFolderType::FT_ENSEMBLE_END); ensemble_num++) + { + addEntry(LLFolderType::EType(ensemble_num), new FolderEntry("ensemble", FALSE)); + } + + addEntry(LLFolderType::FT_CURRENT_OUTFIT, new FolderEntry("current", TRUE)); + addEntry(LLFolderType::FT_OUTFIT, new FolderEntry("outfit", FALSE)); + addEntry(LLFolderType::FT_MY_OUTFITS, new FolderEntry("my_otfts", TRUE)); + addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", TRUE)); + + addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); +}; + +// static +LLFolderType::EType LLFolderType::lookup(const std::string& name) +{ + return LLFolderDictionary::getInstance()->lookup(name); +} + +// static +const std::string &LLFolderType::lookup(LLFolderType::EType folder_type) +{ + const FolderEntry *entry = LLFolderDictionary::getInstance()->lookup(folder_type); + if (entry) + { + return entry->mName; + } + else + { + return badLookup(); + } +} + +// static +// Only ensembles and plain folders aren't protected. "Protected" means +// you can't change certain properties such as their type. +bool LLFolderType::lookupIsProtectedType(EType folder_type) +{ + const LLFolderDictionary *dict = LLFolderDictionary::getInstance(); + const FolderEntry *entry = dict->lookup(folder_type); + if (entry) + { + return entry->mIsProtected; + } + return true; +} + +// static +bool LLFolderType::lookupIsEnsembleType(EType folder_type) +{ + return (folder_type >= FT_ENSEMBLE_START && + folder_type <= FT_ENSEMBLE_END); +} + +// static +LLAssetType::EType LLFolderType::folderTypeToAssetType(LLFolderType::EType folder_type) +{ + if (LLAssetType::lookup(LLAssetType::EType(folder_type)) == LLAssetType::badLookup()) + { + llwarns << "Converting to unknown asset type " << folder_type << llendl; + } + return (LLAssetType::EType)folder_type; +} + +// static +LLFolderType::EType LLFolderType::assetTypeToFolderType(LLAssetType::EType asset_type) +{ + if (LLFolderType::lookup(LLFolderType::EType(asset_type)) == LLFolderType::badLookup()) + { + llwarns << "Converting to unknown folder type " << asset_type << llendl; + } + return (LLFolderType::EType)asset_type; +} + +// static +const std::string &LLFolderType::badLookup() +{ + static const std::string sBadLookup = "llfoldertype_bad_lookup"; + return sBadLookup; +} diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h new file mode 100644 index 0000000000..ecb37d6dde --- /dev/null +++ b/indra/llcommon/llfoldertype.h @@ -0,0 +1,123 @@ +/** + * @file llfoldertype.h + * @brief Declaration of LLFolderType. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * 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 + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFOLDERTYPE_H +#define LL_LLFOLDERTYPE_H + +#include +#include "llassettype.h" + +// This class handles folder types (similar to assettype, except for folders) +// and operations on those. +class LLFolderType +{ +public: + // ! BACKWARDS COMPATIBILITY ! Folder type enums must match asset type enums. + enum EType + { + FT_TEXTURE = 0, + + FT_SOUND = 1, + + FT_CALLINGCARD = 2, + + FT_LANDMARK = 3, + + // FT_SCRIPT = 4, + + FT_CLOTHING = 5, + + FT_OBJECT = 6, + + FT_NOTECARD = 7, + + FT_CATEGORY = 8, + + FT_ROOT_CATEGORY = 9, + + FT_LSL_TEXT = 10, + + // FT_LSL_BYTECODE = 11, + // FT_TEXTURE_TGA = 12, + + FT_BODYPART = 13, + + FT_TRASH = 14, + + FT_SNAPSHOT_CATEGORY = 15, + + FT_LOST_AND_FOUND = 16, + + // FT_SOUND_WAV = 17, + // FT_IMAGE_TGA = 18, + // FT_IMAGE_JPEG = 19, + + FT_ANIMATION = 20, + + FT_GESTURE = 21, + + // FT_SIMSTATE = 22, + + FT_FAVORITE = 23, + + FT_ENSEMBLE_START = 26, + FT_ENSEMBLE_END = 45, + // This range is reserved for special clothing folder types. + + FT_CURRENT_OUTFIT = 46, + FT_OUTFIT = 47, + FT_MY_OUTFITS = 48, + + FT_INBOX = 49, + + FT_COUNT = 50, + + FT_NONE = -1 + }; + + static EType lookup(const std::string& type_name); + static const std::string& lookup(EType folder_type); + + static bool lookupIsProtectedType(EType folder_type); + static bool lookupIsEnsembleType(EType folder_type); + + static LLAssetType::EType folderTypeToAssetType(LLFolderType::EType folder_type); + static LLFolderType::EType assetTypeToFolderType(LLAssetType::EType asset_type); + + static const std::string& badLookup(); // error string when a lookup fails + +protected: + LLFolderType() {} + ~LLFolderType() {} +}; + +#endif // LL_LLFOLDERTYPE_H diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index e2a77f1d1e..b800f239e1 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1291,7 +1291,7 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b ) LLInventoryCategory::LLInventoryCategory( const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType preferred_type, + LLFolderType::EType preferred_type, const std::string& name) : LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name), mPreferredType(preferred_type) @@ -1299,7 +1299,7 @@ LLInventoryCategory::LLInventoryCategory( } LLInventoryCategory::LLInventoryCategory() : - mPreferredType(LLAssetType::AT_NONE) + mPreferredType(LLFolderType::FT_NONE) { mType = LLAssetType::AT_CATEGORY; } @@ -1321,12 +1321,12 @@ void LLInventoryCategory::copyCategory(const LLInventoryCategory* other) mPreferredType = other->mPreferredType; } -LLAssetType::EType LLInventoryCategory::getPreferredType() const +LLFolderType::EType LLInventoryCategory::getPreferredType() const { return mPreferredType; } -void LLInventoryCategory::setPreferredType(LLAssetType::EType type) +void LLInventoryCategory::setPreferredType(LLFolderType::EType type) { mPreferredType = type; } @@ -1372,13 +1372,13 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) if (sd.has(w)) { S8 type = (U8)sd[w].asInteger(); - mPreferredType = static_cast(type); + mPreferredType = static_cast(type); } w = INV_ASSET_TYPE_LABEL_WS; if (sd.has(w)) { S8 type = (U8)sd[w].asInteger(); - mPreferredType = static_cast(type); + mPreferredType = static_cast(type); } w = INV_NAME_LABEL; @@ -1400,7 +1400,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, msg->getUUIDFast(block, _PREHASH_ParentID, mParentUUID, block_num); S8 type; msg->getS8Fast(block, _PREHASH_Type, type, block_num); - mPreferredType = static_cast(type); + mPreferredType = static_cast(type); msg->getStringFast(block, _PREHASH_Name, mName, block_num); LLStringUtil::replaceNonstandardASCII(mName, ' '); } @@ -1449,7 +1449,7 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp) } else if(0 == strcmp("pref_type", keyword)) { - mPreferredType = LLAssetType::lookup(valuestr); + mPreferredType = LLFolderType::lookup(valuestr); } else if(0 == strcmp("name", keyword)) { @@ -1481,7 +1481,7 @@ BOOL LLInventoryCategory::exportFile(LLFILE* fp, BOOL) const mParentUUID.toString(uuid_str); fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); - fprintf(fp, "\t\tpref_type\t%s\n", LLAssetType::lookup(mPreferredType)); + fprintf(fp, "\t\tpref_type\t%s\n", LLFolderType::lookup(mPreferredType).c_str()); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp,"\t}\n"); return TRUE; @@ -1528,7 +1528,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("pref_type", keyword)) { - mPreferredType = LLAssetType::lookup(valuestr); + mPreferredType = LLFolderType::lookup(valuestr); } else if(0 == strcmp("name", keyword)) { @@ -1560,7 +1560,7 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL) mParentUUID.toString(uuid_str); output_stream << "\t\tparent_id\t" << uuid_str << "\n"; output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n"; - output_stream << "\t\tpref_type\t" << LLAssetType::lookup(mPreferredType) << "\n"; + output_stream << "\t\tpref_type\t" << LLFolderType::lookup(mPreferredType) << "\n"; output_stream << "\t\tname\t" << mName.c_str() << "|\n"; output_stream << "\t}\n"; return TRUE; @@ -1596,38 +1596,6 @@ LLSD ll_create_sd_from_inventory_item(LLPointer item) return rv; } -/* deprecated, use LLInventoryItem::fromLLSD() instead -LLPointer ll_create_item_from_sd(const LLSD& sd_item) -{ - LLPointer rv = new LLInventoryItem; - rv->setUUID(sd_item[INV_ITEM_ID_LABEL].asUUID()); - rv->setParent(sd_item[INV_PARENT_ID_LABEL].asUUID()); - rv->rename(sd_item[INV_NAME_LABEL].asString()); - rv->setType( - LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString())); - if (sd_item.has("shadow_id")) - { - LLUUID asset_id = sd_item["shadow_id"]; - LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); - cipher.decrypt(asset_id.mData, UUID_BYTES); - rv->setAssetUUID(asset_id); - } - if (sd_item.has(INV_ASSET_ID_LABEL)) - { - rv->setAssetUUID(sd_item[INV_ASSET_ID_LABEL].asUUID()); - } - rv->setDescription(sd_item[INV_DESC_LABEL].asString()); - rv->setSaleInfo(ll_sale_info_from_sd(sd_item[INV_SALE_INFO_LABEL])); - rv->setPermissions(ll_permissions_from_sd(sd_item[INV_PERMISSIONS_LABEL])); - rv->setInventoryType( - LLInventoryType::lookup( - sd_item[INV_INVENTORY_TYPE_LABEL].asString())); - rv->setFlags((U32)(sd_item[INV_FLAGS_LABEL].asInteger())); - rv->setCreationDate(sd_item[INV_CREATION_DATE_LABEL].asInteger()); - return rv; -} -*/ - LLSD ll_create_sd_from_inventory_category(LLPointer cat) { LLSD rv; @@ -1642,10 +1610,10 @@ LLSD ll_create_sd_from_inventory_category(LLPointer cat) rv[INV_PARENT_ID_LABEL] = cat->getParentUUID(); rv[INV_NAME_LABEL] = cat->getName(); rv[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(cat->getType()); - if(LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType())) + if(LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { rv[INV_PREFERRED_TYPE_LABEL] = - LLAssetType::lookup(cat->getPreferredType()); + LLFolderType::lookup(cat->getPreferredType()).c_str(); } return rv; } @@ -1659,7 +1627,7 @@ LLPointer ll_create_category_from_sd(const LLSD& sd_cat) rv->setType( LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString())); rv->setPreferredType( - LLAssetType::lookup( - sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); + LLFolderType::lookup( + sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); return rv; } diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 64af6c94f5..52bbd2001d 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -37,6 +37,7 @@ #include "llassetstorage.h" #include "lldarray.h" +#include "llfoldertype.h" #include "llinventorytype.h" #include "llmemtype.h" #include "llpermissions.h" @@ -318,15 +319,15 @@ protected: public: MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType preferred_type, + LLFolderType::EType preferred_type, const std::string& name); LLInventoryCategory(); LLInventoryCategory(const LLInventoryCategory* other); void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy // accessors and mutators - LLAssetType::EType getPreferredType() const; - void setPreferredType(LLAssetType::EType type); + LLFolderType::EType getPreferredType() const; + void setPreferredType(LLFolderType::EType type); // For messaging system support virtual void packMessage(LLMessageSystem* msg) const; virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); @@ -342,10 +343,8 @@ public: virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; protected: - // The type of asset that this category was "meant" to hold - // (although it may in fact hold any type). - LLAssetType::EType mPreferredType; - + // May be the type that this category was "meant" to hold (although it may hold any type). + LLFolderType::EType mPreferredType; }; diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index a445466b26..0e71c0d12d 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -79,24 +79,16 @@ LLInventoryDictionary::LLInventoryDictionary() addEntry(LLInventoryType::IT_SOUND, new InventoryEntry("sound", "sound", 1, LLAssetType::AT_SOUND)); addEntry(LLInventoryType::IT_CALLINGCARD, new InventoryEntry("callcard", "calling card", 1, LLAssetType::AT_CALLINGCARD)); addEntry(LLInventoryType::IT_LANDMARK, new InventoryEntry("landmark", "landmark", 1, LLAssetType::AT_LANDMARK)); - //addEntry(LLInventoryType::IT_SCRIPT, new InventoryEntry(NULL,NULL)); - //addEntry(LLInventoryType::IT_CLOTHING, new InventoryEntry(NULL,NULL)); addEntry(LLInventoryType::IT_OBJECT, new InventoryEntry("object", "object", 1, LLAssetType::AT_OBJECT)); addEntry(LLInventoryType::IT_NOTECARD, new InventoryEntry("notecard", "note card", 1, LLAssetType::AT_NOTECARD)); addEntry(LLInventoryType::IT_CATEGORY, new InventoryEntry("category", "folder" )); addEntry(LLInventoryType::IT_ROOT_CATEGORY, new InventoryEntry("root", "root" )); addEntry(LLInventoryType::IT_LSL, new InventoryEntry("script", "script", 2, LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE)); - //addEntry(LLInventoryType::IT_LSL_BYTECODE, new InventoryEntry(NULL,NULL)); - //addEntry(LLInventoryType::IT_TEXTURE_TGA, new InventoryEntry(NULL,NULL)); - //addEntry(LLInventoryType::IT_BODYPART, new InventoryEntry(NULL,NULL)); - //addEntry(LLInventoryType::IT_TRASH, new InventoryEntry(NULL,NULL)); addEntry(LLInventoryType::IT_SNAPSHOT, new InventoryEntry("snapshot", "snapshot", 1, LLAssetType::AT_TEXTURE)); - //addEntry(LLInventoryType::IT_LOST_AND_FOUND, new InventoryEntry(NULL,NULL, )); addEntry(LLInventoryType::IT_ATTACHMENT, new InventoryEntry("attach", "attachment", 1, LLAssetType::AT_OBJECT)); addEntry(LLInventoryType::IT_WEARABLE, new InventoryEntry("wearable", "wearable", 2, LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART)); addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION)); addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE)); - addEntry(LLInventoryType::IT_FAVORITE, new InventoryEntry("favorite", "favorite", 1, LLAssetType::AT_FAVORITE)); } @@ -128,35 +120,9 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_ANIMATION, // AT_ANIMATION LLInventoryType::IT_GESTURE, // AT_GESTURE LLInventoryType::IT_NONE, // AT_SIMSTATE - LLInventoryType::IT_FAVORITE, // AT_FAVORITE LLInventoryType::IT_NONE, // AT_LINK LLInventoryType::IT_NONE, // AT_LINK_FOLDER - - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - LLInventoryType::IT_CATEGORY, // AT_ENSEMBLE - - LLInventoryType::IT_CATEGORY, // AT_CURRENT_OUTFIT - LLInventoryType::IT_CATEGORY, // AT_OUTFIT - LLInventoryType::IT_CATEGORY, // AT_MY_OUTFITS }; // static diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index 14b28bfe4b..e515b8a304 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -67,8 +67,7 @@ public: IT_WEARABLE = 18, IT_ANIMATION = 19, IT_GESTURE = 20, - IT_FAVORITE = 21, - IT_COUNT = 22, + IT_COUNT = 21, IT_NONE = -1 }; diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp index 770594dc9d..c797a70c50 100644 --- a/indra/llinventory/tests/inventorymisc_test.cpp +++ b/indra/llinventory/tests/inventorymisc_test.cpp @@ -94,7 +94,7 @@ LLPointer create_random_inventory_cat() LLPointer cat = new LLInventoryCategory( item_id, parent_id, - LLAssetType::AT_NONE, + LLFolderType::FT_NONE, std::string("Sample category")); return cat; } @@ -452,7 +452,7 @@ namespace tut ensure_equals("4.type::getType() failed", dst->getType(), src->getType()); ensure_equals("5.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType()); - src->setPreferredType( LLAssetType::AT_TEXTURE); + src->setPreferredType( LLFolderType::FT_TEXTURE); sd = ll_create_sd_from_inventory_category(src); dst = ll_create_category_from_sd(sd); ensure_equals("6.preferred type::getPreferredType() failed", dst->getPreferredType(), src->getPreferredType()); diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 5a1cd95ffc..7332f5c954 100644 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -270,7 +270,6 @@ bool is_asset_fetch_by_id_allowed(LLAssetType::EType type) case LLAssetType::AT_BODYPART: case LLAssetType::AT_ANIMATION: case LLAssetType::AT_GESTURE: - case LLAssetType::AT_FAVORITE: rv = true; break; default: @@ -293,7 +292,6 @@ bool is_asset_id_knowable(LLAssetType::EType type) case LLAssetType::AT_BODYPART: case LLAssetType::AT_ANIMATION: case LLAssetType::AT_GESTURE: - case LLAssetType::AT_FAVORITE: case LLAssetType::AT_LINK: case LLAssetType::AT_LINK_FOLDER: rv = true; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 26170d1713..f27d949faf 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -214,7 +214,6 @@ set(viewer_SOURCE_FILES llfloaterwhitelistentry.cpp llfloaterwindlight.cpp llfloaterworldmap.cpp - llfoldertype.cpp llfolderview.cpp llfolderviewitem.cpp llfollowcam.cpp @@ -427,11 +426,13 @@ set(viewer_SOURCE_FILES llvectorperfoptions.cpp llviewchildren.cpp llviewerassetstorage.cpp + llviewerassettype.cpp llvieweraudio.cpp llviewercamera.cpp llviewercontrol.cpp llviewerdisplay.cpp llviewerfloaterreg.cpp + llviewerfoldertype.cpp llviewergenericmessage.cpp llviewergesture.cpp llviewerhelp.cpp @@ -686,7 +687,6 @@ set(viewer_HEADER_FILES llfloaterwhitelistentry.h llfloaterwindlight.h llfloaterworldmap.h - llfoldertype.h llfolderview.h llfoldervieweventlistener.h llfolderviewitem.h @@ -899,12 +899,14 @@ set(viewer_HEADER_FILES llvectorperfoptions.h llviewchildren.h llviewerassetstorage.h + llviewerassettype.h llvieweraudio.h llviewerbuild.h llviewercamera.h llviewercontrol.h llviewerdisplay.h llviewerfloaterreg.h + llviewerfoldertype.h llviewergenericmessage.h llviewergesture.h llviewerhelp.h diff --git a/indra/newview/app_settings/foldertypes.xml b/indra/newview/app_settings/foldertypes.xml index 2038779c4f..0d539177f3 100644 --- a/indra/newview/app_settings/foldertypes.xml +++ b/indra/newview/app_settings/foldertypes.xml @@ -1,66 +1,61 @@ - cb = new addWearableToAgentInventoryCallback( LLPointer(NULL), @@ -1122,8 +1121,8 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name, // First, make a folder in the Clothes directory. LLUUID folder_id = gInventory.createNewCategory( - gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING), - LLAssetType::AT_NONE, + gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING), + LLFolderType::FT_NONE, new_folder_name); bool found_first_item = false; @@ -1256,10 +1255,10 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name) } // First, make a folder in the My Outfits directory. - LLUUID parent_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_MY_OUTFITS); + const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); LLUUID folder_id = gInventory.createNewCategory( parent_id, - LLAssetType::AT_OUTFIT, + LLFolderType::FT_OUTFIT, new_folder_name); LLAppearanceManager::shallowCopyCategory(LLAppearanceManager::getCOF(),folder_id, NULL); @@ -2019,7 +2018,7 @@ void LLInitialWearablesFetch::processWearablesMessage() { if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead. { - LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CURRENT_OUTFIT); + const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) { // Populate the current outfit folder with links to the wearables passed in the message diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4e022aeb29..cc118a6690 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -130,11 +130,11 @@ void LLOutfitObserver::done() { if(LLInventoryType::IT_GESTURE == item->getInventoryType()) { - pid = gInventory.findCategoryUUIDForType(LLAssetType::AT_GESTURE); + pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); } else { - pid = gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); } break; } @@ -146,7 +146,7 @@ void LLOutfitObserver::done() LLUUID cat_id = gInventory.createNewCategory( pid, - LLAssetType::AT_NONE, + LLFolderType::FT_NONE, name); mCatID = cat_id; LLPointer cb = new LLWearInventoryCategoryCallback(mCatID, mAppend); @@ -353,7 +353,7 @@ void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventory /* static */ LLUUID LLAppearanceManager::getCOF() { - return gInventory.findCategoryUUIDForType(LLAssetType::AT_CURRENT_OUTFIT); + return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); } // Update appearance from outfit folder. @@ -370,12 +370,12 @@ void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, boo else { LLViewerInventoryCategory* catp = gInventory.getCategory(category); - if (catp->getPreferredType() == LLAssetType::AT_NONE || - LLAssetType::lookupIsEnsembleCategoryType(catp->getPreferredType())) + if (catp->getPreferredType() == LLFolderType::FT_NONE || + LLFolderType::lookupIsEnsembleType(catp->getPreferredType())) { updateCOFFromCategory(category, append); // append is false - rebuild COF. } - else if (catp->getPreferredType() == LLAssetType::AT_OUTFIT) + else if (catp->getPreferredType() == LLFolderType::FT_OUTFIT) { rebuildCOFFromOutfit(category); } @@ -401,7 +401,7 @@ void LLAppearanceManager::updateCOFFromCategory(const LLUUID& category, bool app return; } - const LLUUID ¤t_outfit_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CURRENT_OUTFIT); + const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); // Processes that take time should show the busy cursor //inc_busy_count(); @@ -499,7 +499,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID { LLViewerInventoryCategory *catp = item->getLinkedCategory(); // Skip copying outfit links. - if (catp && catp->getPreferredType() != LLAssetType::AT_OUTFIT) + if (catp && catp->getPreferredType() != LLFolderType::FT_OUTFIT) { link_inventory_item(gAgent.getID(), item->getLinkedUUID(), @@ -604,7 +604,7 @@ void LLAppearanceManager::rebuildCOFFromOutfit(const LLUUID& category) LLNotifications::instance().add("CouldNotPutOnOutfit"); return; } - + // Processes that take time should show the busy cursor //inc_busy_count(); @@ -622,7 +622,7 @@ void LLAppearanceManager::rebuildCOFFromOutfit(const LLUUID& category) // Create a link to the outfit that we wore. LLViewerInventoryCategory* catp = gInventory.getCategory(category); - if (catp && catp->getPreferredType() == LLAssetType::AT_OUTFIT) + if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) { link_inventory_item(gAgent.getID(), category, current_outfit_id, catp->getName(), LLAssetType::AT_LINK_FOLDER, link_waiter); diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index cd3963050f..ea3809d58d 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -333,7 +333,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) LLAssetStorage::LLStoreAssetCallback callback = NULL; void *userdata = NULL; upload_new_resource(next_file, asset_name, asset_name, - 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, + 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, next_owner_perms, group_perms, everyone_perms, display_name, callback, expected_upload_cost, userdata); diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 2f67401301..97e0aa5f46 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -343,7 +343,7 @@ bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& re // Servers older than 1.25 require the text of the message to be the // calling card folder ID for the offering user. JC LLUUID calling_card_folder_id = - gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); std::string message = calling_card_folder_id.asString(); requestFriendship(notification["payload"]["id"].asUUID(), notification["payload"]["name"].asString(), @@ -355,7 +355,7 @@ bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& re // static void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) { - LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + const LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); send_improved_im(target_id, target_name, message, diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 3b5b7f570e..6a82550ce6 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -437,7 +437,7 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, } else { - LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + const LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); if (item->getParentUUID() == favorites_id) { llwarns << "Attemt to copy a favorite item into the same folder." << llendl; @@ -550,7 +550,7 @@ void LLFavoritesBarCtrl::changed(U32 mask) { if (mFavoriteFolderId.isNull()) { - mFavoriteFolderId = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + mFavoriteFolderId = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); if (mFavoriteFolderId.notNull()) { diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 55b7ed0c99..095fe0a220 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -989,7 +989,7 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata) name, desc, 0, - LLAssetType::AT_NONE, + LLFolderType::FT_NONE, LLInventoryType::IT_ANIMATION, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), name, diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index a73ebf4e06..1cc0fbef22 100644 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -272,7 +272,6 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, Invent ( asstype == LLAssetType::AT_BODYPART && gSavedSettings.getBOOL("BulkChangeIncludeBodyParts" )) || ( asstype == LLAssetType::AT_CLOTHING && gSavedSettings.getBOOL("BulkChangeIncludeClothing" )) || ( asstype == LLAssetType::AT_GESTURE && gSavedSettings.getBOOL("BulkChangeIncludeGestures" )) || - ( asstype == LLAssetType::AT_FAVORITE && gSavedSettings.getBOOL("BulkChangeIncludeFavourite" )) || ( asstype == LLAssetType::AT_NOTECARD && gSavedSettings.getBOOL("BulkChangeIncludeNotecards" )) || ( asstype == LLAssetType::AT_OBJECT && gSavedSettings.getBOOL("BulkChangeIncludeObjects" )) || ( asstype == LLAssetType::AT_LSL_TEXT && gSavedSettings.getBOOL("BulkChangeIncludeScripts" )) || diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 9d07362edc..896a7bfabb 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -292,7 +292,7 @@ void LLFloaterBuy::onClickBuy() { // Put the items where we put new folders. LLUUID category_id; - category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); + category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); // *NOTE: doesn't work for multiple object buy, which UI does not // currently support sale info is used for verification only, if diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index 3a4171c6be..15229e9be3 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -285,7 +285,7 @@ void LLFloaterBuyContents::onClickBuy() // Put the items where we put new folders. LLUUID category_id; - category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CATEGORY); + category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CATEGORY); // *NOTE: doesn't work for multiple object buy, which UI does not // currently support sale info is used for verification only, if diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp index c890f9f122..8cfa0a8a57 100644 --- a/indra/newview/llfloaterinventory.cpp +++ b/indra/newview/llfloaterinventory.cpp @@ -76,6 +76,7 @@ #include "lltabcontainer.h" #include "lltooldraganddrop.h" #include "lluictrlfactory.h" +#include "llviewerfoldertype.h" #include "llviewerinventory.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" @@ -432,8 +433,8 @@ LLFloaterInventory::LLFloaterInventory(const LLSD& key) // Menu Callbacks (non contex menus) mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLFloaterInventory::doToSelected, this, _2)); mCommitCallbackRegistrar.add("Inventory.CloseAllFolders", boost::bind(&LLFloaterInventory::closeAllFolders, this)); - mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLAssetType::AT_TRASH)); - mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLAssetType::AT_LOST_AND_FOUND)); + mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH)); + mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND)); mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLFloaterInventory::doCreate, this, _2)); // mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::newWindow, this)); mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLFloaterInventory::toggleFindOptions, this)); @@ -1133,10 +1134,6 @@ const std::string& get_item_icon_name(LLAssetType::EType asset_type, case LLAssetType::AT_GESTURE: idx = GESTURE_ICON_NAME; break; - case LLAssetType::AT_FAVORITE: - //TODO - need bette idx - idx = LANDMARK_ICON_NAME; - break; case LLAssetType::AT_LINK: idx = LINKITEM_ICON_NAME; break; @@ -1181,8 +1178,8 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) // contex menu callbacks mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryPanel::doToSelected, this, _2)); - mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLAssetType::AT_TRASH)); - mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLAssetType::AT_LOST_AND_FOUND)); + mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH)); + mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND)); mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLInventoryPanel::doCreate, this, _2)); mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2)); mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this)); @@ -1240,19 +1237,19 @@ BOOL LLInventoryPanel::postBuild() // determine the root folder, if any, so inventory contents show just the children // of that folder (i.e. not including the folder itself). - const LLAssetType::EType preferred_type = LLAssetType::lookupHumanReadable(mStartFolderString); + const LLFolderType::EType preferred_type = LLViewerFolderType::lookupTypeFromNewCategoryName(mStartFolderString); - if ("inventory" == mStartFolderString) + if ("INVENTORY" == mStartFolderString) { mStartFolderID = gInventory.getRootFolderID(); } - else if ("library" == mStartFolderString) + else if ("LIBRARY" == mStartFolderString) { mStartFolderID = gInventory.getLibraryRootFolderID(); } else { - mStartFolderID = (preferred_type != LLAssetType::AT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null); + mStartFolderID = (preferred_type != LLFolderType::FT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null); } // build view of inventory if we need default full hierarchy and inventory ready, otherwise wait for modelChanged() callback @@ -1263,7 +1260,7 @@ BOOL LLInventoryPanel::postBuild() } // bit of a hack to make sure the inventory is open. - mFolders->openFolder(preferred_type != LLAssetType::AT_NONE ? LLAssetType::lookupCategoryName(preferred_type) : "My Inventory"); + mFolders->openFolder(preferred_type != LLFolderType::FT_NONE ? LLViewerFolderType::lookupNewCategoryName(preferred_type) : "My Inventory"); if (mSortOrderSetting != INHERIT_SORT_ORDER) { @@ -1711,9 +1708,9 @@ void LLInventoryPanel::openAllFolders() mFolders->arrangeAll(); } -void LLInventoryPanel::openDefaultFolderForType(LLAssetType::EType type) +void LLInventoryPanel::openDefaultFolderForType(LLFolderType::EType type) { - LLUUID category_id = mInventory->findCategoryUUIDForType(type); + const LLUUID category_id = mInventory->findCategoryUUIDForType(type); LLOpenFolderByID opener(category_id); mFolders->applyFunctorRecursively(opener); } diff --git a/indra/newview/llfloaterinventory.h b/indra/newview/llfloaterinventory.h index 4c9ac5d4c6..3fed765bba 100644 --- a/indra/newview/llfloaterinventory.h +++ b/indra/newview/llfloaterinventory.h @@ -37,6 +37,7 @@ #include "llassetstorage.h" #include "lldarray.h" #include "llfloater.h" +#include "llfoldertype.h" #include "llinventory.h" #include "llinventoryfilter.h" #include "llfolderview.h" @@ -131,12 +132,12 @@ public: // Call this method to set the selection. void openAllFolders(); - void openDefaultFolderForType(LLAssetType::EType); + void openDefaultFolderForType(LLFolderType::EType type); void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus); void setSelectCallback(const LLFolderView::signal_t::slot_type& cb) { if (mFolders) mFolders->setSelectCallback(cb); } void clearSelection(); LLInventoryFilter* getFilter() { return mFolders->getFilter(); } - void setFilterTypes(U64 filter, BOOL filter_for_categories = FALSE); // if filter_for_categories is true, operate on folder preferred asset type + void setFilterTypes(U64 filter, BOOL filter_for_categories = FALSE); // if filter_for_categories is true, operate on folder preferred type U32 getFilterTypes() const { return mFolders->getFilterTypes(); } void setFilterPermMask(PermissionMask filter_perm_mask); U32 getFilterPermMask() const { return mFolders->getFilterPermissions(); } diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index ed7d2c71ea..b7296518d4 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -176,7 +176,7 @@ void LLFloaterNameDesc::onBtnOK( ) upload_new_resource(mFilenameAndPath, // file childGetValue("name_form").asString(), childGetValue("description_form").asString(), - 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, + 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), display_name, callback, expected_upload_cost, nruserdata); closeFloater(false); diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index aa82dc34b7..f14a336177 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -157,14 +157,14 @@ void LLFloaterOpenObject::moveToInventory(bool wear) if (wear) { parent_category_id = gInventory.findCategoryUUIDForType( - LLAssetType::AT_CLOTHING); + LLFolderType::FT_CLOTHING); } else { parent_category_id = gInventory.getRootFolderID(); } LLUUID category_id = gInventory.createNewCategory(parent_category_id, - LLAssetType::AT_NONE, + LLFolderType::FT_NONE, name); LLCatAndWear* data = new LLCatAndWear; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 70a3ad5252..b146ed9b38 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -770,7 +770,7 @@ void LLFloaterReporter::takeScreenshot() if (COMPLAINT_REPORT == mReportType) { mResourceDatap->mAssetInfo.mType = LLAssetType::AT_TEXTURE; - mResourceDatap->mPreferredLocation = LLAssetType::EType(-2); + mResourceDatap->mPreferredLocation = LLFolderType::EType(LLResourceData::INVALID_LOCATION); } else { @@ -838,7 +838,7 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, } EReportType report_type = UNKNOWN_REPORT; - if (data->mPreferredLocation == -2) + if (data->mPreferredLocation == LLResourceData::INVALID_LOCATION) { report_type = COMPLAINT_REPORT; } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 235e819218..541e2a2664 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -980,7 +980,7 @@ void LLSnapshotLivePreview::saveTexture() "Snapshot : " + pos_string, "Taken by " + who_took_it + " at " + pos_string, 0, - LLAssetType::AT_SNAPSHOT_CATEGORY, + LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT, PERM_ALL, // Note: Snapshots to inventory is a special case of content upload PERM_NONE, // that ignores the user's premissions preferences and continues to diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index b7e8835fb8..fbaf10d455 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -297,7 +297,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) LLFirstUse::useMap(); // Start speculative download of landmarks - LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); gInventory.startBackgroundFetch(landmark_folder_id); childSetFocus("location", TRUE); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index de18e74752..37c175d03f 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -54,6 +54,7 @@ #include "llviewermenu.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" +#include "llviewerfoldertype.h" #include "llviewerwindow.h" #include "llvoavatar.h" #include "llfloaterproperties.h" @@ -1107,7 +1108,7 @@ void LLFolderView::propertiesSelectedItems( void ) } } -void LLFolderView::changeType(LLInventoryModel *model, LLAssetType::EType new_folder_type) +void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type) { LLFolderBridge *folder_bridge = LLFolderBridge::sSelf; @@ -1957,7 +1958,7 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata) if (action.length() > change_folder_string.length() && (action.compare(0,change_folder_string.length(),"change_folder_type_") == 0)) { - LLAssetType::EType new_folder_type = LLFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length())); + LLFolderType::EType new_folder_type = LLViewerFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length())); changeType(model, new_folder_type); return true; } diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index ebfb4efde2..0bd65b5f90 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -192,7 +192,7 @@ public: void propertiesSelectedItems( void ); // change the folder type - void changeType(LLInventoryModel *model, LLAssetType::EType new_folder_type); + void changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type); void autoOpenItem(LLFolderViewFolder* item); void closeAutoOpenedFolders(); diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h index ff38da279a..60ece75cea 100644 --- a/indra/newview/llfoldervieweventlistener.h +++ b/indra/newview/llfoldervieweventlistener.h @@ -32,6 +32,7 @@ #define LLFOLDERVIEWEVENTLISTENER_H #include "lldarray.h" // JAMESDEBUG convert to std::vector +#include "llfoldertype.h" #include "llfontgl.h" // just for StyleFlags enum #include "llpointer.h" @@ -57,7 +58,7 @@ public: virtual const LLUUID& getUUID() const = 0; virtual time_t getCreationDate() const = 0; // UTC seconds virtual PermissionMask getPermissionMask() const = 0; - virtual LLAssetType::EType getPreferredType() const = 0; + virtual LLFolderType::EType getPreferredType() const = 0; virtual LLPointer getIcon() const = 0; virtual LLFontGL::StyleFlags getLabelStyle() const = 0; virtual std::string getLabelSuffix() const = 0; diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 3591daf92d..d747260e8a 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -244,13 +244,13 @@ void LLFolderViewItem::refreshFromListener() if(mListener) { mLabel = mListener->getDisplayName(); - LLAssetType::EType preferred_type = mListener->getPreferredType(); + LLFolderType::EType preferred_type = mListener->getPreferredType(); // *TODO: to be removed when database supports multi language. This is a // temporary attempt to display the inventory folder in the user locale. // mantipov: *NOTE: be sure this code is synchronized with LLFriendCardsManager::findChildFolderUUID // it uses the same way to find localized string - if (LLAssetType::lookupIsProtectedCategoryType(preferred_type)) + if (LLFolderType::lookupIsProtectedType(preferred_type)) { LLTrans::findString(mLabel, "InvFolder " + mLabel); }; @@ -1749,7 +1749,7 @@ bool LLFolderViewFolder::isTrash() const { if (mAmTrash == LLFolderViewFolder::UNKNOWN) { - mAmTrash = mListener->getUUID() == gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH, false) ? LLFolderViewFolder::TRASH : LLFolderViewFolder::NOT_TRASH; + mAmTrash = mListener->getUUID() == gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH, false) ? LLFolderViewFolder::TRASH : LLFolderViewFolder::NOT_TRASH; } return mAmTrash == LLFolderViewFolder::TRASH; } @@ -2163,7 +2163,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) { const LLUUID &cat_uuid = getListener()->getUUID(); const LLViewerInventoryCategory *cat = gInventory.getCategory(cat_uuid); - if (cat && cat->getPreferredType() == LLAssetType::AT_OUTFIT) + if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT) { getListener()->performAction(NULL, NULL,"replaceoutfit"); return TRUE; @@ -2486,7 +2486,7 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde && b->getListener()->getInventoryType() == LLInventoryType::IT_LANDMARK) { - static LLUUID favorites_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); LLUUID a_uuid = a->getParentFolder()->getListener()->getUUID(); LLUUID b_uuid = b->getParentFolder()->getListener()->getUUID(); diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index fbcaeee01f..5f79fe8b20 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -135,14 +135,14 @@ const LLUUID LLFriendCardsManager::extractAvatarID(const LLUUID& avatarID) // and this method must be called before any actions with friend list void LLFriendCardsManager::ensureFriendFoldersExist() { - LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + const LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); LLUUID friendFolderUUID = findFriendFolderUUIDImpl(); if (friendFolderUUID.isNull()) { friendFolderUUID = gInventory.createNewCategory(callingCardsFolderID, - LLAssetType::AT_CALLINGCARD, get_friend_folder_name()); + LLFolderType::FT_CALLINGCARD, get_friend_folder_name()); } LLUUID friendAllSubfolderUUID = findFriendAllSubfolderUUIDImpl(); @@ -150,7 +150,7 @@ void LLFriendCardsManager::ensureFriendFoldersExist() if (friendAllSubfolderUUID.isNull()) { friendAllSubfolderUUID = gInventory.createNewCategory(friendFolderUUID, - LLAssetType::AT_CALLINGCARD, get_friend_all_subfolder_name()); + LLFolderType::FT_CALLINGCARD, get_friend_all_subfolder_name()); } } @@ -351,7 +351,7 @@ void LLFriendCardsManager::collectFriendsLists(folderid_buddies_map_t& folderBud /************************************************************************/ const LLUUID& LLFriendCardsManager::findFriendFolderUUIDImpl() const { - LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + const LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); std::string friendFolderName = get_friend_folder_name(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ca9ebf8dc1..74f6d84709 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -76,6 +76,7 @@ #include "llscrollcontainer.h" #include "llimview.h" #include "lltooldraganddrop.h" +#include "llviewerfoldertype.h" #include "llviewertexturelist.h" #include "llviewerinventory.h" #include "llviewerobjectlist.h" @@ -83,6 +84,7 @@ #include "llvoavatar.h" #include "llwearable.h" #include "llwearablelist.h" +#include "llviewerassettype.h" #include "llviewermessage.h" #include "llviewerregion.h" #include "llvoavatarself.h" @@ -200,9 +202,9 @@ PermissionMask LLInvFVBridge::getPermissionMask() const } // virtual -LLAssetType::EType LLInvFVBridge::getPreferredType() const +LLFolderType::EType LLInvFVBridge::getPreferredType() const { - return LLAssetType::AT_NONE; + return LLFolderType::FT_NONE; } @@ -333,7 +335,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArrayfindCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); LLViewerInventoryItem* item = NULL; LLViewerInventoryCategory* cat = NULL; std::vector move_ids; @@ -498,7 +500,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const } } const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i)); - if (cat && !LLAssetType::lookupCanLink(cat->getPreferredType())) + if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return FALSE; } @@ -633,7 +635,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const if(obj) { - *type = LLAssetType::lookupDragAndDropType(obj->getActualType()); + *type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType()); if(*type == DAD_NONE) { return FALSE; @@ -674,7 +676,7 @@ BOOL LLInvFVBridge::isInTrash() const { LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - const LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); return model->isObjectDescendentOf(mUUID, trash_id); } @@ -687,7 +689,7 @@ BOOL LLInvFVBridge::isLinkedObjectInTrash() const { LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - const LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); return model->isObjectDescendentOf(obj->getLinkedUUID(), trash_id); } return FALSE; @@ -705,7 +707,7 @@ BOOL LLInvFVBridge::isCOFFolder() const { const LLInventoryModel* model = getInventoryModel(); if(!model) return TRUE; - const LLUUID cof_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CURRENT_OUTFIT); + const LLUUID cof_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); if (mUUID == cof_id || model->isObjectDescendentOf(mUUID, cof_id)) { return TRUE; @@ -1032,7 +1034,7 @@ void LLItemBridge::restoreItem() if(item) { LLInventoryModel* model = getInventoryModel(); - const LLUUID new_parent = model->findCategoryUUIDForType(item->getType()); + const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType())); // do not restamp on restore. LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE); } @@ -1065,7 +1067,7 @@ void LLItemBridge::restoreToWorld() } // Check if it's in the trash. (again similar to the normal rez logic) - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) { remove_from_inventory = TRUE; @@ -1260,7 +1262,7 @@ BOOL LLItemBridge::removeItem() LLPreview::hide(mUUID, TRUE); LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); LLViewerInventoryItem* item = getItem(); // if item is not already in trash @@ -1353,7 +1355,7 @@ BOOL LLFolderBridge::isItemMovable() const LLInventoryObject* obj = getInventoryObject(); if(obj) { - return (!LLAssetType::lookupIsProtectedCategoryType(((LLInventoryCategory*)obj)->getPreferredType())); + return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType())); } return FALSE; } @@ -1389,7 +1391,7 @@ BOOL LLFolderBridge::isItemRemovable() return FALSE; } - if(LLAssetType::lookupIsProtectedCategoryType(category->getPreferredType())) + if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) { return FALSE; } @@ -1402,7 +1404,7 @@ BOOL LLFolderBridge::isItemRemovable() for( i = 0; i < descendent_categories.count(); i++ ) { LLInventoryCategory* category = descendent_categories[i]; - if(LLAssetType::lookupIsProtectedCategoryType(category->getPreferredType())) + if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) { return FALSE; } @@ -1579,20 +1581,20 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, const LLUUID& cat_id = inv_cat->getUUID(); // Is the destination the trash? - const LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); - BOOL is_movable = (!LLAssetType::lookupIsProtectedCategoryType(inv_cat->getPreferredType())); - LLUUID current_outfit_id = model->findCategoryUUIDForType(LLAssetType::AT_CURRENT_OUTFIT); + BOOL is_movable = (!LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType())); + const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLAssetType::AT_OUTFIT); + BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); if (move_is_into_current_outfit || move_is_into_outfit) { // BAP - restrictions? is_movable = true; } - if (mUUID == gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE)) + if (mUUID == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)) { is_movable = FALSE; // It's generally movable but not into Favorites folder. EXT-1604 } @@ -1604,7 +1606,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, for( i = 0; i < descendent_categories.count(); i++ ) { LLInventoryCategory* category = descendent_categories[i]; - if(LLAssetType::lookupIsProtectedCategoryType(category->getPreferredType())) + if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) { // ...can't move "special folders" like Textures is_movable = FALSE; @@ -1837,8 +1839,8 @@ bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat, LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory(); // BAP - safe? // BAP remove AT_NONE support after ensembles are fully working? return (linked_category && - ((linked_category->getPreferredType() == LLAssetType::AT_NONE) || - (LLAssetType::lookupIsEnsembleCategoryType(linked_category->getPreferredType())))); + ((linked_category->getPreferredType() == LLFolderType::FT_NONE) || + (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType())))); } } @@ -2140,7 +2142,7 @@ void LLFolderBridge::determineFolderType() BOOL LLFolderBridge::isItemRenameable() const { LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)getCategory(); - if(cat && !LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType()) + if(cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) && (cat->getOwnerID() == gAgent.getID())) { return TRUE; @@ -2155,15 +2157,15 @@ void LLFolderBridge::restoreItem() if(cat) { LLInventoryModel* model = getInventoryModel(); - LLUUID new_parent = model->findCategoryUUIDForType(cat->getType()); + const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(cat->getType())); // do not restamp children on restore LLInvFVBridge::changeCategoryParent(model, cat, new_parent, FALSE); } } -LLAssetType::EType LLFolderBridge::getPreferredType() const +LLFolderType::EType LLFolderBridge::getPreferredType() const { - LLAssetType::EType preferred_type = LLAssetType::AT_NONE; + LLFolderType::EType preferred_type = LLFolderType::FT_NONE; LLViewerInventoryCategory* cat = getCategory(); if(cat) { @@ -2176,7 +2178,7 @@ LLAssetType::EType LLFolderBridge::getPreferredType() const // Icons for folders are based on the preferred type LLUIImagePtr LLFolderBridge::getIcon() const { - LLAssetType::EType preferred_type = LLAssetType::AT_NONE; + LLFolderType::EType preferred_type = LLFolderType::FT_NONE; LLViewerInventoryCategory* cat = getCategory(); if(cat) { @@ -2185,7 +2187,7 @@ LLUIImagePtr LLFolderBridge::getIcon() const return getIcon(preferred_type); } -LLUIImagePtr LLFolderBridge::getIcon(LLAssetType::EType preferred_type) +LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type) { // we only have one folder image now return LLUI::getUIImage("Inv_FolderClosed"); @@ -2224,7 +2226,7 @@ BOOL LLFolderBridge::removeItem() LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); // Look for any gestures and deactivate them LLInventoryModel::cat_array_t descendent_categories; @@ -2342,12 +2344,11 @@ void LLFolderBridge::folderOptionsMenu() if(!model) return; const LLInventoryCategory* category = model->getCategory(mUUID); - LLAssetType::EType type = category->getPreferredType(); - const bool is_default_folder = category && LLAssetType::lookupIsProtectedCategoryType(type); + LLFolderType::EType type = category->getPreferredType(); + const bool is_default_folder = category && LLFolderType::lookupIsProtectedType(type); // BAP change once we're no longer treating regular categories as ensembles. - const bool is_ensemble = category && (type == LLAssetType::AT_NONE || - LLAssetType::lookupIsEnsembleCategoryType(type)); - + const bool is_ensemble = category && (type == LLFolderType::FT_NONE || + LLFolderType::lookupIsEnsembleType(type)); // calling card related functionality for folders. // Only enable calling-card related options for non-default folders. @@ -2412,8 +2413,8 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // std::vector disabled_items; LLInventoryModel* model = getInventoryModel(); if(!model) return; - LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); - LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); + const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); mItems.clear(); //adding code to clear out member Items (which means Items should not have other data here at this point) mDisabledItems.clear(); //adding code to clear out disabled members from previous @@ -2443,7 +2444,6 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else if(isAgentInventory()) // do not allow creating in library { 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 /*&& @@ -2460,7 +2460,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) mItems.push_back(std::string("Change Type")); LLViewerInventoryCategory *cat = getCategory(); - if (cat && LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType())) + if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { mDisabledItems.push_back(std::string("Change Type")); } @@ -2470,7 +2470,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else { // Want some but not all of the items from getClipboardEntries for outfits. - if (cat && cat->getPreferredType()==LLAssetType::AT_OUTFIT) + if (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT) { mItems.push_back(std::string("Rename")); mItems.push_back(std::string("Delete")); @@ -2606,7 +2606,7 @@ void LLFolderBridge::createNewCategory(void* user_data) if(!model) return; LLUUID id; id = model->createNewCategory(bridge->getUUID(), - LLAssetType::AT_NONE, + LLFolderType::FT_NONE, LLStringUtil::null); model->notifyObservers(); @@ -2691,7 +2691,7 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type) // Separate function so can be called by global menu as well as right-click // menu. // static -void LLFolderBridge::createWearable(LLUUID parent_id, EWearableType type) +void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type) { LLWearable* wearable = LLWearableList::instance().createNewWearable(type); LLAssetType::EType asset_type = wearable->getAssetType(); @@ -2834,17 +2834,17 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, break; case LLAssetType::AT_CATEGORY: - is_movable = !LLAssetType::lookupIsProtectedCategoryType(((LLInventoryCategory*)inv_item)->getPreferredType()); + is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); break; default: break; } - LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); - LLUUID current_outfit_id = model->findCategoryUUIDForType(LLAssetType::AT_CURRENT_OUTFIT); + const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLAssetType::AT_OUTFIT); + BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); if(is_movable && move_is_into_trash) { @@ -2874,7 +2874,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, .isObjDirectDescendentOfCategory (inv_item, getCategory()); } - LLUUID favorites_id = model->findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + const LLUUID& favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE); // we can move item inside a folder only if this folder is Favorites. See EXT-719 accept = is_movable && ((mUUID != inv_item->getParentUUID()) || (mUUID == favorites_id)); @@ -4915,7 +4915,7 @@ void LLLSLTextBridgeAction::doIt() BOOL LLWearableBridgeAction::isInTrash() const { if(!mModel) return FALSE; - LLUUID trash_id = mModel->findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = mModel->findCategoryUUIDForType(LLFolderType::FT_TRASH); return mModel->isObjectDescendentOf(mUUID, trash_id); } @@ -5054,7 +5054,7 @@ std::string LLLinkFolderBridge::sPrefix("Link: "); LLUIImagePtr LLLinkFolderBridge::getIcon() const { - LLAssetType::EType preferred_type = LLAssetType::AT_NONE; + LLFolderType::EType preferred_type = LLFolderType::FT_NONE; if (LLViewerInventoryItem *item = getItem()) { if (const LLViewerInventoryCategory* cat = item->getLinkedCategory()) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 6b2a2d32de..abf9905b73 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -158,7 +158,7 @@ public: virtual const std::string& getName() const; virtual const std::string& getDisplayName() const; virtual PermissionMask getPermissionMask() const; - virtual LLAssetType::EType getPreferredType() const; + virtual LLFolderType::EType getPreferredType() const; virtual time_t getCreationDate() const; virtual LLFontGL::StyleFlags getLabelStyle() const { @@ -297,9 +297,9 @@ public: virtual void selectItem(); virtual void restoreItem(); - virtual LLAssetType::EType getPreferredType() const; + virtual LLFolderType::EType getPreferredType() const; virtual LLUIImagePtr getIcon() const; - static LLUIImagePtr getIcon(LLAssetType::EType asset_type); + static LLUIImagePtr getIcon(LLFolderType::EType preferred_type); virtual BOOL renameItem(const std::string& new_name); virtual BOOL removeItem(); @@ -320,7 +320,7 @@ public: virtual BOOL copyToClipboard() const; static void createWearable(LLFolderBridge* bridge, EWearableType type); - static void createWearable(LLUUID parent_folder_id, EWearableType type); + static void createWearable(const LLUUID &parent_folder_id, EWearableType type); LLViewerInventoryCategory* getCategory() const; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 6009e8e610..091a7c8f4f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -47,6 +47,7 @@ #include "llfocusmgr.h" #include "llinventorybridge.h" #include "llfloaterinventory.h" +#include "llviewerfoldertype.h" #include "llviewerinventory.h" #include "llviewermessage.h" #include "llviewerwindow.h" @@ -305,7 +306,7 @@ void LLInventoryModel::unlockDirectDescendentArrays(const LLUUID& cat_id) // specifies 'type' as what it defaults to containing. The category is // not necessarily only for that type. *NOTE: This will create a new // inventory category on the fly if one does not exist. -LLUUID LLInventoryModel::findCategoryUUIDForType(LLAssetType::EType t, bool create_folder) +const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType t, bool create_folder) { const LLUUID &rv = findCatUUID(t); if(rv.isNull() && isInventoryUsable() && create_folder) @@ -321,10 +322,10 @@ LLUUID LLInventoryModel::findCategoryUUIDForType(LLAssetType::EType t, bool crea // Internal method which looks for a category with the specified // preferred type. Returns LLUUID::null if not found. -const LLUUID &LLInventoryModel::findCatUUID(LLAssetType::EType preferred_type) const +const LLUUID &LLInventoryModel::findCatUUID(LLFolderType::EType preferred_type) const { const LLUUID &root_id = gInventory.getRootFolderID(); - if(LLAssetType::AT_CATEGORY == preferred_type) + if(LLFolderType::FT_CATEGORY == preferred_type) { return root_id; } @@ -352,7 +353,7 @@ const LLUUID &LLInventoryModel::findCatUUID(LLAssetType::EType preferred_type) c // version will take care of details like what the name should be // based on preferred type. Returns the UUID of the new category. LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, - LLAssetType::EType preferred_type, + LLFolderType::EType preferred_type, const std::string& pname) { LLUUID id; @@ -362,9 +363,9 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, return id; } - if(preferred_type == LLAssetType::AT_SIMSTATE) + if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup()) { - lldebugs << "Attempt to create simstate category." << llendl; + lldebugs << "Attempt to create undefined category." << llendl; return id; } @@ -376,7 +377,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, } else { - name.assign(LLAssetType::lookupCategoryName(preferred_type)); + name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type)); } // Add the category to the internal representation @@ -440,7 +441,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, // Start with categories if(!include_trash) { - const LLUUID trash_id = findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); if(trash_id.notNull() && (trash_id == id)) return; } @@ -474,7 +475,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, if (item->getActualType() == LLAssetType::AT_LINK_FOLDER) { LLViewerInventoryCategory *linked_cat = item->getLinkedCategory(); - if (linked_cat && linked_cat->getPreferredType() != LLAssetType::AT_OUTFIT) + if (linked_cat && linked_cat->getPreferredType() != LLFolderType::FT_OUTFIT) // BAP - was // LLAssetType::lookupIsEnsembleCategoryType(linked_cat->getPreferredType())) // Change back once ensemble typing is in place. @@ -654,7 +655,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) if(item->getParentUUID().isNull()) { - LLUUID category_id = findCategoryUUIDForType(new_item->getType()); + const LLUUID category_id = findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(new_item->getType())); new_item->setParent(category_id); item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, category_id); if( item_array ) @@ -678,7 +679,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) LLUUID parent_id = item->getParentUUID(); if(parent_id == CATEGORIZE_LOST_AND_FOUND_ID) { - parent_id = findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); new_item->setParent(parent_id); } item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, parent_id); @@ -691,7 +692,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) // Whoops! No such parent, make one. llinfos << "Lost item: " << new_item->getUUID() << " - " << new_item->getName() << llendl; - parent_id = findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); new_item->setParent(parent_id); item_array = get_ptr_in_map(mParentChildItemTree, parent_id); if(item_array) @@ -1173,7 +1174,7 @@ void LLInventoryModel::mock(const LLUUID& root_id) root_id, LLUUID::null, LLAssetType::AT_CATEGORY, - LLAssetType::lookupCategoryName(LLAssetType::AT_ROOT_CATEGORY), + LLFolderType::lookupNewCategoryName(LLFolderType::FT_ROOT_CATEGORY), gAgent.getID()); addCategory(cat); gInventory.buildParentChildMap(); @@ -1331,7 +1332,7 @@ void fetchDescendentsResponder::result(const LLSD& content) item_it != folder_sd["items"].endArray(); ++item_it) { - LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); if (lost_uuid.notNull()) { LLSD item = *item_it; @@ -2021,7 +2022,7 @@ bool LLInventoryModel::loadSkeleton( update_map_t child_counts; LLUUID id; - LLAssetType::EType preferred_type; + LLFolderType::EType preferred_type; bool rv = true; for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) { @@ -2044,12 +2045,12 @@ bool LLInventoryModel::loadSkeleton( skel = (*it).find("type_default"); if(skel == no_response) { - preferred_type = LLAssetType::AT_NONE; + preferred_type = LLFolderType::FT_NONE; } else { S32 t = atoi((*skel).second.c_str()); - preferred_type = (LLAssetType::EType)t; + preferred_type = (LLFolderType::EType)t; } cat->setPreferredType(preferred_type); skel = (*it).find("version"); @@ -2397,12 +2398,12 @@ void LLInventoryModel::buildParentChildMap() << cat->getName() << llendl; ++lost; // plop it into the lost & found. - LLAssetType::EType pref = cat->getPreferredType(); - if(LLAssetType::AT_NONE == pref) + LLFolderType::EType pref = cat->getPreferredType(); + if(LLFolderType::FT_NONE == pref) { - cat->setParent(findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND)); + cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); } - else if(LLAssetType::AT_CATEGORY == pref) + else if(LLFolderType::FT_CATEGORY == pref) { // it's the root cat->setParent(LLUUID::null); @@ -2461,7 +2462,7 @@ void LLInventoryModel::buildParentChildMap() ++lost; // plop it into the lost & found. // - item->setParent(findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND)); + item->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); // move it later using a special message to move items. If // we update server here, the client might crash. //item->updateServer(); @@ -2482,7 +2483,7 @@ void LLInventoryModel::buildParentChildMap() llwarns << "Found " << lost << " lost items." << llendl; LLMessageSystem* msg = gMessageSystem; BOOL start_new_message = TRUE; - LLUUID lnf = findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + const LLUUID lnf = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); for(std::vector::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it) { if(start_new_message) @@ -2935,7 +2936,7 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, lastfolder = tfolder; tfolder->unpackMessage(msg, _PREHASH_FolderData, i); // make sure it's not a protected folder - tfolder->setPreferredType(LLAssetType::AT_NONE); + tfolder->setPreferredType(LLFolderType::FT_NONE); folders.push_back(tfolder); // examine update for changes. LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID()); @@ -3322,31 +3323,31 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) //---------------------------------------------------------------------------- -// Trash: LLAssetType::AT_TRASH, "ConfirmEmptyTrash" -// Lost&Found: LLAssetType::AT_LOST_AND_FOUND, "ConfirmEmptyLostAndFound" +// Trash: LLFolderType::FT_TRASH, "ConfirmEmptyTrash" +// Lost&Found: LLFolderType::FT_LOST_AND_FOUND, "ConfirmEmptyLostAndFound" -bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLAssetType::EType folder_type) +bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type) { S32 option = LLNotification::getSelectedOption(notification, response); if (option == 0) // YES { - LLUUID folder_id = findCategoryUUIDForType(folder_type); + const LLUUID folder_id = findCategoryUUIDForType(preferred_type); purgeDescendentsOf(folder_id); notifyObservers(); } return false; } -void LLInventoryModel::emptyFolderType(const std::string notification, LLAssetType::EType folder_type) +void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderType::EType preferred_type) { if (!notification.empty()) { LLNotifications::instance().add(notification, LLSD(), LLSD(), - boost::bind(&LLInventoryModel::callbackEmptyFolderType, this, _1, _2, folder_type)); + boost::bind(&LLInventoryModel::callbackEmptyFolderType, this, _1, _2, preferred_type)); } else { - LLUUID folder_id = findCategoryUUIDForType(folder_type); + const LLUUID folder_id = findCategoryUUIDForType(preferred_type); purgeDescendentsOf(folder_id); notifyObservers(); } @@ -3357,7 +3358,7 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLAssetTy void LLInventoryModel::removeItem(const LLUUID& item_id) { LLViewerInventoryItem* item = getItem(item_id); - const LLUUID new_parent = findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID new_parent = findCategoryUUIDForType(LLFolderType::FT_TRASH); if (item && item->getParentUUID() != new_parent) { LLInventoryModel::update_list_t update; diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index c2d8717b70..ed7ba5db8b 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -34,6 +34,7 @@ #define LL_LLINVENTORYMODEL_H #include "llassettype.h" +#include "llfoldertype.h" #include "lldarray.h" #include "llframetimer.h" #include "llhttpclient.h" @@ -278,7 +279,7 @@ public: // SDK: Added flag to specify whether the folder should be created if not found. This fixes the horrible // multiple trash can bug. - LLUUID findCategoryUUIDForType(LLAssetType::EType preferred_type, bool create_folder = true); + const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder = true); // Call this method when it's time to update everyone on a new // state, by default, the inventory model will not update @@ -327,7 +328,7 @@ public: // category. If you want to use the default name based on type, // pass in a NULL to the 'name parameter. LLUUID createNewCategory(const LLUUID& parent_id, - LLAssetType::EType preferred_type, + LLFolderType::EType preferred_type, const std::string& name); // methods to load up inventory skeleton & meat. These are used @@ -385,9 +386,9 @@ public: bool isCategoryComplete(const LLUUID& cat_id) const; // callbacks - // Trigger a notification and empty the folder type (AT_TRASH or AT_LOST_AND_FOUND) if confirmed - void emptyFolderType(const std::string notification, LLAssetType::EType folder_type); - bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLAssetType::EType folder_type); + // Trigger a notification and empty the folder type (FT_TRASH or FT_LOST_AND_FOUND) if confirmed + void emptyFolderType(const std::string notification, LLFolderType::EType folder_type); + bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLFolderType::EType preferred_type); // Utility Functions void removeItem(const LLUUID& item_id); @@ -431,7 +432,7 @@ protected: // // Internal method which looks for a category with the specified // preferred type. Returns LLUUID::null if not found - const LLUUID &findCatUUID(LLAssetType::EType preferred_type) const; + const LLUUID &findCatUUID(LLFolderType::EType preferred_type) const; // Empty the entire contents void empty(); diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index b36b7cf50e..a341720aec 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -138,8 +138,7 @@ static void fetch_landmarks(LLInventoryModel::cat_array_t& cats, LLInventoryCollectFunctor& add) { // Look in "My Favorites" - LLUUID favorites_folder_id = - gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + const LLUUID favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); gInventory.collectDescendentsIf(favorites_folder_id, cats, items, @@ -147,8 +146,7 @@ static void fetch_landmarks(LLInventoryModel::cat_array_t& cats, add); // Look in "Landmarks" - LLUUID landmarks_folder_id = - gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + const LLUUID landmarks_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); gInventory.collectDescendentsIf(landmarks_folder_id, cats, items, @@ -250,7 +248,7 @@ void LLLandmarkActions::createLandmarkHere() LLAgentUI::buildLocationString(landmark_name, LLAgentUI::LOCATION_FORMAT_LANDMARK); LLAgentUI::buildLocationString(landmark_desc, LLAgentUI::LOCATION_FORMAT_FULL); - LLUUID folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); createLandmarkHere(landmark_name, landmark_desc, folder_id); } diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index ea528a1df8..a4ff78ee9b 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -59,6 +59,7 @@ #include "lltoolcomp.h" #include "lltoolmgr.h" #include "lltrans.h" +#include "llviewerassettype.h" #include "llviewerobject.h" #include "llviewerregion.h" #include "llviewerwindow.h" @@ -167,7 +168,7 @@ void LLPanelContents::onClickNewScript(void *userdata) PERM_NONE, PERM_MOVE | PERM_TRANSFER); std::string desc; - LLAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); + LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer new_item = new LLViewerInventoryItem( LLUUID::null, diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index faa938c772..e0c92fd4ab 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -531,7 +531,7 @@ void LLLandmarksPanel::onAddFolderButtonClick() const menu_create_inventory_item(mCurrentSelectedList->getRootFolder() , dynamic_cast(folder_bridge) , LLSD("category") - , gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK) + , gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK) ); } } diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 609b205920..38ec9612a6 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -912,7 +912,7 @@ void LLPanelPlaceInfo::createLandmark(const LLUUID& folder_id) LLStringUtil::replaceChar(desc, '\n', ' '); // If no folder chosen use the "Landmarks" folder. LLLandmarkActions::createLandmarkHere(name, desc, - folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK)); + folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK)); } void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global, LLPanelPickEdit* pick_panel) @@ -960,7 +960,7 @@ void LLPanelPlaceInfo::populateFoldersList() mFolderCombo->removeall(); // Put the "Landmarks" folder first in list. - LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + const LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); const LLViewerInventoryCategory* cat = gInventory.getCategory(landmarks_id); if (!cat) { @@ -1058,7 +1058,7 @@ static std::string getFullFolderName(const LLViewerInventoryCategory* cat) static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats) { - LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + const LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); // Add descendent folders of the "Landmarks" category. LLInventoryModel::item_array_t items; // unused @@ -1071,7 +1071,7 @@ static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats) is_category); // Add the "My Favorites" category. - LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + const LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); LLViewerInventoryCategory* favorites_cat = gInventory.getCategory(favorites_id); if (!favorites_cat) { diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 5ab823b6e5..aa9b698b37 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -588,7 +588,7 @@ void LLPanelPlaces::onOverflowButtonClicked() if (mItem.notNull()) { const LLUUID& item_id = mItem->getUUID(); - const LLUUID& trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); is_landmark_removable = gInventory.isObjectDescendentOf(item_id, gInventory.getRootFolderID()) && !gInventory.isObjectDescendentOf(item_id, trash_id); } @@ -668,7 +668,7 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param) { if ( mItem.notNull() ) { - LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + const LLUUID& favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); if ( favorites_id.notNull() ) { copy_inventory_item(gAgent.getID(), diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index b06e70c00a..34e78b5c46 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -45,6 +45,7 @@ #include "lltooldraganddrop.h" #include "llradiogroup.h" #include "llassetstorage.h" +#include "llviewerassettype.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "lldbstrings.h" @@ -317,7 +318,7 @@ BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y)) { EDragAndDropType type; - type = LLAssetType::lookupDragAndDropType(item->getType()); + type = LLViewerAssetType::lookupDragAndDropType(item->getType()); LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_LIBRARY; if(!mObjectUUID.isNull()) { @@ -406,7 +407,7 @@ void LLPreview::onDiscardBtn(void* data) */ // Move the item to the trash - LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if (item->getParentUUID() != trash_id) { LLInventoryModel::update_list_t update; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index ab2afb8056..7b3a20d102 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -130,10 +130,10 @@ LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& ob preview->setObjectID(object_id); // Start speculative download of sounds and animations - LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_ANIMATION); + const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION); gInventory.startBackgroundFetch(animation_folder_id); - LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_SOUND); + const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND); gInventory.startBackgroundFetch(sound_folder_id); // this will call refresh when we have everything. diff --git a/indra/newview/llresourcedata.h b/indra/newview/llresourcedata.h index 46b79150bb..b4b9042689 100644 --- a/indra/newview/llresourcedata.h +++ b/indra/newview/llresourcedata.h @@ -39,11 +39,12 @@ struct LLResourceData { LLAssetInfo mAssetInfo; - LLAssetType::EType mPreferredLocation; + LLFolderType::EType mPreferredLocation; LLInventoryType::EType mInventoryType; U32 mNextOwnerPerm; S32 mExpectedUploadCost; void *mUserData; + static const S8 INVALID_LOCATION = -2; }; #endif diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index a7f0ce16d3..1e5ee29529 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2820,7 +2820,7 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response, case 0: { // TODO: Make sure you have delete permissions on all of them. - LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); // attempt to derez into the trash. LLDeRezInfo* info = new LLDeRezInfo(DRD_TRASH, trash_id); LLSelectMgr::getInstance()->sendListToRegions("DeRezObject", diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8793d22646..51b651d58e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -330,7 +330,7 @@ void populate_favorites_bar() S32 count = lib_cats->count(); for(S32 i = 0; i < count; ++i) { - if(lib_cats->get(i)->getPreferredType() == LLAssetType::AT_LANDMARK) + if(lib_cats->get(i)->getPreferredType() == LLFolderType::FT_LANDMARK) { lib_landmarks = lib_cats->get(i)->getUUID(); break; @@ -347,7 +347,7 @@ void populate_favorites_bar() gInventory.getDirectDescendentsOf(lib_landmarks, lm_cats, lm_items); if (!lm_items) return; - LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + const LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); if (favorites_id.isNull()) { llerror("My Inventory is missing My Favorites", 0); @@ -2178,7 +2178,7 @@ bool idle_startup() gInventory.buildParentChildMap(); //all categories loaded. lets create "My Favorites" category - gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE,true); + gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true); // lets create "Friends" and "Friends/All" in the Inventory "Calling Cards" and fill it with buddies LLFriendCardsManager::instance().syncFriendsFolder(); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index b5aec1b80b..0fcbb60c72 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -424,7 +424,7 @@ BOOL LLFloaterTexturePicker::postBuild() mInventoryPanel->getRootFolder()->getFilter()->markDefault(); // Commented out to stop opening all folders with textures - // mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE); + // mInventoryPanel->openDefaultFolderForType(LLFolderType::FT_TEXTURE); // don't put keyboard focus on selected item, because the selection callback // will assume that this was user input @@ -1071,7 +1071,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { showPicker(FALSE); //grab textures first... - gInventory.startBackgroundFetch(gInventory.findCategoryUUIDForType(LLAssetType::AT_TEXTURE)); + gInventory.startBackgroundFetch(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); //...then start full inventory fetch. gInventory.startBackgroundFetch(); handled = TRUE; diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index e26a0776ff..2529ac9cf6 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -219,7 +219,6 @@ bool LLToastGroupNotifyPanel::isAttachmentOpenable(LLAssetType::EType type) switch(type) { case LLAssetType::AT_LANDMARK: - case LLAssetType::AT_FAVORITE: case LLAssetType::AT_NOTECARD: case LLAssetType::AT_IMAGE_JPEG: case LLAssetType::AT_IMAGE_TGA: diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 9a63f07a7e..959cb3f182 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -92,7 +92,7 @@ public: virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) { - if(cat && (cat->getPreferredType() == LLAssetType::AT_NONE)) + if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE)) { return true; } @@ -109,7 +109,7 @@ public: LLInventoryItem* item) { if(item) return true; - if(cat && (cat->getPreferredType() == LLAssetType::AT_NONE)) + if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE)) { return true; } @@ -1317,8 +1317,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // Check if it's in the trash. bool is_in_trash = false; - LLUUID trash_id; - trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { is_in_trash = true; @@ -2088,7 +2087,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( if(!item || !item->isComplete()) return ACCEPT_NO; // must not be in the trash - LLUUID trash_id(gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH)); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) ) { return ACCEPT_NO; @@ -2170,8 +2169,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( } // Check if it's in the trash. - LLUUID trash_id; - trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { accept = ACCEPT_YES_SINGLE; @@ -2249,8 +2247,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( } // Check if it's in the trash. - LLUUID trash_id; - trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { accept = ACCEPT_YES_SINGLE; @@ -2388,7 +2385,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) { // it's in the agent inventory - LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) ) { return ACCEPT_NO; @@ -2443,7 +2440,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY) { // it's in the agent inventory - LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) ) { return ACCEPT_NO; @@ -2502,7 +2499,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( if(mSource == SOURCE_AGENT) { - LLUUID trash_id(gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH)); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) ) { return ACCEPT_NO; diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp new file mode 100644 index 0000000000..c974171c2c --- /dev/null +++ b/indra/newview/llviewerassettype.cpp @@ -0,0 +1,114 @@ +/** + * @file llassettype.cpp + * @brief Implementatino of LLViewerAssetType functionality. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * 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 + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llviewerassettype.h" +#include "lldictionary.h" +#include "llmemory.h" +#include "llsingleton.h" + +static const std::string empty_string; + +struct ViewerAssetEntry : public LLDictionaryEntry +{ + ViewerAssetEntry(EDragAndDropType dad_type // drag and drop type + ) + : + LLDictionaryEntry(empty_string), // no reverse lookup needed for now, so just leave this blank + mDadType(dad_type) + { + } + EDragAndDropType mDadType; +}; + +class LLViewerAssetDictionary : public LLSingleton, + public LLDictionary +{ +public: + LLViewerAssetDictionary(); +}; + +LLViewerAssetDictionary::LLViewerAssetDictionary() +{ + // DRAG&DROP TYPE + // |--------------------| + addEntry(LLViewerAssetType::AT_TEXTURE, new ViewerAssetEntry(DAD_TEXTURE)); + addEntry(LLViewerAssetType::AT_SOUND, new ViewerAssetEntry(DAD_SOUND)); + addEntry(LLViewerAssetType::AT_CALLINGCARD, new ViewerAssetEntry(DAD_CALLINGCARD)); + addEntry(LLViewerAssetType::AT_LANDMARK, new ViewerAssetEntry(DAD_LANDMARK)); + addEntry(LLViewerAssetType::AT_SCRIPT, new ViewerAssetEntry(DAD_NONE)); + addEntry(LLViewerAssetType::AT_CLOTHING, new ViewerAssetEntry(DAD_CLOTHING)); + addEntry(LLViewerAssetType::AT_OBJECT, new ViewerAssetEntry(DAD_OBJECT)); + addEntry(LLViewerAssetType::AT_NOTECARD, new ViewerAssetEntry(DAD_NOTECARD)); + addEntry(LLViewerAssetType::AT_CATEGORY, new ViewerAssetEntry(DAD_CATEGORY)); + addEntry(LLViewerAssetType::AT_ROOT_CATEGORY, new ViewerAssetEntry(DAD_ROOT_CATEGORY)); + addEntry(LLViewerAssetType::AT_LSL_TEXT, new ViewerAssetEntry(DAD_SCRIPT)); + addEntry(LLViewerAssetType::AT_LSL_BYTECODE, new ViewerAssetEntry(DAD_NONE)); + addEntry(LLViewerAssetType::AT_TEXTURE_TGA, new ViewerAssetEntry(DAD_NONE)); + addEntry(LLViewerAssetType::AT_BODYPART, new ViewerAssetEntry(DAD_BODYPART)); + addEntry(LLViewerAssetType::AT_SOUND_WAV, new ViewerAssetEntry(DAD_NONE)); + addEntry(LLViewerAssetType::AT_IMAGE_TGA, new ViewerAssetEntry(DAD_NONE)); + addEntry(LLViewerAssetType::AT_IMAGE_JPEG, new ViewerAssetEntry(DAD_NONE)); + addEntry(LLViewerAssetType::AT_ANIMATION, new ViewerAssetEntry(DAD_ANIMATION)); + addEntry(LLViewerAssetType::AT_GESTURE, new ViewerAssetEntry(DAD_GESTURE)); + addEntry(LLViewerAssetType::AT_SIMSTATE, new ViewerAssetEntry(DAD_NONE)); + + addEntry(LLViewerAssetType::AT_LINK, new ViewerAssetEntry(DAD_LINK)); + addEntry(LLViewerAssetType::AT_LINK_FOLDER, new ViewerAssetEntry(DAD_LINK)); + + addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE)); +}; + +EDragAndDropType LLViewerAssetType::lookupDragAndDropType(EType asset_type) +{ + const LLViewerAssetDictionary *dict = LLViewerAssetDictionary::getInstance(); + const ViewerAssetEntry *entry = dict->lookup(asset_type); + if (entry) + return entry->mDadType; + else + return DAD_NONE; +} + +// Generate a good default description +void LLViewerAssetType::generateDescriptionFor(LLViewerAssetType::EType asset_type, + std::string& description) +{ + const S32 BUF_SIZE = 30; + char time_str[BUF_SIZE]; /* Flawfinder: ignore */ + time_t now; + time(&now); + memset(time_str, '\0', BUF_SIZE); + strftime(time_str, BUF_SIZE - 1, "%Y-%m-%d %H:%M:%S ", localtime(&now)); + description.assign(time_str); + description.append(LLAssetType::lookupHumanReadable(asset_type)); +} diff --git a/indra/newview/llviewerassettype.h b/indra/newview/llviewerassettype.h new file mode 100644 index 0000000000..01158885ce --- /dev/null +++ b/indra/newview/llviewerassettype.h @@ -0,0 +1,54 @@ +/** + * @file llviewerassettype.h + * @brief Declaration of LLViewerViewerAssetType. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * 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 + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLVIEWERASSETTYPE_H +#define LL_LLVIEWERASSETTYPE_H + +#include +#include "llassettype.h" + +// This class is similar to llassettype, but contains methods +// only used by the viewer. +class LLViewerAssetType : public LLAssetType +{ +public: + // Generate a good default description. You may want to add a verb + // or agent name after this depending on your application. + static void generateDescriptionFor(LLViewerAssetType::EType asset_type, + std::string& description); + static EDragAndDropType lookupDragAndDropType(EType asset_type); +protected: + LLViewerAssetType() {} + ~LLViewerAssetType() {} +}; + +#endif // LL_LLVIEWERASSETTYPE_H diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp new file mode 100644 index 0000000000..384538364f --- /dev/null +++ b/indra/newview/llviewerfoldertype.cpp @@ -0,0 +1,263 @@ +/** + * @file llfoldertype.cpp + * @brief Implementation of LLViewerFolderType functionality. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * 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 + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llviewerfoldertype.h" +#include "lldictionary.h" +#include "llmemory.h" +#include "llvisualparam.h" + +static const std::string empty_string; + +struct ViewerFolderEntry : public LLDictionaryEntry +{ + // Constructor for non-ensembles + ViewerFolderEntry(const std::string &new_category_name, // default name when creating a new category of this type + const std::string &icon_name // name of the folder icon + ) + : + LLDictionaryEntry(empty_string), // no reverse lookup needed on non-ensembles, so just leave this blank + mIconName(icon_name), + mNewCategoryName(new_category_name) + { + mAllowedNames.clear(); + } + + // Constructor for ensembles + ViewerFolderEntry(const std::string &xui_name, // name of the xui menu item + const std::string &new_category_name, // default name when creating a new category of this type + const std::string &icon_name, // name of the folder icon + const std::string allowed_names // allowed item typenames for this folder type + ) + : + LLDictionaryEntry(xui_name), + mIconName(icon_name), + mNewCategoryName(new_category_name) + { + const std::string delims (","); + LLStringUtilBase::getTokens(allowed_names, mAllowedNames, delims); + } + + bool getIsAllowedName(const std::string &name) const + { + if (mAllowedNames.empty()) + return false; + for (name_vec_t::const_iterator iter = mAllowedNames.begin(); + iter != mAllowedNames.end(); + iter++) + { + if (name == (*iter)) + return true; + } + return false; + } + const std::string mIconName; + const std::string mNewCategoryName; + typedef std::vector name_vec_t; + name_vec_t mAllowedNames; +}; + +class LLViewerFolderDictionary : public LLSingleton, + public LLDictionary +{ +public: + LLViewerFolderDictionary(); +protected: + bool initEnsemblesFromFile(); // Reads in ensemble information from foldertypes.xml +}; + +LLViewerFolderDictionary::LLViewerFolderDictionary() +{ + initEnsemblesFromFile(); + + // NEW CATEGORY NAME FOLDER ICON NAME + // |-------------------------|---------------------------| + addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "inv_folder_texture.tga")); + addEntry(LLFolderType::FT_SOUND, new ViewerFolderEntry("Sounds", "inv_folder_sound.tga")); + addEntry(LLFolderType::FT_CALLINGCARD, new ViewerFolderEntry("Calling Cards", "inv_folder_callingcard.tga")); + addEntry(LLFolderType::FT_LANDMARK, new ViewerFolderEntry("Landmarks", "inv_folder_landmark.tga")); + addEntry(LLFolderType::FT_CLOTHING, new ViewerFolderEntry("Clothing", "inv_folder_clothing.tga")); + addEntry(LLFolderType::FT_OBJECT, new ViewerFolderEntry("Objects", "inv_folder_object.tga")); + addEntry(LLFolderType::FT_NOTECARD, new ViewerFolderEntry("Notecards", "inv_folder_notecard.tga")); + addEntry(LLFolderType::FT_CATEGORY, new ViewerFolderEntry("New Folder", "inv_folder_plain_closed.tga")); + addEntry(LLFolderType::FT_ROOT_CATEGORY, new ViewerFolderEntry("Inventory", "")); + addEntry(LLFolderType::FT_LSL_TEXT, new ViewerFolderEntry("Scripts", "inv_folder_script.tga")); + addEntry(LLFolderType::FT_BODYPART, new ViewerFolderEntry("Body Parts", "inv_folder_bodypart.tga")); + addEntry(LLFolderType::FT_TRASH, new ViewerFolderEntry("Trash", "inv_folder_trash.tga")); + addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new ViewerFolderEntry("Photo Album", "inv_folder_snapshot.tga")); + addEntry(LLFolderType::FT_LOST_AND_FOUND, new ViewerFolderEntry("Lost And Found", "inv_folder_lostandfound.tga")); + addEntry(LLFolderType::FT_ANIMATION, new ViewerFolderEntry("Animations", "inv_folder_animation.tga")); + addEntry(LLFolderType::FT_GESTURE, new ViewerFolderEntry("Gestures", "inv_folder_gesture.tga")); + addEntry(LLFolderType::FT_FAVORITE, new ViewerFolderEntry("Favorite", "inv_folder_plain_closed.tga")); + + addEntry(LLFolderType::FT_CURRENT_OUTFIT, new ViewerFolderEntry("Current Outfit", "inv_folder_current_outfit.tga")); + addEntry(LLFolderType::FT_OUTFIT, new ViewerFolderEntry("New Outfit", "inv_folder_outfit.tga")); + addEntry(LLFolderType::FT_MY_OUTFITS, new ViewerFolderEntry("My Outfits", "inv_folder_my_outfits.tga")); + addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Inbox", "inv_folder_inbox.tga")); + + addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "inv_folder_plain_closed.tga")); +} + +bool LLViewerFolderDictionary::initEnsemblesFromFile() +{ + std::string xml_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"foldertypes.xml"); + LLXmlTree folder_def; + if (!folder_def.parseFile(xml_filename)) + { + llerrs << "Failed to parse folders file " << xml_filename << llendl; + return false; + } + + LLXmlTreeNode* rootp = folder_def.getRoot(); + for (LLXmlTreeNode* ensemble = rootp->getFirstChild(); + ensemble; + ensemble = rootp->getNextChild()) + { + if (!ensemble->hasName("ensemble")) + { + llwarns << "Invalid ensemble definition node " << ensemble->getName() << llendl; + continue; + } + + S32 ensemble_type; + static LLStdStringHandle ensemble_num_string = LLXmlTree::addAttributeString("foldertype_num"); + if (!ensemble->getFastAttributeS32(ensemble_num_string, ensemble_type)) + { + llwarns << "No ensemble type defined" << llendl; + continue; + } + + + if (ensemble_type < S32(LLFolderType::FT_ENSEMBLE_START) || ensemble_type > S32(LLFolderType::FT_ENSEMBLE_END)) + { + llwarns << "Exceeded maximum ensemble index" << LLFolderType::FT_ENSEMBLE_END << llendl; + break; + } + + std::string xui_name; + static LLStdStringHandle xui_name_string = LLXmlTree::addAttributeString("xui_name"); + if (!ensemble->getFastAttributeString(xui_name_string, xui_name)) + { + llwarns << "No xui name defined" << llendl; + continue; + } + + std::string icon_name; + static LLStdStringHandle icon_name_string = LLXmlTree::addAttributeString("icon_name"); + if (!ensemble->getFastAttributeString(icon_name_string, icon_name)) + { + llwarns << "No ensemble icon name defined" << llendl; + continue; + } + + std::string allowed_names; + static LLStdStringHandle allowed_names_string = LLXmlTree::addAttributeString("allowed"); + if (!ensemble->getFastAttributeString(allowed_names_string, allowed_names)) + { + } + + // Add the entry and increment the asset number. + const static std::string new_ensemble_name = "New Ensemble"; + addEntry(LLFolderType::EType(ensemble_type), new ViewerFolderEntry(xui_name, new_ensemble_name, icon_name, allowed_names)); + } + + return true; +} + + +const std::string &LLViewerFolderType::lookupXUIName(LLFolderType::EType folder_type) +{ + const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); + if (entry) + { + return entry->mName; + } + return badLookup(); +} + +LLFolderType::EType LLViewerFolderType::lookupTypeFromXUIName(const std::string &name) +{ + return LLViewerFolderDictionary::getInstance()->lookup(name); +} + +const std::string &LLViewerFolderType::lookupIconName(LLFolderType::EType folder_type) +{ + const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); + if (entry) + { + return entry->mIconName; + } + return badLookup(); +} + +const std::string &LLViewerFolderType::lookupNewCategoryName(LLFolderType::EType folder_type) +{ + const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); + if (entry) + { + return entry->mNewCategoryName; + } + return badLookup(); +} + +LLFolderType::EType LLViewerFolderType::lookupTypeFromNewCategoryName(const std::string& name) +{ + for (LLViewerFolderDictionary::const_iterator iter = LLViewerFolderDictionary::getInstance()->begin(); + iter != LLViewerFolderDictionary::getInstance()->end(); + iter++) + { + const ViewerFolderEntry *entry = iter->second; + if (entry->mNewCategoryName == name) + { + return iter->first; + } + } + return FT_NONE; +} + + +U64 LLViewerFolderType::lookupValidFolderTypes(const std::string& item_name) +{ + U64 matching_folders = 0; + for (LLViewerFolderDictionary::const_iterator iter = LLViewerFolderDictionary::getInstance()->begin(); + iter != LLViewerFolderDictionary::getInstance()->end(); + iter++) + { + const ViewerFolderEntry *entry = iter->second; + if (entry->getIsAllowedName(item_name)) + { + matching_folders |= 1LL << iter->first; + } + } + return matching_folders; +} diff --git a/indra/newview/llviewerfoldertype.h b/indra/newview/llviewerfoldertype.h new file mode 100644 index 0000000000..a6aea62b2a --- /dev/null +++ b/indra/newview/llviewerfoldertype.h @@ -0,0 +1,57 @@ +/** + * @file llviewerfoldertype.h + * @brief Declaration of LLAssetType. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * 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 + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLVIEWERFOLDERTYPE_H +#define LL_LLVIEWERFOLDERTYPE_H + +#include +#include "llfoldertype.h" + +// This class is similar to llfoldertype, but contains methods +// only used by the viewer. This also handles ensembles. +class LLViewerFolderType : public LLFolderType +{ +public: + static const std::string& lookupXUIName(EType folder_type); // name used by the UI + static LLFolderType::EType lookupTypeFromXUIName(const std::string& name); + + static const std::string& lookupIconName(EType asset_type); // folder icon name + static const std::string& lookupNewCategoryName(EType folder_type); // default name when creating new category + static LLFolderType::EType lookupTypeFromNewCategoryName(const std::string& name); // default name when creating new category + + static U64 lookupValidFolderTypes(const std::string& item_name); // which folders allow an item of this type? +protected: + LLViewerFolderType() {} + ~LLViewerFolderType() {} +}; + +#endif // LL_LLVIEWERFOLDERTYPE_H diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 57a4117d5d..38ff5a2064 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -37,7 +37,7 @@ #include "indra_constants.h" #include "llagent.h" -#include "llfoldertype.h" +#include "llviewerfoldertype.h" #include "llviewercontrol.h" #include "llconsole.h" #include "llinventorymodel.h" @@ -48,6 +48,7 @@ #include "llinventorybridge.h" #include "llfloaterinventory.h" +#include "llviewerassettype.h" #include "llviewerregion.h" #include "llviewerobjectlist.h" #include "llpreviewgesture.h" @@ -359,7 +360,7 @@ void LLViewerInventoryItem::updateParentOnServer(BOOL restamp) const LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType pref, + LLFolderType::EType pref, const std::string& name, const LLUUID& owner_id) : LLInventoryCategory(uuid, parent_uuid, pref, name), @@ -416,7 +417,7 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const { // communicate that change with the server. - if (LLAssetType::lookupIsProtectedCategoryType(mPreferredType)) + if (LLFolderType::lookupIsProtectedType(mPreferredType)) { LLNotifications::instance().add("CannotModifyProtectedCategories"); return; @@ -440,7 +441,7 @@ void LLViewerInventoryCategory::removeFromServer( void ) llinfos << "Removing inventory category " << mUUID << " from server." << llendl; // communicate that change with the server. - if(LLAssetType::lookupIsProtectedCategoryType(mPreferredType)) + if(LLFolderType::lookupIsProtectedType(mPreferredType)) { LLNotifications::instance().add("CannotRemoveProtectedCategories"); return; @@ -543,7 +544,7 @@ bool LLViewerInventoryCategory::importFileLocal(LLFILE* fp) } else if(0 == strcmp("pref_type", keyword)) { - mPreferredType = LLAssetType::lookup(valuestr); + mPreferredType = LLFolderType::lookup(valuestr); } else if(0 == strcmp("name", keyword)) { @@ -581,7 +582,7 @@ bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const mParentUUID.toString(uuid_str); fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); - fprintf(fp, "\t\tpref_type\t%s\n", LLAssetType::lookup(mPreferredType)); + fprintf(fp, "\t\tpref_type\t%s\n", LLFolderType::lookup(mPreferredType).c_str()); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); mOwnerID.toString(uuid_str); fprintf(fp, "\t\towner_id\t%s\n", uuid_str.c_str()); @@ -592,8 +593,8 @@ bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const void LLViewerInventoryCategory::determineFolderType() { - LLAssetType::EType original_type = getPreferredType(); - if (LLAssetType::lookupIsProtectedCategoryType(original_type)) + LLFolderType::EType original_type = getPreferredType(); + if (LLFolderType::lookupIsProtectedType(original_type)) return; U64 folder_valid = 0; @@ -616,28 +617,28 @@ void LLViewerInventoryCategory::determineFolderType() { const EWearableType wearable_type = item->getWearableType(); const std::string& wearable_name = LLWearableDictionary::getTypeName(wearable_type); - U64 valid_folder_types = LLFolderType::lookupValidFolderTypes(wearable_name); + U64 valid_folder_types = LLViewerFolderType::lookupValidFolderTypes(wearable_name); folder_valid |= valid_folder_types; folder_invalid |= ~valid_folder_types; } } - for (U8 i = LLAssetType::AT_FOLDER_ENSEMBLE_START; i <= LLAssetType::AT_FOLDER_ENSEMBLE_END; i++) + for (U8 i = LLFolderType::FT_ENSEMBLE_START; i <= LLFolderType::FT_ENSEMBLE_END; i++) { if ((folder_valid & (1LL << i)) && !(folder_invalid & (1LL << i))) { - changeType((LLAssetType::EType)i); + changeType((LLFolderType::EType)i); return; } } } - if (LLAssetType::lookupIsEnsembleCategoryType(original_type)) + if (LLFolderType::lookupIsEnsembleType(original_type)) { - changeType(LLAssetType::AT_NONE); + changeType(LLFolderType::FT_NONE); } } -void LLViewerInventoryCategory::changeType(LLAssetType::EType new_folder_type) +void LLViewerInventoryCategory::changeType(LLFolderType::EType new_folder_type) { const LLUUID &folder_id = getUUID(); const LLUUID &parent_id = getParentUUID(); @@ -948,7 +949,7 @@ void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecar body["notecard-id"] = notecard_inv_id; body["object-id"] = object_id; body["item-id"] = src->getUUID(); - body["folder-id"] = gInventory.findCategoryUUIDForType(src->getType()); + body["folder-id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType())); body["callback-id"] = (LLSD::Integer)callback_id; request["message"] = "CopyInventoryFromNotecard"; @@ -964,7 +965,7 @@ void create_new_item(const std::string& name, U32 next_owner_perm) { std::string desc; - LLAssetType::generateDescriptionFor(asset_type, desc); + LLViewerAssetType::generateDescriptionFor(asset_type, desc); next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; @@ -989,19 +990,14 @@ const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not) const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not) +// ! REFACTOR ! Really need to refactor this so that it's not a bunch of if-then statements... void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, const LLSD& userdata, const LLUUID& default_parent_uuid) { - std::string type = userdata.asString(); + std::string type_name = userdata.asString(); - if (("category" == type) || ("current" == type) || ("outfit" == type) || ("my_otfts" == type) ) + if (("category" == type_name) || ("current" == type_name) || ("outfit" == type_name) || ("my_otfts" == type_name)) { - LLAssetType::EType a_type = LLAssetType::AT_NONE; - if ("current" == type) - a_type = LLAssetType::AT_CURRENT_OUTFIT; - if ("outfit" == type) - a_type = LLAssetType::AT_OUTFIT; - if ("my_otfts" == type) - a_type = LLAssetType::AT_MY_OUTFITS; + LLFolderType::EType preferred_type = LLFolderType::lookup(type_name); LLUUID parent_id; if (bridge) @@ -1017,100 +1013,100 @@ void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, co parent_id = gInventory.getRootFolderID(); } - LLUUID category = gInventory.createNewCategory(parent_id, a_type, LLStringUtil::null); + LLUUID category = gInventory.createNewCategory(parent_id, preferred_type, LLStringUtil::null); gInventory.notifyObservers(); folder->setSelectionByID(category, TRUE); } - else if ("lsl" == type) + else if ("lsl" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_LSL_TEXT); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_LSL_TEXT); create_new_item(NEW_LSL_NAME, parent_id, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, PERM_MOVE | PERM_TRANSFER); } - else if ("notecard" == type) + else if ("notecard" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_NOTECARD); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_NOTECARD); create_new_item(NEW_NOTECARD_NAME, parent_id, LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, PERM_ALL); } - else if ("gesture" == type) + else if ("gesture" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_GESTURE); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); create_new_item(NEW_GESTURE_NAME, parent_id, LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, PERM_ALL); } - else if ("shirt" == type) + else if ("shirt" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_SHIRT); } - else if ("pants" == type) + else if ("pants" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_PANTS); } - else if ("shoes" == type) + else if ("shoes" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_SHOES); } - else if ("socks" == type) + else if ("socks" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_SOCKS); } - else if ("jacket" == type) + else if ("jacket" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_JACKET); } - else if ("skirt" == type) + else if ("skirt" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_SKIRT); } - else if ("gloves" == type) + else if ("gloves" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_GLOVES); } - else if ("undershirt" == type) + else if ("undershirt" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_UNDERSHIRT); } - else if ("underpants" == type) + else if ("underpants" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING); LLFolderBridge::createWearable(parent_id, WT_UNDERPANTS); } - else if ("shape" == type) + else if ("shape" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART); LLFolderBridge::createWearable(parent_id, WT_SHAPE); } - else if ("skin" == type) + else if ("skin" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART); LLFolderBridge::createWearable(parent_id, WT_SKIN); } - else if ("hair" == type) + else if ("hair" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART); LLFolderBridge::createWearable(parent_id, WT_HAIR); } - else if ("eyes" == type) + else if ("eyes" == type_name) { - LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_BODYPART); LLFolderBridge::createWearable(parent_id, WT_EYES); } diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index d523bf2859..529425aa25 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -185,7 +185,7 @@ protected: public: LLViewerInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType preferred_type, + LLFolderType::EType preferred_type, const std::string& name, const LLUUID& owner_id); LLViewerInventoryCategory(const LLUUID& owner_id); @@ -221,7 +221,7 @@ public: bool exportFileLocal(LLFILE* fp) const; bool importFileLocal(LLFILE* fp); void determineFolderType(); - void changeType(LLAssetType::EType new_folder_type); + void changeType(LLFolderType::EType new_folder_type); protected: LLUUID mOwnerID; S32 mVersion; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index dc291d6c34..e4643a15b5 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4190,12 +4190,10 @@ void handle_take_copy() { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; - LLUUID category_id = - gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); + const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id); } - // You can return an object to its owner if it is on your land. class LLObjectReturn : public view_listener_t { @@ -4276,7 +4274,7 @@ class LLObjectEnableReturn : public view_listener_t void force_take_copy(void*) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; - const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); + const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id); } @@ -4337,8 +4335,7 @@ void handle_take() if(category_id.notNull()) { // check trash - LLUUID trash; - trash = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if(category_id == trash || gInventory.isObjectDescendentOf(category_id, trash)) { category_id.setNull(); @@ -4354,7 +4351,7 @@ void handle_take() } if(category_id.isNull()) { - category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); + category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); } LLSD payload; payload["folder_id"] = category_id; @@ -6933,7 +6930,7 @@ void handle_grab_texture(void* data) LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl; LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE; LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE; - LLUUID folder_id(gInventory.findCategoryUUIDForType(asset_type)); + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type)); if(folder_id.notNull()) { std::string name = "Unknown"; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index d3a9e1cef8..d17c7e486f 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -319,7 +319,7 @@ class LLFileUploadBulk : public view_listener_t LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); void *userdata = NULL; - upload_new_resource(filename, asset_name, asset_name, 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, + upload_new_resource(filename, asset_name, asset_name, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), display_name, callback, expected_upload_cost, userdata); @@ -493,7 +493,7 @@ void handle_compress_image(void*) void upload_new_resource(const std::string& src_filename, std::string name, std::string desc, S32 compression_info, - LLAssetType::EType destination_folder_type, + LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, @@ -810,7 +810,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt if(result >= 0) { - LLAssetType::EType dest_loc = (data->mPreferredLocation == LLAssetType::AT_NONE) ? data->mAssetInfo.mType : data->mPreferredLocation; + LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation; if (LLAssetType::AT_SOUND == data->mAssetInfo.mType || LLAssetType::AT_TEXTURE == data->mAssetInfo.mType || @@ -856,7 +856,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt { // Actually add the upload to inventory llinfos << "Adding " << uuid << " to inventory." << llendl; - LLUUID folder_id(gInventory.findCategoryUUIDForType(dest_loc)); + const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc); if(folder_id.notNull()) { U32 next_owner_perms = data->mNextOwnerPerm; @@ -903,7 +903,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt LLAssetStorage::LLStoreAssetCallback callback = NULL; void *userdata = NULL; upload_new_resource(next_file, asset_name, asset_name, // file - 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, + 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, PERM_NONE, PERM_NONE, PERM_NONE, display_name, callback, @@ -915,7 +915,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type, std::string name, std::string desc, S32 compression_info, - LLAssetType::EType destination_folder_type, + LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, @@ -973,14 +973,14 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty llinfos << "Name: " << name << llendl; llinfos << "Desc: " << desc << llendl; llinfos << "Expected Upload Cost: " << expected_upload_cost << llendl; - lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLAssetType::AT_NONE) ? asset_type : destination_folder_type) << llendl; + lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << llendl; lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl; std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory"); if (!url.empty()) { llinfos << "New Agent Inventory via capability" << llendl; LLSD body; - body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLAssetType::AT_NONE) ? asset_type : destination_folder_type); + body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type); body["asset_type"] = LLAssetType::lookup(asset_type); body["inventory_type"] = LLInventoryType::lookup(inv_type); body["name"] = name; diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index bf21292082..da78537a29 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -33,7 +33,7 @@ #ifndef LLVIEWERMENUFILE_H #define LLVIEWERMENUFILE_H -#include "llassettype.h" +#include "llfoldertype.h" #include "llinventorytype.h" class LLTransactionID; @@ -45,7 +45,7 @@ void upload_new_resource(const std::string& src_filename, std::string name, std::string desc, S32 compression_info, - LLAssetType::EType destination_folder_type, + LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, @@ -60,7 +60,7 @@ void upload_new_resource(const LLTransactionID &tid, std::string name, std::string desc, S32 compression_info, - LLAssetType::EType destination_folder_type, + LLFolderType::EType destination_folder_type, LLInventoryType::EType inv_type, U32 next_owner_perms, U32 group_perms, diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 791ec07349..966ddad558 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -210,7 +210,6 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = bool friendship_offer_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); - LLUUID fid; LLMessageSystem* msg = gMessageSystem; const LLSD& payload = notification["payload"]; @@ -220,10 +219,11 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response) switch(option) { case 0: + { // accept LLAvatarTracker::formFriendship(payload["from_id"]); - fid = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + const LLUUID fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); // This will also trigger an onlinenotification if the user is online msg->newMessageFast(_PREHASH_AcceptFriendship); @@ -236,7 +236,9 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response) msg->addUUIDFast(_PREHASH_FolderID, fid); msg->sendReliable(LLHost(payload["sender"].asString())); break; + } case 1: + { // decline // We no longer notify other viewers, but we DO still send // the rejection to the simulator to delete the pending userop. @@ -248,6 +250,7 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response) msg->addUUIDFast(_PREHASH_TransactionID, payload["session_id"]); msg->sendReliable(LLHost(payload["sender"].asString())); break; + } default: // close button probably, possibly timed out break; @@ -768,8 +771,7 @@ public: virtual void done() { LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL; - LLUUID trash_id; - trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); bool notify = false; if(trash_id.notNull() && mObjectID.notNull()) { @@ -876,7 +878,7 @@ void open_offer(const std::vector& items, const std::string& from_name) { std::vector::const_iterator it = items.begin(); std::vector::const_iterator end = items.end(); - LLUUID trash_id(gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH)); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); LLInventoryItem* item; for(; it != end; ++it) { @@ -947,13 +949,12 @@ void open_offer(const std::vector& items, const std::string& from_name) } //Trash Check - LLUUID trash_id; - trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) { return; } - LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); //BOOL inventory_has_focus = gFocusMgr.childHasKeyboardFocus(view); BOOL user_is_away = gAwayTimer.getStarted(); @@ -1713,7 +1714,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) info->mFromGroup = from_group; info->mTransactionID = session_id; info->mType = (LLAssetType::EType) asset_type; - info->mFolderID = gInventory.findCategoryUUIDForType(info->mType); + info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType)); std::string from_name; from_name += "A group member named "; @@ -1847,7 +1848,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) info->mFromID = from_id; info->mFromGroup = from_group; info->mTransactionID = session_id; - info->mFolderID = gInventory.findCategoryUUIDForType(info->mType); + info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType)); if (dialog == IM_TASK_INVENTORY_OFFERED) { @@ -2141,7 +2142,7 @@ bool callingcard_offer_callback(const LLSD& notification, const LLSD& response) msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_TransactionBlock); msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID()); - fid = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); msg->nextBlockFast(_PREHASH_FolderData); msg->addUUIDFast(_PREHASH_FolderID, fid); msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); @@ -2594,11 +2595,10 @@ BOOL LLPostTeleportNotifiers::tick() { // get callingcards and landmarks available to the user arriving. LLInventoryFetchDescendentsObserver::folder_ref_t folders; - LLUUID folder_id; - folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); - if(folder_id.notNull()) - folders.push_back(folder_id); - folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + const LLUUID callingcard_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + if(callingcard_id.notNull()) + folders.push_back(callingcard_id); + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); if(folder_id.notNull()) folders.push_back(folder_id); if(!folders.empty()) @@ -4816,7 +4816,7 @@ void container_inventory_arrived(LLViewerObject* object, // create a new inventory category to put this in LLUUID cat_id; cat_id = gInventory.createNewCategory(gInventory.getRootFolderID(), - LLAssetType::AT_NONE, + LLFolderType::FT_NONE, LLTrans::getString("AcquiredItems")); InventoryObjectList::const_iterator it = inventory->begin(); @@ -4866,7 +4866,7 @@ void container_inventory_arrived(LLViewerObject* object, } LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLUUID category = gInventory.findCategoryUUIDForType(item->getType()); + const LLUUID category = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType())); LLUUID item_id; item_id.generate(); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 65994dfb30..4ce0e2476b 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -59,6 +59,7 @@ #include "lltooltip.h" #include "lltrans.h" #include "lluictrlfactory.h" +#include "llviewerassettype.h" #include "llviewercontrol.h" #include "llviewerinventory.h" #include "llviewertexturelist.h" @@ -465,19 +466,17 @@ LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const } break; - case LLAssetType::AT_SOUND: img_name = "Inv_Sound"; break; + case LLAssetType::AT_SOUND: img_name = "Inv_Sound"; break; case LLAssetType::AT_CLOTHING: img_name = "Inv_Clothing"; break; - case LLAssetType::AT_OBJECT: img_name = "Inv_Object"; break; + case LLAssetType::AT_OBJECT: img_name = "Inv_Object"; break; case LLAssetType::AT_CALLINGCARD: img_name = "Inv_CallingCard"; break; - case LLAssetType::AT_LANDMARK: img_name = "Inv_Landmark"; break; + case LLAssetType::AT_LANDMARK: img_name = "Inv_Landmark"; break; case LLAssetType::AT_NOTECARD: img_name = "Inv_Notecard"; break; case LLAssetType::AT_LSL_TEXT: img_name = "Inv_Script"; break; - case LLAssetType::AT_BODYPART: img_name = "Inv_Skin"; break; - case LLAssetType::AT_ANIMATION: img_name = "Inv_Animation";break; - case LLAssetType::AT_GESTURE: img_name = "Inv_Gesture"; break; - //TODO need img_name - case LLAssetType::AT_FAVORITE: img_name = "Inv_Landmark"; break; - default: llassert(0); + case LLAssetType::AT_BODYPART: img_name = "Inv_Skin"; break; + case LLAssetType::AT_ANIMATION: img_name = "Inv_Animation"; break; + case LLAssetType::AT_GESTURE: img_name = "Inv_Gesture"; break; + default: llassert(0); } return LLUI::getUIImage(img_name); @@ -692,11 +691,10 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) ) { LLToolDragAndDrop::getInstance()->beginDrag( - LLAssetType::lookupDragAndDropType( mDragItem->getType() ), + LLViewerAssetType::lookupDragAndDropType( mDragItem->getType() ), mDragItem->getUUID(), LLToolDragAndDrop::SOURCE_NOTECARD, mPreviewID, mObjectID); - return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } getWindow()->setCursor(UI_CURSOR_HAND); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 964b16df04..9a115ea4e6 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -35,53 +35,22 @@ #include "llvoavatarself.h" #include "llvoavatar.h" -#include -#include - -#include "llaudioengine.h" -#include "noise.h" +#include "pipeline.h" -// TODO: Seraph - Remove unnecessary headers. These are copied from llvoavatar.h. #include "llagent.h" // Get state values from here #include "llagentwearables.h" -#include "llviewercontrol.h" -#include "lldrawpoolavatar.h" -#include "lldriverparam.h" -#include "lleditingmotion.h" -#include "llemote.h" -#include "llface.h" -#include "llfirstuse.h" -#include "llheadrotmotion.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" -#include "llkeyframefallmotion.h" -#include "llkeyframestandmotion.h" -#include "llkeyframewalkmotion.h" -#include "llmutelist.h" #include "llselectmgr.h" -#include "llsprite.h" -#include "lltargetingmotion.h" -#include "lltexlayer.h" -#include "lltexglobalcolor.h" #include "lltoolgrab.h" // for needsRenderBeam #include "lltoolmgr.h" // for needsRenderBeam #include "lltoolmorph.h" #include "lltrans.h" #include "llviewercamera.h" -#include "llviewertexturelist.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" -#include "llviewerparcelmgr.h" #include "llviewerstats.h" -#include "llvovolume.h" -#include "llworld.h" -#include "pipeline.h" -#include "llviewershadermgr.h" -#include "llsky.h" -#include "llanimstatelabels.h" -#include "llgesturemgr.h" //needed to trigger the voice gesticulations -#include "llvoiceclient.h" -#include "llvoicevisualizer.h" // Ventrella +#include "llviewerregion.h" #include "llappearancemgr.h" #include "boost/lexical_cast.hpp" diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index 3fe02088c4..94194b5c0b 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -1123,7 +1123,7 @@ void LLWearable::saveNewAsset() const { llinfos << "Update Agent Inventory via capability" << llendl; LLSD body; - body["folder_id"] = gInventory.findCategoryUUIDForType(getAssetType()); + body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType())); body["asset_type"] = LLAssetType::lookup(getAssetType()); body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE); body["name"] = getName(); diff --git a/indra/newview/skins/default/textures/inv_folder_inbox.tga b/indra/newview/skins/default/textures/inv_folder_inbox.tga new file mode 100644 index 0000000000..04539c2cc4 Binary files /dev/null and b/indra/newview/skins/default/textures/inv_folder_inbox.tga differ diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml index c33f68eaf7..1181493393 100644 --- a/indra/newview/skins/default/xui/en/panel_landmarks.xml +++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml @@ -31,7 +31,7 @@ left="0" mouse_opaque="true" name="favorites_list" - start_folder="favorite" + start_folder="Favorite" width="380"/> - - + + -- cgit v1.2.3