From 49d60e0ded52c095c834e9ca134b67282728b389 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 1 Jul 2024 22:24:32 -0400 Subject: Reduce string temporaries from LLFloaterReg find/get --- indra/newview/llfloatersidepanelcontainer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloatersidepanelcontainer.cpp') diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 2f6d14d6b5..48547852c4 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -113,7 +113,7 @@ LLFloater* LLFloaterSidePanelContainer::getTopmostInventoryFloater() return topmost_floater; } -LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) +LLPanel* LLFloaterSidePanelContainer::openChildPanel(std::string_view panel_name, const LLSD& params) { LLView* view = findChildView(panel_name, true); if (!view) @@ -144,7 +144,7 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na return panel; } -void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& key) +void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, const LLSD& key) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); if (floaterp) @@ -153,7 +153,7 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con } } -void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key) +void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std::string_view panel_name, const LLSD& key) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); if (floaterp) @@ -162,7 +162,7 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con } } -LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name) +LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); @@ -174,7 +174,7 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, return NULL; } -LLPanel* LLFloaterSidePanelContainer::findPanel(const std::string& floater_name, const std::string& panel_name) +LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance(floater_name); -- cgit v1.2.3 From ace506cc8aec370b739b40ab2afa7c1fef4cc030 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 18 Jul 2024 07:38:36 +0300 Subject: viewer#1997 Warn user if closing appearance with unsaved changes --- indra/newview/llfloatersidepanelcontainer.cpp | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'indra/newview/llfloatersidepanelcontainer.cpp') 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(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(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; -- cgit v1.2.3 From 9827dff971807471a2c20c2342bd77c43a931e6f Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sun, 18 Aug 2024 15:40:57 -0400 Subject: Fix frequent deep findChild calls for LLFloaterSidePanelContainer main during various ui callbacks --- indra/newview/llfloatersidepanelcontainer.cpp | 28 ++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloatersidepanelcontainer.cpp') diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 6c5d2570f2..9e577c83a8 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -53,9 +53,15 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); } +bool LLFloaterSidePanelContainer::postBuild() +{ + mMainPanel = getChild(sMainPanelName); + return TRUE; +} + void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild(sMainPanelName)->onOpen(key); + mMainPanel->onOpen(key); } void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) @@ -206,10 +212,16 @@ void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std:: LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); - if (floaterp) { - return floaterp->findChild(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild(panel_name, true); + } } return NULL; @@ -218,10 +230,16 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, st LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name) { LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance(floater_name); - if (floaterp) { - return floaterp->findChild(panel_name, true); + if (panel_name == sMainPanelName) + { + return floaterp->mMainPanel; + } + else + { + return floaterp->findChild(panel_name, true); + } } return NULL; -- cgit v1.2.3 From 39d65cc1c44496889e4d41956e6576012aba6624 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sun, 18 Aug 2024 16:16:37 -0400 Subject: Fix trying to find the outfit edit panel in non-appearance-panel instances of LLFloaterSidePanelContainer --- indra/newview/llfloatersidepanelcontainer.cpp | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'indra/newview/llfloatersidepanelcontainer.cpp') diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 9e577c83a8..7bc95c2884 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -66,24 +66,26 @@ void LLFloaterSidePanelContainer::onOpen(const LLSD& key) void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); - if (panel_outfit_edit) + if(getInstanceName() == "appearance") { - LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); - if (parent == this ) + LLPanelOutfitEdit* panel_outfit_edit = findChild("panel_outfit_edit"); + if (panel_outfit_edit) { - LLSidepanelAppearance* panel_appearance = dynamic_cast(getPanel("appearance")); - if (panel_appearance) + LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); + if (parent == this) { - LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); - if (edit_wearable_ptr) - { - edit_wearable_ptr->onClose(); - } - if (!app_quitting) + LLSidepanelAppearance* panel_appearance = dynamic_cast(mMainPanel); + if (panel_appearance) { - panel_appearance->showOutfitsInventoryPanel(); + LLPanelEditWearable *edit_wearable_ptr = panel_appearance->getWearable(); + if (edit_wearable_ptr) + { + edit_wearable_ptr->onClose(); + } + if(!app_quitting) + { + panel_appearance->showOutfitsInventoryPanel(); + } } } } @@ -99,10 +101,9 @@ void LLFloaterSidePanelContainer::closeFloater(bool app_quitting) void LLFloaterSidePanelContainer::onClickCloseBtn(bool app_quitting) { - if (!app_quitting) + if (!app_quitting && getInstanceName() == "appearance") { - LLPanelOutfitEdit* panel_outfit_edit = - dynamic_cast(LLFloaterSidePanelContainer::findPanel("appearance", "panel_outfit_edit")); + LLPanelOutfitEdit* panel_outfit_edit = findChild("panel_outfit_edit"); if (panel_outfit_edit) { LLFloater* parent = gFloaterView->getParentFloater(panel_outfit_edit); -- cgit v1.2.3 From 169599fd2f211d66f80a54e13daf975229607022 Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Mon, 19 Aug 2024 23:48:07 +0200 Subject: Fix a bunch of XUI errors (#2347) * Fix a bunch of XUI errors * Change TRUE to true --- indra/newview/llfloatersidepanelcontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatersidepanelcontainer.cpp') diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 7bc95c2884..78550b6520 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -56,7 +56,7 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() bool LLFloaterSidePanelContainer::postBuild() { mMainPanel = getChild(sMainPanelName); - return TRUE; + return true; } void LLFloaterSidePanelContainer::onOpen(const LLSD& key) -- cgit v1.2.3