예제 #1
0
// Default constructor
ASFloaterUploadBrowser::ASFloaterUploadBrowser()
    :	LLFloater(std::string("floater_upload_browser"),
                  std::string("FloaterUploadRect"),
                  LLStringUtil::null)
{
    LLUICtrlFactory::getInstance()->buildFloater(this, "floater_upload_browser.xml");

    mUploaderSettings.clear();
    mUploaderSettings = gSavedSettings.getLLSD("AscentUploadSettings");

    mPathName = mUploaderSettings["ActivePath"].asString();
    if (mPathName == "None")
        mPathName = gDirUtilp->getExecutableDir();
    mFilterType = "None";


    //File list ------------------------------------------------------
    mFileList = getChild<LLScrollListCtrl>("file_list");
    childSetCommitCallback("file_list", onClickFile, this);
    childSetDoubleClickCallback("file_list", onDoubleClick);

    //Above File List ------------------------------------------------

    mBookmarkCombo = getChild<LLComboBox>("bookmark_combo");
    S32 index;
    for (index = 0; index < mUploaderSettings["Bookmarks"].size(); index++)
    {
        std::string bookmark = mUploaderSettings["Bookmarks"][index].asString();
        if (bookmark != "")
            mBookmarkCombo->add(bookmark, ADD_BOTTOM);
    }

    mDriveCombo = getChild<LLComboBox>("drive_combo");
    childSetCommitCallback("drive_combo", onChangeDrives, this);
    //This is so unbelievably shitty I can't handle it -HgB
    std::string drive_letters[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; //Oh my god it's somehow worse now -HgB

    mDriveCombo->removeall();
    for (index = 0; index < 26; index++)
    {
        std::string dir = drive_letters[index] + ":";
        S32 file_count = gDirUtilp->countFilesInDir(dir + gDirUtilp->getDirDelimiter(), "*.*");
        if(file_count)
        {
            mDriveCombo->add(dir, ADD_BOTTOM);
        }
    }

    childSetAction("directory_button", onClickFilepathGoto, this);
    childSetCommitCallback("dir_path", onDirCommit, (void*)this);
    //Below File List ------------------------------------------------
    childSetCommitCallback("file_filter_combo", onUpdateFilter, this);


    refresh();
    mFileList->sortByColumn(std::string("file_name"), TRUE);
    mFileList->sortByColumn(std::string("file_type"), TRUE);
    childHide("multiple_uploads_label");
    childHide("bad_image_text");
}
예제 #2
0
BOOL LLPanelDirClassified::postBuild()
{
	LLPanelDirBrowser::postBuild();

	// Teens don't get mature checkbox
	if (gAgent.isTeen())
	{
		childSetValue("incmature", FALSE);
		childHide("incmature");
	}

	// 0 or 3+ character searches allowed, exciting
	childSetKeystrokeCallback("name", onKeystrokeNameClassified, this);
	
	childSetAction("Search", onClickSearchCore, this);
	childSetAction("Browse", onClickSearchCore, this);
	setDefaultBtn( "Browse" );

	childSetAction("Place an Ad...", onClickCreateNewClassified, this);

	childSetAction("Delete", onClickDelete, this);
	childDisable("Delete");
	childHide("Delete");

	// Don't do this every time we open find, it's expensive; require clicking 'search'
	//requestClassified();

	return TRUE;
}
예제 #3
0
BOOL LLPanelDirFind::postBuild()
{
	LLPanelDirBrowser::postBuild();

	childSetAction("back_btn", onClickBack, this);
	childSetAction("home_btn", onClickHome, this);
	childSetAction("forward_btn", onClickForward, this);
	childSetCommitCallback("search_editor", onCommitSearch, this);
	childSetAction("search_btn", onClickSearch, this);
	childSetAction("?", onClickHelp, this);

	// showcase doesn't have maturity flags -- it's all PG
	if (hasChild("incmature"))
	{
		// Teens don't get mature checkbox
		if (gAgent.wantsPGOnly())
		{
			childSetValue("incmature", FALSE);
			childSetValue("incadult", FALSE);
			childHide("incmature");
			childHide("incadult");
			childSetValue("incpg", TRUE);
			childDisable("incpg");
		}		
		
		if (!gAgent.canAccessMature())
		{
			childSetValue("incmature", FALSE);
			childDisable("incmature");
		}
		
		if (!gAgent.canAccessAdult())
		{
			childSetValue("incadult", FALSE);
			childDisable("incadult");
		}
	}
	
	
	mWebBrowser = getChild<LLMediaCtrl>(mBrowserName);
	if (mWebBrowser)
	{
		mWebBrowser->addObserver(this);
		
		// new pages appear in same window as the results page now
		mWebBrowser->setOpenInInternalBrowser( false );
		mWebBrowser->setOpenInExternalBrowser( false );	

		// need to handle inworldz:///app/ URLs for direct teleports
		mWebBrowser->setTrusted( true );

		// redirect 404 pages from S3 somewhere else
		mWebBrowser->set404RedirectUrl( getString("redirect_404_url") );

		navigateToDefaultPage();
	}

	return TRUE;
}
예제 #4
0
BOOL LLPanelDirBrowser::postBuild()
{
	childSetCommitCallback("results", onCommitList, this);

	childSetAction("< Prev", onClickPrev, this);
	childHide("< Prev");

	childSetAction("Next >", onClickNext, this);
	childHide("Next >");

	return TRUE;
}
BOOL LLPanelDirClassified::postBuild()
{
	LLPanelDirBrowser::postBuild();

	// Teens don't get mature checkbox
	if (gAgent.wantsPGOnly())
	{
		childSetValue("incmature", FALSE);
		childSetValue("incadult", FALSE);
		childHide("incmature");
		childHide("incadult");
		childSetValue("incpg", TRUE);
		childDisable("incpg");
	}

	bool mature_enabled = gAgent.canAccessMature();
	if (!mature_enabled)
	{
		childSetValue("incmature", FALSE);
		childDisable("incmature");
	}

	bool adult_enabled = gAgent.canAccessAdult();
	if (!adult_enabled)
	{
		childSetValue("incadult", FALSE);
		childDisable("incadult");
	}

	// 0 or 3+ character searches allowed, exciting
	childSetKeystrokeCallback("name", onKeystrokeNameClassified, this);
	
	childSetAction("Search", onClickSearchCore, this);
	childSetAction("Browse", onClickSearchCore, this);
	setDefaultBtn( "Browse" );

	childSetAction("Place an Ad...", onClickCreateNewClassified, this);

	childSetAction("Delete", onClickDelete, this);
	childDisable("Delete");
	childHide("Delete");

	// Don't do this every time we open find, it's expensive; require clicking 'search'
	//requestClassified();

	childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_CLASSIFIEDS));

	return TRUE;
}
BOOL LLPanelDirEvents::postBuild()
{
	LLPanelDirBrowser::postBuild();

	getChild<LLUICtrl>("date_mode")->setCommitCallback(boost::bind(&LLPanelDirEvents::onDateModeCallback,this));

	getChild<LLButton>("<<")->setClickedCallback(boost::bind(&LLPanelDirEvents::onBackBtn,this));
	getChild<LLButton>(">>")->setClickedCallback(boost::bind(&LLPanelDirEvents::onForwardBtn,this));

	getChild<LLButton>("Today")->setClickedCallback(boost::bind(&LLPanelDirEvents::onClickToday,this));

	getChild<LLButton>("Search")->setClickedCallback(boost::bind(&LLPanelDirEvents::onClickSearchCore,this));
	setDefaultBtn("Search");

	getChild<LLButton>("Delete")->setClickedCallback(boost::bind(&LLPanelDirEvents::onClickDelete,this));
	childDisable("Delete");
	childHide("Delete");

	onDateModeCallback();

	mCurrentSortColumn = "time";

	if (!gDisplayEventHack)
	{
		setDay(0);	// for today
		//performQuery(); // Temporary change to help DB - Sabin
	}
	gDisplayEventHack = FALSE;

	childSetVisible("filter_gaming", (gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_FIND_EVENTS));

	return TRUE;
}
예제 #7
0
BOOL LLPanelDirEvents::postBuild()
{
	LLPanelDirBrowser::postBuild();

	childSetCommitCallback("date_mode", onDateModeCallback, this);

	childSetAction("<<", onBackBtn, this);
	childSetAction(">>", onForwardBtn, this);

	childSetAction("Today", onClickToday, this);

	childSetCommitCallback("mature", onCommitMature, this);

	childSetAction("Search", LLPanelDirBrowser::onClickSearchCore, this);
	setDefaultBtn("Search");

	childSetAction("Delete", onClickDelete, this);
	childDisable("Delete");
	childHide("Delete");

	onDateModeCallback(NULL, this);

	mCurrentSortColumn = "time";

	if (!gDisplayEventHack)
	{
		setDay(0);	// for today
		//performQuery(); // Temporary change to help DB - Sabin
	}
	gDisplayEventHack = FALSE;

	return TRUE;
}
void LLPanelDirBrowser::updateMaturityCheckbox()
{
	BOOL godlike = gAgent.isGodlike();
	// You only have a choice if your maturity is 'mature' or higher.
	// Logic: if you're not at least mature, hide the mature and adult options
	// After that, enable only the options you can legitimately choose.
	// If you're PG only, show you the checkbox but don't let you change it.
	// If you're God, you have everything.
	bool mature_enabled = gAgent.canAccessMature() || godlike;
	bool adult_enabled = gAgent.canAccessAdult() || godlike;

	// These check boxes can only be checked if you have the right access to use them
	std::string control_name_pg = getChild<LLCheckBoxCtrl>("incpg")->getControlName();
	std::string control_name_mature = getChild<LLCheckBoxCtrl>("incmature")->getControlName();
	std::string control_name_adult = getChild<LLCheckBoxCtrl>("incadult")->getControlName();

	childSetValue("incpg", gSavedSettings.getBOOL(control_name_pg));
	childSetValue("incmature", gSavedSettings.getBOOL(control_name_mature) && mature_enabled);
	childSetValue("incadult", gSavedSettings.getBOOL(control_name_adult) && adult_enabled);
	
	// Teens don't get mature/adult choices
	if (gAgent.wantsPGOnly())
	{
		childHide("incmature");
		childHide("incadult");
		childSetValue("incpg", TRUE);
		childDisable("incpg");
	}

	childSetEnabled("incmature", mature_enabled);		
	childSetEnabled("incadult", adult_enabled);

	if (mature_enabled)
	{
		childEnable("incpg");
		childSetVisible("incpg", TRUE);
		childSetVisible("incmature", TRUE);
		childSetVisible("incadult", 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;
}
예제 #10
0
S32 LLPanelDirBrowser::showNextButton(S32 rows)
{
	// HACK: This hack doesn't work for llpaneldirfind (ALL) 
	// because other data is being returned as well.
	if ( getName() != "find_all_old_panel")
	{
		// HACK: The (mResultsPerPage)+1th entry indicates there are 'more'
		bool show_next = (mResultsReceived > mResultsPerPage);
		childSetVisible("Next >", show_next);
		if (show_next)
		{
			rows -= (mResultsReceived - mResultsPerPage);
		}
	}
	else
	{
		// Hide page buttons
		childHide("Next >");
		childHide("< Prev");
	}
	return rows;
}
예제 #11
0
BOOL LLFloaterPostcard::postBuild()
{
	childSetAction("cancel_btn", onClickCancel, this);
	childSetAction("send_btn", onClickSend, this);

	childDisable("from_form");
	childSetAction("publish_help_btn", onClickPublishHelp, this);

	if (gAgent.isTeen())
	{
		// Disable these buttons if they are PG (Teen) users
		childDisable("allow_publish_check");
		childHide("allow_publish_check");
		childDisable("publish_help_btn");
		childHide("publish_help_btn");
		childDisable("mature_check");
		childHide("mature_check");
	}
	
	LLString name_string;
	gAgent.buildFullname(name_string);
	
	childSetValue("name_form", LLSD(name_string));

	LLTextEditor *MsgField = LLUICtrlFactory::getTextEditorByName(this, "msg_form");
	if (MsgField)
	{
		MsgField->setWordWrap(TRUE);

		// For the first time a user focusess to .the msg box, all text will be selected.
		MsgField->setFocusChangedCallback(onMsgFormFocusRecieved, this);
	}
	
	childSetFocus("to_form", TRUE);

    return TRUE;
}
예제 #12
0
//-----------------------------------------------------------------------------
// refresh()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::refresh()
{
	if (!mAnimPreview)
	{
		childShow("bad_animation_text");
		mPlayButton->setEnabled(FALSE);
		mStopButton->setEnabled(FALSE);
		childDisable("ok_btn");
	}
	else
	{
		childHide("bad_animation_text");
		mPlayButton->setEnabled(TRUE);
		LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
		if (avatarp->isMotionActive(mMotionID))
		{
			mStopButton->setEnabled(TRUE);
			LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
			if (avatarp->areAnimationsPaused())
			{

				mPlayButton->setImages(std::string("button_anim_play.tga"),
									   std::string("button_anim_play_selected.tga"));

			}
			else
			{
				if (motionp)
				{
					F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration();
					childSetValue("playback_slider", fraction_complete);
				}
				mPlayButton->setImages(std::string("button_anim_pause.tga"),
									   std::string("button_anim_pause_selected.tga"));

			}
		}
		else
		{
			mPauseRequest = avatarp->requestPause();
			mPlayButton->setImages(std::string("button_anim_play.tga"),
								   std::string("button_anim_play_selected.tga"));

			mStopButton->setEnabled(TRUE); // stop also resets, leave enabled.
		}
		childEnable("ok_btn");
		mAnimPreview->requestUpdate();
	}
}
//-----------------------------------------------------------------------------
// 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;
}
예제 #14
0
void LLFloaterBuyCurrencyUI::updateUI()
{
    bool hasError = mManager.hasError();
    mManager.updateUI(!hasError && !mManager.buying());

    // hide most widgets - we'll turn them on as needed next
    childHide("info_buying");
    childHide("info_cannot_buy");
    childHide("info_need_more");
    childHide("purchase_warning_repurchase");
    childHide("purchase_warning_notenough");
    childHide("contacting");
    childHide("buy_action");

    if (hasError)
    {
        // display an error from the server
        childHide("normal_background");
        childShow("error_background");
        childShow("info_cannot_buy");
        childShow("cannot_buy_message");
        childHide("balance_label");
        childHide("balance_amount");
        childHide("buying_label");
        childHide("buying_amount");
        childHide("total_label");
        childHide("total_amount");

        LLTextBox* message = getChild<LLTextBox>("cannot_buy_message");
        if (message)
        {
            message->setText(mManager.errorMessage());
        }

        childSetVisible("error_web", !mManager.errorURI().empty());
    }
    else
    {
        // display the main Buy L$ interface
        childShow("normal_background");
        childHide("error_background");
        childHide("cannot_buy_message");
        childHide("error_web");

        if (mHasTarget)
        {
            childShow("info_need_more");
        }
        else
        {
            childShow("info_buying");
        }

        if (mManager.buying())
        {
            childSetVisible("contacting", true);
        }
        else
        {
            if (mHasTarget)
            {
                childSetVisible("buy_action", true);
                childSetTextArg("buy_action", "[ACTION]", mTargetName);
            }
        }

        S32 balance = gStatusBar->getBalance();
        childShow("balance_label");
        childShow("balance_amount");
        childSetTextArg("balance_amount", "[AMT]", llformat("%d", balance));

        S32 buying = mManager.getAmount();
        childShow("buying_label");
        childShow("buying_amount");
        childSetTextArg("buying_amount", "[AMT]", llformat("%d", buying));

        S32 total = balance + buying;
        childShow("total_label");
        childShow("total_amount");
        childSetTextArg("total_amount", "[AMT]", llformat("%d", total));

        if (mHasTarget)
        {
            if (total >= mTargetPrice)
            {
                childSetVisible("purchase_warning_repurchase", true);
            }
            else
            {
                childSetVisible("purchase_warning_notenough", true);
            }
        }
    }

    childSetVisible("getting_data", !mManager.canBuy() && !hasError);
}
예제 #15
0
void LLFloaterBuyLandUI::refreshUI()
{
	// section zero: title area
	{
		LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
		if (snapshot)
		{
			snapshot->setImageAssetID(
				mParcelValid ? mParcelSnapshot : LLUUID::null);
		}
		
		if (mParcelValid)
		{
			childSetText("info_parcel", mParcelLocation);

			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea);
			string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects);
		
			childSetText("info_size", getString("meters_supports_object", string_args));

			F32 cost_per_sqm = 0.0f;
			if (mParcelActualArea > 0)
			{
				cost_per_sqm = (F32)mParcelPrice / (F32)mParcelActualArea;
			}

			LLStringUtil::format_map_t info_price_args;
			info_price_args["[PRICE]"] = llformat("%d", mParcelPrice);
			info_price_args["[PRICE_PER_SQM]"] = llformat("%.1f", cost_per_sqm);
			if (mParcelSoldWithObjects)
			{
				info_price_args["[SOLD_WITH_OBJECTS]"] = getString("sold_with_objects");
			}
			else
			{
				info_price_args["[SOLD_WITH_OBJECTS]"] = getString("sold_without_objects");
			}
			childSetText("info_price", getString("info_price_string", info_price_args));
			childSetVisible("info_price", mParcelIsForSale);
		}
		else
		{
			childSetText("info_parcel", getString("no_parcel_selected"));
			childSetText("info_size", LLStringUtil::null);
			childSetText("info_price", LLStringUtil::null);
		}
		
		childSetText("info_action",
			mCanBuy
				?
					mIsForGroup
						? getString("buying_for_group")//"Buying land for group:"
						: getString("buying_will")//"Buying this land will:"
				: 
					mCannotBuyIsError
						? getString("cannot_buy_now")//"Cannot buy now:"
						: getString("not_for_sale")//"Not for sale:"

			);
	}
	
	bool showingError = !mCanBuy || !mSiteValid;
	
	// error section
	if (showingError)
	{
		mChildren.setBadge(std::string("step_error"),
			mCannotBuyIsError
				? LLViewChildren::BADGE_ERROR
				: LLViewChildren::BADGE_WARN);
		
		LLTextBox* message = getChild<LLTextBox>("error_message");
		if (message)
		{
			message->setVisible(true);
			message->setValue(LLSD(!mCanBuy ? mCannotBuyReason : "(waiting for data)"));
		}

		childSetVisible("error_web", 
				mCannotBuyIsError && !mCannotBuyURI.empty());
	}
	else
	{
		childHide("step_error");
		childHide("error_message");
		childHide("error_web");
	}
	
	
	// section one: account
	if (!showingError)
	{
		mChildren.setBadge(std::string("step_1"),
			mSiteMembershipUpgrade
				? LLViewChildren::BADGE_NOTE
				: LLViewChildren::BADGE_OK);
		childSetText("account_action", mSiteMembershipAction);
		childSetText("account_reason", 
			mSiteMembershipUpgrade
				?	getString("must_upgrade")
				:	getString("cant_own_land")
			);
		
		LLComboBox* levels = getChild<LLComboBox>( "account_level");
		if (levels)
		{
			levels->setVisible(mSiteMembershipUpgrade);
			
			levels->removeall();
			for(std::vector<std::string>::const_iterator i
					= mSiteMembershipPlanNames.begin();
				i != mSiteMembershipPlanNames.end();
				++i)
			{
				levels->add(*i);
			}
			
			levels->setCurrentByIndex(mUserPlanChoice);
		}

		childShow("step_1");
		childShow("account_action");
		childShow("account_reason");
	}
	else
	{
		childHide("step_1");
		childHide("account_action");
		childHide("account_reason");
		childHide("account_level");
	}
	
	// section two: land use fees
	if (!showingError)
	{
		mChildren.setBadge(std::string("step_2"),
			mSiteLandUseUpgrade
				? LLViewChildren::BADGE_NOTE
				: LLViewChildren::BADGE_OK);
		childSetText("land_use_action", mSiteLandUseAction);
		
		std::string message;
		
		if (mIsForGroup)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[GROUP]"] = std::string(gAgent.getGroupName());

			message += getString("insufficient_land_credits", string_args);
				
		}
		else
		{
			LLStringUtil::format_map_t string_args;
			string_args["[BUYER]"] = llformat("%d", mAgentCommittedTier);
			message += getString("land_holdings", string_args);
		}
		
		if (!mParcelValid)
		{
			message += getString("no_parcel_selected");
		}
		else if (mParcelBillableArea == mParcelActualArea)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d ", mParcelActualArea);
			message += getString("parcel_meters", string_args);
		}
		else
		{

			if (mParcelBillableArea > mParcelActualArea)
			{	
				LLStringUtil::format_map_t string_args;
				string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
				message += getString("premium_land", string_args);
			}
			else
			{
				LLStringUtil::format_map_t string_args;
				string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
				message += getString("discounted_land", string_args);
			}
		}

		childSetValue("land_use_reason", message);

		childShow("step_2");
		childShow("land_use_action");
		childShow("land_use_reason");
	}
	else
	{
		childHide("step_2");
		childHide("land_use_action");
		childHide("land_use_reason");
	}
	
	// section three: purchase & currency
	S32 finalBalance = mAgentCashBalance + mCurrency.getAmount() - mParcelPrice;
	bool willHaveEnough = finalBalance >= 0;
	bool haveEnough = mAgentCashBalance >= mParcelPrice;
	S32 minContribution = llceil((F32)mParcelBillableArea / GROUP_LAND_BONUS_FACTOR);
	bool groupContributionEnough = mParcelGroupContribution >= minContribution;
	
	mCurrency.updateUI(!showingError  &&  !haveEnough);

	if (!showingError)
	{
		mChildren.setBadge(std::string("step_3"),
			!willHaveEnough
				? LLViewChildren::BADGE_WARN
				: mCurrency.getAmount() > 0
					? LLViewChildren::BADGE_NOTE
					: LLViewChildren::BADGE_OK);
			
		LLStringUtil::format_map_t string_args;
		string_args["[AMOUNT]"] = llformat("%d", mParcelPrice);
		string_args["[SELLER]"] = mParcelSellerName;
		childSetText("purchase_action", getString("pay_to_for_land", string_args));
		childSetVisible("purchase_action", mParcelValid);
		
		std::string reasonString;

		if (haveEnough)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);

			childSetText("currency_reason", getString("have_enough_lindens", string_args));
		}
		else
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
			string_args["[AMOUNT2]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
			
			childSetText("currency_reason", getString("not_enough_lindens", string_args));

			childSetTextArg("currency_est", "[LOCAL_AMOUNT]", mCurrency.getLocalEstimate());
		}
		
		if (willHaveEnough)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", finalBalance);

			childSetText("currency_balance", getString("balance_left", string_args));

		}
		else
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
	
			childSetText("currency_balance", getString("balance_needed", string_args));
			
		}

		childSetValue("remove_contribution", LLSD(groupContributionEnough));
		childSetEnabled("remove_contribution", groupContributionEnough);
		bool showRemoveContribution = mParcelIsGroupLand
							&& (mParcelGroupContribution > 0);
		childSetLabelArg("remove_contribution", "[AMOUNT]",
							llformat("%d", minContribution));
		childSetVisible("remove_contribution", showRemoveContribution);

		childShow("step_3");
		childShow("purchase_action");
		childShow("currency_reason");
		childShow("currency_balance");
	}
	else
	{
		childHide("step_3");
		childHide("purchase_action");
		childHide("currency_reason");
		childHide("currency_balance");
		childHide("remove_group_donation");
	}


	bool agrees_to_covenant = false;
	LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
	if (check)
	{
	    agrees_to_covenant = check->get();
	}

	childSetEnabled("buy_btn",
		mCanBuy  &&  mSiteValid  &&  willHaveEnough  &&  !mTransaction && agrees_to_covenant);
}
예제 #16
0
void LLFloaterSellLandUI::refreshUI()
{
	LLParcel* parcelp = mParcelSelection->getParcel();
	if (!parcelp) return;

	LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
	if (snapshot)
	{
		snapshot->setImageAssetID(mParcelSnapshot);
	}

	childSetText("info_parcel", parcelp->getName());
	childSetTextArg("info_size", "[AREA]", llformat("%d", mParcelActualArea));

	childSetTextArg("price_ld", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());

	std::string price_str = childGetValue("price").asString();
	bool valid_price = false;
	valid_price = (price_str != "") && LLLineEditor::prevalidateNonNegativeS32(utf8str_to_wstring(price_str));

	if (valid_price && mParcelActualArea > 0)
	{
		F32 per_meter_price = 0;
		per_meter_price = F32(mParcelPrice) / F32(mParcelActualArea);
		childSetTextArg("price_per_m", "[PER_METER]", llformat("%0.2f", per_meter_price));
		childShow("price_per_m");

		setBadge("step_price", BADGE_OK);
	}
	else
	{
		childHide("price_per_m");

		if ("" == price_str)
		{
			setBadge("step_price", BADGE_NOTE);
		}
		else
		{
			setBadge("step_price", BADGE_ERROR);
		}
	}

	if (mSellToBuyer)
	{
		childSetValue("sell_to", "user");
		childShow("sell_to_agent");
		childShow("sell_to_select_agent");
	}
	else
	{
		if (mChoseSellTo)
		{
			childSetValue("sell_to", "anyone");
		}
		else
		{
			childSetValue("sell_to", "select");
		}
		childHide("sell_to_agent");
		childHide("sell_to_select_agent");
	}

	// Must select Sell To: Anybody, or User (with a specified username)
	std::string sell_to = childGetValue("sell_to").asString();
	bool valid_sell_to = "select" != sell_to &&
		("user" != sell_to || mAuthorizedBuyer.notNull());

	if (!valid_sell_to)
	{
		setBadge("step_sell_to", BADGE_NOTE);
	}
	else
	{
		setBadge("step_sell_to", BADGE_OK);
	}

	bool valid_sell_objects = ("none" != childGetValue("sell_objects").asString());

	if (!valid_sell_objects)
	{
		setBadge("step_sell_objects", BADGE_NOTE);
	}
	else
	{
		setBadge("step_sell_objects", BADGE_OK);
	}

	if (valid_sell_to && valid_price && valid_sell_objects)
	{
		childEnable("sell_btn");
	}
	else
	{
		childDisable("sell_btn");
	}
}
예제 #17
0
void LLPanelDirBrowser::resetSearchStart()
{
	mSearchStart = 0;
	childHide("Next >");
	childHide("< Prev");
}
BOOL LLPanelDirFind::postBuild()
{
	LLPanelDirBrowser::postBuild();

	getChild<LLButton>("back_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickBack,this));
	if (hasChild("home_btn"))
		getChild<LLButton>("home_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickHome,this));
	getChild<LLButton>("forward_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickForward,this));
	getChild<LLButton>("reload_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickRefresh,this));
	if (hasChild("search_editor"))
		getChild<LLButton>("search_editor")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickSearch,this));
	if (hasChild("search_btn"))
		getChild<LLButton>("search_btn")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickSearch,this));
	if (hasChild("?"))
		getChild<LLButton>("?")->setCommitCallback(boost::bind(&LLPanelDirFind::onClickHelp,this));

	// showcase doesn't have maturity flags -- it's all PG
	if (hasChild("incmature"))
	{
		// Teens don't get mature checkbox
		if (gAgent.wantsPGOnly())
		{
			childSetValue("incmature", FALSE);
			childSetValue("incadult", FALSE);
			childHide("incmature");
			childHide("incadult");
			childSetValue("incpg", TRUE);
			childDisable("incpg");
		}		
		
		if (!gAgent.canAccessMature())
		{
			childSetValue("incmature", FALSE);
			childDisable("incmature");
		}
		
		if (!gAgent.canAccessAdult())
		{
			childSetValue("incadult", FALSE);
			childDisable("incadult");
		}
	}
	
	
	mWebBrowser = getChild<LLMediaCtrl>(mBrowserName);
	if (mWebBrowser)
	{
		mWebBrowser->addObserver(this);

		// need to handle secondlife:///app/ URLs for direct teleports
		mWebBrowser->setTrustedContent( true );

		// redirect 404 pages from S3 somewhere else
		mWebBrowser->set404RedirectUrl( getString("redirect_404_url") );

		navigateToDefaultPage();
	}

	if (LLUICtrl* ctrl = findChild<LLUICtrl>("filter_gaming"))
	{
		const LLViewerRegion* region(gAgent.getRegion());
		ctrl->setVisible(region && (region->getGamingFlags() & REGION_GAMING_PRESENT) && !(region->getGamingFlags() & REGION_GAMING_HIDE_FIND_ALL));
	}

	return TRUE;
}
예제 #19
0
void LLFloaterBuyCurrencyUI::updateUI()
{
	bool hasError = mManager.hasError();
	mManager.updateUI(!hasError && !mManager.buying());

	// section zero: title area
	{
		childSetVisible("info_buying", false);
		childSetVisible("info_cannot_buy", false);
		childSetVisible("info_need_more", false);
		if (hasError)
		{
			childSetVisible("info_cannot_buy", true);
		}
		else if (mHasTarget)
		{
			childSetVisible("info_need_more", true);
		}
		else
		{
			childSetVisible("info_buying", true);
		}
	}
	
	// error section
	if (hasError)
	{
		mChildren.setBadge(std::string("step_error"), LLViewChildren::BADGE_ERROR);
		
		LLTextBox* message = getChild<LLTextBox>("error_message");
		if (message)
		{
			message->setVisible(true);
			message->setWrappedText(mManager.errorMessage());
		}

		childSetVisible("error_web", !mManager.errorURI().empty());
		if (!mManager.errorURI().empty())
		{
			childHide("getting_data");
		}
	}
	else
	{
		childHide("step_error");
		childHide("error_message");
		childHide("error_web");
	}
	
	
	//  currency
	childSetVisible("contacting", false);
	childSetVisible("buy_action", false);
	childSetVisible("buy_action_unknown", false);
	
	if (!hasError)
	{
		mChildren.setBadge(std::string("step_1"), LLViewChildren::BADGE_NOTE);

		if (mManager.buying())
		{
			childSetVisible("contacting", true);
		}
		else
		{
			if (mHasTarget)
			{
				childSetVisible("buy_action", true);
				childSetTextArg("buy_action", "[NAME]", mTargetName);
				childSetTextArg("buy_action", "[PRICE]", llformat("%d",mTargetPrice));
			}
			else
			{
				childSetVisible("buy_action_unknown", true);
			}
		}
		
		S32 balance = gStatusBar->getBalance();
		childShow("balance_label");
		childShow("balance_amount");
		childSetTextArg("balance_amount", "[AMT]", llformat("%d", balance));
		
		S32 buying = mManager.getAmount();
		childShow("buying_label");
		childShow("buying_amount");
		childSetTextArg("buying_amount", "[AMT]", llformat("%d", buying));
		
		S32 total = balance + buying;
		childShow("total_label");
		childShow("total_amount");
		childSetTextArg("total_amount", "[AMT]", llformat("%d", total));

		childSetVisible("purchase_warning_repurchase", false);
		childSetVisible("purchase_warning_notenough", false);
		if (mHasTarget)
		{
			if (total >= mTargetPrice)
			{
				childSetVisible("purchase_warning_repurchase", true);
			}
			else
			{
				childSetVisible("purchase_warning_notenough", true);
			}
		}
	}
	else
	{
		childHide("step_1");
		childHide("balance_label");
		childHide("balance_amount");
		childHide("buying_label");
		childHide("buying_amount");
		childHide("total_label");
		childHide("total_amount");
		childHide("purchase_warning_repurchase");
		childHide("purchase_warning_notenough");
	}
	
	childSetEnabled("buy_btn", mManager.canBuy());

	if (!mManager.canBuy() && !childIsVisible("error_web"))
	{
		childShow("getting_data");
	}
}
예제 #20
0
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------
BOOL LLFloaterAnimPreview::postBuild()
{
	LLRect r;
	LLKeyframeMotion* motionp = NULL;
	LLBVHLoader* loaderp = NULL;

	if (!LLFloaterNameDesc::postBuild())
	{
		return FALSE;
	}

	childSetCommitCallback("name_form", onCommitName, this);

	childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount));
	childSetAction("ok_btn", onBtnOK, this);
	setDefaultBtn();

	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);

	S32 y = mPreviewRect.mTop + BTN_HEIGHT;
	S32 btn_left = PREVIEW_HPAD;

	r.set( btn_left, y, btn_left + 32, y - BTN_HEIGHT );
	mPlayButton = getChild<LLButton>( "play_btn");
	if (!mPlayButton)
	{
		mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0));
	}
	mPlayButton->setClickedCallback(onBtnPlay);
	mPlayButton->setCallbackUserData(this);

	mPlayButton->setImages(std::string("button_anim_play.tga"),
						   std::string("button_anim_play_selected.tga"));
	mPlayButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null);

	mPlayButton->setScaleImage(TRUE);

	mStopButton = getChild<LLButton>( "stop_btn");
	if (!mStopButton)
	{
		mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0));
	}
	mStopButton->setClickedCallback(onBtnStop);
	mStopButton->setCallbackUserData(this);

	mStopButton->setImages(std::string("button_anim_stop.tga"),
						   std::string("button_anim_stop_selected.tga"));
	mStopButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null);

	mStopButton->setScaleImage(TRUE);

	r.set(r.mRight + PREVIEW_HPAD, y, getRect().getWidth() - PREVIEW_HPAD, y - BTN_HEIGHT);
	//childSetCommitCallback("playback_slider", onSliderMove, this);

	childHide("bad_animation_text");

	//childSetCommitCallback("preview_base_anim", onCommitBaseAnim, this);
	//childSetValue("preview_base_anim", "Standing");

	//childSetCommitCallback("priority", onCommitPriority, this);
	//childSetCommitCallback("loop_check", onCommitLoop, this);
	//childSetCommitCallback("loop_in_point", onCommitLoopIn, this);
	//childSetValidate("loop_in_point", validateLoopIn);
	//childSetCommitCallback("loop_out_point", onCommitLoopOut, this);
	//childSetValidate("loop_out_point", validateLoopOut);

	//childSetCommitCallback("hand_pose_combo", onCommitHandPose, this);
	
	//childSetCommitCallback("emote_combo", onCommitEmote, this);
	//childSetValue("emote_combo", "[None]");

	//childSetCommitCallback("ease_in_time", onCommitEaseIn, this);
	//childSetValidate("ease_in_time", validateEaseIn);
	//childSetCommitCallback("ease_out_time", onCommitEaseOut, this);
	//childSetValidate("ease_out_time", validateEaseOut);

	std::string exten = gDirUtilp->getExtension(mFilename);
	if (exten == "bvh")
	{
		// loading a bvh file

		// now load bvh file
		S32 file_size;
		
		LLAPRFile infile ;
		infile.open(mFilenameAndPath, LL_APR_RB, LLAPRFile::global, &file_size);
		
		if (!infile.getFileHandle())
		{
			llwarns << "Can't open BVH file:" << mFilename << llendl;	
		}
		else
		{
			char*	file_buffer;

			file_buffer = new char[file_size + 1];

			if (file_size == infile.read(file_buffer, file_size))
			{
				file_buffer[file_size] = '\0';
				llinfos << "Loading BVH file " << mFilename << llendl;
				loaderp = new LLBVHLoader(file_buffer);
			}

			infile.close() ;
			delete[] file_buffer;
		}
	}

	if (loaderp && loaderp->isInitialized() && loaderp->getDuration() <= MAX_ANIM_DURATION)
	{
		// generate unique id for this motion
		mTransactionID.generate();
		mMotionID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());

		mAnimPreview = new LLPreviewAnimation(256, 256);

		// motion will be returned, but it will be in a load-pending state, as this is a new motion
		// this motion will not request an asset transfer until next update, so we have a chance to 
		// load the keyframe data locally
		motionp = (LLKeyframeMotion*)mAnimPreview->getDummyAvatar()->createMotion(mMotionID);

		// create data buffer for keyframe initialization
		S32 buffer_size = loaderp->getOutputSize();
		U8* buffer = new U8[buffer_size];

		LLDataPackerBinaryBuffer dp(buffer, buffer_size);

		// pass animation data through memory buffer
		loaderp->serialize(dp);
		dp.reset();
		BOOL success = motionp && motionp->deserialize(dp);

		delete []buffer;

		if (success)
		{
			setAnimCallbacks() ;
			
			const LLBBoxLocal &pelvis_bbox = motionp->getPelvisBBox();

			LLVector3 temp = pelvis_bbox.getCenter();
			// only consider XY?
			//temp.mV[VZ] = 0.f;
			F32 pelvis_offset = temp.magVec();

			temp = pelvis_bbox.getExtent();
			//temp.mV[VZ] = 0.f;
			F32 pelvis_max_displacement = pelvis_offset + (temp.magVec() * 0.5f) + 1.f;
			
			F32 camera_zoom = LLViewerCamera::getInstance()->getDefaultFOV() / (2.f * atan(pelvis_max_displacement / PREVIEW_CAMERA_DISTANCE));
		
			mAnimPreview->setZoom(camera_zoom);

			motionp->setName(childGetValue("name_form").asString());
			mAnimPreview->getDummyAvatar()->startMotion(mMotionID);
			childSetMinValue("playback_slider", 0.0);
			childSetMaxValue("playback_slider", 1.0);

			childSetValue("loop_check", LLSD(motionp->getLoop()));
			childSetValue("loop_in_point", LLSD(motionp->getLoopIn() / motionp->getDuration() * 100.f));
			childSetValue("loop_out_point", LLSD(motionp->getLoopOut() / motionp->getDuration() * 100.f));
			childSetValue("priority", LLSD((F32)motionp->getPriority()));
			childSetValue("hand_pose_combo", LLHandMotion::getHandPoseName(motionp->getHandPose()));
			childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration()));
			childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration()));
			setEnabled(TRUE);
			std::string seconds_string;
			seconds_string = llformat(" - %.2f seconds", motionp->getDuration());

			setTitle(mFilename + std::string(seconds_string));
		}
		else
		{
			delete mAnimPreview;
			mAnimPreview = NULL;
			mMotionID.setNull();
			childSetValue("bad_animation_text", getString("failed_to_initialize"));
		}
	}
	else
	{
		if ( loaderp )
		{
			if (loaderp->getDuration() > MAX_ANIM_DURATION)
			{
				LLUIString out_str = getString("anim_too_long");
				out_str.setArg("[LENGTH]", llformat("%.1f", loaderp->getDuration()));
				out_str.setArg("[MAX_LENGTH]", llformat("%.1f", MAX_ANIM_DURATION));
				childSetValue("bad_animation_text", out_str.getString());
			}
			else
			{
				LLUIString out_str = getString("failed_file_read");
				out_str.setArg("[STATUS]", loaderp->getStatus()); // *TODO:Translate
				childSetValue("bad_animation_text", out_str.getString());
			}
		}

		//setEnabled(FALSE);
		mMotionID.setNull();
		mAnimPreview = NULL;
	}

	refresh();

	delete loaderp;

	return TRUE;
}