diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-02-07 21:55:18 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-02-07 21:55:18 +0200 |
commit | 97d58e6184756c25d905cd05ab3073d7560a05ab (patch) | |
tree | 925fff460fd32d6a38048df4757aa18dc9e3f8d3 /indra | |
parent | c97de5ac48c21ba7014ad2258a670db8810fdf5c (diff) |
SL-19134 Item Profile redesign #4
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llsidepaneliteminfo.cpp | 152 | ||||
-rw-r--r-- | indra/newview/llsidepaneliteminfo.h | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 26 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_item_info.xml | 64 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_task_info.xml | 1 |
5 files changed, 154 insertions, 100 deletions
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index ad0bace91a..82a7719c52 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -31,11 +31,13 @@ #include "llagent.h" #include "llavataractions.h" +#include "llavatarnamecache.h" #include "llbutton.h" #include "llcallbacklist.h" #include "llcombobox.h" #include "llfloater.h" #include "llgroupactions.h" +#include "llgroupmgr.h" #include "llinventorydefines.h" #include "llinventorymodel.h" #include "llinventoryobserver.h" @@ -134,19 +136,27 @@ LLSidepanelItemInfo::~LLSidepanelItemInfo() gIdleCallbacks.deleteFunction(&LLSidepanelItemInfo::onIdle, (void*)this); stopObjectInventoryObserver(); + + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } } // virtual BOOL LLSidepanelItemInfo::postBuild() { + mLabelOwnerName = getChild<LLTextBox>("LabelOwnerName"); + mLabelCreatorName = getChild<LLTextBox>("LabelCreatorName"); + getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this)); getChild<LLLineEditor>("LabelItemDesc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this)); - // Creator information - getChild<LLUICtrl>("BtnCreator")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onClickCreator,this)); - // owner information - getChild<LLUICtrl>("BtnOwner")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onClickOwner,this)); // acquired date // owner permissions // Permissions debug text @@ -229,18 +239,6 @@ void LLSidepanelItemInfo::refresh() refreshFromItem(item); return; } - - if (!item) - { - const std::string no_edit_mode_names[]={ - "BtnCreator", - "BtnOwner", - }; - for(size_t t=0; t<LL_ARRAY_SIZE(no_edit_mode_names); ++t) - { - getChildView(no_edit_mode_names[t])->setEnabled(false); - } - } if (mParentFloater) { @@ -319,6 +317,17 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) getChildView("IconLocked")->setVisible(!is_modifiable); getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription()); getChild<LLUICtrl>("item_thumbnail")->setValue(item->getThumbnailUUID()); + + // Style for creator and owner links + LLStyle::Params style_params; + LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + style_params.color = link_color; + style_params.readonly_color = link_color; + style_params.is_link = true; // link will be added later + const LLFontGL* fontp = mLabelCreatorName->getFont(); + style_params.font.name = LLFontGL::nameFromFont(fontp); + style_params.font.size = LLFontGL::sizeFromFont(fontp); + style_params.font.style = "UNDERLINE"; ////////////////// // CREATOR NAME // @@ -329,19 +338,34 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) if (item->getCreatorUUID().notNull()) { LLUUID creator_id = item->getCreatorUUID(); - std::string name = - LLSLURL("agent", creator_id, "completename").getSLURLString(); - getChildView("BtnCreator")->setEnabled(TRUE); + std::string slurl = + LLSLURL("agent", creator_id, "inspect").getSLURLString(); + + style_params.link_href = slurl; + + LLAvatarName av_name; + if (LLAvatarNameCache::get(creator_id, &av_name)) + { + updateCreatorName(creator_id, av_name, style_params); + } + else + { + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } + mLabelCreatorName->setText(LLTrans::getString("None")); + mCreatorCacheConnection = LLAvatarNameCache::get(creator_id, boost::bind(&LLSidepanelItemInfo::updateCreatorName, this, _1, _2, style_params)); + } + getChildView("LabelCreatorTitle")->setEnabled(TRUE); - getChildView("LabelCreatorName")->setEnabled(FALSE); - getChild<LLUICtrl>("LabelCreatorName")->setValue(name); + mLabelCreatorName->setEnabled(FALSE); } else { - getChildView("BtnCreator")->setEnabled(FALSE); getChildView("LabelCreatorTitle")->setEnabled(FALSE); - getChildView("LabelCreatorName")->setEnabled(FALSE); - getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown_multiple")); + mLabelCreatorName->setEnabled(FALSE); + mLabelCreatorName->setValue(getString("unknown_multiple")); } //////////////// @@ -349,27 +373,56 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) //////////////// if(perm.isOwned()) { - std::string name; + std::string slurl; if (perm.isGroupOwned()) { - gCacheName->getGroupName(perm.getGroup(), name); + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(perm.getGroup()); + + slurl = LLSLURL("group", perm.getGroup(), "inspect").getSLURLString(); + style_params.link_href = slurl; + if (group_data && group_data->isGroupPropertiesDataComplete()) + { + mLabelOwnerName->setText(group_data->mName, style_params); + } + else + { + // Triggers refresh + LLGroupMgr::getInstance()->sendGroupPropertiesRequest(perm.getGroup()); + + std::string name; + gCacheName->getGroupName(perm.getGroup(), name); + mLabelOwnerName->setText(name, style_params); + } } else { LLUUID owner_id = perm.getOwner(); - name = LLSLURL("agent", owner_id, "completename").getSLURLString(); + slurl = LLSLURL("agent", owner_id, "inspect").getSLURLString(); + + style_params.link_href = slurl; + LLAvatarName av_name; + if (LLAvatarNameCache::get(owner_id, &av_name)) + { + updateOwnerName(owner_id, av_name, style_params); + } + else + { + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + mLabelOwnerName->setText(LLTrans::getString("None")); + mOwnerCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLSidepanelItemInfo::updateOwnerName, this, _1, _2, style_params)); + } } - getChildView("BtnOwner")->setEnabled(TRUE); getChildView("LabelOwnerTitle")->setEnabled(TRUE); - getChildView("LabelOwnerName")->setEnabled(FALSE); - getChild<LLUICtrl>("LabelOwnerName")->setValue(name); + mLabelOwnerName->setEnabled(FALSE); } else { - getChildView("BtnOwner")->setEnabled(FALSE); getChildView("LabelOwnerTitle")->setEnabled(FALSE); - getChildView("LabelOwnerName")->setEnabled(FALSE); - getChild<LLUICtrl>("LabelOwnerName")->setValue(getString("public")); + mLabelOwnerName->setEnabled(FALSE); + mLabelOwnerName->setValue(getString("public")); } //////////// @@ -480,6 +533,8 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) if( gSavedSettings.getBOOL("DebugPermissions") ) { + childSetVisible("layout_debug_permissions", true); + BOOL slam_perm = FALSE; BOOL overwrite_group = FALSE; BOOL overwrite_everyone = FALSE; @@ -497,38 +552,29 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) perm_string = "B: "; perm_string += mask_to_string(base_mask); getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string); - getChildView("BaseMaskDebug")->setVisible(TRUE); perm_string = "O: "; perm_string += mask_to_string(owner_mask); getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string); - getChildView("OwnerMaskDebug")->setVisible(TRUE); perm_string = "G"; perm_string += overwrite_group ? "*: " : ": "; perm_string += mask_to_string(group_mask); getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string); - getChildView("GroupMaskDebug")->setVisible(TRUE); perm_string = "E"; perm_string += overwrite_everyone ? "*: " : ": "; perm_string += mask_to_string(everyone_mask); getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string); - getChildView("EveryoneMaskDebug")->setVisible(TRUE); perm_string = "N"; perm_string += slam_perm ? "*: " : ": "; perm_string += mask_to_string(next_owner_mask); getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string); - getChildView("NextMaskDebug")->setVisible(TRUE); } else { - getChildView("BaseMaskDebug")->setVisible(FALSE); - getChildView("OwnerMaskDebug")->setVisible(FALSE); - getChildView("GroupMaskDebug")->setVisible(FALSE); - getChildView("EveryoneMaskDebug")->setVisible(FALSE); - getChildView("NextMaskDebug")->setVisible(FALSE); + childSetVisible("layout_debug_permissions", false); } ///////////// @@ -663,6 +709,26 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) } } +void LLSidepanelItemInfo::updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params) +{ + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } + std::string name = creator_name.getCompleteName(); + mLabelCreatorName->setText(name, style_params); +} + +void LLSidepanelItemInfo::updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params) +{ + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + std::string name = owner_name.getCompleteName(); + mLabelOwnerName->setText(name, style_params); +} + void LLSidepanelItemInfo::changed(U32 mask) { const LLUUID& item_id = getItemID(); diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h index 67f8683802..249fd34e8a 100644 --- a/indra/newview/llsidepaneliteminfo.h +++ b/indra/newview/llsidepaneliteminfo.h @@ -29,12 +29,14 @@ #include "llinventoryobserver.h" #include "llpanel.h" +#include "llstyle.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLSidepanelItemInfo // Object properties for inventory side panel. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLAvatarName; class LLButton; class LLFloater; class LLViewerInventoryItem; @@ -42,6 +44,7 @@ class LLItemPropertiesObserver; class LLObjectInventoryObserver; class LLViewerObject; class LLPermissions; +class LLTextBox; class LLSidepanelItemInfo : public LLPanel, public LLInventoryObserver { @@ -66,6 +69,8 @@ public: void dirty(); static void onIdle( void* user_data ); + void updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params); + void updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params); protected: void refresh() override; @@ -82,6 +87,9 @@ private: void startObjectInventoryObserver(); void stopObjectInventoryObserver(); void setPropertiesFieldsEnabled(bool enabled); + + boost::signals2::connection mOwnerCacheConnection; + boost::signals2::connection mCreatorCacheConnection; LLUUID mItemID; // inventory UUID for the inventory item. LLUUID mObjectID; // in-world task UUID, or null if in agent inventory. @@ -91,6 +99,9 @@ private: S32 mUpdatePendingId; bool mIsDirty; // item properties need to be updated LLFloater* mParentFloater; + + LLTextBox* mLabelOwnerName; + LLTextBox* mLabelCreatorName; // // UI Elements diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index bf50b1adfd..82eb629670 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -134,30 +134,4 @@ Purchases from the marketplace will be delivered here. </layout_panel> </layout_stack> </panel> - <panel - follows="all" - layout="topleft" - left="0" - class="sidepanel_item_info" - filename="sidepanel_item_info.xml" - name="sidepanel__item_panel" - top="0" - label="" - height="570" - visible="false" - width="330"> - </panel> - <panel - follows="all" - layout="topleft" - left="0" - class="sidepanel_task_info" - filename="sidepanel_task_info.xml" - name="sidepanel__task_panel" - top="0" - label="" - height="570" - visible="false" - width="330"> - </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml index 5f1c9e74bf..320c20deb6 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml @@ -59,14 +59,14 @@ name="layout_item_name" layout="topleft" follows="all" - height="35"> + height="25"> <line_editor border_style="line" border_thickness="1" follows="left|top|right" layout="topleft" left="5" - top="0" + top="1" right="-25" height="20" max_length_bytes="63" @@ -80,7 +80,7 @@ right="-5" mouse_opaque="true" name="IconLocked" - top="2" + top="3" width="18" /> </layout_panel> @@ -105,7 +105,7 @@ type="string" length="1" follows="left|top" - height="23" + height="17" layout="topleft" left_pad="5" name="LabelOwnerTitle" @@ -115,49 +115,53 @@ </text> <text type="string" - follows="left|right|top" font="SansSerifSmall" - height="15" + follows="left|right|top" layout="topleft" + height="15" + width="187" left_delta="0" + top_pad="0" name="LabelOwnerName" - top_pad="2" use_ellipses="true" - width="165"> + translate="false"> +TestString PleaseIgnore </text> <text type="string" length="1" follows="left|top" - height="23" + height="17" layout="topleft" left_delta="0" name="LabelCreatorTitle" - top_pad="2" + top_pad="7" width="78"> Creator: </text> <text type="string" - follows="left|right|top" font="SansSerifSmall" - height="15" + follows="left|right|top" layout="topleft" left_delta="0" + top_pad="0" + width="187" + height="15" name="LabelCreatorName" - top_pad="2" use_ellipses="true" - width="165"> + translate="false"> +TestString PleaseIgnore </text> <text type="string" length="1" follows="left|top" - height="23" + height="17" layout="topleft" left_delta="0" name="LabelAcquiredTitle" - top_pad="2" + top_pad="7" width="78"> Acquired: </text> @@ -169,8 +173,8 @@ layout="topleft" left_delta="0" name="LabelAcquiredDate" - top_pad="2" - width="210"> + top_pad="0" + width="187"> </text> </layout_panel> @@ -179,7 +183,7 @@ name="layout_item_description" layout="topleft" follows="all" - height="54"> + height="61"> <text type="string" length="1" @@ -213,7 +217,7 @@ layout="topleft" left="5" name="LabelItemExperienceTitle" - top_pad="0" + top_pad="7" width="78" visible="true"> Experience: @@ -237,14 +241,14 @@ name="layout_item_permissions_sale" layout="topleft" follows="all" - height="300"> + height="235"> <view_border bevel_style="none" height="0" layout="topleft" - left="0" - right="-1" + left="5" + right="-6" name="cost_text_border" top="1"/> @@ -252,9 +256,9 @@ type="string" length="1" left="10" - top_pad="5" + top_pad="7" height="15" - follows="left|top|right" + follows="left|top" layout="topleft" name="perm_modify" width="200"> @@ -267,7 +271,7 @@ left="10" top_pad="5" height="15" - follows="left|top|right" + follows="left|top" layout="topleft" name="perm_modify" width="200"> @@ -380,10 +384,10 @@ bevel_style="none" height="0" layout="topleft" - left="0" - right="-1" + left="5" + right="-6" name="cost_text_border" - top_pad="7"/> + top_pad="9"/> <check_box height="18" @@ -391,7 +395,7 @@ layout="topleft" left="20" name="CheckPurchase" - top_pad="20" + top_pad="15" width="100" tool_tip="Lets people buy this object, its content or it copy inworld for specified price." /> <combo_box diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml index 8f7a62fb8a..ddabbbe4cf 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml @@ -168,7 +168,6 @@ translate="false" use_ellipses="true" width="225"> - TestString PleaseIgnore </text> <text type="string" |