From 8ea2c7a37380162ba2926bd23a01583023884408 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Wed, 27 Jan 2010 14:16:37 +0200 Subject: Implemeted normal Sub-Task EXT - 2753 (Implement Avatar icons on IM multifloater tabs) --HG-- branch : product-engine --- indra/newview/llimfloatercontainer.cpp | 46 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 06a7b4a29c..784c2eaaf9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -48,10 +48,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mAutoResize = FALSE; } -LLIMFloaterContainer::~LLIMFloaterContainer() -{ - LLGroupMgr::getInstance()->removeObserver(this); -} +LLIMFloaterContainer::~LLIMFloaterContainer(){} BOOL LLIMFloaterContainer::postBuild() { @@ -95,11 +92,10 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, if(gAgent.isInGroup(session_id)) { mSessions[session_id] = floaterp; - mID = session_id; - mGroupID.push_back(session_id); LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(session_id); LLGroupMgr* gm = LLGroupMgr::getInstance(); - gm->addObserver(this); + gm->addObserver(session_id, this); + floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); if (group_data && group_data->mInsigniaID.notNull()) { @@ -107,6 +103,7 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, } else { + mTabContainer->setTabImage(floaterp, "Generic_Group"); gm->sendGroupPropertiesRequest(session_id); } } @@ -119,13 +116,14 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, mSessions[avatar_id] = floaterp; LLUUID* icon_id_ptr = LLAvatarIconIDCache::getInstance()->get(avatar_id); - if(!icon_id_ptr) + if(icon_id_ptr && icon_id_ptr->notNull()) { - app.sendAvatarPropertiesRequest(avatar_id); + mTabContainer->setTabImage(floaterp, *icon_id_ptr); } else { - mTabContainer->setTabImage(floaterp, *icon_id_ptr); + mTabContainer->setTabImage(floaterp, "Generic_Person"); + app.sendAvatarPropertiesRequest(avatar_id); } } } @@ -134,31 +132,28 @@ void LLIMFloaterContainer::processProperties(void* data, enum EAvatarProcessorTy { if (APT_PROPERTIES == type) { - LLAvatarData* avatar_data = static_cast(data); - if (avatar_data) + LLAvatarData* avatar_data = static_cast(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) { - LLUUID avatar_id = avatar_data->avatar_id; - if(avatar_data->image_id != *LLAvatarIconIDCache::getInstance()->get(avatar_id)) - { - LLAvatarIconIDCache::getInstance()->add(avatar_id,avatar_data->image_id); - } + 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(LLGroupChange gc) +void LLIMFloaterContainer::changed(const LLUUID& group_id, LLGroupChange gc) { if (GC_PROPERTIES == gc) { - for(groupIDs_t::iterator it = mGroupID.begin(); it!=mGroupID.end(); it++) + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id); + if (group_data && group_data->mInsigniaID.notNull()) { - LLUUID group_id = *it; - 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); - } + mTabContainer->setTabImage(get_ptr_in_map(mSessions, group_id), group_data->mInsigniaID); } } } @@ -166,6 +161,7 @@ void LLIMFloaterContainer::changed(LLGroupChange gc) void LLIMFloaterContainer::onCloseFloater(LLUUID id) { LLAvatarPropertiesProcessor::instance().removeObserver(id, this); + LLGroupMgr::instance().removeObserver(id, this); } LLIMFloaterContainer* LLIMFloaterContainer::findInstance() -- cgit v1.2.3