summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-06-10 22:49:25 +0300
committerSergei Litovchuk <slitovchuk@productengine.com>2010-06-10 22:49:25 +0300
commitab399e0cd5dfe4045f275ac3e8ee9b02266ac780 (patch)
tree2343afe9bb622cff401e18044f5eb2dfc9564601
parent33d91c0a396632d55f0b322f10d1594ee2990e1d (diff)
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
-rw-r--r--indra/newview/llinventoryitemslist.cpp60
-rw-r--r--indra/newview/llinventoryitemslist.h10
-rw-r--r--indra/newview/llwearableitemslist.cpp21
-rw-r--r--indra/newview/llwearableitemslist.h20
4 files changed, 79 insertions, 32 deletions
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<LLIconCtrl>("item_icon"));
setTitleCtrl(getChild<LLTextBox>("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))
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h
index c1b1a6f281..d6132717e8 100644
--- a/indra/newview/llinventoryitemslist.h
+++ b/indra/newview/llinventoryitemslist.h
@@ -122,16 +122,16 @@ public:
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
/** Get the name of a corresponding inventory item */
- const std::string& getItemName() const { return mItem->getName(); }
+ const std::string& getItemName() const;
/** Get the asset type of a corresponding inventory item */
- LLAssetType::EType getType() const { return mItem->getType(); }
+ LLAssetType::EType getType() const;
/** Get the wearable type of a corresponding inventory item */
- LLWearableType::EType getWearableType() const { return mItem->getWearableType(); }
+ LLWearableType::EType getWearableType() const;
/** Get the description of a corresponding inventory item */
- const std::string& getDescription() const { return mItem->getDescription(); }
+ const std::string& getDescription() const;
/** Get the associated inventory item */
LLViewerInventoryItem* getItem() const { return mItem; }
@@ -152,7 +152,7 @@ protected:
/**
* Called after inventory item was updated, update panel widgets to reflect inventory changes.
*/
- virtual void updateItem();
+ virtual void updateItem(const std::string& name);
/** setter for mIconCtrl */
void setIconCtrl(LLIconCtrl* icon) { mIconCtrl = icon; }
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index 2eb6bd0df2..f86838194e 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -126,6 +126,19 @@ BOOL LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask)
return LLUICtrl::handleDoubleClick(x, y, mask);
}
+// virtual
+void LLPanelWearableOutfitItem::updateItem(const std::string& name)
+{
+ std::string search_label = name;
+
+ if (mItem && get_is_item_worn(mItem->getUUID()))
+ {
+ search_label += LLTrans::getString("worn");
+ }
+
+ LLPanelInventoryListItemBase::updateItem(search_label);
+}
+
LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item)
: LLPanelInventoryListItemBase(item)
{
@@ -292,12 +305,6 @@ LLPanelDummyClothingListItem* LLPanelDummyClothingListItem::create(LLWearableTyp
return list_item;
}
-void LLPanelDummyClothingListItem::updateItem()
-{
- std::string title = wearableTypeToString(mWearableType);
- setTitle(title, LLStringUtil::null);
-}
-
BOOL LLPanelDummyClothingListItem::postBuild()
{
LLIconCtrl* icon = getChild<LLIconCtrl>("item_icon");
@@ -307,7 +314,7 @@ BOOL LLPanelDummyClothingListItem::postBuild()
addWidgetToRightSide("btn_add_panel");
setIconImage(LLInventoryIcon::getIcon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, FALSE));
- updateItem();
+ updateItem(wearableTypeToString(mWearableType));
// Make it look loke clothing item - reserve space for 'delete' button
setLeftWidgetsWidth(icon->getRect().mLeft);
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index e0d1bf9476..2f95c733aa 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -56,13 +56,13 @@ class LLPanelWearableListItem : public LLPanelInventoryListItemBase
public:
/**
- * Shows buttons when mouse is over
- */
+ * Shows buttons when mouse is over
+ */
/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
/**
- * Hides buttons when mouse is out
- */
+ * Hides buttons when mouse is out
+ */
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
protected:
@@ -84,11 +84,16 @@ public:
static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item);
/**
- * Puts item on if it is not worn by agent
- * otherwise takes it off on double click.
- */
+ * Puts item on if it is not worn by agent
+ * otherwise takes it off on double click.
+ */
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+ /**
+ * Updates item name and (worn) suffix.
+ */
+ /*virtual*/ void updateItem(const std::string& name);
+
protected:
LLPanelWearableOutfitItem(LLViewerInventoryItem* item);
@@ -198,7 +203,6 @@ class LLPanelDummyClothingListItem : public LLPanelWearableListItem
public:
static LLPanelDummyClothingListItem* create(LLWearableType::EType w_type);
- /*virtual*/ void updateItem();
/*virtual*/ BOOL postBuild();
LLWearableType::EType getWearableType() const;