diff options
author | prep@lindenlab.com <prep@lindenlab.com> | 2013-05-10 13:57:02 -0500 |
---|---|---|
committer | prep@lindenlab.com <prep@lindenlab.com> | 2013-05-10 13:57:02 -0500 |
commit | 3f1d360a04c4e4d8f07b7e93cd926961ae379430 (patch) | |
tree | b85715de2e337d6ef4a4409b7babaf5e7c243685 | |
parent | 43224062a64cc658d429e434a7b673fac0b7c012 (diff) |
SH-4035: Removed prompt to save if av just has outfit changes. Hooked up logic to handle ctrl+w and ctrl+shift+w confirmation prompts
-rw-r--r-- | indra/llui/llfloater.cpp | 31 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 3 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 22 | ||||
-rw-r--r-- | indra/llui/llpanel.h | 10 | ||||
-rw-r--r-- | indra/newview/llfloatersidepanelcontainer.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llfloatersidepanelcontainer.h | 3 | ||||
-rw-r--r-- | indra/newview/llsidepanelappearance.cpp | 22 |
7 files changed, 104 insertions, 20 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 09e27a264a..28dfda8faf 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -704,9 +704,15 @@ void LLFloater::openFloater(const LLSD& key) dirtyRect(); } +void LLFloater::verifyClose() +{ + LLPanel::handleCloseConfirmation(); +} + void LLFloater::closeFloater(bool app_quitting) { llinfos << "Closing floater " << getName() << llendl; + if (app_quitting) { LLFloater::sQuitting = true; @@ -781,7 +787,7 @@ void LLFloater::closeFloater(bool app_quitting) dirtyRect(); // Close callbacks - onClose(app_quitting); + onClose(app_quitting); mCloseSignal(this, LLSD(app_quitting)); // Hide or Destroy @@ -1788,11 +1794,19 @@ void LLFloater::initRectControl() void LLFloater::closeFrontmostFloater() { LLFloater* floater_to_close = gFloaterView->getFrontmostClosableFloater(); - if(floater_to_close) + if( floater_to_close ) { - floater_to_close->closeFloater(); + if ( floater_to_close->mVerifyUponClose ) + { + floater_to_close->verifyClose(); + //Closing of the window handle in the subclass - so bug out here. + return; + } + else + { + floater_to_close->closeFloater(); + } } - // if nothing took focus after closing focused floater // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) if (gFocusMgr.getKeyboardFocus() == NULL) @@ -2631,7 +2645,14 @@ void LLFloaterView::closeAllChildren(bool app_quitting) if (floaterp->canClose() && !floaterp->isDead() && (app_quitting || floaterp->getVisible())) { - floaterp->closeFloater(app_quitting); + if ( floaterp->mVerifyUponClose ) + { + floaterp->verifyClose(); + } + else + { + floaterp->closeFloater(app_quitting); + } } } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4dba1e645f..bf71b527b3 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -225,6 +225,7 @@ public: // If allowed, close the floater cleanly, releasing focus. virtual void closeFloater(bool app_quitting = false); + virtual void verifyClose(); // Close the floater or its host. Use when hidding or toggling a floater instance. virtual void closeHostedFloater(); @@ -303,7 +304,7 @@ public: /*virtual*/ void setVisible(BOOL visible); // do not override /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override - + void handleCloseConfirmation( ); void setFrontmost(BOOL take_focus = TRUE); virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 67472ad166..01165a5718 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -114,7 +114,9 @@ LLPanel::LLPanel(const LLPanel::Params& p) mCommitCallbackRegistrar(false), mEnableCallbackRegistrar(false), mXMLFilename(p.filename), - mVisibleSignal(NULL) + mVisibleSignal(NULL), + mCloseConfirmationSignal(NULL), + mVerifyUponClose(false) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { @@ -127,6 +129,7 @@ LLPanel::LLPanel(const LLPanel::Params& p) LLPanel::~LLPanel() { delete mVisibleSignal; + delete mCloseConfirmationSignal; } // virtual @@ -349,6 +352,14 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility ) (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD } + +void LLPanel::handleCloseConfirmation( ) +{ + if (mCloseConfirmationSignal) + { + (*mCloseConfirmationSignal)(this, LLSD() ); + } +} void LLPanel::setFocus(BOOL b) { if( b && !hasFocus()) @@ -959,10 +970,17 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: { mVisibleSignal = new commit_signal_t(); } - return mVisibleSignal->connect(cb); } +boost::signals2::connection LLPanel::setCloseConfirmationCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mCloseConfirmationSignal) + { + mCloseConfirmationSignal = new commit_signal_t(); + } + return mCloseConfirmationSignal->connect(cb); +} static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels"); //----------------------------------------------------------------------------- diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index e63b41f97c..1b0beaa5c8 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -116,6 +116,8 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + void handleCloseConfirmation( ); + // From LLFocusableElement /*virtual*/ void setFocus( BOOL b ); @@ -251,6 +253,10 @@ public: std::string getXMLFilename() { return mXMLFilename; }; boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setCloseConfirmationCallback( const commit_signal_t::slot_type& cb ); + +public: + const BOOL confirmClose() const { return mVerifyUponClose; } protected: // Override to set not found list @@ -260,6 +266,7 @@ protected: EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar; commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD() + commit_signal_t* mCloseConfirmationSignal; std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t; @@ -267,7 +274,8 @@ protected: // for setting the xml filename when building panel in context dependent cases std::string mXMLFilename; - + //Specific close-down logic in subclass + BOOL mVerifyUponClose; private: BOOL mBgVisible; // any background at all? BOOL mBgOpaque; // use opaque color or image diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 4dd558c9c0..43ee54ecd2 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -45,6 +45,39 @@ LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const // Prevent transient floaters (e.g. IM windows) from hiding // when this floater is clicked. LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this); + //We want this container to handle the shutdown logic of the sidepanelappearance. + mVerifyUponClose = TRUE; +} + +BOOL LLFloaterSidePanelContainer::postBuild() +{ + setCloseConfirmationCallback( boost::bind(&LLFloaterSidePanelContainer::onConfirmationClose,this,_2)); + return TRUE; +} + +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(); } LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index 940673b643..26fc092200 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -50,8 +50,9 @@ public: ~LLFloaterSidePanelContainer(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClickCloseBtn(); + /*virtual*/ BOOL postBuild(); + void onConfirmationClose( const LLSD &confirm ); LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 77e9604460..f77275fd1c 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -90,11 +90,12 @@ bool LLSidepanelAppearance::callBackExitWithoutSaveViaClose(const LLSD& notifica S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if ( option == 0 ) { - //revert curernt edits - mEditWearable->revertChanges(); - toggleWearableEditPanel(FALSE); - LLVOAvatarSelf::onCustomizeEnd(FALSE); - mLLFloaterSidePanelContainer->close(); + //revert current edits + mEditWearable->revertChanges(); + //LLAppearanceMgr::getInstance()->wearBaseOutfit(); + toggleWearableEditPanel(FALSE); + LLVOAvatarSelf::onCustomizeEnd( FALSE ); + mLLFloaterSidePanelContainer->close(); return true; } return false; @@ -115,7 +116,7 @@ void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaClose() void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack() { - if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !mSidePanelJustOpened && !LLAppearanceMgr::getInstance()->isOutfitLocked() ) + if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !mSidePanelJustOpened /*&& !LLAppearanceMgr::getInstance()->isOutfitLocked()*/ ) { LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this; LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaBack,pSelf,_1,_2) ); @@ -128,9 +129,9 @@ void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack() void LLSidepanelAppearance::onClose(LLFloaterSidePanelContainer* obj) { - mLLFloaterSidePanelContainer = obj; - if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && - !LLAppearanceMgr::getInstance()->isOutfitLocked() || + mLLFloaterSidePanelContainer = obj; + if ( /*LLAppearanceMgr::getInstance()->isOutfitDirty() && */ + /*!LLAppearanceMgr::getInstance()->isOutfitLocked() ||*/ ( mEditWearable->isAvailable() && mEditWearable->isDirty() ) ) { LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this; @@ -275,8 +276,9 @@ void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) { - if (new_visibility["visible"].asBoolean()) + if (new_visibility["visible"].asBoolean() ) { + const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); |