diff options
author | Roxie Linden <roxie@lindenlab.com> | 2010-02-25 14:12:18 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2010-02-25 14:12:18 -0800 |
commit | 0ac14158bcec40e65fb26d2fea7555ede1e2ca94 (patch) | |
tree | bacf3b28ac4de7f69da67d7616923dafe92b0d49 /indra/newview/llpanelimcontrolpanel.cpp | |
parent | 92cef0426df15c0e661fa795e6b00214f381dd05 (diff) | |
parent | ab0c9c6754836cb26a520d0a9b2d7bbdd13a5f32 (diff) |
automated merge from trunk
Diffstat (limited to 'indra/newview/llpanelimcontrolpanel.cpp')
-rw-r--r-- | indra/newview/llpanelimcontrolpanel.cpp | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index c0b2a40d46..7fd2c98cb1 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -64,21 +64,52 @@ 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() +{ + // hide/show call button + bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + + 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); +} + 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 +118,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::getInstance()->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); + LLVoiceClient::getInstance()->addObserver(this); - LLPanel::draw(); + return TRUE; } void LLPanelChatControlPanel::setSessionId(const LLUUID& session_id) @@ -245,7 +259,6 @@ void LLPanelIMControlPanel::nameUpdatedCallback(const LLUUID& id, const std::str LLPanelGroupControlPanel::LLPanelGroupControlPanel(const LLUUID& session_id): mParticipantList(NULL) { - mSpeakerManager = LLIMModel::getInstance()->getSpeakerManager(session_id); } BOOL LLPanelGroupControlPanel::postBuild() @@ -264,12 +277,11 @@ LLPanelGroupControlPanel::~LLPanelGroupControlPanel() // virtual void LLPanelGroupControlPanel::draw() { - //Remove event does not raised until speakerp->mActivityTimer.hasExpired() is false, see LLSpeakerManager::update() - //so we need update it to raise needed event - mSpeakerManager->update(true); // Need to resort the participant list if it's in sort by recent speaker order. if (mParticipantList) mParticipantList->updateRecentSpeakersOrder(); + //* TODO: find better way to properly enable call button for group and remove this call from draw() + updateCallButton(); LLPanelChatControlPanel::draw(); } @@ -307,7 +319,10 @@ void LLPanelGroupControlPanel::setSessionId(const LLUUID& session_id) // for group and Ad-hoc chat we need to include agent into list if(!mParticipantList) - mParticipantList = new LLParticipantList(mSpeakerManager, getChild<LLAvatarList>("speakers_list"), true,false); + { + LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(session_id); + mParticipantList = new LLParticipantList(speaker_manager, getChild<LLAvatarList>("speakers_list"), true,false); + } } |