summaryrefslogtreecommitdiff
path: root/indra/newview/llimfloatercontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llimfloatercontainer.cpp')
-rw-r--r--indra/newview/llimfloatercontainer.cpp77
1 files changed, 16 insertions, 61 deletions
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 22eb9a51d2..49521b5987 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -37,6 +37,7 @@
#include "llfloaterreg.h"
#include "llimview.h"
#include "llavatariconctrl.h"
+#include "llgroupiconctrl.h"
#include "llagent.h"
//
@@ -90,80 +91,34 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
LLUUID session_id = floaterp->getKey();
- if(gAgent.isInGroup(session_id))
+ LLIconCtrl* icon = 0;
+
+ if(gAgent.isInGroup(session_id, TRUE))
{
+ LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>();
+ icon_params.group_id = session_id;
+ icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params);
+
mSessions[session_id] = floaterp;
- LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(session_id);
- LLGroupMgr* gm = LLGroupMgr::getInstance();
- gm->addObserver(session_id, this);
floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id));
-
- if (group_data && group_data->mInsigniaID.notNull())
- {
- mTabContainer->setTabImage(get_ptr_in_map(mSessions, session_id), group_data->mInsigniaID);
- }
- else
- {
- mTabContainer->setTabImage(floaterp, "Generic_Group");
- gm->sendGroupPropertiesRequest(session_id);
- }
}
else
{
LLUUID avatar_id = LLIMModel::getInstance()->getOtherParticipantID(session_id);
- LLAvatarPropertiesProcessor& app = LLAvatarPropertiesProcessor::instance();
- app.addObserver(avatar_id, this);
- floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, avatar_id));
- mSessions[avatar_id] = floaterp;
- LLUUID* icon_id_ptr = LLAvatarIconIDCache::getInstance()->get(avatar_id);
- if(icon_id_ptr && icon_id_ptr->notNull())
- {
- mTabContainer->setTabImage(floaterp, *icon_id_ptr);
- }
- else
- {
- mTabContainer->setTabImage(floaterp, "Generic_Person");
- app.sendAvatarPropertiesRequest(avatar_id);
- }
- }
-}
+ LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>();
+ icon_params.avatar_id = avatar_id;
+ icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params);
-void LLIMFloaterContainer::processProperties(void* data, enum EAvatarProcessorType type)
-{
- if (APT_PROPERTIES == type)
- {
- LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
- if (avatar_data)
- {
- LLUUID avatar_id = avatar_data->avatar_id;
- LLUUID* cached_avatarId = LLAvatarIconIDCache::getInstance()->get(avatar_id);
- if(cached_avatarId && cached_avatarId->notNull() && avatar_data->image_id != *cached_avatarId)
- {
- LLAvatarIconIDCache::getInstance()->add(avatar_id,avatar_data->image_id);
- mTabContainer->setTabImage(get_ptr_in_map(mSessions, avatar_id), avatar_data->image_id);
- }
- }
- }
-}
-
-void LLIMFloaterContainer::changed(const LLUUID& group_id, LLGroupChange gc)
-{
- if (GC_PROPERTIES == gc)
- {
- LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
- if (group_data && group_data->mInsigniaID.notNull())
- {
- mTabContainer->setTabImage(get_ptr_in_map(mSessions, group_id), group_data->mInsigniaID);
- }
+ mSessions[avatar_id] = floaterp;
+ floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, avatar_id));
}
+ mTabContainer->setTabImage(floaterp, icon);
}
-void LLIMFloaterContainer::onCloseFloater(LLUUID id)
+void LLIMFloaterContainer::onCloseFloater(LLUUID& id)
{
- LLAvatarPropertiesProcessor::instance().removeObserver(id, this);
- LLGroupMgr::instance().removeObserver(id, this);
-
+ mSessions.erase(id);
}
void LLIMFloaterContainer::onNewMessageReceived(const LLSD& data)