From 46897efc3efade25feaaa1dc67bc131c35202d12 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Thu, 29 Apr 2010 02:37:07 +0100 Subject: Make a proper XUI commit_callback for the Voice Font combo --- indra/newview/llcallfloater.cpp | 50 ++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'indra/newview/llcallfloater.cpp') diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 703c7dd435..37e551890a 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -115,8 +115,10 @@ LLCallFloater::LLCallFloater(const LLSD& key) mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&LLCallFloater::removeVoiceLeftParticipant, this, _1), voice_left_remove_delay); mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL); + LLVoiceClient::instance().addObserver(dynamic_cast(this)); LLVoiceClient::instance().addObserver(dynamic_cast(this)); + mCommitCallbackRegistrar.add("Voice.CommitVoiceFont", boost::bind(&LLCallFloater::onCommitVoiceFont, this)); LLTransientFloaterMgr::getInstance()->addControlView(this); // force docked state since this floater doesn't save it between recreations @@ -152,8 +154,6 @@ BOOL LLCallFloater::postBuild() childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this)); mVoiceFont = getChild("voice_font"); - childSetCommitCallback("voice_font", commitVoiceFont, this); // *FIX: childSetCommitCallback deprecated - mNonAvatarCaller = getChild("non_avatar_caller"); mNonAvatarCaller->setVisible(FALSE); @@ -227,6 +227,32 @@ void LLCallFloater::onParticipantsChanged() // virtual void LLCallFloater::onVoiceFontsChanged() +{ + updateVoiceFont(); +} + +////////////////////////////////////////////////////////////////////////// +/// PRIVATE SECTION +////////////////////////////////////////////////////////////////////////// + +void LLCallFloater::leaveCall() +{ + LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); + if (voice_channel) + { + gIMMgr->endCall(voice_channel->getSessionID()); + } +} + +void LLCallFloater::onCommitVoiceFont() +{ + if (LLVoiceClient::instance().hasVoiceFonts()) + { + LLVoiceClient::getInstance()->setVoiceFont(mVoiceFont->getValue()); + } +} + +void LLCallFloater::updateVoiceFont() { if (mVoiceFont) { @@ -250,25 +276,6 @@ void LLCallFloater::onVoiceFontsChanged() } } -////////////////////////////////////////////////////////////////////////// -/// PRIVATE SECTION -////////////////////////////////////////////////////////////////////////// - -void LLCallFloater::leaveCall() -{ - LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); - if (voice_channel) - { - gIMMgr->endCall(voice_channel->getSessionID()); - } -} - -/* static */ -void LLCallFloater::commitVoiceFont(LLUICtrl* ctrl, void* userdata) -{ - LLVoiceClient::getInstance()->setVoiceFont(ctrl->getValue()); -} - void LLCallFloater::updateSession() { LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); @@ -333,6 +340,7 @@ void LLCallFloater::updateSession() } updateTitle(); + updateVoiceFont(); //hide "Leave Call" button for nearby chat bool is_local_chat = mVoiceType == VC_LOCAL_CHAT; -- cgit v1.3