diff options
author | Paul Guslisty <pguslisty@productengine.com> | 2010-01-27 14:16:37 +0200 |
---|---|---|
committer | Paul Guslisty <pguslisty@productengine.com> | 2010-01-27 14:16:37 +0200 |
commit | 8ea2c7a37380162ba2926bd23a01583023884408 (patch) | |
tree | 05e2c1a000562e06e79c25e02ffac84b6a47bdad /indra/newview | |
parent | a5180babefa3f81de5321a9d6d5148ef1bd8e03a (diff) |
Implemeted normal Sub-Task EXT - 2753 (Implement Avatar icons on IM multifloater tabs)
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 44 | ||||
-rw-r--r-- | indra/newview/llgroupmgr.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llgroupmgr.h | 15 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 46 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/button.xml | 4 |
6 files changed, 124 insertions, 30 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 093e4f4894..1ef79aeec0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9916,6 +9916,50 @@ <key>Value</key> <integer>15</integer> </map> + <key>UIButtonImageLeftPadding</key> + <map> + <key>Comment</key> + <string>Button Overlay Image Left Padding</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>4</integer> + </map> + <key>UIButtonImageRightPadding</key> + <map> + <key>Comment</key> + <string>Button Overlay Image Right Padding</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>4</integer> + </map> + <key>UIButtonImageTopPadding</key> + <map> + <key>Comment</key> + <string>Button Overlay Image Top Padding</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>2</integer> + </map> + <key>UIButtonImageBottomPadding</key> + <map> + <key>Comment</key> + <string>Button Overlay Image Bottom Padding</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>2</integer> + </map> <key>UploadBakedTexOld</key> <map> <key>Comment</key> diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index af58e81ca4..8bd0e520c3 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -762,6 +762,14 @@ void LLGroupMgr::addObserver(LLGroupMgrObserver* observer) mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer)); } +void LLGroupMgr::addObserver(const LLUUID& group_id, LLParticularGroupMgrObserver* observer) +{ + if(group_id.notNull() && observer) + { + mParticularObservers[group_id].insert(observer); + } +} + void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer) { if (!observer) @@ -784,6 +792,23 @@ void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer) } } +void LLGroupMgr::removeObserver(const LLUUID& group_id, LLParticularGroupMgrObserver* observer) +{ + if(group_id.isNull() || !observer) + { + return; + } + + observer_map_t::iterator obs_it = mParticularObservers.find(group_id); + if(obs_it == mParticularObservers.end()) + return; + + obs_it->second.erase(observer); + + if (obs_it->second.size() == 0) + mParticularObservers.erase(obs_it); +} + LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id) { group_map_t::iterator gi = mGroups.find(id); @@ -1325,6 +1350,7 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc) LLUUID group_id = gi->first; if (gi->second->mChanged) { + // notify LLGroupMgrObserver // Copy the map because observers may remove themselves on update observer_multimap_t observers = mObservers; @@ -1336,6 +1362,18 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc) oi->second->changed(gc); } gi->second->mChanged = FALSE; + + + // notify LLParticularGroupMgrObserver + observer_map_t::iterator obs_it = mParticularObservers.find(group_id); + if(obs_it == mParticularObservers.end()) + return; + + observer_set_t& obs = obs_it->second; + for (observer_set_t::iterator ob_it = obs.begin(); ob_it != obs.end(); ++ob_it) + { + (*ob_it)->changed(group_id, gc); + } } } } diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 487fdd4c5b..588b4a9034 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -53,6 +53,13 @@ protected: LLUUID mID; }; +class LLParticularGroupMgrObserver +{ +public: + virtual ~LLParticularGroupMgrObserver(){} + virtual void changed(const LLUUID& group_id, LLGroupChange gc) = 0; +}; + class LLGroupRoleData; class LLGroupMemberData @@ -306,7 +313,9 @@ public: ~LLGroupMgr(); void addObserver(LLGroupMgrObserver* observer); + void addObserver(const LLUUID& group_id, LLParticularGroupMgrObserver* observer); void removeObserver(LLGroupMgrObserver* observer); + void removeObserver(const LLUUID& group_id, LLParticularGroupMgrObserver* observer); LLGroupMgrGroupData* getGroupData(const LLUUID& id); void sendGroupPropertiesRequest(const LLUUID& group_id); @@ -355,13 +364,19 @@ public: private: void notifyObservers(LLGroupChange gc); + void notifyObserver(const LLUUID& group_id, LLGroupChange gc); void addGroup(LLGroupMgrGroupData* group_datap); LLGroupMgrGroupData* createGroupData(const LLUUID &id); typedef std::multimap<LLUUID,LLGroupMgrObserver*> observer_multimap_t; observer_multimap_t mObservers; + typedef std::map<LLUUID, LLGroupMgrGroupData*> group_map_t; group_map_t mGroups; + + typedef std::set<LLParticularGroupMgrObserver*> observer_set_t; + typedef std::map<LLUUID,observer_set_t> observer_map_t; + observer_map_t mParticularObservers; }; 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<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); } } } @@ -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() diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 1333b098bc..e4a32dbe1d 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -43,7 +43,7 @@ class LLTabContainer; -class LLIMFloaterContainer : public LLMultiFloater, public LLAvatarPropertiesObserver, public LLGroupMgrObserver +class LLIMFloaterContainer : public LLMultiFloater, public LLAvatarPropertiesObserver, public LLParticularGroupMgrObserver { public: LLIMFloaterContainer(const LLSD& seed); @@ -57,7 +57,7 @@ public: LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); void processProperties(void* data, EAvatarProcessorType type); - void changed(LLGroupChange gc); + void changed(const LLUUID& group_id, LLGroupChange gc); static LLFloater* getCurrentVoiceFloater(); @@ -69,9 +69,6 @@ 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); }; diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml index 51f85e65e2..74d8478551 100644 --- a/indra/newview/skins/default/xui/en/widgets/button.xml +++ b/indra/newview/skins/default/xui/en/widgets/button.xml @@ -7,6 +7,10 @@ image_selected="PushButton_Selected" image_disabled_selected="PushButton_Selected_Disabled" image_disabled="PushButton_Disabled" + image_left_pad="0" + image_right_pad="0" + image_top_pad="0" + image_bottom_pad="0" label_color="ButtonLabelColor" label_color_selected="ButtonLabelSelectedColor" label_color_disabled="ButtonLabelDisabledColor" |