summaryrefslogtreecommitdiff
path: root/indra/newview/llcallfloater.cpp
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-04-29 02:37:07 +0100
committerAimee Linden <aimee@lindenlab.com>2010-04-29 02:37:07 +0100
commit46897efc3efade25feaaa1dc67bc131c35202d12 (patch)
treea7e1f41f8b2d4ff338107f22d5ad3c2d3068debb /indra/newview/llcallfloater.cpp
parentad24d0c72a272dd9b30841ecc20e34d334e6f2b6 (diff)
Make a proper XUI commit_callback for the Voice Font combo
Diffstat (limited to 'indra/newview/llcallfloater.cpp')
-rw-r--r--indra/newview/llcallfloater.cpp50
1 files changed, 29 insertions, 21 deletions
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<LLVoiceClientParticipantObserver*>(this));
LLVoiceClient::instance().addObserver(dynamic_cast<LLVoiceClientFontsObserver*>(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<LLComboBox>("voice_font");
- childSetCommitCallback("voice_font", commitVoiceFont, this); // *FIX: childSetCommitCallback deprecated
-
mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller");
mNonAvatarCaller->setVisible(FALSE);
@@ -228,6 +228,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)
{
mVoiceFont->removeall();
@@ -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;