summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rwxr-xr-xindra/newview/llchathistory.cpp47
1 files changed, 14 insertions, 33 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 05c4181714..84b9ac756a 100755
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -107,6 +107,7 @@ class LLChatHistoryHeader: public LLPanel
public:
LLChatHistoryHeader()
: LLPanel(),
+ mInfoCtrl(NULL),
mPopupMenuHandleAvatar(),
mPopupMenuHandleObject(),
mAvatarID(),
@@ -129,9 +130,6 @@ public:
~LLChatHistoryHeader()
{
- // Detach the info button so that it doesn't get destroyed (EXT-8463).
- hideInfoCtrl();
-
if (mAvatarNameCacheConnection.connected())
{
mAvatarNameCacheConnection.disconnect();
@@ -292,6 +290,11 @@ public:
mUserNameTextBox = getChild<LLTextBox>("user_name");
mTimeBoxTextBox = getChild<LLTextBox>("time_box");
+ mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance());
+ llassert(mInfoCtrl != NULL);
+ mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl));
+ mInfoCtrl->setVisible(FALSE);
+
return LLPanel::postBuild();
}
@@ -589,39 +592,19 @@ protected:
void showInfoCtrl()
{
- if (mAvatarID.isNull() || mFrom.empty() || CHAT_SOURCE_SYSTEM == mSourceType) return;
-
- if (!sInfoCtrl)
- {
- // *TODO: Delete the button at exit.
- sInfoCtrl = LLUICtrlFactory::createFromFile<LLUICtrl>("inspector_info_ctrl.xml", NULL, LLPanel::child_registry_t::instance());
- if (sInfoCtrl)
- {
- sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
- }
- }
-
- if (!sInfoCtrl)
+ const bool isVisible = !mAvatarID.isNull() && !mFrom.empty() && CHAT_SOURCE_SYSTEM != mSourceType;
+ if (isVisible)
{
- llassert(sInfoCtrl != NULL);
- return;
+ const LLRect sticky_rect = mUserNameTextBox->getRect();
+ S32 icon_x = llmin(sticky_rect.mLeft + mUserNameTextBox->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
+ mInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - mInfoCtrl->getRect().getHeight() / 2 ) ;
}
-
- LLTextBox* name = getChild<LLTextBox>("user_name");
- LLRect sticky_rect = name->getRect();
- S32 icon_x = llmin(sticky_rect.mLeft + name->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
- sInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - sInfoCtrl->getRect().getHeight() / 2 ) ;
- addChild(sInfoCtrl);
+ mInfoCtrl->setVisible(isVisible);
}
void hideInfoCtrl()
{
- if (!sInfoCtrl) return;
-
- if (sInfoCtrl->getParent() == this)
- {
- removeChild(sInfoCtrl);
- }
+ mInfoCtrl->setVisible(FALSE);
}
private:
@@ -692,7 +675,7 @@ protected:
LLHandle<LLView> mPopupMenuHandleAvatar;
LLHandle<LLView> mPopupMenuHandleObject;
- static LLUICtrl* sInfoCtrl;
+ LLUICtrl* mInfoCtrl;
LLUUID mAvatarID;
LLSD mObjectData;
@@ -709,8 +692,6 @@ private:
boost::signals2::connection mAvatarNameCacheConnection;
};
-LLUICtrl* LLChatHistoryHeader::sInfoCtrl = NULL;
-
LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
: LLUICtrl(p),
mMessageHeaderFilename(p.message_header),