Sh-4035: Updated implementation according to new specs. Fixed a couple of outstanding bugs.

meow-7.2.2
prep@lindenlab.com 2013-05-28 11:51:11 -05:00
parent 34d2cd0376
commit c498f53d9a
8 changed files with 140 additions and 67 deletions

View File

@ -713,6 +713,18 @@ void LLFloater::closeFloater(bool app_quitting)
{
llinfos << "Closing floater " << getName() << llendl;
if (!app_quitting)
{
if ( mVerifyUponClose && !mForceCloseAfterVerify )
{
onClose( app_quitting );
if ( mForceCloseAfterVerify )
{
return;
}
}
}
if (app_quitting)
{
LLFloater::sQuitting = true;

View File

@ -116,7 +116,8 @@ LLPanel::LLPanel(const LLPanel::Params& p)
mXMLFilename(p.filename),
mVisibleSignal(NULL),
mCloseConfirmationSignal(NULL),
mVerifyUponClose(false)
mVerifyUponClose(false),
mForceCloseAfterVerify(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.
{

View File

@ -255,8 +255,6 @@ public:
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
@ -276,6 +274,9 @@ protected:
std::string mXMLFilename;
//Specific close-down logic in subclass
BOOL mVerifyUponClose;
public:
BOOL mForceCloseAfterVerify;
private:
BOOL mBgVisible; // any background at all?
BOOL mBgOpaque; // use opaque color or image

View File

@ -70,7 +70,16 @@ void LLFloaterSidePanelContainer::onOpen(const LLSD& key)
{
getChild<LLPanel>(sMainPanelName)->onOpen(key);
}
void LLFloaterSidePanelContainer::onClose(bool app_quitting)
{
mForceCloseAfterVerify = true;
LLSidepanelAppearance* panel = getSidePanelAppearance();
if ( panel )
{
panel->mRevertSet = true;
panel->onCloseFromAppearance( this );
}
}
void LLFloaterSidePanelContainer::onClickCloseBtn()
{
LLSidepanelAppearance* panel = getSidePanelAppearance();
@ -127,7 +136,7 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con
{
if ( panel->checkForDirtyEdits() )
{
panel->onClickConfirmExitWithoutSaveIntoAppearance();
panel->onClickConfirmExitWithoutSaveIntoAppearance( floaterp );
}
else
{

View File

@ -44,6 +44,8 @@ class LLSidepanelAppearance;
*/
class LLFloaterSidePanelContainer : public LLFloater
{
friend class LLSidePanelAppearance;
private:
static const std::string sMainPanelName;
@ -52,6 +54,7 @@ public:
~LLFloaterSidePanelContainer();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void onClickCloseBtn();
/*virtual*/ BOOL postBuild();
void onConfirmationClose( const LLSD &confirm );

View File

@ -50,6 +50,7 @@
#include "llviewerwearable.h"
#include "llnotificationsutil.h"
#include "llfloatersidepanelcontainer.h"
#include "llviewerfoldertype.h"
static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
@ -85,58 +86,86 @@ bool LLSidepanelAppearance::callBackExitWithoutSaveViaBack(const LLSD& notificat
return false;
}
bool LLSidepanelAppearance::callBackExitWithoutSaveViaClose(const LLSD& notification, const LLSD& response)
void LLSidepanelAppearance::onCloseFromAppearance(LLFloaterSidePanelContainer* obj)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( option == 0 )
{
//revert current edits
mEditWearable->revertChanges();
//LLAppearanceMgr::getInstance()->wearBaseOutfit();
toggleWearableEditPanel(FALSE);
LLVOAvatarSelf::onCustomizeEnd( FALSE );
mLLFloaterSidePanelContainer->close();
return true;
}
return false;
}
void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaClose()
{
if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
mLLFloaterSidePanelContainer = obj;
if ( mEditWearable->isAvailable() && mEditWearable->isDirty() )
{
LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaClose,pSelf,_1,_2) );
}
else
{
showOutfitsInventoryPanel();
{
LLVOAvatarSelf::onCustomizeEnd(FALSE);
toggleWearableEditPanel(FALSE);
mLLFloaterSidePanelContainer->mForceCloseAfterVerify=false;
}
}
bool LLSidepanelAppearance::callBackExitWithoutSaveIntoAppearance(const LLSD& notification, const LLSD& response)
bool LLSidepanelAppearance::onSaveCommit(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (0 == option)
{
std::string outfit_name = response["message"].asString();
LLStringUtil::trim(outfit_name);
std::string current_outfit_name;
LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name);
if ( current_outfit_name == outfit_name )
{
LLAppearanceMgr::getInstance()->updateBaseOutfit();
}
else
{
LLUUID outfit_folder = LLAppearanceMgr::getInstance()->makeNewOutfitLinks( outfit_name,FALSE );
}
LLVOAvatarSelf::onCustomizeEnd( FALSE );
mLLFloaterSidePanelContainer->close();
}
return false;
}
bool LLSidepanelAppearance::callBackExitWithoutSaveViaClose(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;
std::string outfit_name;
if (!LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
{
outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
}
LLSD args;
args["DESC"] = outfit_name;
LLSD payload;
LLNotificationsUtil::add("SaveOutfitEither", args, payload, boost::bind(&LLSidepanelAppearance::onSaveCommit, this, _1, _2));
showOutfitEditPanel();
return false;
}
else if ( option == 1 )
{
mEditWearable->revertChanges();
toggleWearableEditPanel(FALSE);
showOutfitEditPanel();
LLVOAvatarSelf::onCustomizeEnd( FALSE );
mRevertSet = true;
return false;
}
mLLFloaterSidePanelContainer->mForceCloseAfterVerify = false;
//mRevertSet = true;
return false;
}
void LLSidepanelAppearance::onClickConfirmExitWithoutSaveIntoAppearance()
void LLSidepanelAppearance::onClickConfirmExitWithoutSaveIntoAppearance( LLFloaterSidePanelContainer* obj )
{
if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
mLLFloaterSidePanelContainer = obj;
if ( LLAppearanceMgr::getInstance()->isOutfitDirty() || mEditWearable->isDirty() )
{
LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveIntoAppearance,pSelf,_1,_2) );
LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaClose,pSelf,_1,_2) );
}
else
{
@ -145,33 +174,19 @@ void LLSidepanelAppearance::onClickConfirmExitWithoutSaveIntoAppearance()
}
void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack()
{
/*
if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !mSidePanelJustOpened && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
{
LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaBack,pSelf,_1,_2) );
}
else
*/
{
showOutfitsInventoryPanel();
}
showOutfitsInventoryPanel();
}
void LLSidepanelAppearance::onClose(LLFloaterSidePanelContainer* obj)
{
mLLFloaterSidePanelContainer = obj;
if ( /*LLAppearanceMgr::getInstance()->isOutfitDirty() && */
/*!LLAppearanceMgr::getInstance()->isOutfitLocked() ||*/
( mEditWearable->isAvailable() && mEditWearable->isDirty() ) )
{ mLLFloaterSidePanelContainer = obj;
if ( mEditWearable->isAvailable() && mEditWearable->isDirty() )
{
LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaClose,pSelf,_1,_2) );
}
else
{
{
LLVOAvatarSelf::onCustomizeEnd(FALSE);
toggleWearableEditPanel(FALSE);
mLLFloaterSidePanelContainer->close();
}
}
@ -183,7 +198,8 @@ LLSidepanelAppearance::LLSidepanelAppearance() :
mOutfitEdit(NULL),
mCurrOutfitPanel(NULL),
mOpened(false),
mSidePanelJustOpened(true)
mSidePanelJustOpened(true),
mRevertSet(false)
{
LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
@ -264,11 +280,15 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
{
// No specific panel requested.
// If we're opened for the first time then show My Outfits.
// Else do nothing.
// Else show outfit edit panel
if (!mOpened)
{
showOutfitsInventoryPanel();
}
else
{
showOutfitEditPanel();
}
}
else
{
@ -665,3 +685,4 @@ bool LLSidepanelAppearance::checkForDirtyEdits()
{
return ( mEditWearable->isDirty() ) ? true : false;
}

View File

@ -50,7 +50,8 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
void onClose(LLFloaterSidePanelContainer* obj);
/*virtual*/ void onClose(LLFloaterSidePanelContainer* obj);
void onClickCloseBtn();
void refreshCurrentOutfitName(const std::string& name = "");
@ -72,10 +73,9 @@ public:
bool callBackExitWithoutSaveViaBack(const LLSD& notification, const LLSD& response);
void onClickConfirmExitWithoutSaveViaBack();
bool callBackExitWithoutSaveViaClose(const LLSD& notification, const LLSD& response);
void onClickConfirmExitWithoutSaveViaClose();
bool checkForDirtyEdits();
bool callBackExitWithoutSaveIntoAppearance(const LLSD& notification, const LLSD& response);
void onClickConfirmExitWithoutSaveIntoAppearance();
void onClickConfirmExitWithoutSaveIntoAppearance(LLFloaterSidePanelContainer* obj);
void onCloseFromAppearance(LLFloaterSidePanelContainer* obj);
private:
void onFilterEdit(const std::string& search_string);
@ -88,6 +88,9 @@ private:
void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE);
void toggleWearableEditPanel(BOOL visible, LLViewerWearable* wearable = NULL, BOOL disable_camera_switch = FALSE);
bool onSaveCommit(const LLSD& notification, const LLSD& response);
LLFilterEditor* mFilterEditor;
LLPanelOutfitsInventory* mPanelOutfitsInventory;
LLPanelOutfitEdit* mOutfitEdit;
@ -115,6 +118,9 @@ private:
bool mSidePanelJustOpened;
LLFloaterSidePanelContainer* mLLFloaterSidePanelContainer;
public:
bool mRevertSet;
};
#endif //LL_LLSIDEPANELAPPEARANCE_H

View File

@ -10118,13 +10118,33 @@ Cannot create large prims that intersect other players. Please re-try when othe
icon="alertmodal.tga"
name="ConfirmExitWithoutSave"
type="alertmodal">
Closing this window will discard any changes you have made.
You have not saved the changes to your outfit. Would you like to save it now?
<tag>confirm</tag>
<usetemplate
name="okcancelignore"
notext="Cancel"
yestext="OK"
ignoretext="Don't show me this again."/>
name="yesnocancelbuttons"
notext="Revert"
yestext="Yes"
canceltext="Dismiss"/>
</notification>
<notification
icon="alertmodal.tga"
label="Save Outfit"
name="SaveOutfitEither"
type="alertmodal">
<unique/>
Save outfit (defaults to current outfit):
<tag>confirm</tag>
<form name="form">
<input name="message" type="text">
[DESC]
</input>
<button
default="true"
index="0"
name="OK"
text="Save"/>
</form>
</notification>
</notifications>