This patch adds a Quickfilter drop-down list in the Inventory floater, which allows the user to quickly change the inventory type filter. This is the FULL version of the Quickfilter patch. There is also a BASIC version of the Quickfilter patch, which contains fewer changes, but is not as nice. The main user-visible difference between the two versions is that the basic version lumps Clothing & Body Parts together as one option, while the full version has them as two separate options. This patch was generated against Second Life 1.21.6. It is available under the same terms as the Second Life viewer source (GPLv2 plus FOSS exception). Author: Jacek Antonelli Date: 2008-02-07 diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp index 457a0cb..4b2e810 100644 --- a/linden/indra/llinventory/llinventory.cpp +++ b/linden/indra/llinventory/llinventory.cpp @@ -70,6 +70,121 @@ const U8 TASK_INVENTORY_ASSET_KEY = 1; const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); +/** + * @brief Return the equivalent new inventory type. + * + * Takes an inventory type, asset type, and inventory flags, + * and returns the equivalent LLInventory::NType. + * + * For example, an inventory type of IT_WEARABLE, asset type + * of AT_BODYPART, and flags indicated WT_SHAPE, would be + * converted to NIT_SHAPE. + * + * Returns the most specific type that can be determined, + * or NIT_NONE if no type could be determined. + * + */ +LLInventoryType::NType calc_ntype( + LLInventoryType::EType inv_type, + LLAssetType::EType asset_type, + U32 flags ) +{ + switch( inv_type ) + { + + // WEARABLES + case LLInventoryType::IT_WEARABLE: + { + switch( asset_type ) + { + // BODY PARTS + case LLAssetType::AT_BODYPART: + { + switch( flags & LLInventoryItem::II_FLAGS_WEARABLES_MASK ) + { + case WT_SHAPE: return LLInventoryType::NIT_SHAPE; + case WT_SKIN: return LLInventoryType::NIT_SKIN; + case WT_HAIR: return LLInventoryType::NIT_HAIR; + case WT_EYES: return LLInventoryType::NIT_EYES; + default: return LLInventoryType::NIT_BODYPART; + } + } + + // CLOTHING + case LLAssetType::AT_CLOTHING: + { + switch( flags & LLInventoryItem::II_FLAGS_WEARABLES_MASK ) + { + case WT_SHIRT: return LLInventoryType::NIT_SHIRT; + case WT_PANTS: return LLInventoryType::NIT_PANTS; + case WT_SHOES: return LLInventoryType::NIT_SHOES; + case WT_SOCKS: return LLInventoryType::NIT_SOCKS; + case WT_JACKET: return LLInventoryType::NIT_JACKET; + case WT_GLOVES: return LLInventoryType::NIT_GLOVES; + case WT_UNDERSHIRT: return LLInventoryType::NIT_UNDERSHIRT; + case WT_UNDERPANTS: return LLInventoryType::NIT_UNDERPANTS; + case WT_SKIRT: return LLInventoryType::NIT_SKIRT; + default: return LLInventoryType::NIT_CLOTHING; + } + } + default: + return LLInventoryType::NIT_WEARABLE; + } + } + + // TEXTURES + case LLInventoryType::IT_TEXTURE: + return LLInventoryType::NIT_TEXTURE; + + // SNAPSHOTS + case LLInventoryType::IT_SNAPSHOT: + return LLInventoryType::NIT_SNAPSHOT; + + // CALLING CARDS + case LLInventoryType::IT_CALLINGCARD: + return LLInventoryType::NIT_CALLCARD; + + // LANDMARKS + case LLInventoryType::IT_LANDMARK: + return LLInventoryType::NIT_LANDMARK; + + // SOUNDS + case LLInventoryType::IT_SOUND: + return LLInventoryType::NIT_SOUND; + + // ANIMATIONS + case LLInventoryType::IT_ANIMATION: + return LLInventoryType::NIT_ANIMATION; + + // GESTURES + case LLInventoryType::IT_GESTURE: + return LLInventoryType::NIT_GESTURE; + + // NOTECARDS + case LLInventoryType::IT_NOTECARD: + return LLInventoryType::NIT_NOTECARD; + + // SCRIPTS + case LLInventoryType::IT_LSL: + return LLInventoryType::NIT_SCRIPT_LSL2; + + // OBJECTS + case LLInventoryType::IT_OBJECT: + case LLInventoryType::IT_ATTACHMENT: + return LLInventoryType::NIT_OBJECT; + + // FOLDERS + case LLInventoryType::IT_CATEGORY: + case LLInventoryType::IT_ROOT_CATEGORY: + return LLInventoryType::NIT_FOLDER; + + // UNKNOWN TYPE! + default: + return LLInventoryType::NIT_NONE; + } +} + + ///---------------------------------------------------------------------------- /// Class LLInventoryObject ///---------------------------------------------------------------------------- @@ -287,11 +402,13 @@ LLInventoryItem::LLInventoryItem( mDescription(desc), mSaleInfo(sale_info), mInventoryType(inv_type), + mNInventoryType(LLInventoryType::NIT_NONE), mFlags(flags), mCreationDate(creation_date_utc) { LLStringUtil::replaceNonstandardASCII(mDescription, ' '); LLStringUtil::replaceChar(mDescription, '|', ' '); + recalcNInventoryType(); } LLInventoryItem::LLInventoryItem() : @@ -301,6 +418,7 @@ LLInventoryItem::LLInventoryItem() : mDescription(), mSaleInfo(), mInventoryType(LLInventoryType::IT_NONE), + mNInventoryType(LLInventoryType::NIT_NONE), mFlags(0), mCreationDate(0) { @@ -325,6 +443,7 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other) mDescription = other->mDescription; mSaleInfo = other->mSaleInfo; mInventoryType = other->mInventoryType; + mNInventoryType = other->mNInventoryType; mFlags = other->mFlags; mCreationDate = other->mCreationDate; } @@ -396,6 +515,12 @@ U32 LLInventoryItem::getCRC32() const } +void LLInventoryItem::recalcNInventoryType() +{ + setNInventoryType( calc_ntype(mInventoryType, mType, mFlags) ); +} + + void LLInventoryItem::setDescription(const std::string& d) { std::string new_desc(d); @@ -412,14 +537,27 @@ void LLInventoryItem::setPermissions(const LLPermissions& perm) mPermissions = perm; } +void LLInventoryItem::setType(LLAssetType::EType type) +{ + mType = type; + recalcNInventoryType(); +} + void LLInventoryItem::setInventoryType(LLInventoryType::EType inv_type) { mInventoryType = inv_type; + recalcNInventoryType(); +} + +void LLInventoryItem::setNInventoryType(LLInventoryType::NType inv_type) +{ + mNInventoryType = inv_type; } void LLInventoryItem::setFlags(U32 flags) { mFlags = flags; + recalcNInventoryType(); } void LLInventoryItem::setCreationDate(time_t creation_date_utc) @@ -443,6 +581,11 @@ LLInventoryType::EType LLInventoryItem::getInventoryType() const return mInventoryType; } +LLInventoryType::NType LLInventoryItem::getNInventoryType() const +{ + return mNInventoryType; +} + U32 LLInventoryItem::getFlags() const { return mFlags; diff --git a/linden/indra/llinventory/llinventory.h b/linden/indra/llinventory/llinventory.h index d3cce6b..c573f74 100644 --- a/linden/indra/llinventory/llinventory.h +++ b/linden/indra/llinventory/llinventory.h @@ -42,6 +42,7 @@ #include "llsaleinfo.h" #include "llsd.h" #include "lluuid.h" +#include "llwearabletype.h" #include "llxmlnode.h" // consts for Key field in the task inventory update message @@ -56,6 +57,10 @@ enum }; +LLInventoryType::NType calc_ntype( LLInventoryType::EType inv_type, + LLAssetType::EType asset_type, + U32 flags ); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryObject @@ -131,6 +136,7 @@ protected: std::string mDescription; LLSaleInfo mSaleInfo; LLInventoryType::EType mInventoryType; + LLInventoryType::NType mNInventoryType; U32 mFlags; time_t mCreationDate; // seconds from 1/1/1970, UTC @@ -236,6 +242,7 @@ public: const std::string& getDescription() const; const LLSaleInfo& getSaleInfo() const; LLInventoryType::EType getInventoryType() const; + LLInventoryType::NType getNInventoryType() const; U32 getFlags() const; time_t getCreationDate() const; U32 getCRC32() const; // really more of a checksum. @@ -246,7 +253,9 @@ public: void setDescription(const std::string& new_desc); void setSaleInfo(const LLSaleInfo& sale_info); void setPermissions(const LLPermissions& perm); + void setType(LLAssetType::EType type); void setInventoryType(LLInventoryType::EType inv_type); + void setNInventoryType(LLInventoryType::NType inv_type); void setFlags(U32 flags); void setCreationDate(time_t creation_date_utc); @@ -277,6 +286,9 @@ public: LLSD asLLSD() const; bool fromLLSD(LLSD& sd); +private: + void recalcNInventoryType(); + }; BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b); diff --git a/linden/indra/llinventory/llinventorytype.h b/linden/indra/llinventory/llinventorytype.h index 00a4d28..c81733e 100644 --- a/linden/indra/llinventory/llinventorytype.h +++ b/linden/indra/llinventory/llinventorytype.h @@ -71,6 +71,95 @@ public: IT_NONE = -1 }; + + /** + * @brief New enumerator for inventory types + * + * This is intended as a replacement to the above EType. + * EType will be phased out in favor of this enum. + * + * This enum acts as a bitfield, which This has several + * useful properties for filtering: + * + * 1. The inventory item's type can be compared by either + * equality or bitwise AND. Bitwise AND allows a quick + * check to see whether the type is one of multiple + * possible types. + * + * 2. It allows for a fast hierarchical organization, by + * defining a broad type (e.g. NIT_BODYPART) whose + * value is the bitwise OR-ing of several more specific + * sub-types (e.g. NIT_SKIN|NIT_HAIR|...). + * + */ + enum NType + { + /* No Type */ + NIT_NONE = 0x0000000, + + /* Body Parts */ + NIT_SHAPE = 1 << 0, + NIT_SKIN = 1 << 1, + NIT_HAIR = 1 << 2, + NIT_EYES = 1 << 3, + NIT_BODYPART = 0x000000f, + + /* Clothing */ + NIT_SHIRT = 1 << 4, + NIT_PANTS = 1 << 5, + NIT_SHOES = 1 << 6, + NIT_SOCKS = 1 << 7, + NIT_JACKET = 1 << 8, + NIT_GLOVES = 1 << 9, + NIT_UNDERSHIRT = 1 << 10, + NIT_UNDERPANTS = 1 << 11, + NIT_SKIRT = 1 << 12, + NIT_CLOTHING = 0x0001ff0, + + /* Body Parts | Clothing */ + NIT_WEARABLE = 0x0001fff, + + /* Images */ + NIT_TEXTURE = 1 << 13, + NIT_SNAPSHOT = 1 << 14, + NIT_IMAGE = 0x0006000, + + /* Calling Cards */ + NIT_CALLCARD_OFF = 1 << 15, + NIT_CALLCARD_ON = 1 << 16, + NIT_CALLCARD = 0x0018000, + + /* Landmarks */ + NIT_LANDMARK_UNUSED = 1 << 17, + NIT_LANDMARK_USED = 1 << 18, + NIT_LANDMARK = 0x0060000, + + /* Sounds */ + NIT_SOUND = 1 << 19, + + /* Animations */ + NIT_ANIMATION = 1 << 20, + + /* Gestures */ + NIT_GESTURE = 1 << 21, + + /* Notecards */ + NIT_NOTECARD = 1 << 22, + + /* Scripts */ + NIT_SCRIPT_LSL2 = 1 << 23, + + /* Objects */ + NIT_OBJECT = 1 << 24, + + /* Folders ("Categories" in the old type system) */ + NIT_FOLDER = 1 << 25, + + /* Bitwise OR-ing of all the above */ + NIT_ALL = 0x3ffffff, + }; + + // machine transation between type and strings static EType lookup(const std::string& name); static const char* lookup(EType type); diff --git a/linden/indra/llinventory/llwearabletype.h b/linden/indra/llinventory/llwearabletype.h new file mode 100644 index 0000000..b0a40b2 --- /dev/null +++ b/linden/indra/llinventory/llwearabletype.h @@ -0,0 +1,54 @@ +/** + * @file llwearable.h + * @brief EWearableType enum definition + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2008, 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_LLWEARABLETYPE_H +#define LL_LLWEARABLETYPE_H + +enum EWearableType // If you change this, update LLWearable::getTypeName(), getTypeLabel(), and LLVOAvatar::getTEWearableType() +{ + WT_SHAPE = 0, + WT_SKIN = 1, + WT_HAIR = 2, + WT_EYES = 3, + WT_SHIRT = 4, + WT_PANTS = 5, + WT_SHOES = 6, + WT_SOCKS = 7, + WT_JACKET = 8, + WT_GLOVES = 9, + WT_UNDERSHIRT = 10, + WT_UNDERPANTS = 11, + WT_SKIRT = 12, + WT_COUNT = 13, + WT_INVALID = 255 +}; + +#endif // LL_LLWEARABLETYPE_H diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp index 9a2e13b..cb9dd4e 100644 --- a/linden/indra/llui/llcombobox.cpp +++ b/linden/indra/llui/llcombobox.cpp @@ -194,6 +194,11 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * combo_box->add(label, LLSD(value) ); } + + else if (child->hasName("separator")) + { + combo_box->addSeparator(); + } } } diff --git a/linden/indra/newview/llfloateravatarpicker.cpp b/linden/indra/newview/llfloateravatarpicker.cpp index da1b9b7..216eea7 100644 --- a/linden/indra/newview/llfloateravatarpicker.cpp +++ b/linden/indra/newview/llfloateravatarpicker.cpp @@ -118,7 +118,7 @@ BOOL LLFloaterAvatarPicker::postBuild() mInventoryPanel = getChild("Inventory Panel"); if(mInventoryPanel) { - mInventoryPanel->setFilterTypes(0x1 << LLInventoryType::IT_CALLINGCARD); + mInventoryPanel->setFilterTypes(LLInventoryType::NIT_CALLCARD); mInventoryPanel->setFollowsAll(); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_CALLINGCARD); diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index 8cefd5b..cb9a379 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp @@ -4479,7 +4479,7 @@ LLInventoryFilter::LLInventoryFilter(const std::string& name) : mModified(FALSE), mNeedTextRebuild(TRUE) { - mFilterOps.mFilterTypes = 0xffffffff; + mFilterOps.mFilterTypes = LLInventoryType::NIT_ALL; mFilterOps.mMinDate = time_min(); mFilterOps.mMaxDate = time_max(); mFilterOps.mHoursAgo = 0; @@ -4522,7 +4522,7 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item) } LLFolderViewEventListener* listener = item->getListener(); mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; - BOOL passed = (0x1 << listener->getInventoryType() & mFilterOps.mFilterTypes || listener->getInventoryType() == LLInventoryType::IT_NONE) + BOOL passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE) && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); @@ -4552,7 +4552,7 @@ BOOL LLInventoryFilter::isNotDefault() BOOL LLInventoryFilter::isActive() { - return mFilterOps.mFilterTypes != 0xffffffff + return mFilterOps.mFilterTypes != LLInventoryType::NIT_ALL || mFilterSubString.size() || mFilterOps.mPermissions != PERM_NONE || mFilterOps.mMinDate != time_min() @@ -4800,9 +4800,9 @@ void LLInventoryFilter::setModified(EFilterBehavior behavior) } } -BOOL LLInventoryFilter::isFilterWith(LLInventoryType::EType t) +BOOL LLInventoryFilter::isFilterWith(LLInventoryType::NType t) { - return mFilterOps.mFilterTypes & (0x01 << t); + return mFilterOps.mFilterTypes & t; } std::string LLInventoryFilter::getFilterText() @@ -4812,6 +4812,11 @@ std::string LLInventoryFilter::getFilterText() return mFilterText; } + return rebuildFilterText(); +} + +std::string LLInventoryFilter::rebuildFilterText() +{ mNeedTextRebuild = FALSE; std::string filtered_types; std::string not_filtered_types; @@ -4820,7 +4825,7 @@ std::string LLInventoryFilter::getFilterText() S32 num_filter_types = 0; mFilterText.clear(); - if (isFilterWith(LLInventoryType::IT_ANIMATION)) + if (isFilterWith(LLInventoryType::NIT_ANIMATION)) { filtered_types += " Animations,"; filtered_by_type = TRUE; @@ -4832,7 +4837,19 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_CALLINGCARD)) + if (isFilterWith(LLInventoryType::NIT_BODYPART)) + { + filtered_types += " Body Parts,"; + filtered_by_type = TRUE; + num_filter_types++; + } + else + { + not_filtered_types += " Body Parts,"; + filtered_by_all_types = FALSE; + } + + if (isFilterWith(LLInventoryType::NIT_CALLCARD)) { filtered_types += " Calling Cards,"; filtered_by_type = TRUE; @@ -4844,7 +4861,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_WEARABLE)) + if (isFilterWith(LLInventoryType::NIT_CLOTHING)) { filtered_types += " Clothing,"; filtered_by_type = TRUE; @@ -4856,7 +4873,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_GESTURE)) + if (isFilterWith(LLInventoryType::NIT_GESTURE)) { filtered_types += " Gestures,"; filtered_by_type = TRUE; @@ -4868,7 +4885,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_LANDMARK)) + if (isFilterWith(LLInventoryType::NIT_LANDMARK)) { filtered_types += " Landmarks,"; filtered_by_type = TRUE; @@ -4880,7 +4897,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_NOTECARD)) + if (isFilterWith(LLInventoryType::NIT_NOTECARD)) { filtered_types += " Notecards,"; filtered_by_type = TRUE; @@ -4892,7 +4909,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_OBJECT) && isFilterWith(LLInventoryType::IT_ATTACHMENT)) + if (isFilterWith(LLInventoryType::NIT_OBJECT)) { filtered_types += " Objects,"; filtered_by_type = TRUE; @@ -4904,7 +4921,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_LSL)) + if (isFilterWith(LLInventoryType::NIT_SCRIPT_LSL2)) { filtered_types += " Scripts,"; filtered_by_type = TRUE; @@ -4916,7 +4933,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_SOUND)) + if (isFilterWith(LLInventoryType::NIT_SOUND)) { filtered_types += " Sounds,"; filtered_by_type = TRUE; @@ -4928,7 +4945,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_TEXTURE)) + if (isFilterWith(LLInventoryType::NIT_TEXTURE)) { filtered_types += " Textures,"; filtered_by_type = TRUE; @@ -4940,7 +4957,7 @@ std::string LLInventoryFilter::getFilterText() filtered_by_all_types = FALSE; } - if (isFilterWith(LLInventoryType::IT_SNAPSHOT)) + if (isFilterWith(LLInventoryType::NIT_SNAPSHOT)) { filtered_types += " Snapshots,"; filtered_by_type = TRUE; diff --git a/linden/indra/newview/llfolderview.h b/linden/indra/newview/llfolderview.h index 7978386..af3248d 100644 --- a/linden/indra/newview/llfolderview.h +++ b/linden/indra/newview/llfolderview.h @@ -103,6 +103,7 @@ public: virtual BOOL isUpToDate() const = 0; virtual BOOL hasChildren() const = 0; virtual LLInventoryType::EType getInventoryType() const = 0; + virtual LLInventoryType::NType getNInventoryType() const = 0; virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) {} // This method should be called when a drag begins. returns TRUE @@ -221,6 +222,7 @@ public: void clearModified() { mModified = FALSE; mFilterBehavior = FILTER_NONE; } const std::string getName() const { return mName; } std::string getFilterText(); + std::string rebuildFilterText(); void setFilterCount(S32 count) { mFilterCount = count; } S32 getFilterCount() { return mFilterCount; } @@ -229,7 +231,7 @@ public: void markDefault(); void resetDefault(); - BOOL isFilterWith(LLInventoryType::EType t); + BOOL isFilterWith(LLInventoryType::NType t); S32 getCurrentGeneration() const { return mFilterGeneration; } S32 getMinRequiredGeneration() const { return mMinRequiredGeneration; } diff --git a/linden/indra/newview/llgroupnotify.cpp b/linden/indra/newview/llgroupnotify.cpp index 3f8ff3d..eafa06c 100644 --- a/linden/indra/newview/llgroupnotify.cpp +++ b/linden/indra/newview/llgroupnotify.cpp @@ -248,9 +248,13 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, { addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),std::string("Attached: "),LLFontGL::sSansSerif)); - LLUIImagePtr item_icon = get_item_icon(mInventoryOffer->mType, - LLInventoryType::IT_TEXTURE, - 0, FALSE); + + LLAssetType::EType atype; + LLInventoryType::EType itype; + atype = mInventoryOffer->mType; + itype = LLInventoryType::defaultForAssetType( atype ); + + LLUIImagePtr item_icon = get_item_icon(atype, itype, 0, FALSE); x += LABEL_WIDTH + HPAD; diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp index 12670e2..bde36cc 100644 --- a/linden/indra/newview/llinventorybridge.cpp +++ b/linden/indra/newview/llinventorybridge.cpp @@ -722,6 +722,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, if (new_listener) { new_listener->mInvType = inv_type; + new_listener->mNInvType = calc_ntype(inv_type, asset_type, flags); } return new_listener; diff --git a/linden/indra/newview/llinventorybridge.h b/linden/indra/newview/llinventorybridge.h index fc04b28..329e57f 100644 --- a/linden/indra/newview/llinventorybridge.h +++ b/linden/indra/newview/llinventorybridge.h @@ -192,7 +192,15 @@ public: virtual BOOL dragOrDrop(MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data) { return FALSE; } - virtual LLInventoryType::EType getInventoryType() const { return mInvType; } + + virtual LLInventoryType::EType getInventoryType() const + { + return mInvType; + } + virtual LLInventoryType::NType getNInventoryType() const + { + return mNInvType; + } // LLInvFVBridge functionality virtual void clearDisplayName() {} @@ -221,6 +229,7 @@ protected: LLInventoryPanel* mInventoryPanel; LLUUID mUUID; // item id LLInventoryType::EType mInvType; + LLInventoryType::NType mNInvType; }; diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index f9dd70d..a265906 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -44,6 +44,7 @@ #include "llradiogroup.h" #include "llspinctrl.h" #include "lltextbox.h" +#include "llcombobox.h" #include "llui.h" #include "llfirstuse.h" @@ -117,6 +118,21 @@ LLInventoryViewFinder::LLInventoryViewFinder(const std::string& name, LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_view_finder.xml"); + + childSetCommitCallback("check_animation", onCheckFilterType, this); + childSetCommitCallback("check_bodypart", onCheckFilterType, this); + childSetCommitCallback("check_calling_card", onCheckFilterType, this); + childSetCommitCallback("check_clothing", onCheckFilterType, this); + childSetCommitCallback("check_gesture", onCheckFilterType, this); + childSetCommitCallback("check_landmark", onCheckFilterType, this); + childSetCommitCallback("check_notecard", onCheckFilterType, this); + childSetCommitCallback("check_object", onCheckFilterType, this); + childSetCommitCallback("check_script", onCheckFilterType, this); + childSetCommitCallback("check_sound", onCheckFilterType, this); + childSetCommitCallback("check_texture", onCheckFilterType, this); + childSetCommitCallback("check_snapshot", onCheckFilterType, this); + + childSetAction("All", selectAllTypes, this); childSetAction("None", selectNoTypes, this); @@ -126,6 +142,8 @@ LLInventoryViewFinder::LLInventoryViewFinder(const std::string& name, mSpinSinceDays = getChild("spin_days_ago"); childSetCommitCallback("spin_days_ago", onTimeAgo, this); + childSetCommitCallback("check_show_empty", onCheckShowEmptyFolders, this); + // mCheckSinceLogoff = getChild("check_since_logoff"); childSetCommitCallback("check_since_logoff", onCheckSinceLogoff, this); @@ -135,6 +153,16 @@ LLInventoryViewFinder::LLInventoryViewFinder(const std::string& name, } +// Callback when an inventory type checkbox is changed. +void LLInventoryViewFinder::onCheckFilterType(LLUICtrl *ctrl, void *user_data) +{ + LLInventoryViewFinder *self = (LLInventoryViewFinder *)user_data; + if (!self) return; + + self->rebuildFilter(); +} + + void LLInventoryViewFinder::onCheckSinceLogoff(LLUICtrl *ctrl, void *user_data) { LLInventoryViewFinder *self = (LLInventoryViewFinder *)user_data; @@ -147,6 +175,8 @@ void LLInventoryViewFinder::onCheckSinceLogoff(LLUICtrl *ctrl, void *user_data) { self->mSpinSinceHours->set(1.0f); } + + self->rebuildFilter(); } void LLInventoryViewFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) @@ -160,14 +190,27 @@ void LLInventoryViewFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) since_logoff = false; } self->childSetValue("check_since_logoff", since_logoff); + + self->rebuildFilter(); +} + + +void LLInventoryViewFinder::onCheckShowEmptyFolders(LLUICtrl *ctrl, void *user_data) +{ + LLInventoryViewFinder *self = (LLInventoryViewFinder *)user_data; + if (!self) return; + + self->rebuildFilter(); } + void LLInventoryViewFinder::changeFilter(LLInventoryFilter* filter) { mFilter = filter; updateElementsFromFilter(); } + void LLInventoryViewFinder::updateElementsFromFilter() { if (!mFilter) @@ -179,105 +222,115 @@ void LLInventoryViewFinder::updateElementsFromFilter() LLInventoryFilter::EFolderShow show_folders = mFilter->getShowFolderState(); U32 hours = mFilter->getHoursAgo(); - // update the ui elements + // Update floater title LLFloater::setTitle(mFilter->getName()); - childSetValue("check_animation", (S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION)); - childSetValue("check_calling_card", (S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD)); - childSetValue("check_clothing", (S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE)); - childSetValue("check_gesture", (S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE)); - childSetValue("check_landmark", (S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK)); - childSetValue("check_notecard", (S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD)); - childSetValue("check_object", (S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT)); - childSetValue("check_script", (S32) (filter_types & 0x1 << LLInventoryType::IT_LSL)); - childSetValue("check_sound", (S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND)); - childSetValue("check_texture", (S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE)); - childSetValue("check_snapshot", (S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT)); - childSetValue("check_show_empty", show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS); - childSetValue("check_since_logoff", mFilter->isSinceLogoff()); - mSpinSinceHours->set((F32)(hours % 24)); - mSpinSinceDays->set((F32)(hours / 24)); -} - -void LLInventoryViewFinder::draw() -{ - U32 filter = 0xffffffff; - BOOL filtered_by_all_types = TRUE; + // Update type check boxes + childSetValue("check_animation", + (S32)(filter_types & LLInventoryType::NIT_ANIMATION)); + childSetValue("check_bodypart", + (S32)(filter_types & LLInventoryType::NIT_BODYPART)); + childSetValue("check_calling_card", + (S32)(filter_types & LLInventoryType::NIT_CALLCARD)); + childSetValue("check_clothing", + (S32)(filter_types & LLInventoryType::NIT_CLOTHING)); + childSetValue("check_gesture", + (S32)(filter_types & LLInventoryType::NIT_GESTURE)); + childSetValue("check_landmark", + (S32)(filter_types & LLInventoryType::NIT_LANDMARK)); + childSetValue("check_notecard", + (S32)(filter_types & LLInventoryType::NIT_NOTECARD)); + childSetValue("check_object", + (S32)(filter_types & LLInventoryType::NIT_OBJECT)); + childSetValue("check_script", + (S32)(filter_types & LLInventoryType::NIT_SCRIPT_LSL2)); + childSetValue("check_sound", + (S32)(filter_types & LLInventoryType::NIT_SOUND)); + childSetValue("check_texture", + (S32)(filter_types & LLInventoryType::NIT_TEXTURE)); + childSetValue("check_snapshot", + (S32)(filter_types & LLInventoryType::NIT_SNAPSHOT)); + + // Update other check boxes + childSetValue("check_show_empty", + show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS); + childSetValue("check_since_logoff", + mFilter->isSinceLogoff()); + + // Update hours and days spinners + mSpinSinceHours->set( (F32)(hours % 24) ); + mSpinSinceDays->set( (F32)(hours / 24) ); +} + + +void LLInventoryViewFinder::rebuildFilter() +{ + U32 filter = LLInventoryType::NIT_ALL; if (!childGetValue("check_animation")) { - filter &= ~(0x1 << LLInventoryType::IT_ANIMATION); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_ANIMATION); } + if (!childGetValue("check_bodypart")) + { + filter &= ~(LLInventoryType::NIT_BODYPART); + } if (!childGetValue("check_calling_card")) { - filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_CALLCARD); } if (!childGetValue("check_clothing")) { - filter &= ~(0x1 << LLInventoryType::IT_WEARABLE); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_CLOTHING); } if (!childGetValue("check_gesture")) { - filter &= ~(0x1 << LLInventoryType::IT_GESTURE); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_GESTURE); } if (!childGetValue("check_landmark")) - - { - filter &= ~(0x1 << LLInventoryType::IT_LANDMARK); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_LANDMARK); } if (!childGetValue("check_notecard")) { - filter &= ~(0x1 << LLInventoryType::IT_NOTECARD); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_NOTECARD); } if (!childGetValue("check_object")) { - filter &= ~(0x1 << LLInventoryType::IT_OBJECT); - filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_OBJECT); } if (!childGetValue("check_script")) { - filter &= ~(0x1 << LLInventoryType::IT_LSL); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_SCRIPT_LSL2); } if (!childGetValue("check_sound")) { - filter &= ~(0x1 << LLInventoryType::IT_SOUND); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_SOUND); } if (!childGetValue("check_texture")) { - filter &= ~(0x1 << LLInventoryType::IT_TEXTURE); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_TEXTURE); } if (!childGetValue("check_snapshot")) { - filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT); - filtered_by_all_types = FALSE; + filter &= ~(LLInventoryType::NIT_SNAPSHOT); } - if (!filtered_by_all_types) + if (filter != LLInventoryType::NIT_ALL) { // don't include folders in filter, unless I've selected everything - filter &= ~(0x1 << LLInventoryType::IT_CATEGORY); + filter &= ~(LLInventoryType::NIT_FOLDER); } // update the panel, panel will update the filter @@ -302,8 +355,6 @@ void LLInventoryViewFinder::draw() mInventoryView->mActivePanel->setHoursAgo(hours); mInventoryView->mActivePanel->setSinceLogoff(getCheckSinceLogoff()); mInventoryView->setFilterTextFromFilter(); - - LLFloater::draw(); } void LLInventoryViewFinder::onClose(bool app_quitting) @@ -344,6 +395,7 @@ void LLInventoryViewFinder::selectAllTypes(void* user_data) if(!self) return; self->childSetValue("check_animation", TRUE); + self->childSetValue("check_bodypart", TRUE); self->childSetValue("check_calling_card", TRUE); self->childSetValue("check_clothing", TRUE); self->childSetValue("check_gesture", TRUE); @@ -355,17 +407,7 @@ void LLInventoryViewFinder::selectAllTypes(void* user_data) self->childSetValue("check_texture", TRUE); self->childSetValue("check_snapshot", TRUE); -/* - self->mCheckCallingCard->set(TRUE); - self->mCheckClothing->set(TRUE); - self->mCheckGesture->set(TRUE); - self->mCheckLandmark->set(TRUE); - self->mCheckNotecard->set(TRUE); - self->mCheckObject->set(TRUE); - self->mCheckScript->set(TRUE); - self->mCheckSound->set(TRUE); - self->mCheckTexture->set(TRUE); - self->mCheckSnapshot->set(TRUE);*/ + self->rebuildFilter(); } //static @@ -374,21 +416,8 @@ void LLInventoryViewFinder::selectNoTypes(void* user_data) LLInventoryViewFinder* self = (LLInventoryViewFinder*)user_data; if(!self) return; - /* - self->childSetValue("check_animation", FALSE); - self->mCheckCallingCard->set(FALSE); - self->mCheckClothing->set(FALSE); - self->mCheckGesture->set(FALSE); - self->mCheckLandmark->set(FALSE); - self->mCheckNotecard->set(FALSE); - self->mCheckObject->set(FALSE); - self->mCheckScript->set(FALSE); - self->mCheckSound->set(FALSE); - self->mCheckTexture->set(FALSE); - self->mCheckSnapshot->set(FALSE);*/ - - self->childSetValue("check_animation", FALSE); + self->childSetValue("check_bodypart", FALSE); self->childSetValue("check_calling_card", FALSE); self->childSetValue("check_clothing", FALSE); self->childSetValue("check_gesture", FALSE); @@ -399,6 +428,8 @@ void LLInventoryViewFinder::selectNoTypes(void* user_data) self->childSetValue("check_sound", FALSE); self->childSetValue("check_texture", FALSE); self->childSetValue("check_snapshot", FALSE); + + self->rebuildFilter(); } @@ -549,6 +580,12 @@ void LLInventoryView::init(LLInventoryModel* inventory) mSearchEditor->setSearchCallback(onSearchEdit, this); } + mQuickFilterCombo = getChild("Quick Filter"); + if (mQuickFilterCombo) + { + mQuickFilterCombo->setCommitCallback(onQuickFilterCommit); + } + sActiveViews.put(this); gInventory.addObserver(this); @@ -617,6 +654,11 @@ void LLInventoryView::draw() { mSearchEditor->setText(mActivePanel->getFilterSubString()); } + if (mActivePanel && mQuickFilterCombo) + { + refreshQuickFilter( mQuickFilterCombo ); + } + LLFloater::draw(); } @@ -922,16 +964,9 @@ void LLInventoryView::onClearSearch(void* user_data) LLInventoryView* self = (LLInventoryView*)user_data; if(!self) return; - LLFloater *finder = self->getFinder(); if (self->mActivePanel) { self->mActivePanel->setFilterSubString(LLStringUtil::null); - self->mActivePanel->setFilterTypes(0xffffffff); - } - - if (finder) - { - LLInventoryViewFinder::selectAllTypes(finder); } // re-open folders that were initially open @@ -981,6 +1016,241 @@ void LLInventoryView::onSearchEdit(const std::string& search_string, void* user_ } +//static +void LLInventoryView::onQuickFilterCommit(LLUICtrl* ctrl, void* user_data) +{ + + LLComboBox* quickfilter = (LLComboBox*)ctrl; + + + LLInventoryView* view = (LLInventoryView*)(quickfilter->getParent()); + if (!view->mActivePanel) + { + return; + } + + + std::string item_type = quickfilter->getSimple(); + U32 filter_type; + + if (view->getString("filter_type_animation") == item_type) + { + filter_type = LLInventoryType::NIT_ANIMATION; + } + + else if (view->getString("filter_type_bodypart") == item_type) + { + filter_type = LLInventoryType::NIT_BODYPART; + } + + else if (view->getString("filter_type_callingcard") == item_type) + { + filter_type = LLInventoryType::NIT_CALLCARD; + } + + else if (view->getString("filter_type_clothing") == item_type) + { + filter_type = LLInventoryType::NIT_CLOTHING; + } + + else if (view->getString("filter_type_gesture") == item_type) + { + filter_type = LLInventoryType::NIT_GESTURE; + } + + else if (view->getString("filter_type_landmark") == item_type) + { + filter_type = LLInventoryType::NIT_LANDMARK; + } + + else if (view->getString("filter_type_notecard") == item_type) + { + filter_type = LLInventoryType::NIT_NOTECARD; + } + + else if (view->getString("filter_type_object") == item_type) + { + filter_type = LLInventoryType::NIT_OBJECT; + } + + else if (view->getString("filter_type_script") == item_type) + { + filter_type = LLInventoryType::NIT_SCRIPT_LSL2; + } + + else if (view->getString("filter_type_sound") == item_type) + { + filter_type = LLInventoryType::NIT_SOUND; + } + + else if (view->getString("filter_type_texture") == item_type) + { + filter_type = LLInventoryType::NIT_TEXTURE; + } + + else if (view->getString("filter_type_snapshot") == item_type) + { + filter_type = LLInventoryType::NIT_SNAPSHOT; + } + + else if (view->getString("filter_type_custom") == item_type) + { + // When they select custom, show the floater then return + if( !(view->filtersVisible(view)) ) + { + view->toggleFindOptions(); + } + return; + } + + else if (view->getString("filter_type_all") == item_type) + { + // Show all types + filter_type = 0xffffffff; + } + + else + { + llwarns << "Ignoring unknown filter: " << item_type << llendl; + return; + } + + view->mActivePanel->setFilterTypes( filter_type ); + + // Start fetching inventory in the background, so we have + // some items to show the user. + gInventory.startBackgroundFetch(); + + // Update the Inventory window text + view->setFilterTextFromFilter(); + + // Force the filters window to update itself, if it's open. + LLInventoryViewFinder* finder = view->getFinder(); + if( finder ) + { + finder->updateElementsFromFilter(); + } + + // llinfos << "Quick Filter: " << item_type << llendl; + +} + + + +//static +void LLInventoryView::refreshQuickFilter(LLUICtrl* ctrl) +{ + + LLInventoryView* view = (LLInventoryView*)(ctrl->getParent()); + if (!view->mActivePanel) + { + return; + } + + LLComboBox* quickfilter = view->getChild("Quick Filter"); + if (!quickfilter) + { + return; + } + + + U32 filter_type = view->mActivePanel->getFilterTypes(); + filter_type &= LLInventoryType::NIT_ALL; + + + //llinfos << "filter_type: " << filter_type << llendl; + + std::string selection; + + + if (filter_type == LLInventoryType::NIT_ALL) + { + selection = view->getString("filter_type_all"); + } + + else if (filter_type == LLInventoryType::NIT_NONE) + { + selection = view->getString("filter_type_custom"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_ANIMATION)) + { + selection = view->getString("filter_type_animation"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_BODYPART)) + { + selection = view->getString("filter_type_bodypart"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_CALLCARD)) + { + selection = view->getString("filter_type_callingcard"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_CLOTHING)) + { + selection = view->getString("filter_type_clothing"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_GESTURE)) + { + selection = view->getString("filter_type_gesture"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_LANDMARK)) + { + selection = view->getString("filter_type_landmark"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_NOTECARD)) + { + selection = view->getString("filter_type_notecard"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_OBJECT)) + { + selection = view->getString("filter_type_object"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_SCRIPT_LSL2)) + { + selection = view->getString("filter_type_script"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_SOUND)) + { + selection = view->getString("filter_type_sound"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_TEXTURE)) + { + selection = view->getString("filter_type_texture"); + } + + else if (filter_type == (filter_type & LLInventoryType::NIT_SNAPSHOT)) + { + selection = view->getString("filter_type_snapshot"); + } + + else + { + selection = view->getString("filter_type_custom"); + } + + + // Select the chosen item by label text + BOOL result = quickfilter->setSimple( (selection) ); + + if( !result ) + { + llinfos << "The item didn't exist: " << selection << llendl; + } + +} + + + // static // BOOL LLInventoryView::incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward) // { @@ -1079,124 +1349,163 @@ BOOL LLInventoryView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return handled; } + std::string get_item_icon_name(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type, - U32 attachment_point, - BOOL item_is_multi ) + LLInventoryType::EType inv_type, + U32 flags, + BOOL item_is_multi ) +{ + return get_item_icon_name( calc_ntype(inv_type, asset_type, flags), + item_is_multi ); +} + +std::string get_item_icon_name(LLInventoryType::NType inv_ntype, + BOOL item_is_multi ) { EInventoryIcon idx = OBJECT_ICON_NAME; - if ( item_is_multi ) - { - idx = OBJECT_MULTI_ICON_NAME; - } - - switch(asset_type) + + switch( inv_ntype ) { - case LLAssetType::AT_TEXTURE: - if(LLInventoryType::IT_SNAPSHOT == inventory_type) - { - idx = SNAPSHOT_ICON_NAME; - } - else - { - idx = TEXTURE_ICON_NAME; - } - break; + // BODY PARTS - case LLAssetType::AT_SOUND: - idx = SOUND_ICON_NAME; - break; - case LLAssetType::AT_CALLINGCARD: - if(attachment_point!= 0) - { - idx = CALLINGCARD_ONLINE_ICON_NAME; - } - else - { - idx = CALLINGCARD_OFFLINE_ICON_NAME; - } - break; - case LLAssetType::AT_LANDMARK: - if(attachment_point!= 0) - { - idx = LANDMARK_VISITED_ICON_NAME; - } - else - { - idx = LANDMARK_ICON_NAME; - } - break; - case LLAssetType::AT_SCRIPT: - case LLAssetType::AT_LSL_TEXT: - case LLAssetType::AT_LSL_BYTECODE: - idx = SCRIPT_ICON_NAME; - break; - case LLAssetType::AT_CLOTHING: - idx = CLOTHING_ICON_NAME; - case LLAssetType::AT_BODYPART : - if(LLAssetType::AT_BODYPART == asset_type) - { - idx = BODYPART_ICON_NAME; - } - switch(attachment_point) - { - case WT_SHAPE: + case LLInventoryType::NIT_SHAPE: idx = BODYPART_SHAPE_ICON_NAME; break; - case WT_SKIN: + case LLInventoryType::NIT_SKIN: idx = BODYPART_SKIN_ICON_NAME; break; - case WT_HAIR: + case LLInventoryType::NIT_HAIR: idx = BODYPART_HAIR_ICON_NAME; break; - case WT_EYES: + case LLInventoryType::NIT_EYES: idx = BODYPART_EYES_ICON_NAME; break; - case WT_SHIRT: + + case LLInventoryType::NIT_BODYPART: + idx = BODYPART_ICON_NAME; + break; + + + // CLOTHING + + case LLInventoryType::NIT_SHIRT: idx = CLOTHING_SHIRT_ICON_NAME; break; - case WT_PANTS: + case LLInventoryType::NIT_PANTS: idx = CLOTHING_PANTS_ICON_NAME; break; - case WT_SHOES: + case LLInventoryType::NIT_SHOES: idx = CLOTHING_SHOES_ICON_NAME; break; - case WT_SOCKS: + case LLInventoryType::NIT_SOCKS: idx = CLOTHING_SOCKS_ICON_NAME; break; - case WT_JACKET: + case LLInventoryType::NIT_JACKET: idx = CLOTHING_JACKET_ICON_NAME; break; - case WT_GLOVES: + case LLInventoryType::NIT_GLOVES: idx = CLOTHING_GLOVES_ICON_NAME; break; - case WT_UNDERSHIRT: + case LLInventoryType::NIT_UNDERSHIRT: idx = CLOTHING_UNDERSHIRT_ICON_NAME; break; - case WT_UNDERPANTS: + case LLInventoryType::NIT_UNDERPANTS: idx = CLOTHING_UNDERPANTS_ICON_NAME; break; - case WT_SKIRT: + case LLInventoryType::NIT_SKIRT: idx = CLOTHING_SKIRT_ICON_NAME; break; + + case LLInventoryType::NIT_CLOTHING: + idx = CLOTHING_ICON_NAME; + break; + + + // TEXTURES / SNAPSHOTS + + case LLInventoryType::NIT_SNAPSHOT: + idx = SNAPSHOT_ICON_NAME; + break; + case LLInventoryType::NIT_TEXTURE: + case LLInventoryType::NIT_IMAGE: + idx = TEXTURE_ICON_NAME; + break; + + + // CALLING CARDS + + case LLInventoryType::NIT_CALLCARD_ON: + idx = CALLINGCARD_ONLINE_ICON_NAME; + break; + case LLInventoryType::NIT_CALLCARD_OFF: + case LLInventoryType::NIT_CALLCARD: + idx = CALLINGCARD_OFFLINE_ICON_NAME; + break; + + + // LANDMARKS + + case LLInventoryType::NIT_LANDMARK_USED: + idx = LANDMARK_VISITED_ICON_NAME; + break; + case LLInventoryType::NIT_LANDMARK_UNUSED: + case LLInventoryType::NIT_LANDMARK: + idx = LANDMARK_ICON_NAME; + break; + + + // SOUNDS + + case LLInventoryType::NIT_SOUND: + idx = SOUND_ICON_NAME; + break; + + + // ANIMATIONS + + case LLInventoryType::NIT_ANIMATION: + idx = ANIMATION_ICON_NAME; + break; + + + // GESTURES + + case LLInventoryType::NIT_GESTURE: + idx = GESTURE_ICON_NAME; + break; + + + // NOTECARD + + case LLInventoryType::NIT_NOTECARD: + idx = NOTECARD_ICON_NAME; + break; + + + // SCRIPTS + + case LLInventoryType::NIT_SCRIPT_LSL2: + idx = SCRIPT_ICON_NAME; + break; + + + // OBJECTS + + case LLInventoryType::NIT_OBJECT: + if( item_is_multi ) + { + idx = OBJECT_MULTI_ICON_NAME; + } + else + { + idx = OBJECT_ICON_NAME; + } + break; + default: - // no-op, go with choice above break; - } - break; - case LLAssetType::AT_NOTECARD: - idx = NOTECARD_ICON_NAME; - break; - case LLAssetType::AT_ANIMATION: - idx = ANIMATION_ICON_NAME; - break; - case LLAssetType::AT_GESTURE: - idx = GESTURE_ICON_NAME; - break; - default: - break; } - + return ICON_NAME[idx]; } diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index a37d370..c5c8532 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -58,6 +58,7 @@ class LLCheckBoxCtrl; class LLSpinCtrl; class LLScrollableContainerView; class LLTextBox; +class LLComboBox; class LLIconCtrl; class LLSaveFolderState; class LLSearchEditor; @@ -161,14 +162,18 @@ public: LLInventoryViewFinder(const std::string& name, const LLRect& rect, LLInventoryView* inventory_view); - virtual void draw(); + virtual void rebuildFilter(); virtual void onClose(bool app_quitting); void changeFilter(LLInventoryFilter* filter); void updateElementsFromFilter(); BOOL getCheckShowEmpty(); BOOL getCheckSinceLogoff(); + /** Callback when an inventory type checkbox is changed. */ + static void onCheckFilterType(LLUICtrl *ctrl, void *user_data); + static void onTimeAgo(LLUICtrl*, void *); + static void onCheckShowEmptyFolders(LLUICtrl*, void *); static void onCheckSinceLogoff(LLUICtrl*, void *); static void onCloseBtn(void* user_data); static void selectAllTypes(void* user_data); @@ -239,6 +244,8 @@ public: static void onFoldersByName(void *user_data); static BOOL checkFoldersByName(void *user_data); static void onSearchEdit(const std::string& search_string, void* user_data ); + static void onQuickFilterCommit(LLUICtrl* ctrl, void* user_data); + static void refreshQuickFilter(LLUICtrl* ctrl); static void onFilterSelected(void* userdata, bool from_click); static void onSelectionChange(const std::deque &items, BOOL user_action, void* data); @@ -259,6 +266,7 @@ protected: protected: LLSearchEditor* mSearchEditor; + LLComboBox* mQuickFilterCombo; LLTabContainer* mFilterTabs; LLHandle mFinderHandle; LLInventoryPanel* mActivePanel; @@ -344,6 +352,9 @@ std::string get_item_icon_name(LLAssetType::EType asset_type, U32 attachment_point, BOOL item_is_multi ); +std::string get_item_icon_name(LLInventoryType::NType inv_ntype, + BOOL item_is_multi ); + LLUIImagePtr get_item_icon(LLAssetType::EType asset_type, LLInventoryType::EType inventory_type, U32 attachment_point, diff --git a/linden/indra/newview/llpanelinventory.cpp b/linden/indra/newview/llpanelinventory.cpp index 3c0e6d7..7277f05 100644 --- a/linden/indra/newview/llpanelinventory.cpp +++ b/linden/indra/newview/llpanelinventory.cpp @@ -146,6 +146,7 @@ public: virtual BOOL isUpToDate() const { return TRUE; } virtual BOOL hasChildren() const { return FALSE; } virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; } + virtual LLInventoryType::NType getNInventoryType() const { return LLInventoryType::NIT_FOLDER; } // LLDragAndDropBridge functionality virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; virtual BOOL dragOrDrop(MASK mask, BOOL drop, diff --git a/linden/indra/newview/lltexturectrl.cpp b/linden/indra/newview/lltexturectrl.cpp index 382a4f3..6b84be4 100644 --- a/linden/indra/newview/lltexturectrl.cpp +++ b/linden/indra/newview/lltexturectrl.cpp @@ -237,11 +237,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( if(mInventoryPanel) { - U32 filter_types = 0x0; - filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; - filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; - - mInventoryPanel->setFilterTypes(filter_types); + mInventoryPanel->setFilterTypes( LLInventoryType::NIT_IMAGE ); //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss. mInventoryPanel->setFilterPermMask(immediate_filter_perm_mask); mInventoryPanel->setSelectCallback(onSelectionChange, this); diff --git a/linden/indra/newview/llwearable.h b/linden/indra/newview/llwearable.h index c5f9d06..00a53d3 100644 --- a/linden/indra/newview/llwearable.h +++ b/linden/indra/newview/llwearable.h @@ -37,28 +37,10 @@ #include "llpermissions.h" #include "llsaleinfo.h" #include "llassetstorage.h" +#include "llwearabletype.h" class LLViewerInventoryItem; -enum EWearableType // If you change this, update LLWearable::getTypeName(), getTypeLabel(), and LLVOAvatar::getTEWearableType() -{ - WT_SHAPE = 0, - WT_SKIN = 1, - WT_HAIR = 2, - WT_EYES = 3, - WT_SHIRT = 4, - WT_PANTS = 5, - WT_SHOES = 6, - WT_SOCKS = 7, - WT_JACKET = 8, - WT_GLOVES = 9, - WT_UNDERSHIRT = 10, - WT_UNDERPANTS = 11, - WT_SKIRT = 12, - WT_COUNT = 13, - WT_INVALID = 255 -}; - class LLWearable { friend class LLWearableList; diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml index 1cb1da0..590555f 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml @@ -5,18 +5,64 @@ title="Inventory" width="467"> - + + + Quick Filter: + + + + All Types + Animations + Body Parts + Calling Cards + Clothing + Gestures + Landmarks + Notecards + Objects + Scripts + Sounds + Textures + Snapshots + Custom... + + + + All Types + + Animations + Body Parts + Calling Cards + Clothing + Gestures + Landmarks + Notecards + Objects + Scripts + Sounds + Textures + Snapshots + + Custom... + + + + + + - - - - - - - - - - - - - - - - - - - - - - - -