summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychatbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnearbychatbar.cpp')
-rw-r--r--indra/newview/llnearbychatbar.cpp66
1 files changed, 37 insertions, 29 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 1d8789fde0..c2e1019f43 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -201,35 +201,8 @@ BOOL LLNearbyChatBar::postBuild()
mChatBox->setMaxTextLength(1023);
mChatBox->setEnableLineHistory(TRUE);
- // TODO: Initialization of the output monitor's params should be done via xml
- const S32 MONITOR_RIGHT_PAD = 2;
-
- LLRect monitor_rect = LLRect(0, 18, 18, 0);
- LLRect chatbox_rect = mChatBox->getRect();
-
- S32 monitor_height = monitor_rect.getHeight();
- monitor_rect.mLeft = chatbox_rect.getWidth() - monitor_rect.getWidth() - MONITOR_RIGHT_PAD;
- monitor_rect.mRight = chatbox_rect.getWidth() - MONITOR_RIGHT_PAD;
- monitor_rect.mBottom = (chatbox_rect.getHeight() / 2) - (monitor_height / 2);
- monitor_rect.mTop = monitor_rect.mBottom + monitor_height;
-
- LLOutputMonitorCtrl::Params monitor_params = LLOutputMonitorCtrl::Params();
- monitor_params.name = "output_monitor";
- monitor_params.draw_border(false);
- monitor_params.rect(monitor_rect);
- monitor_params.auto_update(true);
- monitor_params.speaker_id(gAgentID);
-
- LLView::Follows follows = LLView::Follows();
- follows.flags = FOLLOWS_RIGHT;
- monitor_params.follows = follows;
- mOutputMonitor = LLUICtrlFactory::create<LLOutputMonitorCtrl>(monitor_params);
- mChatBox->addChild(mOutputMonitor);
-
- // never show "muted" because you can't mute yourself
- mOutputMonitor->setIsMuted(false);
+ mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
mOutputMonitor->setVisible(FALSE);
-
mTalkBtn = getChild<LLTalkButton>("talk");
// Speak button should be initially disabled because
@@ -254,6 +227,12 @@ bool LLNearbyChatBar::instanceExists()
return LLBottomTray::instanceExists() && LLBottomTray::getInstance()->getNearbyChatBar() != NULL;
}
+void LLNearbyChatBar::draw()
+{
+ displaySpeakingIndicator();
+ LLPanel::draw();
+}
+
std::string LLNearbyChatBar::getCurrentChat()
{
return mChatBox ? mChatBox->getText() : LLStringUtil::null;
@@ -470,6 +449,36 @@ void LLNearbyChatBar::onChatBoxCommit()
gAgent.stopTyping();
}
+void LLNearbyChatBar::displaySpeakingIndicator()
+{
+ LLSpeakerMgr::speaker_list_t speaker_list;
+ LLUUID id;
+
+ id.setNull();
+ mSpeakerMgr.update(TRUE);
+ mSpeakerMgr.getSpeakerList(&speaker_list, FALSE);
+
+ for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i)
+ {
+ LLPointer<LLSpeaker> s = *i;
+ if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING)
+ {
+ id = s->mID;
+ break;
+ }
+ }
+
+ if (!id.isNull())
+ {
+ mOutputMonitor->setVisible(TRUE);
+ mOutputMonitor->setSpeakerId(id);
+ }
+ else
+ {
+ mOutputMonitor->setVisible(FALSE);
+ }
+}
+
void LLNearbyChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate)
{
sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate);
@@ -622,7 +631,6 @@ LLWString LLNearbyChatBar::stripChannelNumber(const LLWString &mesg, S32* channe
void LLNearbyChatBar::setPTTState(bool state)
{
mTalkBtn->setSpeakBtnToggleState(state);
- mOutputMonitor->setVisible(state);
}
void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)