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-enginemaster
parent
0a6e0deb32
commit
0480e29597
|
|
@ -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*/)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "llinventorymodel.h"
|
||||
#include "lllistcontextmenu.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "lloutfitobserver.h"
|
||||
#include "llsidetray.h"
|
||||
#include "lltransutil.h"
|
||||
#include "llviewermenu.h"
|
||||
|
|
@ -199,6 +200,9 @@ void LLOutfitsList::onOpen(const LLSD& /*info*/)
|
|||
mCategoriesObserver->addCategory(outfits,
|
||||
boost::bind(&LLOutfitsList::refreshList, this, outfits));
|
||||
|
||||
// Start observing changes in Current Outfit to update items worn state.
|
||||
LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLOutfitsList::onCOFChanged, this));
|
||||
|
||||
// Fetch "My Outfits" contents and refresh the list to display
|
||||
// initially fetched items. If not all items are fetched now
|
||||
// the observer will refresh the list as soon as the new items
|
||||
|
|
@ -645,6 +649,43 @@ void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
|
|||
LLWearableItemsList::ContextMenu::instance().show(list, selected_uuids, x, y);
|
||||
}
|
||||
|
||||
void LLOutfitsList::onCOFChanged()
|
||||
{
|
||||
LLInventoryModel::changed_items_t changed_linked_items;
|
||||
|
||||
const LLInventoryModel::changed_items_t& changed_items = gInventory.getChangedIDs();
|
||||
for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items.begin();
|
||||
iter != changed_items.end();
|
||||
++iter)
|
||||
{
|
||||
LLViewerInventoryItem* item = gInventory.getItem(*iter);
|
||||
if (item)
|
||||
{
|
||||
// From gInventory we get the UUIDs of new links added to COF
|
||||
// or removed from COF. These links UUIDs are not the same UUIDs
|
||||
// that we have in each wearable items list. So we collect base items
|
||||
// UUIDs to find all items or links that point to same base items in wearable
|
||||
// items lists and update their worn state there.
|
||||
changed_linked_items.insert(item->getLinkedUUID());
|
||||
}
|
||||
}
|
||||
|
||||
for (outfits_map_t::iterator iter = mOutfitsMap.begin();
|
||||
iter != mOutfitsMap.end();
|
||||
++iter)
|
||||
{
|
||||
LLAccordionCtrlTab* tab = iter->second;
|
||||
if (!tab) continue;
|
||||
|
||||
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
|
||||
if (!list) continue;
|
||||
|
||||
// Every list updates the labels of changed items or
|
||||
// the links that point to these items.
|
||||
list->updateChangedItems(changed_linked_items);
|
||||
}
|
||||
}
|
||||
|
||||
bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y)
|
||||
{
|
||||
if(!tab || !tab->getHeaderVisible()) return false;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ private:
|
|||
void onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id);
|
||||
void onAccordionTabDoubleClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id);
|
||||
void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
|
||||
void onCOFChanged();
|
||||
|
||||
void onSelectionChange(LLUICtrl* ctrl);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "llagentwearables.h"
|
||||
#include "llappearancemgr.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "llmenugl.h" // for LLContextMenu
|
||||
#include "lltransutil.h"
|
||||
#include "llviewerattachmenu.h"
|
||||
|
|
@ -510,6 +509,37 @@ void LLWearableItemsList::updateList(const LLUUID& category_id)
|
|||
refreshList(item_array);
|
||||
}
|
||||
|
||||
void LLWearableItemsList::updateChangedItems(const LLInventoryModel::changed_items_t& changed_items_uuids)
|
||||
{
|
||||
typedef std::vector<LLPanel*> item_panel_list_t;
|
||||
|
||||
item_panel_list_t items;
|
||||
getItems(items);
|
||||
|
||||
for (item_panel_list_t::iterator items_iter = items.begin();
|
||||
items_iter != items.end();
|
||||
++items_iter)
|
||||
{
|
||||
LLPanelInventoryListItemBase* item = dynamic_cast<LLPanelInventoryListItemBase*>(*items_iter);
|
||||
if (!item) continue;
|
||||
|
||||
LLViewerInventoryItem* inv_item = item->getItem();
|
||||
if (!inv_item) continue;
|
||||
|
||||
LLUUID linked_uuid = inv_item->getLinkedUUID();
|
||||
|
||||
for (LLInventoryModel::changed_items_t::iterator iter = changed_items_uuids.begin();
|
||||
iter != changed_items_uuids.end();
|
||||
++iter)
|
||||
{
|
||||
if (linked_uuid == *iter)
|
||||
{
|
||||
item->setNeedsRefresh(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLWearableItemsList::onRightClick(S32 x, S32 y)
|
||||
{
|
||||
uuid_vec_t selected_uuids;
|
||||
|
|
|
|||
|
|
@ -355,6 +355,12 @@ public:
|
|||
|
||||
void updateList(const LLUUID& category_id);
|
||||
|
||||
/**
|
||||
* Update items that match UUIDs from changed_items_uuids
|
||||
* or links that point at such items.
|
||||
*/
|
||||
void updateChangedItems(const LLInventoryModel::changed_items_t& changed_items_uuids);
|
||||
|
||||
protected:
|
||||
friend class LLUICtrlFactory;
|
||||
LLWearableItemsList(const LLWearableItemsList::Params& p);
|
||||
|
|
|
|||
Loading…
Reference in New Issue