diff options
Diffstat (limited to 'indra/newview/llimfloatercontainer.cpp')
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 93 |
1 files changed, 45 insertions, 48 deletions
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 06a7b4a29c..ba034609e9 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" // @@ -48,13 +49,11 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mAutoResize = FALSE; } -LLIMFloaterContainer::~LLIMFloaterContainer() -{ - LLGroupMgr::getInstance()->removeObserver(this); -} +LLIMFloaterContainer::~LLIMFloaterContainer(){} BOOL LLIMFloaterContainer::postBuild() { + LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1)); // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button // mTabContainer will be initialized in LLMultiFloater::addChild() return TRUE; @@ -92,80 +91,78 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLUUID session_id = floaterp->getKey(); + LLIconCtrl* icon = 0; + 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); + LLGroupIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLGroupIconCtrl>(); + icon_params.group_id = session_id; + icon = LLUICtrlFactory::instance().createWidget<LLGroupIconCtrl>(icon_params); - if (group_data && group_data->mInsigniaID.notNull()) - { - mTabContainer->setTabImage(get_ptr_in_map(mSessions, session_id), group_data->mInsigniaID); - } - else - { - gm->sendGroupPropertiesRequest(session_id); - } + mSessions[session_id] = floaterp; + floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, 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) - { - app.sendAvatarPropertiesRequest(avatar_id); - } - else - { - mTabContainer->setTabImage(floaterp, *icon_id_ptr); - } + LLAvatarIconCtrl::Params icon_params = LLUICtrlFactory::instance().getDefaultParams<LLAvatarIconCtrl>(); + icon_params.avatar_id = avatar_id; + icon = LLUICtrlFactory::instance().createWidget<LLAvatarIconCtrl>(icon_params); + + mSessions[avatar_id] = floaterp; + floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, avatar_id)); } + mTabContainer->setTabImage(floaterp, icon); +} + +void LLIMFloaterContainer::onCloseFloater(LLUUID& id) +{ + mSessions.erase(id); } void LLIMFloaterContainer::processProperties(void* data, enum EAvatarProcessorType type) { if (APT_PROPERTIES == type) { - LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data); - if (avatar_data) + 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) { - 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); } } } -void LLIMFloaterContainer::onCloseFloater(LLUUID id) +void LLIMFloaterContainer::onNewMessageReceived(const LLSD& data) { - LLAvatarPropertiesProcessor::instance().removeObserver(id, this); + LLUUID session_id = data["from_id"].asUUID(); + LLFloater* floaterp = get_ptr_in_map(mSessions, session_id); + LLFloater* current_floater = LLMultiFloater::getActiveFloater(); + + if(floaterp && current_floater && floaterp != current_floater) + { + if(LLMultiFloater::isFloaterFlashing(floaterp)) + LLMultiFloater::setFloaterFlashing(floaterp, FALSE); + LLMultiFloater::setFloaterFlashing(floaterp, TRUE); + } } LLIMFloaterContainer* LLIMFloaterContainer::findInstance() |