viewer#1997 Warn user if closing appearance with unsaved changes

master
Andrey Kleshchev 2024-07-18 07:38:36 +03:00 committed by Andrey Kleshchev
parent 87b5ecf565
commit ace506cc8a
3 changed files with 62 additions and 2 deletions

View File

@ -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;

View File

@ -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

View File

@ -4261,6 +4261,20 @@ Unable to add estate manager [AGENT] to banned list.
Can&apos;t change appearance until clothing and shape are loaded.
</notification>
<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"