diff options
author | Aimee Linden <aimee@lindenlab.com> | 2010-05-24 16:21:56 +0100 |
---|---|---|
committer | Aimee Linden <aimee@lindenlab.com> | 2010-05-24 16:21:56 +0100 |
commit | d85464bb3304a112f1dd766428889a919c5715e2 (patch) | |
tree | 3f9dc690683776be3d8b023ecbadf93d17f26d65 /indra/newview/llpanelvoiceeffect.cpp | |
parent | c5cca5a80943a84b0b556095bcb52ed933ea4826 (diff) |
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.
Diffstat (limited to 'indra/newview/llpanelvoiceeffect.cpp')
-rw-r--r-- | indra/newview/llpanelvoiceeffect.cpp | 54 |
1 files changed, 32 insertions, 22 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); + } } } |