summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorylistitem.h2
-rw-r--r--indra/newview/llwearableitemslist.cpp101
-rw-r--r--indra/newview/llwearableitemslist.h23
-rw-r--r--indra/newview/skins/default/textures/icons/add_icon.pngbin0 -> 3386 bytes
-rw-r--r--indra/newview/skins/default/textures/icons/remove_icon.pngbin0 -> 3446 bytes
-rw-r--r--indra/newview/skins/default/textures/textures.xml3
-rw-r--r--indra/newview/skins/default/xui/en/outfit_accordion_tab.xml1
-rw-r--r--indra/newview/skins/default/xui/en/panel_outfits_wearing.xml1
-rw-r--r--indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml64
9 files changed, 183 insertions, 12 deletions
diff --git a/indra/newview/llinventorylistitem.h b/indra/newview/llinventorylistitem.h
index d4dd212cc3..cf713a6930 100644
--- a/indra/newview/llinventorylistitem.h
+++ b/indra/newview/llinventorylistitem.h
@@ -197,6 +197,7 @@ protected:
virtual BOOL handleToolTip( S32 x, S32 y, MASK mask);
const LLUUID mInventoryItemUUID;
+ bool mHovered;
private:
@@ -221,7 +222,6 @@ private:
LLUIImagePtr mSelectedImage;
LLUIImagePtr mSeparatorImage;
- bool mHovered;
bool mSelected;
bool mSeparatorVisible;
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index bf4db81475..89b74ae962 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -92,17 +92,77 @@ LLPanelWearableListItem::LLPanelWearableListItem(LLViewerInventoryItem* item, co
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
+static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelWearableOutfitItem(&typeid(LLPanelWearableOutfitItem::Params), "wearable_outfit_list_item");
+
+LLPanelWearableOutfitItem::Params::Params()
+: add_btn("add_btn"),
+ remove_btn("remove_btn")
+{
+}
+
+BOOL LLPanelWearableOutfitItem::postBuild()
+{
+ LLPanelWearableListItem::postBuild();
+
+ LLViewerInventoryItem* inv_item = getItem();
+ mShowWidgets &= (inv_item->getType() != LLAssetType::AT_BODYPART);
+ if(mShowWidgets)
+ {
+ addWidgetToRightSide("add_wearable");
+ addWidgetToRightSide("remove_wearable");
+
+ childSetAction("add_wearable", boost::bind(&LLPanelWearableOutfitItem::onAddWearable, this));
+ childSetAction("remove_wearable", boost::bind(&LLPanelWearableOutfitItem::onRemoveWearable, this));
+
+ setWidgetsVisible(false);
+ reshapeWidgets();
+ }
+ return TRUE;
+}
+
+BOOL LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask)
+{
+ if(!mShowWidgets)
+ {
+ return LLPanelWearableListItem::handleDoubleClick(x, y, mask);
+ }
+
+ if(LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID))
+ {
+ onRemoveWearable();
+ }
+ else
+ {
+ onAddWearable();
+ }
+ return TRUE;
+}
+
+void LLPanelWearableOutfitItem::onAddWearable()
+{
+ setWidgetsVisible(false);
+ reshapeWidgets();
+ LLAppearanceMgr::instance().wearItemOnAvatar(mInventoryItemUUID, true, false);
+}
+
+void LLPanelWearableOutfitItem::onRemoveWearable()
+{
+ setWidgetsVisible(false);
+ reshapeWidgets();
+ LLAppearanceMgr::instance().removeItemFromAvatar(mInventoryItemUUID);
+}
// static
LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryItem* item,
- bool worn_indication_enabled)
+ bool worn_indication_enabled,
+ bool show_widgets)
{
LLPanelWearableOutfitItem* list_item = NULL;
if (item)
{
- const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>();
+ const LLPanelWearableOutfitItem::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelWearableOutfitItem>();
- list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled, params);
+ list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled, params, show_widgets);
list_item->initFromParams(params);
list_item->postBuild();
}
@@ -110,11 +170,23 @@ LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryIt
}
LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item,
- bool worn_indication_enabled,
- const LLPanelWearableOutfitItem::Params& params)
-: LLPanelInventoryListItemBase(item, params)
+ bool worn_indication_enabled,
+ const LLPanelWearableOutfitItem::Params& params,
+ bool show_widgets)
+: LLPanelWearableListItem(item, params)
, mWornIndicationEnabled(worn_indication_enabled)
+, mShowWidgets(show_widgets)
{
+ if(mShowWidgets)
+ {
+ LLButton::Params button_params = params.add_btn;
+ applyXUILayout(button_params, this);
+ addChild(LLUICtrlFactory::create<LLButton>(button_params));
+
+ button_params = params.remove_btn;
+ applyXUILayout(button_params, this);
+ addChild(LLUICtrlFactory::create<LLButton>(button_params));
+ }
}
// virtual
@@ -127,11 +199,22 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name,
// We don't use get_is_item_worn() here because this update is triggered by
// an inventory observer upon link in COF beind added or removed so actual
// worn status of a linked item may still remain unchanged.
- if (mWornIndicationEnabled && LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID))
+ bool is_worn = LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID);
+ if (mWornIndicationEnabled && is_worn)
{
search_label += LLTrans::getString("worn");
item_state = IS_WORN;
}
+ if(mShowWidgets)
+ {
+ setShowWidget("add_wearable", !is_worn);
+ setShowWidget("remove_wearable", is_worn);
+ if(mHovered)
+ {
+ setWidgetsVisible(true);
+ reshapeWidgets();
+ }
+ }
LLPanelInventoryListItemBase::updateItem(search_label, item_state);
}
@@ -634,6 +717,7 @@ static const LLDefaultChildRegistry::Register<LLWearableItemsList> r("wearable_i
LLWearableItemsList::Params::Params()
: standalone("standalone", true)
, worn_indication_enabled("worn_indication_enabled", true)
+, show_item_widgets("show_item_widgets", false)
{}
LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
@@ -649,6 +733,7 @@ LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
}
mWornIndicationEnabled = p.worn_indication_enabled;
setNoItemsCommentText(LLTrans::getString("LoadingData"));
+ mShowItemWidgets = p.show_item_widgets;
}
// virtual
@@ -665,7 +750,7 @@ LLPanel* LLWearableItemsList::createNewItem(LLViewerInventoryItem* item)
return NULL;
}
- return LLPanelWearableOutfitItem::create(item, mWornIndicationEnabled);
+ return LLPanelWearableOutfitItem::create(item, mWornIndicationEnabled, mShowItemWidgets);
}
void LLWearableItemsList::updateList(const LLUUID& category_id)
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index ba8488b237..f7774a7086 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -72,12 +72,23 @@ protected:
* Extends LLPanelInventoryListItemBase with handling
* double click to wear the item.
*/
-class LLPanelWearableOutfitItem : public LLPanelInventoryListItemBase
+class LLPanelWearableOutfitItem : public LLPanelWearableListItem
{
LOG_CLASS(LLPanelWearableOutfitItem);
public:
+ struct Params : public LLInitParam::Block<Params, LLPanelWearableListItem::Params>
+ {
+ Optional<LLButton::Params> add_btn, remove_btn;
+
+ Params();
+ };
+
+ BOOL postBuild();
+ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+
static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item,
- bool worn_indication_enabled);
+ bool worn_indication_enabled,
+ bool show_widgets);
/**
* Updates item name and (worn) suffix.
@@ -85,12 +96,16 @@ public:
/*virtual*/ void updateItem(const std::string& name,
EItemState item_state = IS_DEFAULT);
+ void onAddWearable();
+ void onRemoveWearable();
+
protected:
LLPanelWearableOutfitItem(LLViewerInventoryItem* item,
- bool worn_indication_enabled, const Params& params);
+ bool worn_indication_enabled, const Params& params, bool show_widgets = false);
private:
bool mWornIndicationEnabled;
+ bool mShowWidgets;
};
class LLPanelDeletableWearableListItem : public LLPanelWearableListItem
@@ -442,6 +457,7 @@ public:
{
Optional<bool> standalone;
Optional<bool> worn_indication_enabled;
+ Optional<bool> show_item_widgets;
Params();
};
@@ -482,6 +498,7 @@ protected:
bool mIsStandalone;
bool mWornIndicationEnabled;
+ bool mShowItemWidgets;
ESortOrder mSortOrder;
diff --git a/indra/newview/skins/default/textures/icons/add_icon.png b/indra/newview/skins/default/textures/icons/add_icon.png
new file mode 100644
index 0000000000..cb68ee8e16
--- /dev/null
+++ b/indra/newview/skins/default/textures/icons/add_icon.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/icons/remove_icon.png b/indra/newview/skins/default/textures/icons/remove_icon.png
new file mode 100644
index 0000000000..6e62ee33f4
--- /dev/null
+++ b/indra/newview/skins/default/textures/icons/remove_icon.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 4429a1677e..1f2c0867c4 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -743,6 +743,9 @@ with the same filename but different name
<texture name="Wearables_Divider" file_name="windows/Wearables_Divider.png" preload="false" />
+ <texture name="Add_Icon" file_name="icons/add_icon.png" preload="false" />
+ <texture name="Remove_Icon" file_name="icons/remove_icon.png" preload="false" />
+
<texture name="Web_Profile_Off" file_name="icons/Web_Profile_Off.png" preload="false" />
<texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
diff --git a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
index 2a24c74feb..d74dca8b95 100644
--- a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
+++ b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
@@ -18,6 +18,7 @@
follows="all"
keep_one_selected="true"
multi_select="true"
+ show_item_widgets="true"
name="wearable_items_list"
translate="false"
standalone="false"
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
index 42a7974316..b2dc975c6e 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
@@ -36,6 +36,7 @@
left="3"
multi_select="true"
name="cof_items_list"
+ show_item_widgets="true"
standalone="false"
top="0"
width="309"
diff --git a/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml b/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml
new file mode 100644
index 0000000000..cd84b91b1f
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/wearable_outfit_list_item.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<inventory_list_item
+ follows="top|right|left"
+ height="20"
+ name="inventory_item"
+ tab_stop="false"
+ hover_image="ListItem_Over"
+ selected_image="ListItem_Select"
+ separator_image="Wearables_Divider"
+ width="380">
+ <!-- DEFAULT style for inventory list item -->
+ <default_style
+ font="SansSerifSmall"
+ font.style="NORMAL" />
+
+ <!-- style for inventory list item WORN on avatar -->
+ <worn_style
+ font="SansSerifSmall"
+ font.style="BOLD"
+ color="EmphasisColor" />
+ <item_icon
+ height="16"
+ follows="top|left"
+ image_name="Inv_Object"
+ layout="topleft"
+ left="0"
+ name="item_icon"
+ top="0"
+ width="16" />
+ <item_name
+ follows="left|right"
+ height="20"
+ layout="topleft"
+ left="21"
+ parse_urls="false"
+ use_ellipses="true"
+ name="item_name"
+ text_color="white"
+ top="4"
+ value="..."
+ width="359" />
+ <add_btn
+ name="add_wearable"
+ layout="topleft"
+ follows="top|right"
+ image_unselected="Add_Icon"
+ image_selected="Add_Icon"
+ top="1"
+ left="0"
+ height="16"
+ width="16"
+ tab_stop="false" />
+ <remove_btn
+ name="remove_wearable"
+ layout="topleft"
+ follows="top|right"
+ image_unselected="Remove_Icon"
+ image_selected="Remove_Icon"
+ top="1"
+ left="26"
+ height="16"
+ width="16"
+ tab_stop="false" />
+</inventory_list_item>