From 3c637e49452229e8df3cce833a275daaef650d9c Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 17 Mar 2017 10:18:31 +0200 Subject: MAINT-7215 Add "+" button next to filter editor in Avatar rendering settings floater --- indra/newview/llfloateravatarrendersettings.cpp | 61 ++++++++++++++++++++-- indra/newview/llfloateravatarrendersettings.h | 4 ++ .../xui/en/floater_avatar_render_settings.xml | 21 ++++++-- .../xui/en/menu_avatar_rendering_settings_add.xml | 18 +++++++ .../default/xui/en/panel_preferences_graphics1.xml | 2 - 5 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_avatar_rendering_settings_add.xml (limited to 'indra') 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("render_settings_list"); mAvatarSettingsList->setRightMouseDownCallback(boost::bind(&LLFloaterAvatarRenderSettings::onAvatarListRightClick, this, _1, _2, _3)); - + this->setVisibleCallback(boost::bind(&LLFloaterAvatarRenderSettings::removePicker, this)); getChild("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("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 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" /> + + + + + + + + + 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"> -