diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2017-03-17 10:18:31 +0200 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2017-03-17 10:18:31 +0200 |
commit | 3c637e49452229e8df3cce833a275daaef650d9c (patch) | |
tree | 1dcfb6bc96396badf54cb6c884a87e956c44772e | |
parent | bc268526b742068027da960c53815b7891bf45c7 (diff) |
MAINT-7215 Add "+" button next to filter editor in Avatar rendering settings floater
5 files changed, 94 insertions, 12 deletions
diff --git a/indra/newview/llfloateravatarrendersettings.cpp b/indra/newview/llfloateravatarrendersettings.cpp index 530b3bd481..e7ac3f2737 100644 --- a/indra/newview/llfloateravatarrendersettings.cpp +++ b/indra/newview/llfloateravatarrendersettings.cpp @@ -28,6 +28,7 @@ #include "llfloateravatarrendersettings.h" #include "llavatarnamecache.h" +#include "llfloateravatarpicker.h" #include "llfiltereditor.h" #include "llfloaterreg.h" #include "llnamelistctrl.h" @@ -71,6 +72,7 @@ LLFloaterAvatarRenderSettings::LLFloaterAvatarRenderSettings(const LLSD& key) { mContextMenu = new LLSettingsContextMenu(this); LLRenderMuteList::getInstance()->addObserver(&sAvatarRenderMuteListObserver); + mCommitCallbackRegistrar.add("Settings.AddNewEntry", boost::bind(&LLFloaterAvatarRenderSettings::onClickAdd, this, _2)); } LLFloaterAvatarRenderSettings::~LLFloaterAvatarRenderSettings() @@ -84,12 +86,20 @@ BOOL LLFloaterAvatarRenderSettings::postBuild() LLFloater::postBuild(); mAvatarSettingsList = getChild<LLNameListCtrl>("render_settings_list"); mAvatarSettingsList->setRightMouseDownCallback(boost::bind(&LLFloaterAvatarRenderSettings::onAvatarListRightClick, this, _1, _2, _3)); - + this->setVisibleCallback(boost::bind(&LLFloaterAvatarRenderSettings::removePicker, this)); getChild<LLFilterEditor>("people_filter_input")->setCommitCallback(boost::bind(&LLFloaterAvatarRenderSettings::onFilterEdit, this, _2)); return TRUE; } +void LLFloaterAvatarRenderSettings::removePicker() +{ + if(mPicker.get()) + { + mPicker.get()->closeFloater(); + } +} + void LLFloaterAvatarRenderSettings::draw() { if(mNeedsUpdate) @@ -185,15 +195,15 @@ void LLFloaterAvatarRenderSettings::onCustomAction (const LLSD& userdata, const if ("default" == command_name) { new_setting = S32(LLVOAvatar::AV_RENDER_NORMALLY); - } + } else if ("never" == command_name) - { + { new_setting = S32(LLVOAvatar::AV_DO_NOT_RENDER); } else if ("always" == command_name) - { + { new_setting = S32(LLVOAvatar::AV_ALWAYS_RENDER); - } + } LLVOAvatar *avatarp = find_avatar(av_id); if (avatarp) @@ -233,3 +243,44 @@ void LLFloaterAvatarRenderSettings::setNeedsUpdate() if(!instance) return; instance->mNeedsUpdate = true; } + +void LLFloaterAvatarRenderSettings::onClickAdd(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + S32 visual_setting = 0; + if ("never" == command_name) + { + visual_setting = S32(LLVOAvatar::AV_DO_NOT_RENDER); + } + else if ("always" == command_name) + { + visual_setting = S32(LLVOAvatar::AV_ALWAYS_RENDER); + } + + LLView * button = findChild<LLButton>("plus_btn", TRUE); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterAvatarRenderSettings::callbackAvatarPicked, this, _1, visual_setting), + FALSE, TRUE, FALSE, root_floater->getName(), button); + + if (root_floater) + { + root_floater->addDependentFloater(picker); + } + + mPicker = picker->getHandle(); +} + +void LLFloaterAvatarRenderSettings::callbackAvatarPicked(const uuid_vec_t& ids, S32 visual_setting) +{ + if (ids.empty()) return; + + LLVOAvatar *avatarp = find_avatar(ids[0]); + if (avatarp) + { + avatarp->setVisualMuteSettings(LLVOAvatar::VisualMuteSettings(visual_setting)); + } + else + { + LLRenderMuteList::getInstance()->saveVisualMuteSetting(ids[0], visual_setting); + } +} diff --git a/indra/newview/llfloateravatarrendersettings.h b/indra/newview/llfloateravatarrendersettings.h index 367b0620ac..fe727bcf32 100644 --- a/indra/newview/llfloateravatarrendersettings.h +++ b/indra/newview/llfloateravatarrendersettings.h @@ -50,15 +50,19 @@ public: void onFilterEdit(const std::string& search_string); void onCustomAction (const LLSD& userdata, const LLUUID& av_id); bool isActionChecked(const LLSD& userdata, const LLUUID& av_id); + void onClickAdd(const LLSD& userdata); static void setNeedsUpdate(); private: bool isHiddenRow(const std::string& av_name); + void callbackAvatarPicked(const uuid_vec_t& ids, S32 visual_setting); + void removePicker(); bool mNeedsUpdate; LLListContextMenu* mContextMenu; LLNameListCtrl* mAvatarSettingsList; + LLHandle<LLFloater> mPicker; std::string mNameFilter; }; diff --git a/indra/newview/skins/default/xui/en/floater_avatar_render_settings.xml b/indra/newview/skins/default/xui/en/floater_avatar_render_settings.xml index dd37e329e5..03e812d36d 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar_render_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar_render_settings.xml @@ -23,22 +23,33 @@ height="23" layout="topleft" left="8" - right="-8" + right="-47" label="Filter People" max_length_chars="300" name="people_filter_input" text_color="Black" text_pad_left="10" top="4" /> + <menu_button + follows="top|right" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="AddItem_Off" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + layout="topleft" + left_pad="7" + menu_filename="menu_avatar_rendering_settings_add.xml" + menu_position="bottomleft" + name="plus_btn" + tool_tip="Actions on selected person" + top="3" + width="31" /> <name_list - allow_select="true" bottom="-8" draw_heading="true" - opaque="true" follows="all" left="8" - keep_selection_visible_on_reshape="true" - item_pad="2" multi_select="false" name="render_settings_list" right="-8" diff --git a/indra/newview/skins/default/xui/en/menu_avatar_rendering_settings_add.xml b/indra/newview/skins/default/xui/en/menu_avatar_rendering_settings_add.xml new file mode 100644 index 0000000000..c64b24ed70 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_avatar_rendering_settings_add.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<toggleable_menu + name="menu_settings_add.xml" + left="0" bottom="0" visible="false" + mouse_opaque="false"> + <menu_item_call + label="Always Render a Resident..." + name="add_avatar_always_render"> + <on_click + function="Settings.AddNewEntry" parameter="always"/> + </menu_item_call> + <menu_item_call + label="Never Render a Resident..." + name="add_avatar_never_render"> + <on_click + function="Settings.AddNewEntry" parameter="never"/> + </menu_item_call> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 652b7fd029..4692a226d9 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -303,8 +303,6 @@ name="AlwaysRenderFriends" top_delta="24" width="256"> - <check_box.commit_callback - function="Pref.RenderFriends" /> </check_box> <button height="23" |