diff options
author | James Cook <james@lindenlab.com> | 2010-02-03 14:13:56 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-02-03 14:13:56 -0800 |
commit | 88350edbcbec615f3b15fc82bd5ce4005621ac6f (patch) | |
tree | c244f41159cf32f3e03c6c311e1453bbd383bad5 /indra/newview/llpanelimcontrolpanel.cpp | |
parent | d489216b6ef41f0d22f3a9062ba6daacc67bc038 (diff) | |
parent | 0bee31de32cb5999e7ec06d74f55d34ce0ac052b (diff) |
merge
Diffstat (limited to 'indra/newview/llpanelimcontrolpanel.cpp')
-rw-r--r-- | indra/newview/llpanelimcontrolpanel.cpp | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index a39fe64767..15e8258475 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -64,21 +64,56 @@ void LLPanelChatControlPanel::onOpenVoiceControlsClicked() LLFloaterReg::showInstance("voice_controls"); } +void LLPanelChatControlPanel::onChange(EStatusType status, const std::string &channelURI, bool proximal) +{ + if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) + { + return; + } + + updateCallButton(); +} + void LLPanelChatControlPanel::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) { updateButtons(new_state >= LLVoiceChannel::STATE_CALL_STARTED); } +void LLPanelChatControlPanel::updateCallButton() +{ + bool voice_enabled = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking(); + + LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId); + + if (!session) + { + childSetEnabled("call_btn", false); + return; + } + + bool session_initialized = session->mSessionInitialized; + bool callback_enabled = session->mCallBackEnabled; + + BOOL enable_connect = session_initialized + && voice_enabled + && callback_enabled; + childSetEnabled("call_btn", enable_connect); +} + void LLPanelChatControlPanel::updateButtons(bool is_call_started) { childSetVisible("end_call_btn_panel", is_call_started); childSetVisible("voice_ctrls_btn_panel", is_call_started); childSetVisible("call_btn_panel", ! is_call_started); + updateCallButton(); + } LLPanelChatControlPanel::~LLPanelChatControlPanel() { mVoiceChannelStateChangeConnection.disconnect(); + if(LLVoiceClient::getInstance()) + LLVoiceClient::getInstance()->removeObserver(this); } BOOL LLPanelChatControlPanel::postBuild() @@ -87,26 +122,9 @@ BOOL LLPanelChatControlPanel::postBuild() childSetAction("end_call_btn", boost::bind(&LLPanelChatControlPanel::onEndCallButtonClicked, this)); childSetAction("voice_ctrls_btn", boost::bind(&LLPanelChatControlPanel::onOpenVoiceControlsClicked, this)); - return TRUE; -} - -void LLPanelChatControlPanel::draw() -{ - // hide/show start call and end call buttons - bool voice_enabled = LLVoiceClient::voiceEnabled(); - - LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId); - if (!session) return; - - bool session_initialized = session->mSessionInitialized; - bool callback_enabled = session->mCallBackEnabled; - - BOOL enable_connect = session_initialized - && voice_enabled - && callback_enabled; - childSetEnabled("call_btn", enable_connect); + gVoiceClient->addObserver(this); - LLPanel::draw(); + return TRUE; } void LLPanelChatControlPanel::setSessionId(const LLUUID& session_id) |