From 0480e29597a354279119c28839710b54bc030bc7 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 10 Jun 2010 15:42:23 +0300 Subject: EXT-7609 FIXED Added worn items indication in Appearance panel. - Added (worn) suffix to indicate worn item of LLPanelInventoryListItemBase type (all flat list items in Appearance panel). - Used LLOutfitObserver for updating (worn) suffix when user wears an item from My Outfits list. - Added updating only items and links to items with specific UUIDs in LLWearableItemsList. Reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/551/ --HG-- branch : product-engine --- indra/newview/llinventoryitemslist.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventoryitemslist.cpp') diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index cd0e976a79..a9814a1b9a 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -79,7 +79,15 @@ void LLPanelInventoryListItemBase::draw() void LLPanelInventoryListItemBase::updateItem() { setIconImage(mIconImage); - setTitle(mItem->getName(), mHighlightedText); + + std::string name = mItem->getName(); + + if (get_is_item_worn(mItem->getUUID())) + { + name += LLTrans::getString("worn"); + } + + setTitle(name, mHighlightedText); } void LLPanelInventoryListItemBase::addWidgetToLeftSide(const std::string& name, bool show_widget/* = true*/) -- cgit v1.2.3 From ab399e0cd5dfe4045f275ac3e8ee9b02266ac780 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 10 Jun 2010 22:49:25 +0300 Subject: EXT-7609 FIXED Item name (worn) suffix made searchable. - Wearable list items filter now searches sub-string in whole item title including (worn) suffix. - Removed (worn) indication from items which don't need it in Edit Outfit. Only worn items can be edited there. - Added null pointer checks for inventory item member of LLPanelInventoryListItemBase class and its descendants. Reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/551/. --HG-- branch : product-engine --- indra/newview/llinventoryitemslist.cpp | 60 +++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 12 deletions(-) (limited to 'indra/newview/llinventoryitemslist.cpp') diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index 55cb2619cf..23ea786484 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -70,23 +70,19 @@ void LLPanelInventoryListItemBase::draw() { if (getNeedsRefresh()) { - updateItem(); + if (mItem) + { + updateItem(mItem->getName()); + } setNeedsRefresh(false); } LLPanel::draw(); } -void LLPanelInventoryListItemBase::updateItem() +// virtual +void LLPanelInventoryListItemBase::updateItem(const std::string& name) { setIconImage(mIconImage); - - std::string name = mItem->getName(); - - if (get_is_item_worn(mItem->getUUID())) - { - name += LLTrans::getString("worn"); - } - setTitle(name, mHighlightedText); } @@ -140,7 +136,11 @@ BOOL LLPanelInventoryListItemBase::postBuild() setIconCtrl(getChild("item_icon")); setTitleCtrl(getChild("item_name")); - mIconImage = LLInventoryIcon::getIcon(mItem->getType(), mItem->getInventoryType(), mItem->getFlags(), FALSE); + if (mItem) + { + mIconImage = LLInventoryIcon::getIcon(mItem->getType(), mItem->getInventoryType(), mItem->getFlags(), FALSE); + updateItem(mItem->getName()); + } setNeedsRefresh(true); @@ -169,6 +169,42 @@ void LLPanelInventoryListItemBase::onMouseLeave(S32 x, S32 y, MASK mask) LLPanel::onMouseLeave(x, y, mask); } +const std::string& LLPanelInventoryListItemBase::getItemName() const +{ + if (!mItem) + { + return LLStringUtil::null; + } + return mItem->getName(); +} + +LLAssetType::EType LLPanelInventoryListItemBase::getType() const +{ + if (!mItem) + { + return LLAssetType::AT_NONE; + } + return mItem->getType(); +} + +LLWearableType::EType LLPanelInventoryListItemBase::getWearableType() const +{ + if (!mItem) + { + return LLWearableType::WT_NONE; + } + return mItem->getWearableType(); +} + +const std::string& LLPanelInventoryListItemBase::getDescription() const +{ + if (!mItem) + { + return LLStringUtil::null; + } + return mItem->getDescription(); +} + S32 LLPanelInventoryListItemBase::notify(const LLSD& info) { S32 rv = 0; @@ -176,7 +212,7 @@ S32 LLPanelInventoryListItemBase::notify(const LLSD& info) { mHighlightedText = info["match_filter"].asString(); - std::string test(mItem->getName()); + std::string test(mTitleCtrl->getText()); LLStringUtil::toUpper(test); if(mHighlightedText.empty() || std::string::npos != test.find(mHighlightedText)) -- cgit v1.2.3