diff options
Diffstat (limited to 'indra/newview/llnearbychatbar.cpp')
-rw-r--r-- | indra/newview/llnearbychatbar.cpp | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 83f8d14b5f..50e31e85e4 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -179,25 +179,29 @@ LLNearbyChatBar::LLNearbyChatBar() //virtual BOOL LLNearbyChatBar::postBuild() { - mChatBox = getChild<LLLineEditor>("chat_box",TRUE,FALSE); + mChatBox = getChild<LLLineEditor>("chat_box"); - if (mChatBox) - { - mChatBox->setCommitCallback(boost::bind(&LLNearbyChatBar::onChatBoxCommit, this)); - mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); - mChatBox->setFocusLostCallback(&onChatBoxFocusLost, this); - - mChatBox->setIgnoreArrowKeys(TRUE); - mChatBox->setCommitOnFocusLost( FALSE ); - mChatBox->setRevertOnEsc( FALSE ); - mChatBox->setIgnoreTab(TRUE); - mChatBox->setPassDelete(TRUE); - mChatBox->setReplaceNewlinesWithSpaces(FALSE); - mChatBox->setMaxTextLength(1023); - mChatBox->setEnableLineHistory(TRUE); - } + mChatBox->setCommitCallback(boost::bind(&LLNearbyChatBar::onChatBoxCommit, this)); + mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); + mChatBox->setFocusLostCallback(&onChatBoxFocusLost, this); + + mChatBox->setIgnoreArrowKeys(TRUE); + mChatBox->setCommitOnFocusLost( FALSE ); + mChatBox->setRevertOnEsc( FALSE ); + mChatBox->setIgnoreTab(TRUE); + mChatBox->setPassDelete(TRUE); + mChatBox->setReplaceNewlinesWithSpaces(FALSE); + mChatBox->setMaxTextLength(1023); + mChatBox->setEnableLineHistory(TRUE); + + mTalkBtn = getChild<LLTalkButton>("talk"); - mTalkBtn = getChild<LLTalkButton>("talk",TRUE,FALSE); + // Speak button should be initially disabled because + // it takes some time between logging in to world and connecting to voice channel. + mTalkBtn->setEnabled(FALSE); + + // Registering Chat Bar to receive Voice client status change notifications. + gVoiceClient->addObserver(this); return TRUE; } @@ -208,6 +212,12 @@ LLNearbyChatBar* LLNearbyChatBar::getInstance() return LLBottomTray::getInstance() ? LLBottomTray::getInstance()->getNearbyChatBar() : NULL; } +//static +bool LLNearbyChatBar::instanceExists() +{ + return LLBottomTray::instanceExists() && LLBottomTray::getInstance()->getNearbyChatBar() != NULL; +} + std::string LLNearbyChatBar::getCurrentChat() { return mChatBox ? mChatBox->getText() : LLStringUtil::null; @@ -616,6 +626,27 @@ public: } }; +void LLNearbyChatBar::onChange(EStatusType status, const std::string &channelURI, bool proximal) +{ + // Time it takes to connect to voice channel might be pretty long, + // so don't expect user login or STATUS_VOICE_ENABLED to be followed by STATUS_JOINED. + BOOL enable = FALSE; + + switch (status) + { + // Do not add STATUS_VOICE_ENABLED because voice chat is + // inactive until STATUS_JOINED + case STATUS_JOINED: + enable = TRUE; + break; + default: + enable = FALSE; + break; + } + + mTalkBtn->setEnabled(enable); +} + // Creating the object registers with the dispatcher. LLChatHandler gChatHandler; |