diff options
Diffstat (limited to 'linden/indra/newview/llfloateractivespeakers.cpp')
-rw-r--r-- | linden/indra/newview/llfloateractivespeakers.cpp | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/linden/indra/newview/llfloateractivespeakers.cpp b/linden/indra/newview/llfloateractivespeakers.cpp index 21b302a..7445ef0 100644 --- a/linden/indra/newview/llfloateractivespeakers.cpp +++ b/linden/indra/newview/llfloateractivespeakers.cpp | |||
@@ -55,8 +55,6 @@ const F32 TYPING_ANIMATION_FPS = 2.5f; | |||
55 | LLLocalSpeakerMgr* gLocalSpeakerMgr = NULL; | 55 | LLLocalSpeakerMgr* gLocalSpeakerMgr = NULL; |
56 | LLActiveSpeakerMgr* gActiveChannelSpeakerMgr = NULL; | 56 | LLActiveSpeakerMgr* gActiveChannelSpeakerMgr = NULL; |
57 | 57 | ||
58 | LLSpeaker::speaker_map_t LLSpeaker::sSpeakers; | ||
59 | |||
60 | LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType type) : | 58 | LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType type) : |
61 | mStatus(LLSpeaker::STATUS_TEXT_ONLY), | 59 | mStatus(LLSpeaker::STATUS_TEXT_ONLY), |
62 | mLastSpokeTime(0.f), | 60 | mLastSpokeTime(0.f), |
@@ -71,8 +69,6 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType | |||
71 | mModeratorMutedVoice(FALSE), | 69 | mModeratorMutedVoice(FALSE), |
72 | mModeratorMutedText(FALSE) | 70 | mModeratorMutedText(FALSE) |
73 | { | 71 | { |
74 | mHandle.init(); | ||
75 | sSpeakers.insert(std::make_pair(mHandle, this)); | ||
76 | if (name.empty() && type == SPEAKER_AGENT) | 72 | if (name.empty() && type == SPEAKER_AGENT) |
77 | { | 73 | { |
78 | lookupName(); | 74 | lookupName(); |
@@ -87,30 +83,21 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType | |||
87 | mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); | 83 | mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); |
88 | } | 84 | } |
89 | 85 | ||
90 | LLSpeaker::~LLSpeaker() | ||
91 | { | ||
92 | sSpeakers.erase(mHandle); | ||
93 | } | ||
94 | 86 | ||
95 | void LLSpeaker::lookupName() | 87 | void LLSpeaker::lookupName() |
96 | { | 88 | { |
97 | gCacheName->getName(mID, onAvatarNameLookup, new LLViewHandle(mHandle)); | 89 | gCacheName->getName(mID, onAvatarNameLookup, new LLHandle<LLSpeaker>(getHandle())); |
98 | } | 90 | } |
99 | 91 | ||
100 | //static | 92 | //static |
101 | void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* user_data) | 93 | void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* user_data) |
102 | { | 94 | { |
103 | LLViewHandle speaker_handle = *(LLViewHandle*)user_data; | 95 | LLSpeaker* speaker_ptr = ((LLHandle<LLSpeaker>*)user_data)->get(); |
104 | delete (LLViewHandle*)user_data; | 96 | delete (LLHandle<LLSpeaker>*)user_data; |
105 | 97 | ||
106 | speaker_map_t::iterator found_it = sSpeakers.find(speaker_handle); | 98 | if (speaker_ptr) |
107 | if (found_it != sSpeakers.end()) | ||
108 | { | 99 | { |
109 | LLSpeaker* speakerp = found_it->second; | 100 | speaker_ptr->mDisplayName = llformat("%s %s", first, last); |
110 | if (speakerp) | ||
111 | { | ||
112 | speakerp->mDisplayName = llformat("%s %s", first, last); | ||
113 | } | ||
114 | } | 101 | } |
115 | } | 102 | } |
116 | 103 | ||
@@ -300,10 +287,10 @@ BOOL LLPanelActiveSpeakers::postBuild() | |||
300 | mSpeakerList->setCommitCallback(onSelectSpeaker); | 287 | mSpeakerList->setCommitCallback(onSelectSpeaker); |
301 | mSpeakerList->setCallbackUserData(this); | 288 | mSpeakerList->setCallbackUserData(this); |
302 | 289 | ||
303 | mMuteTextCtrl = (LLUICtrl*)getCtrlByNameAndType("mute_text_btn", WIDGET_TYPE_DONTCARE); | 290 | mMuteTextCtrl = getCtrlByNameAndType("mute_text_btn", WIDGET_TYPE_DONTCARE); |
304 | childSetCommitCallback("mute_text_btn", onClickMuteTextCommit, this); | 291 | childSetCommitCallback("mute_text_btn", onClickMuteTextCommit, this); |
305 | 292 | ||
306 | mMuteVoiceCtrl = (LLUICtrl*)getCtrlByNameAndType("mute_btn", WIDGET_TYPE_DONTCARE); | 293 | mMuteVoiceCtrl = getCtrlByNameAndType("mute_btn", WIDGET_TYPE_DONTCARE); |
307 | childSetCommitCallback("mute_btn", onClickMuteVoiceCommit, this); | 294 | childSetCommitCallback("mute_btn", onClickMuteVoiceCommit, this); |
308 | childSetAction("mute_btn", onClickMuteVoice, this); | 295 | childSetAction("mute_btn", onClickMuteVoice, this); |
309 | 296 | ||
@@ -509,7 +496,7 @@ void LLPanelActiveSpeakers::refreshSpeakers() | |||
509 | 496 | ||
510 | if (speakerp->mIsModerator) | 497 | if (speakerp->mIsModerator) |
511 | { | 498 | { |
512 | speaker_name += LLString(" ") + getFormattedUIString("moderator_label"); | 499 | speaker_name += LLString(" ") + getString("moderator_label"); |
513 | } | 500 | } |
514 | 501 | ||
515 | name_cell->setValue(speaker_name); | 502 | name_cell->setValue(speaker_name); |
@@ -610,8 +597,7 @@ void LLPanelActiveSpeakers::setSpeaker(const LLUUID& id, const LLString& name, L | |||
610 | void LLPanelActiveSpeakers::setVoiceModerationCtrlMode( | 597 | void LLPanelActiveSpeakers::setVoiceModerationCtrlMode( |
611 | const BOOL& moderated_voice) | 598 | const BOOL& moderated_voice) |
612 | { | 599 | { |
613 | LLUICtrl* voice_moderation_ctrl = (LLUICtrl*) getChildByName( | 600 | LLUICtrl* voice_moderation_ctrl = getCtrlByNameAndType("moderation_mode", WIDGET_TYPE_DONTCARE); |
614 | "moderation_mode", TRUE); //recursive lookup | ||
615 | 601 | ||
616 | if ( voice_moderation_ctrl ) | 602 | if ( voice_moderation_ctrl ) |
617 | { | 603 | { |
@@ -734,7 +720,7 @@ void LLPanelActiveSpeakers::onSelectSpeaker(LLUICtrl* source, void* user_data) | |||
734 | void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data) | 720 | void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data) |
735 | { | 721 | { |
736 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; | 722 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; |
737 | LLUICtrl* speakers_list = (LLUICtrl*)self->getChildByName("speakers_list", TRUE); | 723 | LLUICtrl* speakers_list = self->getCtrlByNameAndType("speakers_list", WIDGET_TYPE_DONTCARE); |
738 | if (!speakers_list || !gAgent.getRegion()) return; | 724 | if (!speakers_list || !gAgent.getRegion()) return; |
739 | 725 | ||
740 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); | 726 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); |
@@ -799,7 +785,7 @@ void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data | |||
799 | void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data) | 785 | void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data) |
800 | { | 786 | { |
801 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; | 787 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; |
802 | LLUICtrl* speakers_list = (LLUICtrl*)self->getChildByName("speakers_list", TRUE); | 788 | LLUICtrl* speakers_list = self->getCtrlByNameAndType("speakers_list", WIDGET_TYPE_DONTCARE); |
803 | if (!speakers_list || !gAgent.getRegion()) return; | 789 | if (!speakers_list || !gAgent.getRegion()) return; |
804 | 790 | ||
805 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); | 791 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); |