summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2010-04-29 19:06:13 +0300
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2010-04-29 19:06:13 +0300
commit02d6922727bd674025759a95df15a1f764b784fd (patch)
tree28d45a64157149e462833309b12eeedc6a5be7ab /indra/newview
parent85e3432579844afa8f76b4071329264f85711507 (diff)
Fixed EXT-7163(normal) - Create dummy inventory item panel (an item panel for unworn wearable types)
Added new wearable list item - LLPanelDummyClothingListItem for not worn wearable types, it displays grayed wearable type icon, grayed title '<clothing type> not worn' and 'add' button. Modified base class to be more flexible. Moved init() to protected section. Modified COF panel to use dummy item. Reviewed by Mike Antipov - https://codereview.productengine.com/secondlife/r/335/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llcofwearables.cpp8
-rw-r--r--indra/newview/llinventoryitemslist.cpp48
-rw-r--r--indra/newview/llinventoryitemslist.h17
-rw-r--r--indra/newview/llwearableitemslist.cpp84
-rw-r--r--indra/newview/llwearableitemslist.h30
-rw-r--r--indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml62
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml14
7 files changed, 236 insertions, 27 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index a2a1dd504a..b8222ebb18 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -204,10 +204,10 @@ void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by
U32 size = clothing_by_type[type].size();
if (size) continue;
- //*TODO create dummy item panel
-
- //*TODO add dummy item panel -> mClothing->addItem(dummy_item_panel, item->getUUID(), ADD_BOTTOM, false);
-
+ EWearableType w_type = static_cast<EWearableType>(type);
+ LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type);
+ if(!item_panel) continue;
+ mClothing->addItem(item_panel, LLUUID::null, ADD_BOTTOM, false);
addWearableTypeSeparator(mClothing);
}
}
diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp
index 3d8cb6dfe8..e78ffcba62 100644
--- a/indra/newview/llinventoryitemslist.cpp
+++ b/indra/newview/llinventoryitemslist.cpp
@@ -65,14 +65,8 @@ LLPanelInventoryListItemBase* LLPanelInventoryListItemBase::create(LLViewerInven
void LLPanelInventoryListItemBase::updateItem()
{
- if (mItemIcon.notNull())
- mIcon->setImage(mItemIcon);
-
- LLTextUtil::textboxSetHighlightedVal(
- mTitle,
- LLStyle::Params(),
- mItem->getName(),
- mHighlightedText);
+ setIconImage(mIconImage);
+ setTitle(mItem->getName(), mHighlightedText);
}
void LLPanelInventoryListItemBase::addWidgetToLeftSide(const std::string& name, bool show_widget/* = true*/)
@@ -122,9 +116,10 @@ void LLPanelInventoryListItemBase::setShowWidget(LLUICtrl* ctrl, bool show)
BOOL LLPanelInventoryListItemBase::postBuild()
{
- // Inheritors need to call base implementation
- mIcon = getChild<LLIconCtrl>("item_icon");
- mTitle = getChild<LLTextBox>("item_name");
+ setIconCtrl(getChild<LLIconCtrl>("item_icon"));
+ setTitleCtrl(getChild<LLTextBox>("item_name"));
+
+ mIconImage = get_item_icon(mItem->getType(), mItem->getInventoryType(), mItem->getFlags(), FALSE);
updateItem();
@@ -156,13 +151,12 @@ void LLPanelInventoryListItemBase::onMouseLeave(S32 x, S32 y, MASK mask)
LLPanelInventoryListItemBase::LLPanelInventoryListItemBase(LLViewerInventoryItem* item)
: LLPanel()
, mItem(item)
-, mIcon(NULL)
-, mTitle(NULL)
+, mIconCtrl(NULL)
+, mTitleCtrl(NULL)
, mWidgetSpacing(WIDGET_SPACING)
, mLeftWidgetsWidth(0)
, mRightWidgetsWidth(0)
{
- mItemIcon = get_item_icon(mItem->getType(), mItem->getInventoryType(), mItem->getFlags(), FALSE);
}
void LLPanelInventoryListItemBase::init()
@@ -197,6 +191,24 @@ void LLPanelInventoryListItemBase::reshapeWidgets()
reshapeMiddleWidgets();
}
+void LLPanelInventoryListItemBase::setIconImage(const LLUIImagePtr& image)
+{
+ if(image)
+ {
+ mIconImage = image;
+ mIconCtrl->setImage(mIconImage);
+ }
+}
+
+void LLPanelInventoryListItemBase::setTitle(const std::string& title, const std::string& highlit_text)
+{
+ LLTextUtil::textboxSetHighlightedVal(
+ mTitleCtrl,
+ LLStyle::Params(),
+ title,
+ highlit_text);
+}
+
void LLPanelInventoryListItemBase::reshapeLeftWidgets()
{
S32 widget_left = 0;
@@ -246,16 +258,16 @@ void LLPanelInventoryListItemBase::reshapeRightWidgets()
void LLPanelInventoryListItemBase::reshapeMiddleWidgets()
{
- LLRect icon_rect(mIcon->getRect());
+ LLRect icon_rect(mIconCtrl->getRect());
icon_rect.setLeftTopAndSize(mLeftWidgetsWidth + getWidgetSpacing(), icon_rect.mTop,
icon_rect.getWidth(), icon_rect.getHeight());
- mIcon->setShape(icon_rect);
+ mIconCtrl->setShape(icon_rect);
S32 name_left = icon_rect.mRight + getWidgetSpacing();
S32 name_right = getLocalRect().getWidth() - mRightWidgetsWidth - getWidgetSpacing();
- LLRect name_rect(mTitle->getRect());
+ LLRect name_rect(mTitleCtrl->getRect());
name_rect.set(name_left, name_rect.mTop, name_right, name_rect.mBottom);
- mTitle->setShape(name_rect);
+ mTitleCtrl->setShape(name_rect);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h
index 15f04c79a9..152aafbd7e 100644
--- a/indra/newview/llinventoryitemslist.h
+++ b/indra/newview/llinventoryitemslist.h
@@ -125,6 +125,11 @@ protected:
*/
virtual void init();
+ /** setter for mIconCtrl */
+ void setIconCtrl(LLIconCtrl* icon) { mIconCtrl = icon; }
+ /** setter for MTitleCtrl */
+ void setTitleCtrl(LLTextBox* tb) { mTitleCtrl = tb; }
+
void setLeftWidgetsWidth(S32 width) { mLeftWidgetsWidth = width; }
void setRightWidgetsWidth(S32 width) { mRightWidgetsWidth = width; }
@@ -139,6 +144,12 @@ protected:
*/
virtual void reshapeWidgets();
+ /** set wearable type icon image */
+ void setIconImage(const LLUIImagePtr& image);
+
+ /** Set item title - inventory item name usually */
+ void setTitle(const std::string& title, const std::string& highlit_text);
+
private:
/** reshape left side widgets
@@ -155,10 +166,10 @@ private:
LLViewerInventoryItem* mItem;
- LLIconCtrl* mIcon;
- LLTextBox* mTitle;
+ LLIconCtrl* mIconCtrl;
+ LLTextBox* mTitleCtrl;
- LLUIImagePtr mItemIcon;
+ LLUIImagePtr mIconImage;
std::string mHighlightedText;
widget_array_t mLeftSideWidgets;
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index b8fab63be9..56b2791993 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -33,8 +33,11 @@
#include "llwearableitemslist.h"
+#include "lliconctrl.h"
+
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
+#include "lltransutil.h"
class LLFindOutfitItems : public LLInventoryCollectFunctor
{
@@ -212,6 +215,87 @@ void LLPanelBodyPartsListItem::setShowEditButton(bool show)
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
+LLPanelDummyClothingListItem* LLPanelDummyClothingListItem::create(EWearableType w_type)
+{
+ LLPanelDummyClothingListItem* list_item = new LLPanelDummyClothingListItem(w_type);
+ list_item->init();
+ return list_item;
+}
+
+void LLPanelDummyClothingListItem::updateItem()
+{
+ std::string title = wearableTypeToString(mWearableType);
+ setTitle(title, LLStringUtil::null);
+}
+
+BOOL LLPanelDummyClothingListItem::postBuild()
+{
+ LLIconCtrl* icon = getChild<LLIconCtrl>("item_icon");
+ setIconCtrl(icon);
+ setTitleCtrl(getChild<LLTextBox>("item_name"));
+
+ addWidgetToRightSide("btn_add");
+
+ setIconImage(get_item_icon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, FALSE));
+ updateItem();
+
+ // Make it look loke clothing item - reserve space for 'delete' button
+ setLeftWidgetsWidth(icon->getRect().mLeft);
+
+ setWidgetsVisible(false);
+ reshapeWidgets();
+
+ return TRUE;
+}
+
+LLPanelDummyClothingListItem::LLPanelDummyClothingListItem(EWearableType w_type)
+ : LLPanelWearableListItem(NULL)
+ , mWearableType(w_type)
+{
+}
+
+void LLPanelDummyClothingListItem::init()
+{
+ LLUICtrlFactory::getInstance()->buildPanel(this, "panel_dummy_clothing_list_item.xml");
+}
+
+typedef std::map<EWearableType, std::string> clothing_to_string_map_t;
+
+clothing_to_string_map_t init_clothing_string_map()
+{
+ clothing_to_string_map_t w_map;
+ w_map.insert(std::make_pair(WT_SHIRT, "shirt_not_worn"));
+ w_map.insert(std::make_pair(WT_PANTS, "pants_not_worn"));
+ w_map.insert(std::make_pair(WT_SHOES, "shoes_not_worn"));
+ w_map.insert(std::make_pair(WT_SOCKS, "socks_not_worn"));
+ w_map.insert(std::make_pair(WT_JACKET, "jacket_not_worn"));
+ w_map.insert(std::make_pair(WT_GLOVES, "gloves_not_worn"));
+ w_map.insert(std::make_pair(WT_UNDERSHIRT, "undershirt_not_worn"));
+ w_map.insert(std::make_pair(WT_UNDERPANTS, "underpants_not_worn"));
+ w_map.insert(std::make_pair(WT_SKIRT, "skirt_not_worn"));
+ w_map.insert(std::make_pair(WT_ALPHA, "alpha_not_worn"));
+ w_map.insert(std::make_pair(WT_TATTOO, "tattoo_not_worn"));
+ return w_map;
+}
+
+std::string LLPanelDummyClothingListItem::wearableTypeToString(EWearableType w_type)
+{
+ static const clothing_to_string_map_t w_map = init_clothing_string_map();
+ static const std::string invalid_str = LLTrans::getString("invalid_not_worn");
+
+ std::string type_str = invalid_str;
+ clothing_to_string_map_t::const_iterator it = w_map.find(w_type);
+ if(w_map.end() != it)
+ {
+ type_str = LLTrans::getString(it->second);
+ }
+ return type_str;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
static const LLDefaultChildRegistry::Register<LLWearableItemsList> r("wearable_items_list");
LLWearableItemsList::Params::Params()
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index ae43b3f673..c4a415dfbf 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -81,7 +81,6 @@ public:
virtual ~LLPanelClothingListItem();
- /*virtual*/ void init();
/*virtual*/ BOOL postBuild();
/**
@@ -96,6 +95,8 @@ public:
protected:
LLPanelClothingListItem(LLViewerInventoryItem* item);
+
+ /*virtual*/ void init();
};
class LLPanelBodyPartsListItem : public LLPanelWearableListItem
@@ -107,7 +108,6 @@ public:
virtual ~LLPanelBodyPartsListItem();
- /*virtual*/ void init();
/*virtual*/ BOOL postBuild();
/**
@@ -118,6 +118,32 @@ public:
protected:
LLPanelBodyPartsListItem(LLViewerInventoryItem* item);
+
+ /*virtual*/ void init();
+};
+
+/**
+ * @class LLPanelDummyClothingListItem
+ *
+ * A dummy item panel - displays grayed clothing icon, grayed title '<clothing> not worn' and 'add' button
+ */
+class LLPanelDummyClothingListItem : public LLPanelWearableListItem
+{
+public:
+ static LLPanelDummyClothingListItem* create(EWearableType w_type);
+
+ /*virtual*/ void updateItem();
+ /*virtual*/ BOOL postBuild();
+
+protected:
+ LLPanelDummyClothingListItem(EWearableType w_type);
+
+ /*virtual*/ void init();
+
+ static std::string wearableTypeToString(EWearableType w_type);
+
+private:
+ EWearableType mWearableType;
};
/**
diff --git a/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml b/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml
new file mode 100644
index 0000000000..dbbfa8f2e2
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ follows="top|right|left"
+ height="20"
+ layout="topleft"
+ left="0"
+ name="dummy_clothing_item"
+ top="0"
+ width="380">
+ <icon
+ follows="top|right|left"
+ height="20"
+ image_name="ListItem_Over"
+ layout="topleft"
+ left="0"
+ name="hovered_icon"
+ top="0"
+ visible="false"
+ width="380" />
+ <icon
+ height="20"
+ follows="top|right|left"
+ image_name="ListItem_Select"
+ layout="topleft"
+ left="0"
+ name="selected_icon"
+ top="0"
+ visible="false"
+ width="380" />
+ <icon
+ height="16"
+ color="0.75 0.75 0.75 1"
+ follows="top|left"
+ image_name="Inv_Object"
+ layout="topleft"
+ left="20"
+ name="item_icon"
+ top="2"
+ width="16" />
+ <text
+ follows="left|right"
+ height="16"
+ layout="topleft"
+ left_pad="5"
+ allow_html="false"
+ use_ellipses="true"
+ name="item_name"
+ text_color="LtGray_50"
+ top="4"
+ value="..."
+ width="359" />
+ <button
+ name="btn_add"
+ layout="topleft"
+ follows="top|right"
+ label="+"
+ top="0"
+ left="0"
+ height="20"
+ width="20"
+ tab_stop="false" />
+</panel>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 3cba76cbfa..e0d58a16c8 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -1802,6 +1802,20 @@ Clears (deletes) the media and all params from the given face.
<string name="alpha">Alpha</string>
<string name="tattoo">Tattoo</string>
<string name="invalid">invalid</string>
+
+ <!-- Not Worn Wearable Types -->
+ <string name="shirt_not_worn">Shirt not worn</string>
+ <string name="pants_not_worn">Pants not worn</string>
+ <string name="shoes_not_worn">Shoes not worn</string>
+ <string name="socks_not_worn">Socks not worn</string>
+ <string name="jacket_not_worn">Jacket not worn</string>
+ <string name="gloves_not_worn">Gloves not worn</string>
+ <string name="undershirt_not_worn">Undershirt not worn</string>
+ <string name="underpants_not_worn">Underpants not worn</string>
+ <string name="skirt_not_worn">Skirt not worn</string>
+ <string name="alpha_not_worn">Alpha not worn</string>
+ <string name="tattoo_not_worn">Tattoo not worn</string>
+ <string name="invalid_not_worn">invalid</string>
<!-- Wearable List-->
<string name="NewWearable">New [WEARABLE_ITEM]</string>