summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llimfloatercontainer.cpp84
-rw-r--r--indra/newview/llimfloatercontainer.h21
2 files changed, 96 insertions, 9 deletions
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 6cc985aef4..06a7b4a29c 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -35,19 +35,22 @@
#include "llimfloatercontainer.h"
#include "llfloaterreg.h"
+#include "llimview.h"
+#include "llavatariconctrl.h"
+#include "llagent.h"
//
// LLIMFloaterContainer
//
LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed)
-: LLMultiFloater(seed),
- mActiveVoiceFloater(NULL)
+: LLMultiFloater(seed)
{
mAutoResize = FALSE;
}
LLIMFloaterContainer::~LLIMFloaterContainer()
{
+ LLGroupMgr::getInstance()->removeObserver(this);
}
BOOL LLIMFloaterContainer::postBuild()
@@ -87,13 +90,84 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
- // make sure active voice icon shows up for new tab
- if (floaterp == mActiveVoiceFloater)
+ LLUUID session_id = floaterp->getKey();
+
+ 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);
+
+ if (group_data && group_data->mInsigniaID.notNull())
+ {
+ mTabContainer->setTabImage(get_ptr_in_map(mSessions, session_id), group_data->mInsigniaID);
+ }
+ else
+ {
+ 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)
+ {
+ app.sendAvatarPropertiesRequest(avatar_id);
+ }
+ else
+ {
+ mTabContainer->setTabImage(floaterp, *icon_id_ptr);
+ }
+ }
+}
+
+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;
+ if(avatar_data->image_id != *LLAvatarIconIDCache::getInstance()->get(avatar_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)
+{
+ if (GC_PROPERTIES == gc)
{
- mTabContainer->setTabImage(floaterp, "active_voice_tab.tga");
+ for(groupIDs_t::iterator it = mGroupID.begin(); it!=mGroupID.end(); it++)
+ {
+ 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);
+ }
+ }
}
}
+void LLIMFloaterContainer::onCloseFloater(LLUUID id)
+{
+ LLAvatarPropertiesProcessor::instance().removeObserver(id, this);
+}
+
LLIMFloaterContainer* LLIMFloaterContainer::findInstance()
{
return LLFloaterReg::findTypedInstance<LLIMFloaterContainer>("im_container");
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index d4a542dfc2..1333b098bc 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -33,12 +33,17 @@
#ifndef LL_LLIMFLOATERCONTAINER_H
#define LL_LLIMFLOATERCONTAINER_H
+#include <map>
+#include <vector>
+
#include "llfloater.h"
#include "llmultifloater.h"
+#include "llavatarpropertiesprocessor.h"
+#include "llgroupmgr.h"
class LLTabContainer;
-class LLIMFloaterContainer : public LLMultiFloater
+class LLIMFloaterContainer : public LLMultiFloater, public LLAvatarPropertiesObserver, public LLGroupMgrObserver
{
public:
LLIMFloaterContainer(const LLSD& seed);
@@ -51,15 +56,23 @@ public:
BOOL select_added_floater,
LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
+ void processProperties(void* data, EAvatarProcessorType type);
+ void changed(LLGroupChange gc);
+
static LLFloater* getCurrentVoiceFloater();
static LLIMFloaterContainer* findInstance();
static LLIMFloaterContainer* getInstance();
-protected:
-
- LLFloater* mActiveVoiceFloater;
+private:
+ typedef std::map<LLUUID,LLPanel*> avatarID_panel_map_t;
+ avatarID_panel_map_t mSessions;
+
+ typedef std::vector<LLUUID> groupIDs_t;
+ groupIDs_t mGroupID;
+
+ void onCloseFloater(LLUUID avatar_id);
};
#endif // LL_LLIMFLOATERCONTAINER_H