Example #1
0
// static
void LLFloaterClothing::show(void*)
{
	if (sInstance)
	{
		sInstance->setVisibleAndFrontmost();
	}
	else
	{
		LLFloaterClothing *self = new LLFloaterClothing();

		self->buildClothingList();

		if (self->mAllowSelection)
		{
			LLCtrlSelectionInterface* iface = self->childGetSelectionInterface("clothing_list");
			if (iface) iface->selectFirstItem();
		}
		self->childSetFocus("clothing_list");
		
		self->mSelectedID = LLUUID::null;

		// Update button labels
		onCommitList(NULL, self);
	}

	gSavedSettings.setBOOL("ClothingBtnState", TRUE);
}
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------
BOOL LLFloaterImagePreview::postBuild()
{
    if (!LLFloaterNameDesc::postBuild())
    {
        return FALSE;
    }

    LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
    if (iface)
    {
        iface->selectFirstItem();
    }
    childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this);

    mPreviewRect.set(PREVIEW_HPAD,
                     PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD,
                     getRect().getWidth() - PREVIEW_HPAD,
                     PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
    mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);

    getChildView("bad_image_text")->setVisible(FALSE);

    if (mRawImagep.notNull() && gAgent.getRegion() != NULL)
    {
        mAvatarPreview = new LLImagePreviewAvatar(256, 256);
        mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE);

        mSculptedPreview = new LLImagePreviewSculpted(256, 256);
        mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f);

        if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF)
            getChildView("lossless_check")->setEnabled(TRUE);

// <FS:CR> Temporary texture uploads
        if (LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() == 0
                || gAgent.getRegion()->getCentralBakeVersion() > 0)
        {
            gSavedSettings.setBOOL("TemporaryUpload", FALSE);
            getChild<LLCheckBoxCtrl>("temp_check")->setVisible(FALSE);
        }
// </FS:CR>
    }
    else
    {
        mAvatarPreview = NULL;
        mSculptedPreview = NULL;
        getChildView("bad_image_text")->setVisible(TRUE);
        getChildView("clothing_type_combo")->setEnabled(FALSE);
        getChildView("ok_btn")->setEnabled(FALSE);

        if(!mImageLoadError.empty())
        {
            getChild<LLUICtrl>("bad_image_text")->setValue(mImageLoadError.c_str());
        }
    }

    getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));

    return TRUE;
}
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------
BOOL LLFloaterImagePreview::postBuild()
{
	if (!LLFloaterNameDesc::postBuild())
	{
		return FALSE;
	}

	childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee());
	childSetAction("ok_btn", onBtnOK, this);

	LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
	if (iface)
	{
		iface->selectFirstItem();
	}
	childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this);

	mPreviewRect.set(PREVIEW_HPAD, 
		PREVIEW_TEXTURE_HEIGHT,
		getRect().getWidth() - PREVIEW_HPAD, 
		PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
	mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);

	childHide("bad_image_text");

	if (mRawImagep.notNull() && gAgent.getRegion() != NULL)
	{
		mAvatarPreview = new LLImagePreviewAvatar(256, 256);
		mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE);

		mSculptedPreview = new LLImagePreviewSculpted(256, 256);
		mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f);

		if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF)
			childEnable("lossless_check");

		// <edit>
		gSavedSettings.setBOOL("TemporaryUpload",FALSE);
		childSetValue("temp_check",FALSE);
		// </edit>
	}
	else
	{
		mAvatarPreview = NULL;
		mSculptedPreview = NULL;
		childShow("bad_image_text");
		childDisable("clothing_type_combo");
		childDisable("ok_btn");
	}

	return TRUE;
}
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------
BOOL LLFloaterSculptPreview::postBuild()
{
	childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount));

	LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
	if (iface)
	{
		iface->selectFirstItem();
	}
	childSetCommitCallback("clothing_type_combo", onPreviewTypeCommit, this);

	mPreviewRect.set(PREVIEW_HPAD, 
		PREVIEW_TEXTURE_HEIGHT,
		getRect().getWidth() - PREVIEW_HPAD, 
		PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
	mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);

	childHide("bad_image_text");

	if (mRawImagep.notNull() && gAgent.getRegion() != NULL)
	{
		mAvatarPreview = new LLPreviewAvatar(256, 256);
		mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE);

		mSculptedPreview = new LLPreviewSculpted(256, 256);
		mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f);

		if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF)
			childEnable("lossless_check");

		childSetValue("temp_check",FALSE);
	}
	else
	{
		mAvatarPreview = NULL;
		mSculptedPreview = NULL;
		childShow("bad_image_text");
		childDisable("clothing_type_combo");
		childDisable("ok_btn");
	}

	return TRUE;
}