summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorygallery.cpp87
-rw-r--r--indra/newview/llinventorygallery.h10
-rw-r--r--indra/newview/lloutfitgallery.cpp7
-rw-r--r--indra/newview/lloutfitgallery.h1
-rw-r--r--indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml15
5 files changed, 107 insertions, 13 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index 0fc7816f59..8c49cd5a4b 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -243,6 +243,9 @@ void LLInventoryGallery::initGallery()
}
reArrangeRows();
mGalleryCreated = true;
+
+ const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ mCategoriesObserver->addCategory(cof, boost::bind(&LLInventoryGallery::onCOFChanged, this));
}
}
@@ -462,7 +465,7 @@ void LLInventoryGallery::removeFromLastRow(LLInventoryGalleryItem* item)
mItemPanels.pop_back();
}
-LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, bool is_link)
+LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, bool is_link, bool is_worn)
{
LLInventoryGalleryItem::Params giparams;
LLInventoryGalleryItem* gitem = LLUICtrlFactory::create<LLInventoryGalleryItem>(giparams);
@@ -475,6 +478,7 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L
gitem->setGallery(this);
gitem->setType(type, inventory_type, flags, is_link);
gitem->setThumbnail(thumbnail_id);
+ gitem->setWorn(is_worn);
gitem->setCreatorName(get_searchable_creator_name(&gInventory, item_id));
gitem->setDescription(get_searchable_description(&gInventory, item_id));
gitem->setAssetIDStr(get_searchable_UUID(&gInventory, item_id));
@@ -641,6 +645,7 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id)
LLUUID thumbnail_id = obj->getThumbnailUUID();;
LLInventoryType::EType inventory_type(LLInventoryType::IT_CATEGORY);
U32 misc_flags = 0;
+ bool is_worn = false;
if (LLAssetType::AT_CATEGORY == obj->getType())
{
name = get_localized_folder_name(item_id);
@@ -656,10 +661,11 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id)
{
inventory_type = inv_item->getInventoryType();
misc_flags = inv_item->getFlags();
+ is_worn = LLAppearanceMgr::instance().isLinkedInCOF(item_id);
}
}
-
- LLInventoryGalleryItem* item = buildGalleryItem(name, item_id, obj->getType(), thumbnail_id, inventory_type, misc_flags, obj->getIsLinkType());
+
+ LLInventoryGalleryItem* item = buildGalleryItem(name, item_id, obj->getType(), thumbnail_id, inventory_type, misc_flags, obj->getIsLinkType(), is_worn);
mItemMap.insert(LLInventoryGallery::gallery_item_map_t::value_type(item_id, item));
item->setRightMouseDownCallback(boost::bind(&LLInventoryGallery::showContextMenu, this, _1, _2, _3, item_id));
item->setFocusReceivedCallback(boost::bind(&LLInventoryGallery::onChangeItemSelection, this, item_id));
@@ -712,6 +718,19 @@ void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name)
}
}
+void LLInventoryGallery::updateWornItem(LLUUID item_id, bool is_worn)
+{
+ gallery_item_map_t::iterator iter = mItemMap.find(item_id);
+ if (iter != mItemMap.end())
+ {
+ LLInventoryGalleryItem* item = iter->second;
+ if (item)
+ {
+ item->setWorn(is_worn);
+ }
+ }
+}
+
void LLInventoryGallery::updateItemThumbnail(LLUUID item_id)
{
LLInventoryObject* obj = gInventory.getObject(item_id);
@@ -836,6 +855,46 @@ void LLInventoryGallery::computeDifference(
LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved);
}
+void LLInventoryGallery::onCOFChanged()
+{
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+
+ gInventory.collectDescendents(
+ LLAppearanceMgr::instance().getCOF(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+
+ uuid_vec_t vnew;
+ uuid_vec_t vadded;
+ uuid_vec_t vremoved;
+
+ for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
+ iter != item_array.end();
+ ++iter)
+ {
+ vnew.push_back((*iter)->getLinkedUUID());
+ }
+
+ // We need to update only items that were added or removed from COF.
+ LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved);
+
+ mCOFLinkedItems = vnew;
+
+ for (uuid_vec_t::const_iterator iter = vadded.begin();
+ iter != vadded.end();
+ ++iter)
+ {
+ updateWornItem(*iter, true);
+ }
+
+ for (uuid_vec_t::const_iterator iter = vremoved.begin(); iter != vremoved.end(); ++iter)
+ {
+ updateWornItem(*iter, false);
+ }
+}
+
void LLInventoryGallery::deselectItem(const LLUUID& category_id)
{
// Reset selection if the item is selected.
@@ -973,6 +1032,7 @@ LLInventoryGalleryItem::~LLInventoryGalleryItem()
BOOL LLInventoryGalleryItem::postBuild()
{
mNameText = getChild<LLTextBox>("item_name");
+ mSuffixText = getChild<LLTextBox>("suffix_text");
mTextBgPanel = getChild<LLPanel>("text_bg_panel");
mHidden = false;
@@ -1036,9 +1096,10 @@ void LLInventoryGalleryItem::draw()
void LLInventoryGalleryItem::setName(std::string name)
{
+ mName = name;
+ mNameText->setFont(getTextFont());
mNameText->setText(name);
mNameText->setToolTip(name);
- mName = name;
}
void LLInventoryGalleryItem::setSelected(bool value)
@@ -1137,6 +1198,24 @@ BOOL LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro
return baseHandleDragAndDrop(mUUID, drop, cargo_type, cargo_data, accept, tooltip_msg);
}
+void LLInventoryGalleryItem::setWorn(bool value)
+{
+ mWorn = value;
+ mSuffixText->setValue(mWorn ? getString("worn_string") : "");
+
+ mNameText->setFont(getTextFont());
+ mNameText->setText(mName); // refresh to pick up font changes
+}
+
+LLFontGL* LLInventoryGalleryItem::getTextFont()
+{
+ if(mWorn)
+ {
+ return LLFontGL::getFontSansSerifSmallBold();
+ }
+ return mIsLink ? LLFontGL::getFontSansSerifSmallItalic() : LLFontGL::getFontSansSerifSmall();
+}
+
//-----------------------------
// Helper drag&drop functions
//-----------------------------
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index c53640d0ff..036817de93 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -81,6 +81,7 @@ public:
void updateRemovedItem(LLUUID item_id);
void updateChangedItemName(LLUUID item_id, std::string name);
void updateItemThumbnail(LLUUID item_id);
+ void updateWornItem(LLUUID item_id, bool is_worn);
void updateMessageVisibility();
@@ -103,6 +104,7 @@ public:
LLUUID getOutfitImageID(LLUUID outfit_id);
void refreshList(const LLUUID& category_id);
+ void onCOFChanged();
void computeDifference(const LLInventoryModel::cat_array_t vcats, const LLInventoryModel::item_array_t vitems, uuid_vec_t& vadded, uuid_vec_t& vremoved);
void deselectItem(const LLUUID& category_id);
@@ -147,7 +149,7 @@ private:
void updateRowsIfNeeded();
void updateGalleryWidth();
- LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, bool is_link);
+ LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, bool is_link, bool is_worn);
void buildGalleryPanel(int row_count);
void reshapeGalleryPanel(int row_count);
@@ -187,6 +189,7 @@ private:
typedef std::map<LLUUID, LLInventoryGalleryItem*> gallery_item_map_t;
gallery_item_map_t mItemMap;
+ uuid_vec_t mCOFLinkedItems;
std::map<LLInventoryGalleryItem*, S32> mItemIndexMap;
LLInventoryFilter::ESearchType mSearchType;
@@ -223,8 +226,11 @@ public:
EAcceptance* accept,
std::string& tooltip_msg);
+ LLFontGL* getTextFont();
+
void setName(std::string name);
void setSelected(bool value);
+ void setWorn(bool value);
void setUUID(LLUUID id) {mUUID = id;}
LLUUID getUUID() { return mUUID;}
@@ -251,8 +257,10 @@ public:
private:
LLUUID mUUID;
LLTextBox* mNameText;
+ LLTextBox* mSuffixText;
LLPanel* mTextBgPanel;
bool mSelected;
+ bool mWorn;
bool mDefaultImage;
bool mHidden;
bool mIsFolder;
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 6ea1bfc54a..415d0a96d7 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -64,7 +64,6 @@ const S32 GALLERY_ITEMS_PER_ROW_MIN = 2;
LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
: LLOutfitListBase(),
- mTexturesObserver(NULL),
mOutfitsObserver(NULL),
mScrollPanel(NULL),
mGalleryPanel(NULL),
@@ -438,12 +437,6 @@ void LLOutfitGallery::moveRowPanel(LLPanel* stack, int left, int bottom)
LLOutfitGallery::~LLOutfitGallery()
{
delete mOutfitGalleryMenu;
-
- if (gInventory.containsObserver(mTexturesObserver))
- {
- gInventory.removeObserver(mTexturesObserver);
- }
- delete mTexturesObserver;
if (gInventory.containsObserver(mOutfitsObserver))
{
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h
index 5c417cf7ee..16116d4b71 100644
--- a/indra/newview/lloutfitgallery.h
+++ b/indra/newview/lloutfitgallery.h
@@ -175,7 +175,6 @@ private:
item_num_map_t mItemIndexMap;
- LLInventoryCategoriesObserver* mTexturesObserver;
LLInventoryCategoriesObserver* mOutfitsObserver;
};
class LLOutfitGalleryContextMenu : public LLOutfitContextMenu
diff --git a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml
index 281604503f..05a02158c0 100644
--- a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml
@@ -13,6 +13,7 @@
layout="topleft"
left="0"
top="0">
+ <string name="worn_string">(worn)</string>
<thumbnail
name="preview_thumbnail"
image_name="Thumbnail_Fallback"
@@ -64,10 +65,24 @@
layout="topleft"
name="item_name"
parse_urls="false"
+ text_readonly_color="White"
top="2"
width="127"
use_ellipses="true">
Item name, folder name.
</text>
+ <text
+ read_only="true"
+ length="1"
+ follows="left|top"
+ left="1"
+ height="10"
+ layout="topleft"
+ name="suffix_text"
+ text_readonly_color="InventoryItemLinkColor"
+ top="13"
+ width="127">
+ (worn)
+ </text>
</panel>
</panel>