diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatervoiceeffect.cpp | 91 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_voice_effect.xml | 89 |
3 files changed, 150 insertions, 31 deletions
diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp index 5a579f5aeb..de12e8d12a 100644 --- a/indra/newview/llfloatervoiceeffect.cpp +++ b/indra/newview/llfloatervoiceeffect.cpp @@ -99,29 +99,94 @@ void LLFloaterVoiceEffect::update() return; } + LL_DEBUGS("Voice")<< "Rebuilding voice effect list."<< LL_ENDL; + + // Preserve selected items and scroll position + S32 scroll_pos = mVoiceEffectList->getScrollPos(); + uuid_vec_t selected_items; + std::vector<LLScrollListItem*> items = mVoiceEffectList->getAllSelected(); + for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++) + { + selected_items.push_back((*it)->getUUID()); + } + mVoiceEffectList->deleteAllItems(); - LLSD element; - element["id"] = LLUUID::null; - element["columns"][1]["column"] = "name"; - element["columns"][1]["value"] = getString("no_voice_effect"); - mVoiceEffectList->addElement(element, ADD_BOTTOM); - - 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 the "No Voice Effect" entry + LLSD element; + + element["id"] = LLUUID::null; + element["columns"][0]["column"] = "name"; + element["columns"][0]["value"] = getString("no_voice_effect"); + element["columns"][0]["font"]["name"] = "SANSSERIF"; + element["columns"][0]["font"]["style"] = "BOLD"; + + LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM); + // *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :( + if(sl_item) { + ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(LLFontGL::BOLD); + } + } + + const voice_effect_list_t& template_list = effect_interface->getVoiceEffectTemplateList(); + if (!template_list.empty()) + { + for (voice_effect_list_t::const_iterator it = template_list.begin(); it != template_list.end(); ++it) + { + const LLUUID& effect_id = it->second; + std::string effect_name = it->first; + + LLSD effect_properties = effect_interface->getVoiceEffectProperties(effect_id); + bool is_template_only = effect_properties["template_only"].asBoolean(); + bool is_new = effect_properties["is_new"].asBoolean(); + std::string expiry_date = effect_properties["expiry_date"].asString(); + + std::string font_style = "NORMAL"; + if (!is_template_only) + { + font_style = "BOLD"; + } LLSD element; - element["id"] = it->second; - element["columns"][1]["column"] = "name"; - element["columns"][1]["value"] = it->first; - mVoiceEffectList->addElement(element, ADD_BOTTOM); + element["id"] = effect_id; + + element["columns"][0]["column"] = "name"; + element["columns"][0]["value"] = effect_name; + element["columns"][0]["font"]["name"] = "SANSSERIF"; + element["columns"][0]["font"]["style"] = font_style; + element["columns"][1]["column"] = "new"; + element["columns"][1]["value"] = is_new ? getString("new_voice_effect") : ""; + element["columns"][1]["font"]["name"] = "SANSSERIF"; + element["columns"][1]["font"]["style"] = font_style; + + element["columns"][2]["column"] = "expires"; + element["columns"][2]["value"] = !is_template_only ? expiry_date : ""; + element["columns"][2]["font"]["name"] = "SANSSERIF"; + element["columns"][2]["font"]["style"] = font_style; + + LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM); + // *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :( + if(sl_item) + { + LLFontGL::StyleFlags style = is_template_only ? LLFontGL::NORMAL : LLFontGL::BOLD; + ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style); + } } } + // Re-select items that were selected before, and restore the scroll position + for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++) + { + mVoiceEffectList->selectByID(*it); + } + mVoiceEffectList->setScrollPos(scroll_pos); + mVoiceEffectList->setValue(effect_interface->getVoiceEffect()); mVoiceEffectList->setEnabled(true); + // Update button states + // *TODO: Should separate this from rebuilding the effects list, to avoid rebuilding it unnecessarily bool recording = effect_interface->isPreviewRecording(); getChild<LLButton>("record_btn")->setVisible(!recording); getChild<LLButton>("record_stop_btn")->setVisible(recording); diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 8d898378d6..5caf26c492 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -289,6 +289,7 @@ public: //@{ virtual bool setVoiceEffect(const LLUUID& id) = 0; virtual const LLUUID getVoiceEffect() = 0; + virtual LLSD getVoiceEffectProperties(const LLUUID& id) = 0; virtual void refreshVoiceEffectLists(bool clear_lists) = 0; virtual const voice_effect_list_t &getVoiceEffectList() const = 0; diff --git a/indra/newview/skins/default/xui/en/floater_voice_effect.xml b/indra/newview/skins/default/xui/en/floater_voice_effect.xml index 5627eb3aff..8f2f13dffe 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_effect.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_effect.xml @@ -16,6 +16,9 @@ <string name="no_voice_effect"> No Voice Effect </string> + <string name="new_voice_effect"> + New! + </string> <scroll_list bottom_delta="400" draw_heading="true" @@ -26,23 +29,75 @@ top="20" name="voice_effect_list"> <scroll_list.columns - label="New" - name="new" - width="48" /> - <scroll_list.columns label="Name" name="name" width="153" /> + <scroll_list.columns + label="New" + name="new" + width="48" /> <scroll_list.columns label="Expires" name="expires" width="100" /> - <scroll_list.columns - label="" - name="key" - width="-1" /> </scroll_list> - <panel + <panel + background_visible="true" + bevel_style="none" + top_pad="0" + follows="left|right|bottom" + height="30" + label="bottom_panel" + layout="topleft" + left="0" + name="bottom_panel" + width="313"> +<!-- + <menu_button + follows="bottom|left" + height="18" + image_disabled="OptionsMenu_Disabled" + image_selected="OptionsMenu_Press" + image_unselected="OptionsMenu_Off" + layout="topleft" + left="10" + menu_filename="menu_voice_effect_gear.xml" + name="gear_btn" + top="5" + tool_tip="More options" + width="18" /> +--> + <button + follows="bottom|left" + font="SansSerifBigBold" + height="18" + image_selected="AddItem_Press" + image_unselected="AddItem_Off" + image_disabled="AddItem_Disabled" + layout="topleft" + left="10" + name="new_gesture_btn" + tool_tip="Make new gesture" + top="5" + width="18" /> + <button + follows="bottom|left" + font="SansSerifBigBold" + height="10" + image_hover_selected="Activate_Checkmark" + image_selected="Activate_Checkmark" + image_unselected="Activate_Checkmark" + layout="topleft" + left_pad="5" + name="activate_btn" + tool_tip="Activate/Deactivate selected voice effect" + top="10" + width="10"> + <button.commit_callback + function="VoiceEffect.Activate" /> + </button> + </panel> +<!-- <panel background_visible="true" bevel_style="none" top_pad="0" @@ -53,7 +108,6 @@ left="0" name="bottom_panel" width="313"> -<!-- <button follows="bottom|left" font="SansSerifBigBold" @@ -70,17 +124,16 @@ <button.commit_callback function="VoiceEffect.Activate" /> </button> ---> - </panel> + </panel> --> <button follows="left|bottom" height="23" - label="Record" + label="Record Sample" layout="topleft" left="6" name="record_btn" top_pad="5" - width="83"> + width="135"> <button.commit_callback function="VoiceEffect.Record" /> </button> @@ -92,19 +145,19 @@ left_delta="0" name="record_stop_btn" top_delta="0" - width="83"> + width="135"> <button.commit_callback function="VoiceEffect.Record" /> </button> <button follows="left|bottom" height="23" - label="Play" + label="Play Preview" layout="topleft" left_pad="6" name="play_btn" top_delta="0" - width="83"> + width="135"> <button.commit_callback function="VoiceEffect.Play" /> </button> @@ -116,7 +169,7 @@ left_delta="0" name="play_stop_btn" top_delta="0" - width="83"> + width="135"> <button.commit_callback function="VoiceEffect.Play" /> </button> |