LLMakeOutfitDialog::LLMakeOutfitDialog(bool modal) : LLModalDialog(LLStringUtil::null, 515, 510, modal)
{
	LLUICtrlFactory::getInstance()->buildFloater(this, "floater_new_outfit_dialog.xml");

	setCanClose(!modal);
	setCanMinimize(!modal);

	// Build list of check boxes
	for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
	{
		std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel((LLWearableType::EType)i);
		mCheckBoxList.push_back(std::make_pair(name, i));
		// Hide undergarments from teens
		if (gAgent.isTeen() && ((LLWearableType::WT_UNDERSHIRT == (LLWearableType::EType)i) || (LLWearableType::WT_UNDERPANTS == (LLWearableType::EType)i)))
		{
			childSetVisible(name, false); // Lest they know what's beyond their reach.
		}
		else
		{
			bool enabled = gAgentWearables.getWearableCount((LLWearableType::EType)i);	// TODO: MULTI-WEARABLE
			bool selected = enabled && (LLWearableType::WT_SHIRT <= i); // only select clothing by default
			childSetEnabled(name, enabled);
			childSetValue(name, selected);
		}
	}

	// NOTE: .xml needs to be updated if attachments are added or their names are changed!
	LLVOAvatar* avatar = gAgentAvatarp;
	if (avatar)
	{
		for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); iter != avatar->mAttachmentPoints.end();)
		{
			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
			LLViewerJointAttachment* attachment = curiter->second;
			S32	attachment_pt = curiter->first;	
			bool object_attached = (attachment->getNumObjects() > 0);
			std::string name = std::string("checkbox_") + attachment->getName();
			mCheckBoxList.push_back(std::make_pair(name, attachment_pt));
			childSetEnabled(name, object_attached);
		}
	}

	if (!gHippoGridManager->getConnectedGrid()->supportsInvLinks())
	{
		childSetEnabled("checkbox_use_links", false);
		childSetValue("checkbox_use_links", false);
		childSetEnabled("checkbox_use_outfits", false);
		childSetValue("checkbox_use_outfits", false);
	}

	getChild<LLUICtrl>("Save")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onSave, this)); 
	getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::close, this, _1)); 
	getChild<LLUICtrl>("Check All")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onCheckAll, this, true));
	getChild<LLUICtrl>("Uncheck All")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onCheckAll, this, false));
	getChild<LLUICtrl>("checkbox_use_outfits")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::refresh, this));
	startModal();
}
// All logic for deciding not to show an alert is done here,
// so that the alert is valid until show() is called.
bool LLAlertDialog::show()
{
	// If this is a caution message, change the color and add an icon.
	if (mCaution)
	{
		setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertCautionBoxColor" ) );
	}
	else
	{
		setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertBoxColor" ) );
	}

	startModal();
	gFloaterView->adjustToFitScreen(this, FALSE);
	open();	/* Flawfinder: ignore */
 	setFocus(TRUE);
	if (mLineEditor)
	{
		mLineEditor->setFocus(TRUE);
		mLineEditor->selectAll();
	}
	if(mDefaultOption >= 0)
	{
		// delay before enabling default button
		mDefaultBtnTimer.start();
		mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY);
	}

	// attach to floater if necessary
	LLUUID context_key = mNote->getPayload()["context"].asUUID();
	LLFloaterNotificationContext* contextp = dynamic_cast<LLFloaterNotificationContext*>(LLNotificationContext::getInstance(context_key));
	if (contextp && contextp->getFloater())
	{
		contextp->getFloater()->addDependentFloater(this, FALSE);
	}
	return true;
}
Exemple #3
0
// All logic for deciding not to show an alert is done here,
// so that the alert is valid until show() is called.
bool LLAlertDialog::show()
{
	// If mModal, check to see if we are not displaying alerts,
	//   and do any application logic before showing modal alerts
	if (sDisplayCallback)
	{
		bool show = sDisplayCallback(mModal);
		if (show == false)
		{
			mOptionChosen = mDefaultOption;
			llinfos << "Alert: " << mLabel << llendl;
			delete this;
			return false;
		}
	}

	// Check to see if the user wants to ignore this alert
	if (mIgnorable > 0)
	{
		BOOL warn = sSettings->getWarning(mIgnoreLabel);
		if (!warn)
		{
			switch(mIgnorable)
			{
			case IGNORE_USE_DEFAULT:
				mOptionChosen = mDefaultOption;
				break;
			case IGNORE_USE_SAVED:
				mOptionChosen = sSettings->getS32("Default" + mIgnoreLabel);
				break;
			case IGNORE_SHOW_AGAIN:
				break;
			}
			delete this;
			return false;
		}
	}

	// If this is a caution message, change the color and add an icon.
	if (mCaution)
	{
		setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertCautionBoxColor" ) );
	}
	else
	{
		setBackgroundColor( LLUI::sColorsGroup->getColor( "AlertBoxColor" ) );
	}

	// Check to see if we are already displaying the alert
	if (mUnique)
	{
		std::map<LLString,LLAlertDialog*>::iterator iter = sUniqueActiveMap.find(mLabel);
		if (iter != sUniqueActiveMap.end())
		{
			gFloaterView->bringToFront(iter->second);
			mUnique = FALSE; // don't remove entry from map on destruction
			delete this;
			return false;
		}
		sUniqueActiveMap[mLabel] = this;
	}
	startModal();
	gFloaterView->adjustToFitScreen(this, FALSE);
	open();	/* Flawfinder: ignore */
 	setFocus(TRUE);
	if (mLineEditor)
	{
		mLineEditor->setFocus(TRUE);
		mLineEditor->selectAll();
	}
	if(mDefaultOption >= 0)
	{
		// delay before enabling default button
		mDefaultBtnTimer.start();
		mDefaultBtnTimer.setTimerExpirySec(DEFAULT_BUTTON_DELAY);
	}
	return true;
}