Skip to content
Snippets Groups Projects
Commit 69df2f1b authored by prep@lindenlab.com's avatar prep@lindenlab.com
Browse files

SH-4035: Hooked up logic to handle 'me->appearance'. Refactored out some...

SH-4035: Hooked up logic to handle 'me->appearance'. Refactored out some commonly used code in llfloatersidepanelcontainer
parent c542c275
No related branches found
No related tags found
No related merge requests found
...@@ -56,30 +56,11 @@ BOOL LLFloaterSidePanelContainer::postBuild() ...@@ -56,30 +56,11 @@ BOOL LLFloaterSidePanelContainer::postBuild()
} }
void LLFloaterSidePanelContainer::onConfirmationClose( const LLSD &confirm ) void LLFloaterSidePanelContainer::onConfirmationClose( const LLSD &confirm )
{ {
/*
LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("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"));
panel_appearance->onClose(this);
}
else
{
LLFloater::onClickCloseBtn();
}
}
else
{
LLFloater::onClickCloseBtn();
}
*/
onClickCloseBtn(); onClickCloseBtn();
} }
LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer()
{ {
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this);
...@@ -92,20 +73,10 @@ void LLFloaterSidePanelContainer::onOpen(const LLSD& key) ...@@ -92,20 +73,10 @@ void LLFloaterSidePanelContainer::onOpen(const LLSD& key)
void LLFloaterSidePanelContainer::onClickCloseBtn() void LLFloaterSidePanelContainer::onClickCloseBtn()
{ {
LLPanelOutfitEdit* panel_outfit_edit = LLSidepanelAppearance* panel = getSidePanelAppearance();
dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); if ( panel )
if (panel_outfit_edit)
{ {
LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit); panel->onClose( this );
if (parent == this )
{
LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
panel_appearance->onClose(this);
}
else
{
LLFloater::onClickCloseBtn();
}
} }
else else
{ {
...@@ -114,7 +85,7 @@ void LLFloaterSidePanelContainer::onClickCloseBtn() ...@@ -114,7 +85,7 @@ void LLFloaterSidePanelContainer::onClickCloseBtn()
} }
void LLFloaterSidePanelContainer::close() void LLFloaterSidePanelContainer::close()
{ {
LLFloater::onClickCloseBtn(); LLFloater::onClickCloseBtn();
} }
LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params)
...@@ -124,7 +95,7 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na ...@@ -124,7 +95,7 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
if (!getVisible()) if (!getVisible())
{ {
openFloater(); openFloater();
} }
LLPanel* panel = NULL; LLPanel* panel = NULL;
...@@ -145,10 +116,30 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na ...@@ -145,10 +116,30 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& key) void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& key)
{ {
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name); //If we're already open then check whether anything is dirty
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
if (floaterp) if (floaterp)
{ {
floaterp->openChildPanel(sMainPanelName, key); if ( floaterp->getVisible() )
{
LLSidepanelAppearance* panel = floaterp->getSidePanelAppearance();
if ( panel )
{
if ( panel->checkForDirtyEdits() )
{
panel->onClickConfirmExitWithoutSaveIntoAppearance();
}
else
{
//or a call into some new f() that just shows inv panel?
floaterp->openChildPanel(sMainPanelName, key);
}
}
}
else
{
floaterp->openChildPanel(sMainPanelName, key);
}
} }
} }
...@@ -172,3 +163,19 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, ...@@ -172,3 +163,19 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name,
return NULL; return NULL;
} }
LLSidepanelAppearance* LLFloaterSidePanelContainer::getSidePanelAppearance()
{
LLSidepanelAppearance* panel_appearance = NULL;
LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit"));
if (panel_outfit_edit)
{
LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit);
if (parent == this )
{
panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
}
}
return panel_appearance;
}
\ No newline at end of file
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "llfloater.h" #include "llfloater.h"
class LLSidepanelAppearance;
/** /**
* Class LLFloaterSidePanelContainer * Class LLFloaterSidePanelContainer
* *
...@@ -81,6 +83,9 @@ class LLFloaterSidePanelContainer : public LLFloater ...@@ -81,6 +83,9 @@ class LLFloaterSidePanelContainer : public LLFloater
} }
return panel; return panel;
} }
private:
LLSidepanelAppearance* getSidePanelAppearance();
}; };
#endif // LL_LLFLOATERSIDEPANELCONTAINER_H #endif // LL_LLFLOATERSIDEPANELCONTAINER_H
...@@ -114,6 +114,35 @@ void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaClose() ...@@ -114,6 +114,35 @@ void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaClose()
} }
} }
bool LLSidepanelAppearance::callBackExitWithoutSaveIntoAppearance(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( option == 0 )
{
//revert current edits
mEditWearable->revertChanges();
toggleWearableEditPanel(FALSE);
LLVOAvatarSelf::onCustomizeEnd( FALSE );
//mLLFloaterSidePanelContainer->close();
showOutfitsInventoryPanel();
return true;
}
return false;
}
void LLSidepanelAppearance::onClickConfirmExitWithoutSaveIntoAppearance()
{
if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
{
LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveIntoAppearance,pSelf,_1,_2) );
}
else
{
showOutfitsInventoryPanel();
}
}
void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack() void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack()
{ {
if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !mSidePanelJustOpened /*&& !LLAppearanceMgr::getInstance()->isOutfitLocked()*/ ) if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !mSidePanelJustOpened /*&& !LLAppearanceMgr::getInstance()->isOutfitLocked()*/ )
...@@ -629,3 +658,8 @@ void LLSidepanelAppearance::updateScrollingPanelList() ...@@ -629,3 +658,8 @@ void LLSidepanelAppearance::updateScrollingPanelList()
mEditWearable->updateScrollingPanelList(); mEditWearable->updateScrollingPanelList();
} }
} }
bool LLSidepanelAppearance::checkForDirtyEdits()
{
return ( mEditWearable->isDirty() ) ? true : false;
}
\ No newline at end of file
...@@ -73,7 +73,9 @@ class LLSidepanelAppearance : public LLPanel ...@@ -73,7 +73,9 @@ class LLSidepanelAppearance : public LLPanel
void onClickConfirmExitWithoutSaveViaBack(); void onClickConfirmExitWithoutSaveViaBack();
bool callBackExitWithoutSaveViaClose(const LLSD& notification, const LLSD& response); bool callBackExitWithoutSaveViaClose(const LLSD& notification, const LLSD& response);
void onClickConfirmExitWithoutSaveViaClose(); void onClickConfirmExitWithoutSaveViaClose();
bool checkForDirtyEdits();
bool callBackExitWithoutSaveIntoAppearance(const LLSD& notification, const LLSD& response);
void onClickConfirmExitWithoutSaveIntoAppearance();
private: private:
void onFilterEdit(const std::string& search_string); void onFilterEdit(const std::string& search_string);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment