From d85464bb3304a112f1dd766428889a919c5715e2 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Mon, 24 May 2010 16:21:56 +0100 Subject: EXT-7138 WIP Don't rebuild the voice effect combo list every time a different effect is selected. Added a notification on receiving new voice effects. --- indra/newview/llpanelvoiceeffect.cpp | 54 +++++++++++++--------- indra/newview/llpanelvoiceeffect.h | 2 +- indra/newview/llvoicevivox.cpp | 7 +++ .../newview/skins/default/xui/en/notifications.xml | 11 +++++ 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp index 4f73f38edc..f4f0ea3ee7 100644 --- a/indra/newview/llpanelvoiceeffect.cpp +++ b/indra/newview/llpanelvoiceeffect.cpp @@ -72,7 +72,7 @@ BOOL LLPanelVoiceEffect::postBuild() effect_interface->addObserver(this); } - update(); + update(true); return TRUE; } @@ -112,39 +112,49 @@ void LLPanelVoiceEffect::onCommitVoiceEffect() // virtual void LLPanelVoiceEffect::onVoiceEffectChanged(bool effect_list_updated) { - update(); + update(effect_list_updated); } -void LLPanelVoiceEffect::update() +void LLPanelVoiceEffect::update(bool list_updated) { if (mVoiceEffectCombo) { LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface(); - if (!effect_interface || !LLVoiceClient::instance().isVoiceWorking()) + if (list_updated) { - mVoiceEffectCombo->setEnabled(false); - return; - } - - mVoiceEffectCombo->removeall(); - mVoiceEffectCombo->add(getString("no_voice_effect"), LLUUID::null); - mVoiceEffectCombo->addSeparator(); + // Add the default "No Voice Effect" entry. + mVoiceEffectCombo->removeall(); + mVoiceEffectCombo->add(getString("no_voice_effect"), LLUUID::null); + mVoiceEffectCombo->addSeparator(); - const voice_effect_list_t& effect_list = effect_interface->getVoiceEffectList(); - if (!effect_list.empty()) - { - for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it) + // Add entries for each Voice Effect. + const voice_effect_list_t& effect_list = effect_interface->getVoiceEffectList(); + if (!effect_list.empty()) { - mVoiceEffectCombo->add(it->first, it->second, ADD_BOTTOM); + for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it) + { + mVoiceEffectCombo->add(it->first, it->second, ADD_BOTTOM); + } + + mVoiceEffectCombo->addSeparator(); } - mVoiceEffectCombo->addSeparator(); + // Add the fixed entries to go to the preview floater or marketing page. + mVoiceEffectCombo->add(getString("preview_voice_effects"), PREVIEW_VOICE_EFFECTS); + mVoiceEffectCombo->add(getString("get_voice_effects"), GET_VOICE_EFFECTS); } - mVoiceEffectCombo->add(getString("preview_voice_effects"), PREVIEW_VOICE_EFFECTS); - mVoiceEffectCombo->add(getString("get_voice_effects"), GET_VOICE_EFFECTS); - - mVoiceEffectCombo->setValue(effect_interface->getVoiceEffect()); - mVoiceEffectCombo->setEnabled(true); + if (effect_interface && LLVoiceClient::instance().isVoiceWorking()) + { + // Select the current voice effect. + mVoiceEffectCombo->setValue(effect_interface->getVoiceEffect()); + mVoiceEffectCombo->setEnabled(true); + } + else + { + // If voice isn't working or Voice Effects are not supported disable the control. + mVoiceEffectCombo->setValue(LLUUID::null); + mVoiceEffectCombo->setEnabled(false); + } } } diff --git a/indra/newview/llpanelvoiceeffect.h b/indra/newview/llpanelvoiceeffect.h index bd7bdd04f2..235db5a9e4 100644 --- a/indra/newview/llpanelvoiceeffect.h +++ b/indra/newview/llpanelvoiceeffect.h @@ -53,7 +53,7 @@ public: private: void onCommitVoiceEffect(); - void update(); + void update(bool list_updated); /// Called by voice effect provider when voice effect list is changed. virtual void onVoiceEffectChanged(bool effect_list_updated); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 070e4f0d2d..17f4b661be 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6857,6 +6857,13 @@ void LLVivoxVoiceClient::accountGetSessionFontsResponse(int statusCode, const st } mVoiceFontsReceived = true; + // If new Voice Fonts have been found notify the user. + if (mVoiceFontsNew) + { + LLNotificationsUtil::add("VoiceEffectsNew"); + mVoiceFontsNew = false; + } + notifyVoiceFontObservers(true); } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 6b5659f6c0..b997dee30c 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5988,6 +5988,17 @@ Voice Effects will expire in less than [INTERVAL] days. [[URL] Renew your subscription] or they will be removed. + LLNotificationsUtil::add("VoiceEffectsNew"); + + +New Voice Effects are available! + +