diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-04-13 17:49:26 +0300 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-04-13 17:49:26 +0300 |
commit | 107a7eb919bb0afadf6ad3f92482cf7e6d67c56e (patch) | |
tree | f01c774bd61274661f8504812f5ad2b563953a27 /indra/newview/llinventorygallery.cpp | |
parent | c3d22fba600a6c40268dfbec15ec1fe145cbbb1d (diff) |
SL-19544 WIP add active suffix for gestures and add appropriate context menu handling
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 9766a39e3c..9344668f52 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -92,6 +92,9 @@ LLInventoryGallery::LLInventoryGallery(const LLInventoryGallery::Params& p) mThumbnailsObserver = new LLThumbnailsObserver(); gInventory.addObserver(mThumbnailsObserver); + mGestureObserver = new LLGalleryGestureObserver(this); + LLGestureMgr::instance().addObserver(mGestureObserver); + mUsername = gAgentUsername; LLStringUtil::toUpper(mUsername); } @@ -154,6 +157,9 @@ LLInventoryGallery::~LLInventoryGallery() gInventory.removeObserver(mThumbnailsObserver); } delete mThumbnailsObserver; + + LLGestureMgr::instance().removeObserver(mGestureObserver); + delete mGestureObserver; } void LLInventoryGallery::setRootFolder(const LLUUID cat_id) @@ -701,7 +707,14 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id) { inventory_type = inv_item->getInventoryType(); misc_flags = inv_item->getFlags(); - is_worn = LLAppearanceMgr::instance().isLinkedInCOF(item_id); + if (LLAssetType::AT_GESTURE == obj->getType()) + { + is_worn = LLGestureMgr::instance().isGestureActive(item_id); + } + else + { + is_worn = LLAppearanceMgr::instance().isLinkedInCOF(item_id); + } } else if (LLAssetType::AT_CATEGORY == obj->getType()) { @@ -943,6 +956,37 @@ void LLInventoryGallery::onCOFChanged() } } +void LLInventoryGallery::onGesturesChanged() +{ + uuid_vec_t vnew; + uuid_vec_t vadded; + uuid_vec_t vremoved; + + const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures(); + for (LLGestureMgr::item_map_t::const_iterator iter = active_gestures.begin(); + iter != active_gestures.end(); + ++iter) + { + vnew.push_back(iter->first); + } + + LLCommonUtils::computeDifference(vnew, mActiveGestures, vadded, vremoved); + + mActiveGestures = 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. @@ -1353,7 +1397,13 @@ BOOL LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro void LLInventoryGalleryItem::setWorn(bool value) { mWorn = value; - mSuffixText->setValue(mWorn ? getString("worn_string") : ""); + std::string suffix(""); + + if(mWorn) + { + suffix = (mType == LLAssetType::AT_GESTURE) ? getString("active_string") : getString("worn_string"); + } + mSuffixText->setValue(suffix); mNameText->setFont(getTextFont()); mNameText->setText(mName); // refresh to pick up font changes |