SL-10957 [EEP] Add Reset button to revert to shared environment

meow-7.2.2
maxim_productengine 2019-04-16 16:26:52 +03:00
parent 479385c97f
commit cc70bf9ea0
4 changed files with 47 additions and 3 deletions

View File

@ -28,6 +28,7 @@
#include "llfloaterenvironmentadjust.h"
#include "llnotificationsutil.h"
#include "llslider.h"
#include "llsliderctrl.h"
#include "llcolorswatch.h"
@ -53,6 +54,7 @@ namespace
const std::string FIELD_SKY_GLOW_SIZE("glow_size");
const std::string FIELD_SKY_STAR_BRIGHTNESS("star_brightness");
const std::string FIELD_SKY_MOON_ROTATION("moon_rotation");
const std::string BTN_RESET("btn_reset");
const F32 SLIDER_SCALE_SUN_AMBIENT(3.0f);
const F32 SLIDER_SCALE_BLUE_HORIZON_DENSITY(2.0f);
@ -93,6 +95,7 @@ BOOL LLFloaterEnvironmentAdjust::postBuild()
getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunScaleChanged(); });
getChild<LLUICtrl>(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); });
getChild<LLUICtrl>(BTN_RESET)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onButtonReset(); });
refresh();
return TRUE;
@ -184,6 +187,22 @@ void LLFloaterEnvironmentAdjust::captureCurrentEnvironment()
}
void LLFloaterEnvironmentAdjust::onButtonReset()
{
LLNotificationsUtil::add("PersonalSettingsConfirmReset", LLSD(), LLSD(),
[this](const LLSD&notif, const LLSD&resp)
{
S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
if (opt == 0)
{
this->closeFloater();
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().updateEnvironment();
}
});
}
//-------------------------------------------------------------------------
void LLFloaterEnvironmentAdjust::onAmbientLightChanged()
{

View File

@ -77,6 +77,8 @@ private:
void onMoonRotationChanged();
void onButtonReset();
void onEnvironmentUpdated(LLEnvironment::EnvSelection_t env, S32 version);
LLSettingsSky::ptr_t mLiveSky;

View File

@ -5,14 +5,14 @@
save_rect="false"
title="Personal Lighting"
width="845"
height="225"
height="230"
min_width="500"
min_height="225"
single_instance="true"
can_resize="false">
<layout_stack name="outer_stack"
width="845"
height="212"
height="220"
follows="all"
animate="false"
top="0"
@ -84,6 +84,16 @@
name="blue_density"
top_pad="5"
width="60"/>
<button
follows="left|top"
height="23"
label="Reset"
tool_tip="Close and reset to Shared Environment"
layout="topleft"
name="btn_reset"
left_delta="-2"
top_pad="10"
width="100"/>
<text follows="right|top"
height="10"
layout="topleft"

View File

@ -11345,7 +11345,20 @@ Are you sure you want to continue?
notext="No"
yestext="Yes"/>
</notification>
<notification
icon="alertmodal.tga"
name="PersonalSettingsConfirmReset"
type="alertmodal">
You are about to remove all applied Personal lighting settings.
Are you sure you want to continue?
<tag>confirm</tag>
<usetemplate
name="okcancelbuttons"
notext="No"
yestext="Yes"/>
</notification>
<notification
icon="alertmodal.tga"
name="SettingsMakeNoTrans"