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/CMakeLists.txt | 2 + indra/newview/llcallfloater.cpp | 57 ++----------------- indra/newview/llcallfloater.h | 12 +--- indra/newview/llvoiceclient.cpp | 7 ++- .../default/xui/en/floater_voice_controls.xml | 66 +++++++--------------- 5 files changed, 36 insertions(+), 108 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 835a9aacd5..688886de3a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -350,6 +350,7 @@ set(viewer_SOURCE_FILES llpanelprofileview.cpp llpanelteleporthistory.cpp llpaneltiptoast.cpp + llpanelvoicefont.cpp llpanelvolume.cpp llpanelvolumepulldown.cpp llparcelselection.cpp @@ -857,6 +858,7 @@ set(viewer_HEADER_FILES llpanelprofileview.h llpanelteleporthistory.h llpaneltiptoast.h + llpanelvoicefont.h llpanelvolume.h llpanelvolumepulldown.h llparcelselection.h 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()) diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index 90b23eb4c4..e4341175e2 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -40,7 +40,6 @@ class LLAvatarList; class LLAvatarListItem; -class LLComboBox; class LLNonAvatarCaller; class LLOutputMonitorCtrl; class LLParticipantList; @@ -58,9 +57,7 @@ class LLSpeakersDelayActionsStorage; * When the Resident is engaged in any chat except Nearby Chat, the Voice Control Panel * also provides a 'Leave Call' button to allow the Resident to leave that voice channel. */ -class LLCallFloater : public LLTransientDockableFloater, - LLVoiceClientParticipantObserver, - LLVoiceClientFontsObserver +class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipantObserver { public: @@ -80,9 +77,6 @@ public: */ /*virtual*/ void onParticipantsChanged(); - /// Called by LLVoiceClient::notifyVoiceFontObservers when voice font list is changed. - /*virtual*/ void onVoiceFontsChanged(); - static void sOnCurrentChannelChanged(const LLUUID& session_id); private: @@ -107,9 +101,6 @@ private: void leaveCall(); - void onCommitVoiceFont(); - void updateVoiceFont(); - /** * Updates mSpeakerManager and list according to current Voice Channel * @@ -239,7 +230,6 @@ private: LLNonAvatarCaller* mNonAvatarCaller; EVoiceControls mVoiceType; LLPanel* mAgentPanel; - LLComboBox* mVoiceFont; LLOutputMonitorCtrl* mSpeakingIndicator; bool mIsModeratorMutedVoice; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 497f1db44d..007d95043d 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -7262,8 +7262,13 @@ bool LLVoiceClient::setVoiceFont(const LLUUID& id) bool LLVoiceClient::setVoiceFont(const std::string &session_handle, const LLUUID& id) { sessionState *session = findSession(session_handle); + if (!session) + { + LL_DEBUGS("Voice") << "Invalid Session." << LL_ENDL; + return false; + } - if (!session || !session->mVoiceEnabled || !hasVoiceFonts()) + if (!hasVoiceFonts()) { LL_DEBUGS("Voice") << "Voice fonts not available." << LL_ENDL; return false; 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 370bc05c28..83380577ca 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml @@ -3,7 +3,7 @@ can_resize="true" can_minimize="true" can_close="false" - height="202" + height="205" layout="topleft" min_height="124" min_width="190" @@ -35,9 +35,6 @@ name="no_one_near"> No one near has voice enabled - - No Voice Effect - + width="262"> + - +