diff --git a/indra/newview/fsfloatervoicecontrols.cpp b/indra/newview/fsfloatervoicecontrols.cpp index c804e2150b..8278a80bd8 100644 --- a/indra/newview/fsfloatervoicecontrols.cpp +++ b/indra/newview/fsfloatervoicecontrols.cpp @@ -111,6 +111,8 @@ FSFloaterVoiceControls::FSFloaterVoiceControls(const LLSD& key) , mSpeakingIndicator(NULL) , mIsModeratorMutedVoice(false) , mInitParticipantsVoiceState(false) +, mVolumeSlider(NULL) +, mMuteButton(NULL) { static LLUICachedControl voice_left_remove_delay ("VoiceParticipantLeftRemoveDelay", 10); mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&FSFloaterVoiceControls::removeVoiceLeftParticipant, this, _1), voice_left_remove_delay); @@ -149,21 +151,20 @@ BOOL FSFloaterVoiceControls::postBuild() mAvatarList = getChild("speakers_list"); mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&FSFloaterVoiceControls::onAvatarListRefreshed, this)); - // Disable obsolete V1 code - //mAvatarList->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onParticipantSelected,this)); - childSetAction("leave_call_btn", boost::bind(&FSFloaterVoiceControls::leaveCall, this)); mNonAvatarCaller = findChild("non_avatar_caller"); mNonAvatarCaller->setVisible(FALSE); - // Disable obsolete V1 code - //mVolumeSlider=getChild("volume_slider"); - //mVolumeSlider->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onVolumeChanged,this)); - // - //mMuteButton=getChild("mute_btn"); - //mMuteButton->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onMuteChanged,this)); - // + mVolumeSlider = findChild("volume_slider"); + mMuteButton = findChild("mute_btn"); + + if (mVolumeSlider && mMuteButton) + { + mAvatarList->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onParticipantSelected, this)); + mVolumeSlider->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onVolumeChanged, this)); + mMuteButton->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onMuteChanged, this)); + } initAgentData(); @@ -385,60 +386,58 @@ void FSFloaterVoiceControls::onAvatarListRefreshed() } } -// Disable obsolete V1 code -//void FSFloaterVoiceControls::onParticipantSelected() -//{ -// uuid_vec_t participants; -// mAvatarList->getSelectedUUIDs(participants); -// -// mVolumeSlider->setEnabled(FALSE); -// mMuteButton->setEnabled(FALSE); -// -// mSelectedParticipant=LLUUID::null; -// -// if(participants.size()!=1) -// return; -// -// mSelectedParticipant=participants[0]; -// -// if(mSelectedParticipant.isNull()) -// return; -// -// if(!LLVoiceClient::instance().getVoiceEnabled(mSelectedParticipant)) -// return; -// -// mVolumeSlider->setEnabled(TRUE); -// mMuteButton->setEnabled(TRUE); -// -// mMuteButton->setToggleState(LLVoiceClient::instance().getOnMuteList(mSelectedParticipant)); -// mVolumeSlider->setValue(LLVoiceClient::instance().getUserVolume(mSelectedParticipant)); -//} -// -//void FSFloaterVoiceControls::onVolumeChanged() -//{ -// if(mSelectedParticipant.isNull()) -// return; -// -// LLVoiceClient::instance().setUserVolume(mSelectedParticipant,mVolumeSlider->getValueF32()); -//} -// -//void FSFloaterVoiceControls::onMuteChanged() -//{ -// if(mSelectedParticipant.isNull()) -// return; -// -// LLAvatarListItem* item=dynamic_cast(mAvatarList->getItemByValue(mSelectedParticipant)); -// if(!item) -// return; -// -// LLMute mute(mSelectedParticipant,item->getAvatarName(),LLMute::AGENT); -// -// if(mMuteButton->getValue().asBoolean()) -// LLMuteList::instance().add(mute,LLMute::flagVoiceChat); -// else -// LLMuteList::instance().remove(mute,LLMute::flagVoiceChat); -//} -// +void FSFloaterVoiceControls::onParticipantSelected() +{ + uuid_vec_t participants; + mAvatarList->getSelectedUUIDs(participants); + + mVolumeSlider->setEnabled(FALSE); + mMuteButton->setEnabled(FALSE); + + mSelectedParticipant=LLUUID::null; + + if(participants.size()!=1) + return; + + mSelectedParticipant=participants[0]; + + if(mSelectedParticipant.isNull()) + return; + + if(!LLVoiceClient::instance().getVoiceEnabled(mSelectedParticipant)) + return; + + mVolumeSlider->setEnabled(TRUE); + mMuteButton->setEnabled(TRUE); + + mMuteButton->setToggleState(LLVoiceClient::instance().getOnMuteList(mSelectedParticipant)); + mVolumeSlider->setValue(LLVoiceClient::instance().getUserVolume(mSelectedParticipant)); +} + +void FSFloaterVoiceControls::onVolumeChanged() +{ + if(mSelectedParticipant.isNull()) + return; + + LLVoiceClient::instance().setUserVolume(mSelectedParticipant,mVolumeSlider->getValueF32()); +} + +void FSFloaterVoiceControls::onMuteChanged() +{ + if(mSelectedParticipant.isNull()) + return; + + LLAvatarListItem* item=dynamic_cast(mAvatarList->getItemByValue(mSelectedParticipant)); + if(!item) + return; + + LLMute mute(mSelectedParticipant,item->getAvatarName(),LLMute::AGENT); + + if(mMuteButton->getValue().asBoolean()) + LLMuteList::instance().add(mute,LLMute::flagVoiceChat); + else + LLMuteList::instance().remove(mute,LLMute::flagVoiceChat); +} // static void FSFloaterVoiceControls::sOnCurrentChannelChanged(const LLUUID& /*session_id*/) diff --git a/indra/newview/fsfloatervoicecontrols.h b/indra/newview/fsfloatervoicecontrols.h index bd2ff8fb47..228cf5be33 100644 --- a/indra/newview/fsfloatervoicecontrols.h +++ b/indra/newview/fsfloatervoicecontrols.h @@ -131,20 +131,17 @@ private: * This updates the slider and mute button at the lower edge, so the selected participant * becomes the target of this control. */ - // Disable obsolete V1 code - //void onParticipantSelected(); + void onParticipantSelected(); /** * Gets called whenever the volume on the optional single slider control gets changed */ - // Disable obsolete V1 code - //void onVolumeChanged(); + void onVolumeChanged(); /** * Gets called whenever the optional single mute button gets toggled */ - // Disable obsolete V1 code - //void onMuteChanged(); + void onMuteChanged(); /** * Updates window title with an avatar name @@ -262,11 +259,9 @@ private: LLOutputMonitorCtrl* mSpeakingIndicator; bool mIsModeratorMutedVoice; - // Disable obsolete V1 code - //LLUUID mSelectedParticipant; - //LLSliderCtrl* mVolumeSlider; - //LLButton* mMuteButton; - // + LLUUID mSelectedParticipant; + LLSliderCtrl* mVolumeSlider; + LLButton* mMuteButton; /** * Flag indicated that participants voice states should be initialized.