summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llcallfloater.cpp50
-rw-r--r--indra/newview/llcallfloater.h3
-rw-r--r--indra/newview/llvoiceclient.cpp49
-rw-r--r--indra/newview/llvoiceclient.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_voice_controls.xml9
5 files changed, 58 insertions, 54 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;
diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h
index 160eff312c..90b23eb4c4 100644
--- a/indra/newview/llcallfloater.h
+++ b/indra/newview/llcallfloater.h
@@ -107,7 +107,8 @@ private:
void leaveCall();
- static void commitVoiceFont(LLUICtrl*,void* userdata);
+ void onCommitVoiceFont();
+ void updateVoiceFont();
/**
* Updates mSpeakerManager and list according to current Voice Channel
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index d131285512..657a130c27 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -7256,55 +7256,46 @@ void LLVoiceClient::addVoiceFont(const S32 font_index,
bool LLVoiceClient::setVoiceFont(const LLUUID& id)
{
- if (!mAudioSession || !mAudioSession->mVoiceEnabled || !hasVoiceFonts())
+ return mAudioSession ? setVoiceFont(mAudioSession->mHandle, id) : false;
+}
+
+bool LLVoiceClient::setVoiceFont(const std::string &session_handle, const LLUUID& id)
+{
+ sessionState *session = findSession(session_handle);
+
+ if (!session || !session->mVoiceEnabled || !hasVoiceFonts())
{
LL_DEBUGS("Voice") << "Voice fonts not available." << LL_ENDL;
return false;
}
- if (id.isNull() || (mVoiceFontMap.find(&id) != mVoiceFontMap.end()))
- {
- // *TODO: Check for expired fonts?
- mAudioSession->mVoiceFontID = id;
-
- // *TODO: Separate voice font defaults for spatial chat and IM?
- gSavedSettings.setString("VoiceFontDefault", id.asString());
- }
- else
+ if (!id.isNull() && (mVoiceFontMap.find(&id) == mVoiceFontMap.end()))
{
LL_DEBUGS("Voice") << "Invalid voice font " << id << LL_ENDL;
return false;
}
- sessionSetVoiceFontSendMessage(mAudioSession);
+ // *TODO: Check for expired fonts?
+ mAudioSession->mVoiceFontID = id;
+
+ // *TODO: Separate voice font defaults for spatial chat and IM?
+ gSavedSettings.setString("VoiceFontDefault", id.asString());
+
+ sessionSetVoiceFontSendMessage(session);
notifyVoiceFontObservers();
+
return true;
}
const LLUUID LLVoiceClient::getVoiceFont()
{
- if (mAudioSession)
- {
- return getVoiceFont(mAudioSession->mHandle);
- }
- else
- {
- return LLUUID::null;
- }
+ return mAudioSession ? getVoiceFont(mAudioSession->mHandle) : LLUUID::null;
}
const LLUUID LLVoiceClient::getVoiceFont(const std::string &session_handle)
{
- LLUUID result;
- if (hasVoiceFonts())
- {
- sessionState *session = findSession(session_handle);
- if (session)
- {
- result = mAudioSession->mVoiceFontID;
- }
- }
- return result;
+ sessionState *session = findSession(session_handle);
+ return session ? session->mVoiceFontID : LLUUID::null;
}
S32 LLVoiceClient::getVoiceFontIndex(const LLUUID& id) const
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index a1083652aa..a997f9d500 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -444,6 +444,7 @@ static void updatePosition(void);
// Voice Fonts
bool hasVoiceFonts() const { return !mVoiceFontMap.empty(); };
bool setVoiceFont(const LLUUID& id);
+ bool setVoiceFont(const std::string &session_handle, const LLUUID& id);
const LLUUID getVoiceFont();
const LLUUID getVoiceFont(const std::string &session_handle);
diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
index 885c8304eb..44840a82d0 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
@@ -110,15 +110,18 @@
name="voice_font_panel"
width="150">
<combo_box
+ enabled="false"
follows="left|top|right"
height="23"
name="voice_font"
top_pad="0"
width="150">
<combo_box.item
- label="No Voice Effect"
- name="no_voice_font"
- value="0" />
+ label="No Voice Effect"
+ name="no_voice_font"
+ value="0" />
+ <combo_box.commit_callback
+ function="Voice.CommitVoiceFont" />
</combo_box>
</layout_panel>
<layout_panel