summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-11-03 20:44:00 -0700
committerMerov Linden <merov@lindenlab.com>2012-11-03 20:44:00 -0700
commit7c7cc56b037f05f148a7215d0c5f567989a0c012 (patch)
tree11afb3864d36de63ccd2b1dffa7ba2daebd82e9f /indra/newview/llchathistory.cpp
parentb6ad7db0d61033425a4f65270731023afe74ecce (diff)
parent3b39ec165aa837d02bf1bf57ff8f3aab3229659c (diff)
Pull merge from richard/viewer-chui
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp80
1 files changed, 52 insertions, 28 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index c61a8c8562..605e3ece51 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -28,6 +28,8 @@
#include "llchathistory.h"
+#include <boost/signals2.hpp>
+
#include "llavatarnamecache.h"
#include "llinstantmessage.h"
@@ -110,7 +112,8 @@ public:
mFrom(),
mSessionID(),
mMinUserNameWidth(0),
- mUserNameFont(NULL)
+ mUserNameFont(NULL),
+ mAvatarNameCacheConnection()
{}
static LLChatHistoryHeader* createInstance(const std::string& file_name)
@@ -124,6 +127,11 @@ public:
{
// Detach the info button so that it doesn't get destroyed (EXT-8463).
hideInfoCtrl();
+
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}
BOOL handleMouseUp(S32 x, S32 y, MASK mask)
@@ -283,8 +291,7 @@ public:
// Start with blank so sample data from XUI XML doesn't
// flash on the screen
user_name->setValue( LLSD() );
- LLAvatarNameCache::get(mAvatarID,
- boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2));
+ fetchAvatarName();
}
else if (chat.mChatStyle == CHAT_STYLE_HISTORY ||
mSourceType == CHAT_SOURCE_AGENT)
@@ -416,31 +423,6 @@ public:
}
}
- void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
- {
- mFrom = av_name.mDisplayName;
-
- LLTextBox* user_name = getChild<LLTextBox>("user_name");
- user_name->setValue( LLSD(av_name.mDisplayName ) );
- user_name->setToolTip( av_name.mUsername );
-
- if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
- LLAvatarNameCache::useDisplayNames() &&
- !av_name.mIsDisplayNameDefault)
- {
- LLStyle::Params style_params_name;
- LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
- style_params_name.color(userNameColor);
- style_params_name.font.name("SansSerifSmall");
- style_params_name.font.style("NORMAL");
- style_params_name.readonly_color(userNameColor);
- user_name->appendText(" - " + av_name.mUsername, FALSE, style_params_name);
- }
- setToolTip( av_name.mUsername );
- // name might have changed, update width
- updateMinUserNameWidth();
- }
-
protected:
static const S32 PADDING = 20;
@@ -555,6 +537,45 @@ private:
user_name->reshape(user_rect.getWidth() + delta_pos_x, user_rect.getHeight());
}
+ void fetchAvatarName()
+ {
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+
+ if (mAvatarID.notNull())
+ {
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID,
+ boost::bind(&LLChatHistoryHeader::onAvatarNameCache, this, _1, _2));
+ }
+ }
+
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
+ {
+ mFrom = av_name.mDisplayName;
+
+ LLTextBox* user_name = getChild<LLTextBox>("user_name");
+ user_name->setValue( LLSD(av_name.mDisplayName ) );
+ user_name->setToolTip( av_name.mUsername );
+
+ if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
+ LLAvatarNameCache::useDisplayNames() &&
+ !av_name.mIsDisplayNameDefault)
+ {
+ LLStyle::Params style_params_name;
+ LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
+ style_params_name.color(userNameColor);
+ style_params_name.font.name("SansSerifSmall");
+ style_params_name.font.style("NORMAL");
+ style_params_name.readonly_color(userNameColor);
+ user_name->appendText(" - " + av_name.mUsername, FALSE, style_params_name);
+ }
+ setToolTip( av_name.mUsername );
+ // name might have changed, update width
+ updateMinUserNameWidth();
+ }
+
protected:
LLHandle<LLView> mPopupMenuHandleAvatar;
LLHandle<LLView> mPopupMenuHandleObject;
@@ -569,6 +590,9 @@ protected:
S32 mMinUserNameWidth;
const LLFontGL* mUserNameFont;
+
+private:
+ boost::signals2::connection mAvatarNameCacheConnection;
};
LLUICtrl* LLChatHistoryHeader::sInfoCtrl = NULL;