diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-07-18 07:38:36 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-07-18 14:07:01 +0300 |
commit | ace506cc8aec370b739b40ab2afa7c1fef4cc030 (patch) | |
tree | 0de895a9769f9d4ab735ef3c8d158940a8dea99b /indra | |
parent | 87b5ecf565e78ca49b2c90478eb2c26d537e4831 (diff) |
viewer#1997 Warn user if closing appearance with unsaved changes
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatersidepanelcontainer.cpp | 41 | ||||
-rw-r--r-- | indra/newview/llfloatersidepanelcontainer.h | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 14 |
3 files changed, 62 insertions, 2 deletions
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 48547852c4..6c5d2570f2 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -28,6 +28,7 @@ #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" +#include "llnotificationsutil.h" #include "llpaneleditwearable.h" // newview includes @@ -90,6 +91,46 @@ void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) } } +void LLFloaterSidePanelContainer::onClickCloseBtn(bool app_quitting) +{ + if (!app_quitting) + { + LLPanelOutfitEdit* panel_outfit_edit = + dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); + if (panel_outfit_edit) + { + LLFloater* parent = gFloaterView->getParentFloater(panel_outfit_edit); + if (parent == this) + { + LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance")); + if (panel_appearance) + { + LLPanelEditWearable* edit_wearable_ptr = panel_appearance->getWearable(); + if (edit_wearable_ptr && edit_wearable_ptr->getVisible() && edit_wearable_ptr->isDirty()) + { + LLNotificationsUtil::add("UsavedWearableChanges", LLSD(), LLSD(), [this](const LLSD& notification, const LLSD& response) + { + onCloseMsgCallback(notification, response); + }); + return; + } + } + } + } + } + + closeFloater(); +} + +void LLFloaterSidePanelContainer::onCloseMsgCallback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + closeFloater(); + } +} + LLFloater* LLFloaterSidePanelContainer::getTopmostInventoryFloater() { LLFloater* topmost_floater = NULL; diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index 19d6c747cb..d7f6c309c4 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -49,9 +49,11 @@ public: LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams()); ~LLFloaterSidePanelContainer(); - /*virtual*/ void onOpen(const LLSD& key); + void onOpen(const LLSD& key) override; - /*virtual*/ void closeFloater(bool app_quitting = false); + void closeFloater(bool app_quitting = false) override; + + void onClickCloseBtn(bool app_qutting) override; void cleanup() { destroy(); } @@ -84,6 +86,9 @@ public: } return panel; } + +protected: + void onCloseMsgCallback(const LLSD& notification, const LLSD& response); }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3ba4f2f3e4..2c19a89fb2 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4263,6 +4263,20 @@ Can't change appearance until clothing and shape are loaded. <notification icon="alertmodal.tga" + name="UsavedWearableChanges" + type="alertmodal"> +You have unsaved changes. + <tag>group</tag> + <tag>confirm</tag> + <usetemplate + ignoretext="Confirm before I discard unsaved wearable changes" + name="okcancelignore" + notext="Keep Editing" + yestext="Discard"/> + </notification> + + <notification + icon="alertmodal.tga" name="ClassifiedMustBeAlphanumeric" type="alertmodal"> The name of your classified must start with a letter from A to Z or a number. No punctuation is allowed. |