From 9f9b240dcee53a50b56a0ccb8d255a86d0ce62c9 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Tue, 6 Apr 2010 11:39:01 +0100 Subject: Added voice font selection to the voice floater. --- indra/newview/llcallfloater.cpp | 53 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'indra/newview/llcallfloater.cpp') diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 76e058a1c3..52739184c0 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -52,6 +52,7 @@ #include "lltransientfloatermgr.h" #include "llviewerwindow.h" #include "llvoicechannel.h" +#include "llvoiceclient.h" // for Voice font list types #include "llviewerparcelmgr.h" static void get_voice_participants_uuids(std::vector& speakers_uuids); @@ -95,7 +96,7 @@ static void* create_non_avatar_caller(void*) return new LLNonAvatarCaller; } -LLVoiceChannel* LLCallFloater::sCurrentVoiceCanel = NULL; +LLVoiceChannel* LLCallFloater::sCurrentVoiceChannel = NULL; LLCallFloater::LLCallFloater(const LLSD& key) : LLTransientDockableFloater(NULL, false, key) @@ -105,6 +106,7 @@ LLCallFloater::LLCallFloater(const LLSD& key) , mNonAvatarCaller(NULL) , mVoiceType(VC_LOCAL_CHAT) , mAgentPanel(NULL) +, mVoiceFont(NULL) , mSpeakingIndicator(NULL) , mIsModeratorMutedVoice(false) , mInitParticipantsVoiceState(false) @@ -146,6 +148,9 @@ 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); @@ -157,7 +162,6 @@ BOOL LLCallFloater::postBuild() initAgentData(); - connectToChannel(LLVoiceChannel::getCurrentVoiceChannel()); setIsChrome(true); @@ -205,6 +209,9 @@ void LLCallFloater::draw() // virtual void LLCallFloater::onChange() { + // *FIX: Temporarily dumping this here till I decide where it should go + updateVoiceFont(); + if (NULL == mParticipants) return; updateParticipantsVoiceState(); @@ -231,6 +238,37 @@ void LLCallFloater::leaveCall() } } +/* static */ +void LLCallFloater::commitVoiceFont(LLUICtrl* ctrl, void* userdata) +{ + LLVoiceClient::getInstance()->setVoiceFont(ctrl->getValue()); +} + +void LLCallFloater::updateVoiceFont() +{ + if (mVoiceFont) + { + mVoiceFont->removeall(); + mVoiceFont->add(getString("no_voice_font"), 0); + + if (LLVoiceClient::getInstance()->getVoiceFontsAvailable()) + { + const LLVoiceClient::voice_font_list_t font_list = LLVoiceClient::getInstance()->getVoiceFontList(); + + for (LLVoiceClient::voice_font_list_t::const_iterator it = font_list.begin(); it != font_list.end(); ++it) + { + mVoiceFont->add(*(it->second), it->first, ADD_BOTTOM); + } + mVoiceFont->setEnabled(true); + mVoiceFont->setValue(LLVoiceClient::getInstance()->getVoiceFont()); + } + else + { + mVoiceFont->setEnabled(false); + } + } +} + void LLCallFloater::updateSession() { LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); @@ -369,7 +407,7 @@ void LLCallFloater::sOnCurrentChannelChanged(const LLUUID& /*session_id*/) // *NOTE: if signal was sent for voice channel with LLVoiceChannel::STATE_NO_CHANNEL_INFO // it sill be sent for the same channel again (when state is changed). // So, lets ignore this call. - if (channel == sCurrentVoiceCanel) return; + if (channel == sCurrentVoiceChannel) return; LLCallFloater* call_floater = LLFloaterReg::getTypedInstance("voice_controls"); @@ -714,9 +752,9 @@ void LLCallFloater::connectToChannel(LLVoiceChannel* channel) { mVoiceChannelStateChangeConnection.disconnect(); - sCurrentVoiceCanel = channel; + sCurrentVoiceChannel = channel; - mVoiceChannelStateChangeConnection = sCurrentVoiceCanel->setStateChangedCallback(boost::bind(&LLCallFloater::onVoiceChannelStateChanged, this, _1, _2)); + mVoiceChannelStateChangeConnection = sCurrentVoiceChannel->setStateChangedCallback(boost::bind(&LLCallFloater::onVoiceChannelStateChanged, this, _1, _2)); updateState(channel->getState()); } @@ -736,7 +774,7 @@ void LLCallFloater::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old void LLCallFloater::updateState(const LLVoiceChannel::EState& new_state) { - LL_DEBUGS("Voice") << "Updating state: " << new_state << ", session name: " << sCurrentVoiceCanel->getSessionName() << LL_ENDL; + LL_DEBUGS("Voice") << "Updating state: " << new_state << ", session name: " << sCurrentVoiceChannel->getSessionName() << LL_ENDL; if (LLVoiceChannel::STATE_CONNECTED == new_state) { updateSession(); @@ -745,6 +783,9 @@ void LLCallFloater::updateState(const LLVoiceChannel::EState& new_state) { reset(new_state); } + + // *FIX: Dumped here till I decide where to put it + updateVoiceFont(); } void LLCallFloater::reset(const LLVoiceChannel::EState& new_state) -- cgit v1.2.3 From e9b613e8d4362412a03b8c141614553f902a24b3 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Mon, 19 Apr 2010 15:16:48 +0100 Subject: Identify fonts with UUIDs rather than using the font indexes directly as they are not guaranteed unique across sessions. Replaced all references to "Font" with "Voice Font" where possible to reduce confusion for anyone grepping code in future. --- indra/newview/llcallfloater.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llcallfloater.cpp') diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index f13e74679d..30f211d46d 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -250,15 +250,15 @@ void LLCallFloater::updateVoiceFont() if (mVoiceFont) { mVoiceFont->removeall(); - mVoiceFont->add(getString("no_voice_font"), 0); + mVoiceFont->add(getString("no_voice_font"), LLUUID::null); - if (LLVoiceClient::getInstance()->getVoiceFontsAvailable()) + if (LLVoiceClient::getInstance()->hasVoiceFonts()) { const LLVoiceClient::voice_font_list_t font_list = LLVoiceClient::getInstance()->getVoiceFontList(); for (LLVoiceClient::voice_font_list_t::const_iterator it = font_list.begin(); it != font_list.end(); ++it) { - mVoiceFont->add(*(it->second), it->first, ADD_BOTTOM); + mVoiceFont->add(*(it->first), *(it->second), ADD_BOTTOM); } mVoiceFont->setEnabled(true); mVoiceFont->setValue(LLVoiceClient::getInstance()->getVoiceFont()); -- cgit v1.2.3 From cacfa18643092547e7665b36d482ad9c8c5dfc54 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Wed, 28 Apr 2010 03:33:15 +0100 Subject: Persist Voice Font selection. Added 'VoiceFontDefault' saved setting. Implemented LLVoiceClientFontsObserver to update the UI when the voice font list is received. Renamed LLVoiceClientParticipantObserver::onChange() to onParticipantsChanged to avoid ambiguity and make the code more readable. Made the Voice Font combo in the VCP auto resize to make best use of the available space when the 'Leave Call button is not visible. --- indra/newview/llcallfloater.cpp | 64 +++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 34 deletions(-) (limited to 'indra/newview/llcallfloater.cpp') diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index f41875f67b..703c7dd435 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -115,7 +115,8 @@ 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::getInstance()->addObserver(this); + LLVoiceClient::instance().addObserver(dynamic_cast(this)); + LLVoiceClient::instance().addObserver(dynamic_cast(this)); LLTransientFloaterMgr::getInstance()->addControlView(this); // force docked state since this floater doesn't save it between recreations @@ -135,7 +136,8 @@ LLCallFloater::~LLCallFloater() if(LLVoiceClient::instanceExists()) { - LLVoiceClient::instance().removeObserver(this); + LLVoiceClient::instance().removeObserver(dynamic_cast(this)); + LLVoiceClient::instance().removeObserver(dynamic_cast(this)); } LLTransientFloaterMgr::getInstance()->removeControlView(this); } @@ -208,11 +210,8 @@ void LLCallFloater::draw() } // virtual -void LLCallFloater::onChange() +void LLCallFloater::onParticipantsChanged() { - // *FIX: Temporarily dumping this here till I decide where it should go - updateVoiceFont(); - if (NULL == mParticipants) return; updateParticipantsVoiceState(); @@ -226,42 +225,23 @@ void LLCallFloater::onChange() } } -////////////////////////////////////////////////////////////////////////// -/// 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::updateVoiceFont() +// virtual +void LLCallFloater::onVoiceFontsChanged() { if (mVoiceFont) { mVoiceFont->removeall(); mVoiceFont->add(getString("no_voice_font"), LLUUID::null); - if (LLVoiceClient::getInstance()->hasVoiceFonts()) + if (LLVoiceClient::instance().hasVoiceFonts()) { - const LLVoiceClient::voice_font_list_t font_list = LLVoiceClient::getInstance()->getVoiceFontList(); - + const LLVoiceClient::voice_font_list_t font_list = LLVoiceClient::instance().getVoiceFontList(); for (LLVoiceClient::voice_font_list_t::const_iterator it = font_list.begin(); it != font_list.end(); ++it) { mVoiceFont->add(*(it->first), *(it->second), ADD_BOTTOM); } mVoiceFont->setEnabled(true); - mVoiceFont->setValue(LLVoiceClient::getInstance()->getVoiceFont()); + mVoiceFont->setValue(LLVoiceClient::instance().getVoiceFont()); } else { @@ -270,6 +250,25 @@ void LLCallFloater::updateVoiceFont() } } +////////////////////////////////////////////////////////////////////////// +/// 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(); @@ -334,7 +333,7 @@ void LLCallFloater::updateSession() } updateTitle(); - + //hide "Leave Call" button for nearby chat bool is_local_chat = mVoiceType == VC_LOCAL_CHAT; childSetVisible("leave_call_btn_panel", !is_local_chat); @@ -787,9 +786,6 @@ void LLCallFloater::updateState(const LLVoiceChannel::EState& new_state) { reset(new_state); } - - // *FIX: Dumped here till I decide where to put it - updateVoiceFont(); } void LLCallFloater::reset(const LLVoiceChannel::EState& new_state) -- cgit v1.2.3 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.2.3 From 7a6474129c6015e102b30570fa474ba48e4c85e0 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Fri, 30 Apr 2010 19:38:52 +0100 Subject: Move the Voice Font control from LLCallFloater to its own panel so that it can be reused. --- indra/newview/llcallfloater.cpp | 57 +++++------------------------------------ 1 file changed, 6 insertions(+), 51 deletions(-) (limited to 'indra/newview/llcallfloater.cpp') diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 37e551890a..1c03fbde41 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -52,7 +52,7 @@ #include "lltransientfloatermgr.h" #include "llviewerwindow.h" #include "llvoicechannel.h" -#include "llvoiceclient.h" // for Voice font list types +#include "llviewercontrol.h" #include "llviewerparcelmgr.h" static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids); @@ -106,7 +106,6 @@ LLCallFloater::LLCallFloater(const LLSD& key) , mNonAvatarCaller(NULL) , mVoiceType(VC_LOCAL_CHAT) , mAgentPanel(NULL) -, mVoiceFont(NULL) , mSpeakingIndicator(NULL) , mIsModeratorMutedVoice(false) , mInitParticipantsVoiceState(false) @@ -115,10 +114,7 @@ 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)); + LLVoiceClient::instance().addObserver(this); LLTransientFloaterMgr::getInstance()->addControlView(this); // force docked state since this floater doesn't save it between recreations @@ -138,8 +134,7 @@ LLCallFloater::~LLCallFloater() if(LLVoiceClient::instanceExists()) { - LLVoiceClient::instance().removeObserver(dynamic_cast(this)); - LLVoiceClient::instance().removeObserver(dynamic_cast(this)); + LLVoiceClient::instance().removeObserver(this); } LLTransientFloaterMgr::getInstance()->removeControlView(this); } @@ -153,7 +148,6 @@ BOOL LLCallFloater::postBuild() childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this)); - mVoiceFont = getChild("voice_font"); mNonAvatarCaller = getChild("non_avatar_caller"); mNonAvatarCaller->setVisible(FALSE); @@ -225,12 +219,6 @@ void LLCallFloater::onParticipantsChanged() } } -// virtual -void LLCallFloater::onVoiceFontsChanged() -{ - updateVoiceFont(); -} - ////////////////////////////////////////////////////////////////////////// /// PRIVATE SECTION ////////////////////////////////////////////////////////////////////////// @@ -244,38 +232,6 @@ void LLCallFloater::leaveCall() } } -void LLCallFloater::onCommitVoiceFont() -{ - if (LLVoiceClient::instance().hasVoiceFonts()) - { - LLVoiceClient::getInstance()->setVoiceFont(mVoiceFont->getValue()); - } -} - -void LLCallFloater::updateVoiceFont() -{ - if (mVoiceFont) - { - mVoiceFont->removeall(); - mVoiceFont->add(getString("no_voice_font"), LLUUID::null); - - if (LLVoiceClient::instance().hasVoiceFonts()) - { - const LLVoiceClient::voice_font_list_t font_list = LLVoiceClient::instance().getVoiceFontList(); - for (LLVoiceClient::voice_font_list_t::const_iterator it = font_list.begin(); it != font_list.end(); ++it) - { - mVoiceFont->add(*(it->first), *(it->second), ADD_BOTTOM); - } - mVoiceFont->setEnabled(true); - mVoiceFont->setValue(LLVoiceClient::instance().getVoiceFont()); - } - else - { - mVoiceFont->setEnabled(false); - } - } -} - void LLCallFloater::updateSession() { LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); @@ -333,23 +289,22 @@ void LLCallFloater::updateSession() if (NULL == mSpeakerManager) { - // by default let show nearby chat participants + // By default show nearby chat participants mSpeakerManager = LLLocalSpeakerMgr::getInstance(); lldebugs << "Set DEFAULT speaker manager" << llendl; mVoiceType = VC_LOCAL_CHAT; } updateTitle(); - updateVoiceFont(); - //hide "Leave Call" button for nearby chat + // Hide "Leave Call" button for nearby chat bool is_local_chat = mVoiceType == VC_LOCAL_CHAT; childSetVisible("leave_call_btn_panel", !is_local_chat); refreshParticipantList(); updateAgentModeratorState(); - //show floater for voice calls & only in CONNECTED to voice channel state + // Show floater for voice calls & only in CONNECTED to voice channel state if (!is_local_chat && voice_channel && LLVoiceChannel::STATE_CONNECTED == voice_channel->getState()) -- cgit v1.2.3