diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelpermissions.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llpanelpermissions.h | 12 |
2 files changed, 68 insertions, 19 deletions
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 29ca172f60..0e5a7aec0d 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -171,6 +171,8 @@ BOOL LLPanelPermissions::postBuild() childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); mLabelGroupName = getChild<LLNameBox>("Group Name Proxy"); + mLabelOwnerName = getChild<LLTextBox>("Owner Name"); + mLabelCreatorName = getChild<LLTextBox>("Creator Name"); return TRUE; } @@ -178,6 +180,14 @@ BOOL LLPanelPermissions::postBuild() LLPanelPermissions::~LLPanelPermissions() { + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } // base class will take care of everything } @@ -192,14 +202,14 @@ void LLPanelPermissions::disableAll() getChildView("Creator:")->setEnabled(FALSE); getChild<LLUICtrl>("Creator Icon")->setVisible(FALSE); - getChild<LLUICtrl>("Creator Name")->setValue(LLStringUtil::null); - getChildView("Creator Name")->setEnabled(FALSE); + mLabelCreatorName->setValue(LLStringUtil::null); + mLabelCreatorName->setEnabled(FALSE); getChildView("Owner:")->setEnabled(FALSE); getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE); getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE); - getChild<LLUICtrl>("Owner Name")->setValue(LLStringUtil::null); - getChildView("Owner Name")->setEnabled(FALSE); + mLabelOwnerName->setValue(LLStringUtil::null); + mLabelOwnerName->setEnabled(FALSE); getChildView("Group:")->setEnabled(FALSE); getChild<LLUICtrl>("Group Name Proxy")->setValue(LLStringUtil::null); @@ -383,7 +393,7 @@ void LLPanelPermissions::refresh() style_params.color = link_color; style_params.readonly_color = link_color; style_params.is_link = true; // link will be added later - const LLFontGL* fontp = getChild<LLTextBox>("Creator Name")->getFont(); + const LLFontGL* fontp = mLabelCreatorName->getFont(); style_params.font.name = LLFontGL::nameFromFont(fontp); style_params.font.size = LLFontGL::sizeFromFont(fontp); style_params.font.style = "UNDERLINE"; @@ -391,14 +401,20 @@ void LLPanelPermissions::refresh() LLAvatarName av_name; if (LLAvatarNameCache::get(mCreatorID, &av_name)) { - // If name isn't present, this will 'request' it and trigger refresh() again - LLTextBox* text_box = getChild<LLTextBox>("Creator Name"); - style_params.link_href = creator_app_link; - text_box->setText(av_name.getCompleteName(), style_params); + updateCreatorName(mCreatorID, av_name, style_params); + } + else + { + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } + mLabelCreatorName->setText(LLTrans::getString("None")); + mCreatorCacheConnection = LLAvatarNameCache::get(mCreatorID, boost::bind(&LLPanelPermissions::updateCreatorName, this, _1, _2, style_params)); } getChild<LLAvatarIconCtrl>("Creator Icon")->setValue(mCreatorID); getChild<LLAvatarIconCtrl>("Creator Icon")->setVisible(TRUE); - getChildView("Creator Name")->setEnabled(TRUE); + mLabelCreatorName->setEnabled(TRUE); // Update owner text field getChildView("Owner:")->setEnabled(TRUE); @@ -413,9 +429,8 @@ void LLPanelPermissions::refresh() LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mOwnerID); if (group_data && group_data->isGroupPropertiesDataComplete()) { - LLTextBox* text_box = getChild<LLTextBox>("Owner Name"); style_params.link_href = owner_app_link; - text_box->setText(group_data->mName, style_params); + mLabelOwnerName->setText(group_data->mName, style_params); getChild<LLGroupIconCtrl>("Owner Group Icon")->setIconId(group_data->mInsigniaID); getChild<LLGroupIconCtrl>("Owner Group Icon")->setVisible(TRUE); getChild<LLUICtrl>("Owner Icon")->setVisible(FALSE); @@ -444,18 +459,27 @@ void LLPanelPermissions::refresh() } owner_id = mLastOwnerID; } + + style_params.link_href = owner_app_link; if (LLAvatarNameCache::get(owner_id, &av_name)) { - // If name isn't present, this will 'request' it and trigger refresh() again - LLTextBox* text_box = getChild<LLTextBox>("Owner Name"); - style_params.link_href = owner_app_link; - text_box->setText(av_name.getCompleteName(), style_params); + 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(&LLPanelPermissions::updateOwnerName, this, _1, _2, style_params)); } + getChild<LLAvatarIconCtrl>("Owner Icon")->setValue(owner_id); getChild<LLAvatarIconCtrl>("Owner Icon")->setVisible(TRUE); getChild<LLUICtrl>("Owner Group Icon")->setVisible(FALSE); } - getChildView("Owner Name")->setEnabled(TRUE); + mLabelOwnerName->setEnabled(TRUE); // update group text field getChildView("Group:")->setEnabled(TRUE); @@ -944,6 +968,23 @@ void LLPanelPermissions::refresh() getChildView("clickaction")->setEnabled(is_perm_modify && is_nonpermanent_enforced && all_volume); } +void LLPanelPermissions::updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params) +{ + if (mOwnerCacheConnection.connected()) + { + mOwnerCacheConnection.disconnect(); + } + mLabelOwnerName->setText(owner_name.getCompleteName(), style_params); +} + +void LLPanelPermissions::updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params) +{ + if (mCreatorCacheConnection.connected()) + { + mCreatorCacheConnection.disconnect(); + } + mLabelCreatorName->setText(creator_name.getCompleteName(), style_params); +} // static void LLPanelPermissions::onClickClaim(void*) diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h index 2d15954baa..e657f8f8b7 100644 --- a/indra/newview/llpanelpermissions.h +++ b/indra/newview/llpanelpermissions.h @@ -28,6 +28,7 @@ #define LL_LLPANELPERMISSIONS_H #include "llpanel.h" +#include "llstyle.h" #include "lluuid.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -36,6 +37,8 @@ // Panel for permissions of an object. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLAvatarName; +class LLTextBox; class LLNameBox; class LLViewerInventoryItem; @@ -46,7 +49,8 @@ public: virtual ~LLPanelPermissions(); /*virtual*/ BOOL postBuild(); - + 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); void refresh(); // refresh all labels as needed protected: @@ -85,10 +89,14 @@ protected: private: LLNameBox* mLabelGroupName; // group name - + LLTextBox* mLabelOwnerName; + LLTextBox* mLabelCreatorName; LLUUID mCreatorID; LLUUID mOwnerID; LLUUID mLastOwnerID; + + boost::signals2::connection mOwnerCacheConnection; + boost::signals2::connection mCreatorCacheConnection; }; |