diff options
Diffstat (limited to 'linden/indra/newview/llfloateractivespeakers.cpp')
-rw-r--r-- | linden/indra/newview/llfloateractivespeakers.cpp | 114 |
1 files changed, 66 insertions, 48 deletions
diff --git a/linden/indra/newview/llfloateractivespeakers.cpp b/linden/indra/newview/llfloateractivespeakers.cpp index 7445ef0..ed2f9f8 100644 --- a/linden/indra/newview/llfloateractivespeakers.cpp +++ b/linden/indra/newview/llfloateractivespeakers.cpp | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "llagent.h" | 36 | #include "llagent.h" |
37 | #include "llvoavatar.h" | 37 | #include "llvoavatar.h" |
38 | #include "llfloateravatarinfo.h" | 38 | #include "llfloateravatarinfo.h" |
39 | #include "llvieweruictrlfactory.h" | 39 | #include "lluictrlfactory.h" |
40 | #include "llviewercontrol.h" | 40 | #include "llviewercontrol.h" |
41 | #include "llscrolllistctrl.h" | 41 | #include "llscrolllistctrl.h" |
42 | #include "llbutton.h" | 42 | #include "llbutton.h" |
@@ -52,9 +52,6 @@ const LLColor4 INACTIVE_COLOR(0.3f, 0.3f, 0.3f, 0.5f); | |||
52 | const LLColor4 ACTIVE_COLOR(0.5f, 0.5f, 0.5f, 1.f); | 52 | const LLColor4 ACTIVE_COLOR(0.5f, 0.5f, 0.5f, 1.f); |
53 | const F32 TYPING_ANIMATION_FPS = 2.5f; | 53 | const F32 TYPING_ANIMATION_FPS = 2.5f; |
54 | 54 | ||
55 | LLLocalSpeakerMgr* gLocalSpeakerMgr = NULL; | ||
56 | LLActiveSpeakerMgr* gActiveChannelSpeakerMgr = NULL; | ||
57 | |||
58 | LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType type) : | 55 | LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType type) : |
59 | mStatus(LLSpeaker::STATUS_TEXT_ONLY), | 56 | mStatus(LLSpeaker::STATUS_TEXT_ONLY), |
60 | mLastSpokeTime(0.f), | 57 | mLastSpokeTime(0.f), |
@@ -78,7 +75,7 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const LLString& name, const ESpeakerType | |||
78 | mDisplayName = name; | 75 | mDisplayName = name; |
79 | } | 76 | } |
80 | 77 | ||
81 | gVoiceClient->setUserVolume(id, gMuteListp->getSavedResidentVolume(id)); | 78 | gVoiceClient->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id)); |
82 | 79 | ||
83 | mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); | 80 | mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); |
84 | } | 81 | } |
@@ -166,7 +163,7 @@ LLFloaterActiveSpeakers::LLFloaterActiveSpeakers(const LLSD& seed) : mPanel(NULL | |||
166 | mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL); | 163 | mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL); |
167 | // do not automatically open singleton floaters (as result of getInstance()) | 164 | // do not automatically open singleton floaters (as result of getInstance()) |
168 | BOOL no_open = FALSE; | 165 | BOOL no_open = FALSE; |
169 | gUICtrlFactory->buildFloater(this, "floater_active_speakers.xml", &getFactoryMap(), no_open); | 166 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_active_speakers.xml", &getFactoryMap(), no_open); |
170 | //RN: for now, we poll voice client every frame to get voice amplitude feedback | 167 | //RN: for now, we poll voice client every frame to get voice amplitude feedback |
171 | //gVoiceClient->addObserver(this); | 168 | //gVoiceClient->addObserver(this); |
172 | mPanel->refreshSpeakers(); | 169 | mPanel->refreshSpeakers(); |
@@ -176,8 +173,17 @@ LLFloaterActiveSpeakers::~LLFloaterActiveSpeakers() | |||
176 | { | 173 | { |
177 | } | 174 | } |
178 | 175 | ||
176 | void LLFloaterActiveSpeakers::onOpen() | ||
177 | { | ||
178 | gSavedSettings.setBOOL("ShowActiveSpeakers", TRUE); | ||
179 | } | ||
180 | |||
179 | void LLFloaterActiveSpeakers::onClose(bool app_quitting) | 181 | void LLFloaterActiveSpeakers::onClose(bool app_quitting) |
180 | { | 182 | { |
183 | if (!app_quitting) | ||
184 | { | ||
185 | gSavedSettings.setBOOL("ShowActiveSpeakers", FALSE); | ||
186 | } | ||
181 | setVisible(FALSE); | 187 | setVisible(FALSE); |
182 | } | 188 | } |
183 | 189 | ||
@@ -190,7 +196,7 @@ void LLFloaterActiveSpeakers::draw() | |||
190 | 196 | ||
191 | BOOL LLFloaterActiveSpeakers::postBuild() | 197 | BOOL LLFloaterActiveSpeakers::postBuild() |
192 | { | 198 | { |
193 | mPanel = (LLPanelActiveSpeakers*)LLUICtrlFactory::getPanelByName(this, "active_speakers_panel"); | 199 | mPanel = getChild<LLPanelActiveSpeakers>("active_speakers_panel"); |
194 | return TRUE; | 200 | return TRUE; |
195 | } | 201 | } |
196 | 202 | ||
@@ -203,7 +209,7 @@ void LLFloaterActiveSpeakers::onChange() | |||
203 | void* LLFloaterActiveSpeakers::createSpeakersPanel(void* data) | 209 | void* LLFloaterActiveSpeakers::createSpeakersPanel(void* data) |
204 | { | 210 | { |
205 | // don't show text only speakers | 211 | // don't show text only speakers |
206 | return new LLPanelActiveSpeakers(gActiveChannelSpeakerMgr, FALSE); | 212 | return new LLPanelActiveSpeakers(LLActiveSpeakerMgr::getInstance(), FALSE); |
207 | } | 213 | } |
208 | 214 | ||
209 | // | 215 | // |
@@ -281,24 +287,29 @@ LLPanelActiveSpeakers::LLPanelActiveSpeakers(LLSpeakerMgr* data_source, BOOL sho | |||
281 | 287 | ||
282 | BOOL LLPanelActiveSpeakers::postBuild() | 288 | BOOL LLPanelActiveSpeakers::postBuild() |
283 | { | 289 | { |
284 | mSpeakerList = LLUICtrlFactory::getScrollListByName(this, "speakers_list"); | 290 | std::string sort_column = gSavedSettings.getString(LLString("FloaterActiveSpeakersSortColumn")); |
291 | BOOL sort_ascending = gSavedSettings.getBOOL( LLString("FloaterActiveSpeakersSortAscending")); | ||
292 | |||
293 | mSpeakerList = getChild<LLScrollListCtrl>("speakers_list"); | ||
294 | mSpeakerList->sortByColumn(sort_column, sort_ascending); | ||
285 | mSpeakerList->setDoubleClickCallback(onDoubleClickSpeaker); | 295 | mSpeakerList->setDoubleClickCallback(onDoubleClickSpeaker); |
286 | mSpeakerList->setCommitOnSelectionChange(TRUE); | 296 | mSpeakerList->setCommitOnSelectionChange(TRUE); |
287 | mSpeakerList->setCommitCallback(onSelectSpeaker); | 297 | mSpeakerList->setCommitCallback(onSelectSpeaker); |
298 | mSpeakerList->setSortChangedCallback(onSortChanged); | ||
288 | mSpeakerList->setCallbackUserData(this); | 299 | mSpeakerList->setCallbackUserData(this); |
289 | 300 | ||
290 | mMuteTextCtrl = getCtrlByNameAndType("mute_text_btn", WIDGET_TYPE_DONTCARE); | 301 | mMuteTextCtrl = getChild<LLUICtrl>("mute_text_btn"); |
291 | childSetCommitCallback("mute_text_btn", onClickMuteTextCommit, this); | 302 | childSetCommitCallback("mute_text_btn", onClickMuteTextCommit, this); |
292 | 303 | ||
293 | mMuteVoiceCtrl = getCtrlByNameAndType("mute_btn", WIDGET_TYPE_DONTCARE); | 304 | mMuteVoiceCtrl = getChild<LLUICtrl>("mute_btn"); |
294 | childSetCommitCallback("mute_btn", onClickMuteVoiceCommit, this); | 305 | childSetCommitCallback("mute_btn", onClickMuteVoiceCommit, this); |
295 | childSetAction("mute_btn", onClickMuteVoice, this); | 306 | childSetAction("mute_btn", onClickMuteVoice, this); |
296 | 307 | ||
297 | childSetCommitCallback("speaker_volume", onVolumeChange, this); | 308 | childSetCommitCallback("speaker_volume", onVolumeChange, this); |
298 | 309 | ||
299 | mNameText = LLUICtrlFactory::getTextBoxByName(this, "resident_name"); | 310 | mNameText = getChild<LLTextBox>("resident_name"); |
300 | 311 | ||
301 | mProfileBtn = LLUICtrlFactory::getButtonByName(this, "profile_btn"); | 312 | mProfileBtn = getChild<LLButton>("profile_btn"); |
302 | childSetAction("profile_btn", onClickProfile, this); | 313 | childSetAction("profile_btn", onClickProfile, this); |
303 | 314 | ||
304 | childSetCommitCallback("moderator_allow_voice", onModeratorMuteVoice, this); | 315 | childSetCommitCallback("moderator_allow_voice", onModeratorMuteVoice, this); |
@@ -332,7 +343,7 @@ void LLPanelActiveSpeakers::addSpeaker(const LLUUID& speaker_id) | |||
332 | 343 | ||
333 | columns[0]["column"] = "icon_speaking_status"; | 344 | columns[0]["column"] = "icon_speaking_status"; |
334 | columns[0]["type"] = "icon"; | 345 | columns[0]["type"] = "icon"; |
335 | columns[0]["value"] = gViewerArt.getString("icn_active-speakers-dot-lvl0.tga"); | 346 | columns[0]["value"] = "icn_active-speakers-dot-lvl0.tga"; |
336 | 347 | ||
337 | LLString speaker_name; | 348 | LLString speaker_name; |
338 | if (speakerp->mDisplayName.empty()) | 349 | if (speakerp->mDisplayName.empty()) |
@@ -388,14 +399,13 @@ void LLPanelActiveSpeakers::refreshSpeakers() | |||
388 | 399 | ||
389 | mSpeakerMgr->update(); | 400 | mSpeakerMgr->update(); |
390 | 401 | ||
391 | const LLString icon_image_0 = gViewerArt.getString("icn_active-speakers-dot-lvl0.tga"); | 402 | const LLString icon_image_0 = "icn_active-speakers-dot-lvl0.tga"; |
392 | const LLString icon_image_1 = gViewerArt.getString("icn_active-speakers-dot-lvl1.tga"); | 403 | const LLString icon_image_1 = "icn_active-speakers-dot-lvl1.tga"; |
393 | const LLString icon_image_2 = gViewerArt.getString("icn_active-speakers-dot-lvl2.tga"); | 404 | const LLString icon_image_2 = "icn_active-speakers-dot-lvl2.tga"; |
394 | |||
395 | 405 | ||
396 | std::vector<LLScrollListItem*> items = mSpeakerList->getAllData(); | 406 | std::vector<LLScrollListItem*> items = mSpeakerList->getAllData(); |
397 | 407 | ||
398 | LLUUID mute_icon_image = LLUUID(gViewerArt.getString("mute_icon.tga")); | 408 | LLString mute_icon_image = "mute_icon.tga"; |
399 | 409 | ||
400 | LLSpeakerMgr::speaker_list_t speaker_list; | 410 | LLSpeakerMgr::speaker_list_t speaker_list; |
401 | mSpeakerMgr->getSpeakerList(&speaker_list, mShowTextChatters); | 411 | mSpeakerMgr->getSpeakerList(&speaker_list, mShowTextChatters); |
@@ -516,27 +526,23 @@ void LLPanelActiveSpeakers::refreshSpeakers() | |||
516 | mSpeakerList->setSorted(FALSE); | 526 | mSpeakerList->setSorted(FALSE); |
517 | 527 | ||
518 | LLPointer<LLSpeaker> selected_speakerp = mSpeakerMgr->findSpeaker(selected_id); | 528 | LLPointer<LLSpeaker> selected_speakerp = mSpeakerMgr->findSpeaker(selected_id); |
519 | 529 | // update UI for selected participant | |
520 | if (gMuteListp) | 530 | if (mMuteVoiceCtrl) |
521 | { | 531 | { |
522 | // update UI for selected participant | 532 | mMuteVoiceCtrl->setValue(LLMuteList::getInstance()->isMuted(selected_id, LLMute::flagVoiceChat)); |
523 | if (mMuteVoiceCtrl) | 533 | mMuteVoiceCtrl->setEnabled(LLVoiceClient::voiceEnabled() |
524 | { | 534 | && gVoiceClient->getVoiceEnabled(selected_id) |
525 | mMuteVoiceCtrl->setValue(gMuteListp->isMuted(selected_id, LLMute::flagVoiceChat)); | 535 | && selected_id.notNull() |
526 | mMuteVoiceCtrl->setEnabled(LLVoiceClient::voiceEnabled() | ||
527 | && gVoiceClient->getVoiceEnabled(selected_id) | ||
528 | && selected_id.notNull() | ||
529 | && selected_id != gAgent.getID() | ||
530 | && (selected_speakerp.notNull() && selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT)); | ||
531 | } | ||
532 | if (mMuteTextCtrl) | ||
533 | { | ||
534 | mMuteTextCtrl->setValue(gMuteListp->isMuted(selected_id, LLMute::flagTextChat)); | ||
535 | mMuteTextCtrl->setEnabled(selected_id.notNull() | ||
536 | && selected_id != gAgent.getID() | 536 | && selected_id != gAgent.getID() |
537 | && selected_speakerp.notNull() | 537 | && (selected_speakerp.notNull() && selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT)); |
538 | && !gMuteListp->isLinden(selected_speakerp->mDisplayName)); | 538 | } |
539 | } | 539 | if (mMuteTextCtrl) |
540 | { | ||
541 | mMuteTextCtrl->setValue(LLMuteList::getInstance()->isMuted(selected_id, LLMute::flagTextChat)); | ||
542 | mMuteTextCtrl->setEnabled(selected_id.notNull() | ||
543 | && selected_id != gAgent.getID() | ||
544 | && selected_speakerp.notNull() | ||
545 | && !LLMuteList::getInstance()->isLinden(selected_speakerp->mDisplayName)); | ||
540 | } | 546 | } |
541 | childSetValue("speaker_volume", gVoiceClient->getUserVolume(selected_id)); | 547 | childSetValue("speaker_volume", gVoiceClient->getUserVolume(selected_id)); |
542 | childSetEnabled("speaker_volume", LLVoiceClient::voiceEnabled() | 548 | childSetEnabled("speaker_volume", LLVoiceClient::voiceEnabled() |
@@ -597,7 +603,7 @@ void LLPanelActiveSpeakers::setSpeaker(const LLUUID& id, const LLString& name, L | |||
597 | void LLPanelActiveSpeakers::setVoiceModerationCtrlMode( | 603 | void LLPanelActiveSpeakers::setVoiceModerationCtrlMode( |
598 | const BOOL& moderated_voice) | 604 | const BOOL& moderated_voice) |
599 | { | 605 | { |
600 | LLUICtrl* voice_moderation_ctrl = getCtrlByNameAndType("moderation_mode", WIDGET_TYPE_DONTCARE); | 606 | LLUICtrl* voice_moderation_ctrl = getChild<LLUICtrl>("moderation_mode"); |
601 | 607 | ||
602 | if ( voice_moderation_ctrl ) | 608 | if ( voice_moderation_ctrl ) |
603 | { | 609 | { |
@@ -613,7 +619,7 @@ void LLPanelActiveSpeakers::onClickMuteTextCommit(LLUICtrl* ctrl, void* user_dat | |||
613 | { | 619 | { |
614 | LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; | 620 | LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; |
615 | LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); | 621 | LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); |
616 | BOOL is_muted = gMuteListp->isMuted(speaker_id, LLMute::flagTextChat); | 622 | BOOL is_muted = LLMuteList::getInstance()->isMuted(speaker_id, LLMute::flagTextChat); |
617 | std::string name; | 623 | std::string name; |
618 | 624 | ||
619 | //fill in name using voice client's copy of name cache | 625 | //fill in name using voice client's copy of name cache |
@@ -629,11 +635,11 @@ void LLPanelActiveSpeakers::onClickMuteTextCommit(LLUICtrl* ctrl, void* user_dat | |||
629 | 635 | ||
630 | if (!is_muted) | 636 | if (!is_muted) |
631 | { | 637 | { |
632 | gMuteListp->add(mute, LLMute::flagTextChat); | 638 | LLMuteList::getInstance()->add(mute, LLMute::flagTextChat); |
633 | } | 639 | } |
634 | else | 640 | else |
635 | { | 641 | { |
636 | gMuteListp->remove(mute, LLMute::flagTextChat); | 642 | LLMuteList::getInstance()->remove(mute, LLMute::flagTextChat); |
637 | } | 643 | } |
638 | } | 644 | } |
639 | 645 | ||
@@ -648,7 +654,7 @@ void LLPanelActiveSpeakers::onClickMuteVoiceCommit(LLUICtrl* ctrl, void* user_da | |||
648 | { | 654 | { |
649 | LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; | 655 | LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; |
650 | LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); | 656 | LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); |
651 | BOOL is_muted = gMuteListp->isMuted(speaker_id, LLMute::flagVoiceChat); | 657 | BOOL is_muted = LLMuteList::getInstance()->isMuted(speaker_id, LLMute::flagVoiceChat); |
652 | std::string name; | 658 | std::string name; |
653 | 659 | ||
654 | LLPointer<LLSpeaker> speakerp = panelp->mSpeakerMgr->findSpeaker(speaker_id); | 660 | LLPointer<LLSpeaker> speakerp = panelp->mSpeakerMgr->findSpeaker(speaker_id); |
@@ -664,11 +670,11 @@ void LLPanelActiveSpeakers::onClickMuteVoiceCommit(LLUICtrl* ctrl, void* user_da | |||
664 | 670 | ||
665 | if (!is_muted) | 671 | if (!is_muted) |
666 | { | 672 | { |
667 | gMuteListp->add(mute, LLMute::flagVoiceChat); | 673 | LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat); |
668 | } | 674 | } |
669 | else | 675 | else |
670 | { | 676 | { |
671 | gMuteListp->remove(mute, LLMute::flagVoiceChat); | 677 | LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat); |
672 | } | 678 | } |
673 | } | 679 | } |
674 | 680 | ||
@@ -683,7 +689,7 @@ void LLPanelActiveSpeakers::onVolumeChange(LLUICtrl* source, void* user_data) | |||
683 | gVoiceClient->setUserVolume(speaker_id, new_volume); | 689 | gVoiceClient->setUserVolume(speaker_id, new_volume); |
684 | 690 | ||
685 | // store this volume setting for future sessions | 691 | // store this volume setting for future sessions |
686 | gMuteListp->setSavedResidentVolume(speaker_id, new_volume); | 692 | LLMuteList::getInstance()->setSavedResidentVolume(speaker_id, new_volume); |
687 | } | 693 | } |
688 | 694 | ||
689 | //static | 695 | //static |
@@ -716,11 +722,23 @@ void LLPanelActiveSpeakers::onSelectSpeaker(LLUICtrl* source, void* user_data) | |||
716 | panelp->handleSpeakerSelect(); | 722 | panelp->handleSpeakerSelect(); |
717 | } | 723 | } |
718 | 724 | ||
725 | |||
726 | //static | ||
727 | void LLPanelActiveSpeakers::onSortChanged(void* user_data) | ||
728 | { | ||
729 | LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; | ||
730 | std::string sort_column = panelp->mSpeakerList->getSortColumnName(); | ||
731 | BOOL sort_ascending = panelp->mSpeakerList->getSortAscending(); | ||
732 | gSavedSettings.setString(LLString("FloaterActiveSpeakersSortColumn"), sort_column); | ||
733 | gSavedSettings.setBOOL( LLString("FloaterActiveSpeakersSortAscending"), sort_ascending); | ||
734 | } | ||
735 | |||
736 | |||
719 | //static | 737 | //static |
720 | void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data) | 738 | void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data) |
721 | { | 739 | { |
722 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; | 740 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; |
723 | LLUICtrl* speakers_list = self->getCtrlByNameAndType("speakers_list", WIDGET_TYPE_DONTCARE); | 741 | LLUICtrl* speakers_list = self->getChild<LLUICtrl>("speakers_list"); |
724 | if (!speakers_list || !gAgent.getRegion()) return; | 742 | if (!speakers_list || !gAgent.getRegion()) return; |
725 | 743 | ||
726 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); | 744 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); |
@@ -785,7 +803,7 @@ void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data | |||
785 | void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data) | 803 | void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data) |
786 | { | 804 | { |
787 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; | 805 | LLPanelActiveSpeakers* self = (LLPanelActiveSpeakers*)user_data; |
788 | LLUICtrl* speakers_list = self->getCtrlByNameAndType("speakers_list", WIDGET_TYPE_DONTCARE); | 806 | LLUICtrl* speakers_list = self->getChild<LLUICtrl>("speakers_list"); |
789 | if (!speakers_list || !gAgent.getRegion()) return; | 807 | if (!speakers_list || !gAgent.getRegion()) return; |
790 | 808 | ||
791 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); | 809 | std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); |