From cee7da2602f22d8450eb46f92564f58a80267909 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 7 Jun 2010 23:20:15 -0700 Subject: Fixed group notice history showing wrong icons for attached inventory --- linden/indra/newview/llinventoryview.cpp | 131 +++++++++++++++++++++++++++ linden/indra/newview/llinventoryview.h | 7 ++ linden/indra/newview/llpanelgroupnotices.cpp | 6 +- 3 files changed, 141 insertions(+), 3 deletions(-) diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index 7be1542..e6041c4 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -1585,6 +1585,137 @@ std::string get_item_icon_name(LLInventoryType::NType inv_ntype, return ICON_NAME[idx]; } +std::string get_item_icon_name(LLAssetType::EType asset_type, + LLInventoryType::NType inv_ntype, + U32 flags, + BOOL item_is_multi) +{ + EInventoryIcon idx = OBJECT_ICON_NAME; + if ( item_is_multi ) + { + idx = OBJECT_MULTI_ICON_NAME; + } + + switch(asset_type) + { + case LLAssetType::AT_TEXTURE: + if(LLInventoryType::NIT_SNAPSHOT == inv_ntype) + { + idx = SNAPSHOT_ICON_NAME; + } + else + { + idx = TEXTURE_ICON_NAME; + } + break; + + case LLAssetType::AT_SOUND: + idx = SOUND_ICON_NAME; + break; + case LLAssetType::AT_CALLINGCARD: + if(flags != 0) + { + idx = CALLINGCARD_ONLINE_ICON_NAME; + } + else + { + idx = CALLINGCARD_OFFLINE_ICON_NAME; + } + break; + case LLAssetType::AT_LANDMARK: + if(flags!= 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; + switch(LLInventoryItem::II_FLAGS_WEARABLES_MASK & flags) + { + case WT_SHIRT: + idx = CLOTHING_SHIRT_ICON_NAME; + break; + case WT_PANTS: + idx = CLOTHING_PANTS_ICON_NAME; + break; + case WT_SHOES: + idx = CLOTHING_SHOES_ICON_NAME; + break; + case WT_SOCKS: + idx = CLOTHING_SOCKS_ICON_NAME; + break; + case WT_JACKET: + idx = CLOTHING_JACKET_ICON_NAME; + break; + case WT_GLOVES: + idx = CLOTHING_GLOVES_ICON_NAME; + break; + case WT_UNDERSHIRT: + idx = CLOTHING_UNDERSHIRT_ICON_NAME; + break; + case WT_UNDERPANTS: + idx = CLOTHING_UNDERPANTS_ICON_NAME; + break; + case WT_SKIRT: + idx = CLOTHING_SKIRT_ICON_NAME; + break; + case WT_ALPHA: + idx = CLOTHING_ALPHA_ICON_NAME; + break; + case WT_TATTOO: + idx = CLOTHING_TATTOO_ICON_NAME; + break; + default: + // no-op, go with choice above + break; + } + break; + case LLAssetType::AT_BODYPART: + idx = BODYPART_ICON_NAME; + switch(LLInventoryItem::II_FLAGS_WEARABLES_MASK & flags) + { + case WT_SHAPE: + idx = BODYPART_SHAPE_ICON_NAME; + break; + case WT_SKIN: + idx = BODYPART_SKIN_ICON_NAME; + break; + case WT_HAIR: + idx = BODYPART_HAIR_ICON_NAME; + break; + case WT_EYES: + idx = BODYPART_EYES_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]; +} + LLUIImagePtr get_item_icon(LLAssetType::EType asset_type, LLInventoryType::EType inventory_type, U32 attachment_point, diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index 495a340..2650ed8 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -391,6 +391,13 @@ std::string get_item_icon_name(LLAssetType::EType asset_type, std::string get_item_icon_name(LLInventoryType::NType inv_ntype, BOOL item_is_multi ); +// Uses NType only. For when we don't know an asset's inventory type or have no way of finding that information. +// Sends a default inv_ntype to use if there are multiple NTypes for an asset type. +std::string get_item_icon_name(LLAssetType::EType asset_type, + LLInventoryType::NType inv_ntype, + U32 flags, + 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/llpanelgroupnotices.cpp b/linden/indra/newview/llpanelgroupnotices.cpp index e07259f..3d5cd3e 100644 --- a/linden/indra/newview/llpanelgroupnotices.cpp +++ b/linden/indra/newview/llpanelgroupnotices.cpp @@ -320,7 +320,7 @@ void LLPanelGroupNotices::setItem(LLPointer inv_item) }; std::string icon_name = get_item_icon_name(inv_item->getType(), - inv_item->getInventoryType(), + inv_item->getNInventoryType(), inv_item->getFlags(), item_is_multi ); @@ -479,7 +479,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) { std::string icon_name = get_item_icon_name( (LLAssetType::EType)asset_type, - LLInventoryType::IT_NONE,FALSE, FALSE); + LLInventoryType::NIT_NONE,FALSE, FALSE); row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = icon_name; } @@ -547,7 +547,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject, mInventoryOffer = inventory_offer; std::string icon_name = get_item_icon_name(mInventoryOffer->mType, - LLInventoryType::IT_TEXTURE, + LLInventoryType::NIT_TEXTURE, 0, FALSE); mViewInventoryIcon->setImage(icon_name); -- cgit v1.1