diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 110 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.h | 41 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.h | 2 | ||||
-rw-r--r-- | indra/newview/llpaneleditwater.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llpaneleditwater.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.h | 19 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 14 |
9 files changed, 194 insertions, 51 deletions
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 0b4de90703..6f7bd85699 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -69,6 +69,7 @@ namespace const std::string ACTION_SAVE("save_settings"); const std::string ACTION_SAVEAS("save_as_new_settings"); + const std::string ACTION_COMMIT("commit_changes"); const std::string ACTION_APPLY_LOCAL("apply_local"); const std::string ACTION_APPLY_PARCEL("apply_parcel"); const std::string ACTION_APPLY_REGION("apply_region"); @@ -85,7 +86,8 @@ LLFloaterFixedEnvironment::LLFloaterFixedEnvironment(const LLSD &key) : LLFloater(key), mFlyoutControl(nullptr), mInventoryId(), - mInventoryItem(nullptr) + mInventoryItem(nullptr), + mIsDirty(false) { } @@ -108,6 +110,7 @@ BOOL LLFloaterFixedEnvironment::postBuild() mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); + mFlyoutControl->setMenuItemVisible(ACTION_COMMIT, false); return TRUE; } @@ -191,6 +194,24 @@ void LLFloaterFixedEnvironment::syncronizeTabs() } } +LLFloaterSettingsPicker * LLFloaterFixedEnvironment::getSettingsPicker() +{ + LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get()); + + // Show the dialog + if (!picker) + { + picker = new LLFloaterSettingsPicker(this, + LLUUID::null, "SELECT SETTINGS"); + + mInventoryFloater = picker->getHandle(); + + picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitSetting(data.asUUID()); }); + } + + return picker; +} + void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId) { if (inventoryId.isNull()) @@ -231,6 +252,30 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId) [this](LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); }); } + +void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnvironment::on_confirm_fn cb) +{ + if (isDirty()) + { + LLSD args(LLSDMap("TYPE", mSettings->getSettingsType()) + ("NAME", mSettings->getName())); + + // create and show confirmation textbox + LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), + [this, cb](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + cb(); + }); + } + else if (cb) + { + cb(); + } + +} + void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID asset_id) { LLSettingsVOBase::getSettingsAsset(asset_id, @@ -257,11 +302,12 @@ void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::p void LLFloaterFixedEnvironment::onNameChanged(const std::string &name) { mSettings->setName(name); + setDirtyFlag(); } void LLFloaterFixedEnvironment::onButtonImport() { - doImportFromDisk(); + checkAndConfirmSettingsLoss([this](){ doImportFromDisk(); }); } void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) @@ -290,29 +336,12 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) void LLFloaterFixedEnvironment::onButtonCancel() { - // *TODO*: If changed issue a warning? - this->closeFloater(); + checkAndConfirmSettingsLoss([this](){ closeFloater(); }); } void LLFloaterFixedEnvironment::onButtonLoad() { - // LLUI::sWindow->setCursor(UI_CURSOR_WAIT); - LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get()); - - // Show the dialog - if (!picker) - { - picker = new LLFloaterSettingsPicker(this, - LLUUID::null, "SELECT SETTINGS"); - - mInventoryFloater = picker->getHandle(); - - picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitSetting(data.asUUID()); }); - } - - picker->setSettingsFilter(mSettings->getSettingsTypeValue()); - picker->openFloater(); - picker->setFocus(TRUE); + checkAndConfirmSettingsLoss([this](){ doSelectFromInventory(); }); } void LLFloaterFixedEnvironment::doApplyCreateNewInventory() @@ -396,6 +425,7 @@ void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inven return; } + clearDirtyFlag(); setFocus(TRUE); // Call back the focus... loadInventoryItem(inventory_id); } @@ -404,12 +434,29 @@ void LLFloaterFixedEnvironment::onInventoryUpdated(LLUUID asset_id, LLUUID inven { LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL; + clearDirtyFlag(); if (inventory_id != mInventoryId) { loadInventoryItem(inventory_id); } } + +void LLFloaterFixedEnvironment::doSelectFromInventory() +{ + LLFloaterSettingsPicker *picker = getSettingsPicker(); + + picker->setSettingsFilter(mSettings->getSettingsTypeValue()); + picker->openFloater(); + picker->setFocus(TRUE); +} + +void LLFloaterFixedEnvironment::onPanelDirtyFlagChanged(bool value) +{ + if (value) + setDirtyFlag(); +} + //------------------------------------------------------------------------- bool LLFloaterFixedEnvironment::canUseInventory() const { @@ -452,6 +499,7 @@ BOOL LLFloaterFixedEnvironmentWater::postBuild() panel = new LLPanelSettingsWaterMainTab; panel->buildFromFile("panel_settings_water.xml"); panel->setWater(std::static_pointer_cast<LLSettingsWater>(mSettings)); + panel->setOnDirtyFlagChanged( [this] (LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); return TRUE; @@ -477,11 +525,6 @@ void LLFloaterFixedEnvironmentWater::onOpen(const LLSD& key) LLFloaterFixedEnvironment::onOpen(key); } -void LLFloaterFixedEnvironmentWater::onClose(bool app_quitting) -{ - LLFloaterFixedEnvironment::onClose(app_quitting); -} - void LLFloaterFixedEnvironmentWater::doImportFromDisk() { // Load a a legacy Windlight XML from disk. @@ -500,8 +543,9 @@ void LLFloaterFixedEnvironmentWater::doImportFromDisk() return; } + clearDirtyFlag(); LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacywater); - this->setEditSettings(legacywater); + setEditSettings(legacywater); LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST, true); } } @@ -520,16 +564,19 @@ BOOL LLFloaterFixedEnvironmentSky::postBuild() panel = new LLPanelSettingsSkyAtmosTab; panel->buildFromFile("panel_settings_sky_atmos.xml"); panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings)); + panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); panel = new LLPanelSettingsSkyCloudTab; panel->buildFromFile("panel_settings_sky_clouds.xml"); panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings)); + panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); panel = new LLPanelSettingsSkySunMoonTab; panel->buildFromFile("panel_settings_sky_sunmoon.xml"); panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings)); + panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); return TRUE; @@ -553,12 +600,6 @@ void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key) } LLFloaterFixedEnvironment::onOpen(key); - -} - -void LLFloaterFixedEnvironmentSky::onClose(bool app_quitting) -{ - LLFloaterFixedEnvironment::onClose(app_quitting); } void LLFloaterFixedEnvironmentSky::doImportFromDisk() @@ -580,8 +621,9 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk() return; } + clearDirtyFlag(); LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacysky); - this->setEditSettings(legacysky); + setEditSettings(legacysky); LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST, true); } } diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index f3b14c2daf..b610aef5f7 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -32,9 +32,12 @@ #include "llflyoutcombobtn.h" #include "llinventory.h" +#include "boost/signals2.hpp" + class LLTabContainer; class LLButton; class LLLineEditor; +class LLFloaterSettingsPicker; /** * Floater container for creating and editing fixed environment settings. @@ -56,16 +59,24 @@ public: virtual void onFocusReceived() override; virtual void onFocusLost() override; - void setEditSettings(const LLSettingsBase::ptr_t &settings) { mSettings = settings; syncronizeTabs(); refresh(); } + void setEditSettings(const LLSettingsBase::ptr_t &settings) { mSettings = settings; clearDirtyFlag(); syncronizeTabs(); refresh(); } LLSettingsBase::ptr_t getEditSettings() const { return mSettings; } + virtual BOOL isDirty() const override { return getIsDirty(); } + protected: + typedef std::function<void()> on_confirm_fn; + virtual void updateEditEnvironment() = 0; virtual void refresh() override; virtual void syncronizeTabs(); + LLFloaterSettingsPicker *getSettingsPicker(); + void loadInventoryItem(const LLUUID &inventoryId); + void checkAndConfirmSettingsLoss(on_confirm_fn cb); + LLTabContainer * mTab; LLLineEditor * mTxtName; @@ -90,6 +101,13 @@ protected: void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); + bool getIsDirty() const { return mIsDirty; } + void setDirtyFlag() { mIsDirty = true; } + virtual void clearDirtyFlag() { mIsDirty = false; } + + void doSelectFromInventory(); + void onPanelDirtyFlagChanged(bool); + private: void onNameChanged(const std::string &name); @@ -100,6 +118,8 @@ private: void onPickerCommitSetting(LLUUID asset_id); void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status); + + bool mIsDirty; }; class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment @@ -112,7 +132,6 @@ public: BOOL postBuild() override; virtual void onOpen(const LLSD& key) override; - virtual void onClose(bool app_quitting) override; protected: virtual void updateEditEnvironment() override; @@ -132,7 +151,6 @@ public: BOOL postBuild() override; virtual void onOpen(const LLSD& key) override; - virtual void onClose(bool app_quitting) override; protected: virtual void updateEditEnvironment() override; @@ -147,13 +165,26 @@ class LLSettingsEditPanel : public LLPanel public: virtual void setSettings(const LLSettingsBase::ptr_t &) = 0; -// virtual void refresh() override; + typedef boost::signals2::signal<void(LLPanel *, bool)> on_dirty_charged_sg; + typedef boost::signals2::connection connection_t; + + inline bool getIsDirty() const { return mIsDirty; } + inline void setIsDirty() { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } + inline void clearIsDirty() { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } + + inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb) { return mOnDirtyChanged.connect(cb); } protected: LLSettingsEditPanel() : - LLPanel() + LLPanel(), + mIsDirty(false), + mOnDirtyChanged() {} +private: + bool mIsDirty; + + on_dirty_charged_sg mOnDirtyChanged; }; #endif // LL_FLOATERFIXEDENVIRONMENT_H diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index cb303b7ee2..59dc7c8a2d 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -156,46 +156,64 @@ void LLPanelSettingsSkyAtmosTab::refresh() void LLPanelSettingsSkyAtmosTab::onAmbientLightChanged() { mSkySettings->setAmbientColor(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_AMBIENT_LIGHT)->get() * SLIDER_SCALE_SUN_AMBIENT)); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onBlueHorizonChanged() { mSkySettings->setBlueHorizon(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_HORIZON)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY)); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onBlueDensityChanged() { mSkySettings->setBlueDensity(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_DENSITY)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY)); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onHazeHorizonChanged() { mSkySettings->setHazeHorizon(getChild<LLUICtrl>(FIELD_SKY_HAZE_HORIZON)->getValue().asReal()); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onHazeDensityChanged() { mSkySettings->setHazeDensity(getChild<LLUICtrl>(FIELD_SKY_HAZE_DENSITY)->getValue().asReal()); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onSceneGammaChanged() { mSkySettings->setGamma(getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->getValue().asReal()); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onDensityMultipChanged() { mSkySettings->setDensityMultiplier(getChild<LLUICtrl>(FIELD_SKY_DENSITY_MULTIP)->getValue().asReal()); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onDistanceMultipChanged() { mSkySettings->setDistanceMultiplier(getChild<LLUICtrl>(FIELD_SKY_DISTANCE_MULTIP)->getValue().asReal()); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyAtmosTab::onMaxAltChanged() { mSkySettings->setMaxY(getChild<LLUICtrl>(FIELD_SKY_MAX_ALT)->getValue().asReal()); + mSkySettings->update(); + setIsDirty(); } //========================================================================== @@ -279,16 +297,21 @@ void LLPanelSettingsSkyCloudTab::refresh() void LLPanelSettingsSkyCloudTab::onCloudColorChanged() { mSkySettings->setCloudColor(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_CLOUD_COLOR)->get())); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyCloudTab::onCloudCoverageChanged() { mSkySettings->setCloudShadow(getChild<LLUICtrl>(FIELD_SKY_CLOUD_COVERAGE)->getValue().asReal()); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkyCloudTab::onCloudScaleChanged() { mSkySettings->setCloudScale(getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCALE)->getValue().asReal()); + setIsDirty(); } void LLPanelSettingsSkyCloudTab::onCloudScrollChanged() @@ -296,11 +319,13 @@ void LLPanelSettingsSkyCloudTab::onCloudScrollChanged() LLVector2 scroll(getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_XY)->getValue()); scroll += CLOUD_SCROLL_ADJUST; mSkySettings->setCloudScrollRate(scroll); + setIsDirty(); } void LLPanelSettingsSkyCloudTab::onCloudMapChanged() { mSkySettings->setCloudNoiseTextureId(getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->getValue().asUUID()); + setIsDirty(); } void LLPanelSettingsSkyCloudTab::onCloudDensityChanged() @@ -310,6 +335,7 @@ void LLPanelSettingsSkyCloudTab::onCloudDensityChanged() getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_D)->getValue().asReal()); mSkySettings->setCloudPosDensity1(density); + setIsDirty(); } void LLPanelSettingsSkyCloudTab::onCloudDetailChanged() @@ -319,6 +345,7 @@ void LLPanelSettingsSkyCloudTab::onCloudDetailChanged() getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_D)->getValue().asReal()); mSkySettings->setCloudPosDensity2(detail); + setIsDirty(); } //========================================================================== @@ -398,6 +425,8 @@ void LLPanelSettingsSkySunMoonTab::onSunMoonColorChanged() color *= SLIDER_SCALE_SUN_AMBIENT; mSkySettings->setSunlightColor(color); + mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onGlowChanged() @@ -409,46 +438,54 @@ void LLPanelSettingsSkySunMoonTab::onGlowChanged() mSkySettings->setGlow(glow); mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onStarBrightnessChanged() { mSkySettings->setStarBrightness(getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->getValue().asReal()); mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onSunRotationChanged() { mSkySettings->setSunRotation(getChild<LLVirtualTrackball>(FIELD_SKY_SUN_ROTATION)->getRotation()); mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onSunScaleChanged() { mSkySettings->setSunScale((getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->getValue().asReal())); mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onSunImageChanged() { mSkySettings->setSunTextureId(getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->getValue().asUUID()); mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onMoonRotationChanged() { mSkySettings->setMoonRotation(getChild<LLVirtualTrackball>(FIELD_SKY_MOON_ROTATION)->getRotation()); mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onMoonImageChanged() { mSkySettings->setMoonTextureId(getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->getValue().asUUID()); mSkySettings->update(); + setIsDirty(); } void LLPanelSettingsSkySunMoonTab::onMoonScaleChanged() { mSkySettings->setMoonScale((getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->getValue().asReal())); mSkySettings->update(); + setIsDirty(); } diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h index f0cfc0dab7..ae4f433955 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -48,7 +48,7 @@ public: virtual void setSettings(const LLSettingsBase::ptr_t &settings) override { setSky(std::static_pointer_cast<LLSettingsSky>(settings)); } LLSettingsSky::ptr_t getSky() const { return mSkySettings; } - void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; refresh(); } + void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; clearIsDirty(); refresh(); } protected: LLSettingsSky::ptr_t mSkySettings; diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index 9d9a183ffd..bf00ee34f9 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -161,21 +161,25 @@ void LLPanelSettingsWaterMainTab::refresh() void LLPanelSettingsWaterMainTab::onFogColorChanged() { mWaterSettings->setWaterFogColor(LLColor3(mClrFogColor->get())); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onFogDensityChanged() { mWaterSettings->setWaterFogDensity(getChild<LLUICtrl>(FIELD_WATER_FOG_DENSITY)->getValue().asReal()); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onFogUnderWaterChanged() { mWaterSettings->setFogMod(getChild<LLUICtrl>(FIELD_WATER_UNDERWATER_MOD)->getValue().asReal()); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onNormalMapChanged() { mWaterSettings->setNormalMapID(mTxtNormalMap->getImageAssetID()); + setIsDirty(); } @@ -184,6 +188,7 @@ void LLPanelSettingsWaterMainTab::onLargeWaveChanged() LLVector2 vect(getChild<LLUICtrl>(FIELD_WATER_WAVE1_XY)->getValue()); LL_WARNS("LAPRAS") << "Changing Large Wave from " << mWaterSettings->getWave1Dir() << " -> " << vect << LL_ENDL; mWaterSettings->setWave1Dir(vect); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onSmallWaveChanged() @@ -191,6 +196,7 @@ void LLPanelSettingsWaterMainTab::onSmallWaveChanged() LLVector2 vect(getChild<LLUICtrl>(FIELD_WATER_WAVE2_XY)->getValue()); LL_WARNS("LAPRAS") << "Changing Small Wave from " << mWaterSettings->getWave2Dir() << " -> " << vect << LL_ENDL; mWaterSettings->setWave2Dir(vect); + setIsDirty(); } @@ -199,29 +205,35 @@ void LLPanelSettingsWaterMainTab::onNormalScaleChanged() LLVector3 vect(getChild<LLUICtrl>(FIELD_WATER_NORMAL_SCALE_X)->getValue().asReal(), getChild<LLUICtrl>(FIELD_WATER_NORMAL_SCALE_Y)->getValue().asReal(), getChild<LLUICtrl>(FIELD_WATER_NORMAL_SCALE_Z)->getValue().asReal()); LL_WARNS("LAPRAS") << "Changing normal scale from " << mWaterSettings->getNormalScale() << " -> " << vect << LL_ENDL; mWaterSettings->setNormalScale(vect); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onFresnelScaleChanged() { mWaterSettings->setFresnelScale(getChild<LLUICtrl>(FIELD_WATER_FRESNEL_SCALE)->getValue().asReal()); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onFresnelOffsetChanged() { mWaterSettings->setFresnelOffset(getChild<LLUICtrl>(FIELD_WATER_FRESNEL_OFFSET)->getValue().asReal()); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onScaleAboveChanged() { mWaterSettings->setScaleAbove(getChild<LLUICtrl>(FIELD_WATER_SCALE_ABOVE)->getValue().asReal()); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onScaleBelowChanged() { mWaterSettings->setScaleBelow(getChild<LLUICtrl>(FIELD_WATER_SCALE_BELOW)->getValue().asReal()); + setIsDirty(); } void LLPanelSettingsWaterMainTab::onBlurMultipChanged() { mWaterSettings->setBlurMultiplier(getChild<LLUICtrl>(FIELD_WATER_BLUR_MULTIP)->getValue().asReal()); + setIsDirty(); } diff --git a/indra/newview/llpaneleditwater.h b/indra/newview/llpaneleditwater.h index 5a04f98b05..ab2dc47bcc 100644 --- a/indra/newview/llpaneleditwater.h +++ b/indra/newview/llpaneleditwater.h @@ -49,7 +49,7 @@ public: virtual void setSettings(const LLSettingsBase::ptr_t &settings) override { setWater(std::static_pointer_cast<LLSettingsWater>(settings)); } LLSettingsWater::ptr_t getWater() const { return mWaterSettings; } - void setWater(const LLSettingsWater::ptr_t &water) { mWaterSettings = water; refresh(); } + void setWater(const LLSettingsWater::ptr_t &water) { mWaterSettings = water; clearIsDirty(); refresh(); } protected: LLSettingsWater::ptr_t mWaterSettings; diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 971f12c7e7..6a0c784708 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -44,17 +44,16 @@ class LLPanelEnvironmentInfo : public LLPanel public: LLPanelEnvironmentInfo(); - // LLPanel virtual BOOL postBuild() override; virtual void onOpen(const LLSD& key) override; - // LLView + virtual BOOL isDirty() const override { return getIsDirty(); } virtual void onVisibilityChange(BOOL new_visibility) override; virtual void refresh() override; - S32 getCurrentParcelId() const { return mCurrentParcelId; } - void setCurrentParcelId(S32 parcel_id) { mCurrentParcelId = parcel_id; } + S32 getCurrentParcelId() const { return mCurrentParcelId; } + void setCurrentParcelId(S32 parcel_id) { mCurrentParcelId = parcel_id; } virtual bool isRegion() const = 0; virtual LLParcel * getParcel() = 0; @@ -95,9 +94,9 @@ protected: void setApplyProgress(bool started); void setDirtyFlag(U32 flag); void clearDirtyFlag(U32 flag); - bool getIsDirty() const { return (mDirtyFlag != 0); } - bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); } - U32 getDirtyFlag() const { return mDirtyFlag; } + bool getIsDirty() const { return (mDirtyFlag != 0); } + bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); } + U32 getDirtyFlag() const { return mDirtyFlag; } void onSwitchDefaultSelection(); void onSldDayLengthChanged(F32 value); @@ -130,8 +129,8 @@ protected: private: static void onIdlePlay(void *); - LLHandle<LLFloater> mSettingsFloater; - LLHandle<LLFloater> mEditFloater; - S32 mDirtyFlag; + LLHandle<LLFloater> mSettingsFloater; + LLHandle<LLFloater> mEditFloater; + S32 mDirtyFlag; }; #endif // LL_LLPANELEXPERIENCES_H diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 3638cd0b44..719d682118 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -227,6 +227,14 @@ void LLSettingsVOBase::onAgentAssetUploadComplete(LLUUID itemId, LLUUID newAsset psettings->setAssetId(newAssetId); if (callback) callback( newAssetId, itemId, LLUUID::null, response ); + +#if 0 + std::string exprtFile = gDirUtilp->getTempDir() + gDirUtilp->getDirDelimiter() + newAssetId.asString() + ".llsd"; + + LLSettingsVOBase::exportFile(psettings, exprtFile, LLSDSerialize::LLSD_NOTATION); + + LL_WARNS("LAPRAS") << "SETTINGS File written as: '" << exprtFile << "'" << LL_ENDL; +#endif } void LLSettingsVOBase::onTaskAssetUploadComplete(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, LLSettingsBase::ptr_t psettings, inventory_result_fn callback) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f011fe0aaa..2ab22cb565 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -11183,5 +11183,19 @@ Settings are not supported on this region. Please move to a settings enabled region and retry your action. <tag>fail</tag> </notification> + + <notification + icon="alertmodal.tga" + name="SettingsConfirmLoss" + type="alertmodal"> +You are about to lose the changes you have made to this [TYPE] named "[NAME]". +Are you sure you want to continue? + <tag>confirm</tag> + <usetemplate + ignoretext="Are you sure you want to lose changes?" + name="okcancelignore" + notext="No" + yestext="Yes"/> + </notification> </notifications> |