diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-04-17 13:22:27 +0300 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-04-17 13:22:27 +0300 |
commit | 5554686b9117901cddb3d36f237622442c1d7a8d (patch) | |
tree | d10ef52054d798e9f228acde7990d5b4298f994a /indra/newview/llinventorygallery.cpp | |
parent | 94dd7b2c0c020bad25dab9472d612f673f136422 (diff) |
SL-19544 WIP show item permissions after item name
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 94996cb941..f6a1f49306 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -1202,7 +1202,8 @@ LLInventoryGalleryItem::LLInventoryGalleryItem(const Params& p) mSelected(false), mDefaultImage(true), mName(""), - mSuffix(""), + mWornSuffix(""), + mPermSuffix(""), mUUID(LLUUID()), mIsFolder(true), mIsLink(false), @@ -1221,7 +1222,6 @@ LLInventoryGalleryItem::~LLInventoryGalleryItem() BOOL LLInventoryGalleryItem::postBuild() { mNameText = getChild<LLTextBox>("item_name"); - mSuffixText = getChild<LLTextBox>("suffix_text"); mTextBgPanel = getChild<LLPanel>("text_bg_panel"); return TRUE; @@ -1262,6 +1262,32 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::E } } } + else + { + const LLInventoryItem *item = gInventory.getItem(mUUID); + if(item && (LLAssetType::AT_CALLINGCARD != item->getType()) && !mIsLink) + { + std::string delim(" --"); + bool copy = item->getPermissions().allowCopyBy(gAgent.getID()); + if (!copy) + { + mPermSuffix += delim; + mPermSuffix += LLTrans::getString("no_copy_lbl"); + } + bool mod = item->getPermissions().allowModifyBy(gAgent.getID()); + if (!mod) + { + mPermSuffix += mPermSuffix.empty() ? delim : ","; + mPermSuffix += LLTrans::getString("no_modify_lbl"); + } + bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); + if (!xfer) + { + mPermSuffix += mPermSuffix.empty() ? delim : ","; + mPermSuffix += LLTrans::getString("no_transfer_lbl"); + } + } + } getChild<LLIconCtrl>("item_type")->setValue(icon_name); getChild<LLIconCtrl>("link_overlay")->setVisible(is_link); @@ -1294,9 +1320,7 @@ void LLInventoryGalleryItem::draw() void LLInventoryGalleryItem::setName(std::string name) { mName = name; - mNameText->setFont(getTextFont()); - mNameText->setText(name); - mNameText->setToolTip(name); + updateNameText(); } void LLInventoryGalleryItem::setSelected(bool value) @@ -1401,16 +1425,14 @@ void LLInventoryGalleryItem::setWorn(bool value) if(mWorn) { - mSuffix = (mType == LLAssetType::AT_GESTURE) ? getString("active_string") : getString("worn_string"); + mWornSuffix = (mType == LLAssetType::AT_GESTURE) ? LLTrans::getString("active") : LLTrans::getString("worn"); } else { - mSuffix = ""; + mWornSuffix = ""; } - mSuffixText->setValue(mSuffix); - mNameText->setFont(getTextFont()); - mNameText->setText(mName); // refresh to pick up font changes + updateNameText(); } LLFontGL* LLInventoryGalleryItem::getTextFont() @@ -1422,6 +1444,14 @@ LLFontGL* LLInventoryGalleryItem::getTextFont() return mIsLink ? LLFontGL::getFontSansSerifSmallItalic() : LLFontGL::getFontSansSerifSmall(); } +void LLInventoryGalleryItem::updateNameText() +{ + mNameText->setFont(getTextFont()); + mNameText->setText(mName + mPermSuffix + mWornSuffix); + mNameText->setToolTip(mName + mPermSuffix + mWornSuffix); + getChild<LLThumbnailCtrl>("preview_thumbnail")->setToolTip(mName + mPermSuffix + mWornSuffix); +} + //----------------------------- // LLThumbnailsObserver //----------------------------- |