EXT-7337 WIP Added template voice fonts to the voice font list for previewing

meow-7.2.2
Aimee Linden 2010-05-19 16:28:03 +01:00
parent be06622345
commit 95ed59a9de
3 changed files with 151 additions and 32 deletions

View File

@ -99,29 +99,94 @@ void LLFloaterVoiceEffect::update()
return;
}
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);
LL_DEBUGS("Voice")<< "Rebuilding voice effect list."<< LL_ENDL;
const voice_effect_list_t& effect_list = effect_interface->getVoiceEffectList();
if (!effect_list.empty())
// 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++)
{
for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it)
selected_items.push_back((*it)->getUUID());
}
mVoiceEffectList->deleteAllItems();
{
// 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)
{
LLSD element;
element["id"] = it->second;
element["columns"][1]["column"] = "name";
element["columns"][1]["value"] = it->first;
mVoiceEffectList->addElement(element, ADD_BOTTOM);
((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"] = 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);

View File

@ -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;

View File

@ -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"
@ -25,24 +28,76 @@
multi_select="false"
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>