SL-18243 Add wear and unwear buttons on line items in Outfits floater
parent
2dd3030993
commit
cfc2d2890e
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
|
|
@ -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" />
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
left="3"
|
||||
multi_select="true"
|
||||
name="cof_items_list"
|
||||
show_item_widgets="true"
|
||||
standalone="false"
|
||||
top="0"
|
||||
width="309"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Reference in New Issue