void LLFloaterBuyLandUI::runWebSitePrep(const std::string& password) { if (!mCanBuy) { return; } BOOL remove_contribution = getChild<LLUICtrl>("remove_contribution")->getValue().asBoolean(); mParcelBuyInfo = LLViewerParcelMgr::getInstance()->setupParcelBuy(gAgent.getID(), gAgent.getSessionID(), gAgent.getGroupID(), mIsForGroup, mIsClaim, remove_contribution); if (mParcelBuyInfo && !mSiteMembershipUpgrade && !mSiteLandUseUpgrade && mCurrency.getAmount() == 0 && mSiteConfirm != "password") { sendBuyLand(); return; } std::string newLevel = "noChange"; if (mSiteMembershipUpgrade) { LLComboBox* levels = getChild<LLComboBox>( "account_level"); if (levels) { mUserPlanChoice = levels->getCurrentIndex(); newLevel = mSiteMembershipPlanIDs[mUserPlanChoice]; } } LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendString("language", LLUI::getLanguage()); keywordArgs.appendString("levelId", newLevel); keywordArgs.appendInt("billableArea", mIsForGroup ? 0 : mParcelBillableArea); keywordArgs.appendInt("currencyBuy", mCurrency.getAmount()); keywordArgs.appendInt("estimatedCost", mCurrency.getUSDEstimate()); keywordArgs.appendString("estimatedLocalCost", mCurrency.getLocalEstimate()); keywordArgs.appendString("confirm", mSiteConfirm); if (!password.empty()) { keywordArgs.appendString("password", password); } LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionBuy, params); }
void LLFloaterBuyCurrencyUI::draw() { if (mManager.process()) { if (mManager.bought()) { close(); return; } updateUI(); } LLFloater::draw(); }
void LLFloaterBuyCurrencyUI::onClickBuy() { mManager.buy(getString("buy_currency")); updateUI(); // Update L$ balance LLStatusBar::sendMoneyBalanceRequest(); }
void LLFloaterBuyCurrencyUI::onClickErrorWeb() { LLWeb::loadURLExternal(mManager.errorURI()); closeFloater(); // Update L$ balance LLStatusBar::sendMoneyBalanceRequest(); }
void LLFloaterBuyLandUI::finishWebSiteInfo() { LLXMLRPCValue result = mTransaction->responseValue(); mSiteValid = result["success"].asBool(); if (!mSiteValid) { tellUserError( result["errorMessage"].asString(), result["errorURI"].asString() ); return; } LLXMLRPCValue membership = result["membership"]; mSiteMembershipUpgrade = membership["upgrade"].asBool(); mSiteMembershipAction = membership["action"].asString(); mSiteMembershipPlanIDs.clear(); mSiteMembershipPlanNames.clear(); LLXMLRPCValue levels = membership["levels"]; for (LLXMLRPCValue level = levels.rewind(); level.isValid(); level = levels.next()) { mSiteMembershipPlanIDs.push_back(level["id"].asString()); mSiteMembershipPlanNames.push_back(level["description"].asString()); } mUserPlanChoice = 0; LLXMLRPCValue landUse = result["landUse"]; mSiteLandUseUpgrade = landUse["upgrade"].asBool(); mSiteLandUseAction = landUse["action"].asString(); LLXMLRPCValue currency = result["currency"]; if (currency["estimatedCost"].isValid()) { mCurrency.setUSDEstimate(currency["estimatedCost"].asInt()); } if (currency["estimatedLocalCost"].isValid()) { mCurrency.setLocalEstimate(currency["estimatedLocalCost"].asString()); } mSiteConfirm = result["confirm"].asString(); }
void LLFloaterBuyLandUI::startBuyPreConfirm() { std::string action; std::string type_currency = LLGridManager::getInstance()->getCurrency(); if (mSiteMembershipUpgrade) { action += mSiteMembershipAction; action += "\n"; LLComboBox* levels = getChild<LLComboBox>( "account_level"); if (levels) { action += " * "; action += mSiteMembershipPlanNames[levels->getCurrentIndex()]; action += "\n"; } } if (mSiteLandUseUpgrade) { action += mSiteLandUseAction; action += "\n"; } if (mCurrency.getAmount() > 0) { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mCurrency.getAmount()); string_args["[LOCAL_AMOUNT]"] = mCurrency.getLocalEstimate(); string_args["[CUR]"] = type_currency; action += getString("buy_for_US", string_args); } LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelPrice); string_args["[SELLER]"] = mParcelSellerName; string_args["[CUR]"] = type_currency; action += getString("pay_to_for_land", string_args); LLConfirmationManager::confirm(mSiteConfirm, action, *this, &LLFloaterBuyLandUI::startBuyPostConfirm); }
void LLFloaterBuyLandUI::startBuyPreConfirm() { std::string action; if (mSiteMembershipUpgrade) { action += mSiteMembershipAction; action += "\n"; LLComboBox* levels = getChild<LLComboBox>( "account_level"); if (levels) { action += " * "; action += mSiteMembershipPlanNames[levels->getCurrentIndex()]; action += "\n"; } } if (mSiteLandUseUpgrade) { action += mSiteLandUseAction; action += "\n"; } if (mCurrency.getAmount() > 0) { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mCurrency.getAmount()); string_args["[AMOUNT2]"] = llformat("%#.2f", mCurrency.getEstimate() / 100.0); string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); action += getString("buy_for_US", string_args); } LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelPrice); string_args["[SELLER]"] = mParcelSellerName; string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); action += getString("pay_to_for_land", string_args); LLConfirmationManager::confirm(mSiteConfirm, action, *this, &LLFloaterBuyLandUI::startBuyPostConfirm); }
void LLFloaterBuyCurrencyUI::draw() { if (mManager.process()) { if (mManager.bought()) { LLNotificationsUtil::add("BuyLindenDollarSuccess"); closeFloater(); return; } updateUI(); } // disable the Buy button when we are not able to buy getChildView("buy_btn")->setEnabled(mManager.canBuy()); LLFloater::draw(); }
// virtual BOOL LLFloaterBuyLandUI::canClose() { bool can_close = (mTransaction ? FALSE : TRUE) && mCurrency.canCancel(); if (!can_close) { // explain to user why they can't do this, see DEV-9605 LLNotificationsUtil::add("CannotCloseFloaterBuyLand"); } return can_close; }
// virtual BOOL LLFloaterBuyLandUI::postBuild() { mCurrency.prepare(); childSetAction("buy_btn", onClickBuy, this); childSetAction("cancel_btn", onClickCancel, this); childSetAction("error_web", onClickErrorWeb, this); return TRUE; }
// virtual BOOL LLFloaterBuyLandUI::canClose() { bool can_close = (mTransaction ? FALSE : TRUE) && mCurrency.canCancel(); if (!can_close) { // explain to user why they can't do this, see DEV-9605 gViewerWindow->alertXml("CannotCloseFloaterBuyLand"); } return can_close; }
void LLFloaterBuyCurrencyUI::draw() { if (mManager.process()) { if (mManager.bought()) { std::string type_currency = LLGridManager::getInstance()->getCurrency(); LLSD args; args["CUR"] = type_currency; LLNotificationsUtil::add("BuyLindenDollarSuccess", args); closeFloater(); return; } updateUI(); } // disable the Buy button when we are not able to buy getChildView("buy_btn")->setEnabled(mManager.canBuy()); LLFloater::draw(); }
void LLFloaterBuyLandUI::draw() { LLFloater::draw(); bool needsUpdate = false; needsUpdate |= checkTransaction(); needsUpdate |= mCurrency.process(); if (mBought) { closeFloater(); } else if (needsUpdate) { if (mCanBuy && mCurrency.hasError()) { tellUserError(mCurrency.errorMessage(), mCurrency.errorURI()); } refreshUI(); } }
// virtual BOOL LLFloaterBuyLandUI::postBuild() { setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2)); mCurrency.prepare(); getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickBuy, this)); getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickCancel, this)); getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickErrorWeb, this)); center(); return TRUE; }
// virtual BOOL LLFloaterBuyCurrencyUI::postBuild() { mManager.prepare(); getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this)); getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this)); getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickErrorWeb, this)); center(); updateUI(); return TRUE; }
// virtual BOOL LLFloaterBuyCurrencyUI::postBuild() { mManager.prepare(); std::string type_currency = LLGridManager::getInstance()->getCurrency(); std::string title = "BUY " + type_currency; getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this)); getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this)); getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickErrorWeb, this)); setTitle(title); center(); updateUI(); return TRUE; }
void LLFloaterBuyCurrencyUI::target(const std::string& name, S32 price) { mHasTarget = true; mTargetName = name; mTargetPrice = price; S32 balance = gStatusBar->getBalance(); S32 need = price - balance; if (need < 0) { need = 0; } mManager.setAmount(need + MINIMUM_BALANCE_AMOUNT); }
void LLFloaterBuyLandUI::updateWebSiteInfo() { S32 askBillableArea = mIsForGroup ? 0 : mParcelBillableArea; S32 askCurrencyBuy = mCurrency.getAmount(); if (mTransaction && mTransactionType == TransactionPreflight && mPreflightAskBillableArea == askBillableArea && mPreflightAskCurrencyBuy == askCurrencyBuy) { return; } mPreflightAskBillableArea = askBillableArea; mPreflightAskCurrencyBuy = askCurrencyBuy; #if 0 // enable this code if you want the details to blank while we're talking // to the web site... it's kind of jarring mSiteValid = false; mSiteMembershipUpgrade = false; mSiteMembershipAction = "(waiting)"; mSiteMembershipPlanIDs.clear(); mSiteMembershipPlanNames.clear(); mSiteLandUseUpgrade = false; mSiteLandUseAction = "(waiting)"; mSiteCurrencyEstimated = false; mSiteCurrencyEstimatedCost = 0; #endif LLXMLRPCValue keywordArgs = LLXMLRPCValue::createStruct(); keywordArgs.appendString("agentId", gAgent.getID().asString()); keywordArgs.appendString( "secureSessionId", gAgent.getSecureSessionID().asString()); keywordArgs.appendString("language", LLUI::getLanguage()); keywordArgs.appendInt("billableArea", mPreflightAskBillableArea); keywordArgs.appendInt("currencyBuy", mPreflightAskCurrencyBuy); LLXMLRPCValue params = LLXMLRPCValue::createArray(); params.append(keywordArgs); startTransaction(TransactionPreflight, params); }
void LLFloaterBuyCurrencyUI::onClickErrorWeb() { LLWeb::loadURLExternal(mManager.errorURI()); closeFloater(); }
void LLFloaterBuyCurrencyUI::updateUI() { bool hasError = mManager.hasError(); mManager.updateUI(!hasError && !mManager.buying()); // hide most widgets - we'll turn them on as needed next getChildView("info_buying")->setVisible(FALSE); getChildView("info_cannot_buy")->setVisible(FALSE); getChildView("info_need_more")->setVisible(FALSE); getChildView("purchase_warning_repurchase")->setVisible(FALSE); getChildView("purchase_warning_notenough")->setVisible(FALSE); getChildView("contacting")->setVisible(FALSE); getChildView("buy_action")->setVisible(FALSE); if (hasError) { // display an error from the server getChildView("normal_background")->setVisible(FALSE); getChildView("error_background")->setVisible(TRUE); getChildView("info_cannot_buy")->setVisible(TRUE); getChildView("cannot_buy_message")->setVisible(TRUE); getChildView("balance_label")->setVisible(FALSE); getChildView("balance_amount")->setVisible(FALSE); getChildView("buying_label")->setVisible(FALSE); getChildView("buying_amount")->setVisible(FALSE); getChildView("total_label")->setVisible(FALSE); getChildView("total_amount")->setVisible(FALSE); LLTextBox* message = getChild<LLTextBox>("cannot_buy_message"); if (message) { message->setText(mManager.errorMessage()); } getChildView("error_web")->setVisible( !mManager.errorURI().empty()); } else { // display the main Buy L$ interface getChildView("normal_background")->setVisible(TRUE); getChildView("error_background")->setVisible(FALSE); getChildView("cannot_buy_message")->setVisible(FALSE); getChildView("error_web")->setVisible(FALSE); if (mHasTarget) { getChildView("info_need_more")->setVisible(TRUE); } else { getChildView("info_buying")->setVisible(TRUE); } if (mManager.buying()) { getChildView("contacting")->setVisible( true); } else { if (mHasTarget) { getChildView("buy_action")->setVisible( true); getChild<LLUICtrl>("buy_action")->setTextArg("[ACTION]", mTargetName); } } S32 balance = gStatusBar->getBalance(); getChildView("balance_label")->setVisible(TRUE); getChildView("balance_amount")->setVisible(TRUE); getChild<LLUICtrl>("balance_amount")->setTextArg("[AMT]", llformat("%d", balance)); S32 buying = mManager.getAmount(); getChildView("buying_label")->setVisible(TRUE); getChildView("buying_amount")->setVisible(TRUE); getChild<LLUICtrl>("buying_amount")->setTextArg("[AMT]", llformat("%d", buying)); S32 total = balance + buying; getChildView("total_label")->setVisible(TRUE); getChildView("total_amount")->setVisible(TRUE); getChild<LLUICtrl>("total_amount")->setTextArg("[AMT]", llformat("%d", total)); if (mHasTarget) { if (total >= mTargetPrice) { getChildView("purchase_warning_repurchase")->setVisible( true); } else { getChildView("purchase_warning_notenough")->setVisible( true); } } } getChildView("getting_data")->setVisible( !mManager.canBuy() && !hasError); }
void LLFloaterBuyCurrencyUI::onClickBuy() { mManager.buy(getString("buy_currency")); updateUI(); }
BOOL LLFloaterBuyCurrencyUI::canClose() { return mManager.canCancel(); }
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"); } }
void LLFloaterBuyLandUI::refreshUI() { // section zero: title area { LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image"); if (snapshot) { snapshot->setImageAssetID( mParcelValid ? mParcelSnapshot : LLUUID::null); } if (mParcelValid) { getChild<LLUICtrl>("info_parcel")->setValue(mParcelLocation); LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea); string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects); getChild<LLUICtrl>("info_size")->setValue(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"); } getChild<LLUICtrl>("info_price")->setValue(getString("info_price_string", info_price_args)); getChildView("info_price")->setVisible( mParcelIsForSale); } else { getChild<LLUICtrl>("info_parcel")->setValue(getString("no_parcel_selected")); getChild<LLUICtrl>("info_size")->setValue(LLStringUtil::null); getChild<LLUICtrl>("info_price")->setValue(LLStringUtil::null); } getChild<LLUICtrl>("info_action")->setValue( 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)")); } getChildView("error_web")->setVisible(mCannotBuyIsError && !mCannotBuyURI.empty()); } else { getChildView("step_error")->setVisible(FALSE); getChildView("error_message")->setVisible(FALSE); getChildView("error_web")->setVisible(FALSE); } // section one: account if (!showingError) { mChildren.setBadge(std::string("step_1"), mSiteMembershipUpgrade ? LLViewChildren::BADGE_NOTE : LLViewChildren::BADGE_OK); getChild<LLUICtrl>("account_action")->setValue(mSiteMembershipAction); getChild<LLUICtrl>("account_reason")->setValue( 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); } getChildView("step_1")->setVisible(TRUE); getChildView("account_action")->setVisible(TRUE); getChildView("account_reason")->setVisible(TRUE); } else { getChildView("step_1")->setVisible(FALSE); getChildView("account_action")->setVisible(FALSE); getChildView("account_reason")->setVisible(FALSE); getChildView("account_level")->setVisible(FALSE); } // section two: land use fees if (!showingError) { mChildren.setBadge(std::string("step_2"), mSiteLandUseUpgrade ? LLViewChildren::BADGE_NOTE : LLViewChildren::BADGE_OK); getChild<LLUICtrl>("land_use_action")->setValue(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 += LLTrans::getString("sentences_separator") + getString("no_parcel_selected"); } else if (mParcelBillableArea == mParcelActualArea) { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d ", mParcelActualArea); message += LLTrans::getString("sentences_separator") + getString("parcel_meters", string_args); } else { if (mParcelBillableArea > mParcelActualArea) { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea); message += LLTrans::getString("sentences_separator") + getString("premium_land", string_args); } else { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea); message += LLTrans::getString("sentences_separator") + getString("discounted_land", string_args); } } getChild<LLUICtrl>("land_use_reason")->setValue(message); getChildView("step_2")->setVisible(TRUE); getChildView("land_use_action")->setVisible(TRUE); getChildView("land_use_reason")->setVisible(TRUE); } else { getChildView("step_2")->setVisible(FALSE); getChildView("land_use_action")->setVisible(FALSE); getChildView("land_use_reason")->setVisible(FALSE); } // 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; getChild<LLUICtrl>("purchase_action")->setValue(getString("pay_to_for_land", string_args)); getChildView("purchase_action")->setVisible( mParcelValid); std::string reasonString; if (haveEnough) { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance); getChild<LLUICtrl>("currency_reason")->setValue(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); getChild<LLUICtrl>("currency_reason")->setValue(getString("not_enough_lindens", string_args)); getChild<LLUICtrl>("currency_est")->setTextArg("[LOCAL_AMOUNT]", mCurrency.getLocalEstimate()); } if (willHaveEnough) { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", finalBalance); getChild<LLUICtrl>("currency_balance")->setValue(getString("balance_left", string_args)); } else { LLStringUtil::format_map_t string_args; string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance); getChild<LLUICtrl>("currency_balance")->setValue(getString("balance_needed", string_args)); } getChild<LLUICtrl>("remove_contribution")->setValue(LLSD(groupContributionEnough)); getChildView("remove_contribution")->setEnabled(groupContributionEnough); bool showRemoveContribution = mParcelIsGroupLand && (mParcelGroupContribution > 0); getChildView("remove_contribution")->setLabelArg("[AMOUNT]", llformat("%d", minContribution)); getChildView("remove_contribution")->setVisible( showRemoveContribution); getChildView("step_3")->setVisible(TRUE); getChildView("purchase_action")->setVisible(TRUE); getChildView("currency_reason")->setVisible(TRUE); getChildView("currency_balance")->setVisible(TRUE); } else { getChildView("step_3")->setVisible(FALSE); getChildView("purchase_action")->setVisible(FALSE); getChildView("currency_reason")->setVisible(FALSE); getChildView("currency_balance")->setVisible(FALSE); getChildView("remove_group_donation")->setVisible(FALSE); } bool agrees_to_covenant = false; LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant"); if (check) { agrees_to_covenant = check->get(); } getChildView("buy_btn")->setEnabled(mCanBuy && mSiteValid && willHaveEnough && !mTransaction && agrees_to_covenant); }
void LLFloaterBuyLandUI::updateParcelInfo() { LLParcel* parcel = mParcel->getParcel(); mParcelValid = parcel && mRegion; mParcelIsForSale = false; mParcelIsGroupLand = false; mParcelGroupContribution = 0; mParcelPrice = 0; mParcelActualArea = 0; mParcelBillableArea = 0; mParcelSupportedObjects = 0; mParcelSoldWithObjects = false; mParcelLocation = ""; mParcelSnapshot.setNull(); mParcelSellerName = ""; mCanBuy = false; mCannotBuyIsError = false; if (!mParcelValid) { mCannotBuyReason = getString("no_land_selected"); return; } if (mParcel->getMultipleOwners()) { mCannotBuyReason = getString("multiple_parcels_selected"); return; } const LLUUID& parcelOwner = parcel->getOwnerID(); mIsClaim = parcel->isPublic(); if (!mIsClaim) { mParcelActualArea = parcel->getArea(); mParcelIsForSale = parcel->getForSale(); mParcelIsGroupLand = parcel->getIsGroupOwned(); mParcelPrice = mParcelIsForSale ? parcel->getSalePrice() : 0; if (mParcelIsGroupLand) { LLUUID group_id = parcel->getGroupID(); mParcelGroupContribution = gAgent.getGroupContribution(group_id); } } else { mParcelActualArea = mParcel->getClaimableArea(); mParcelIsForSale = true; mParcelPrice = mParcelActualArea * parcel->getClaimPricePerMeter(); } mParcelBillableArea = llround(mRegion->getBillableFactor() * mParcelActualArea); mParcelSupportedObjects = llround( parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()); // Can't have more than region max tasks, regardless of parcel // object bonus factor. LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(region) { S32 max_tasks_per_region = (S32)region->getMaxTasks(); mParcelSupportedObjects = llmin( mParcelSupportedObjects, max_tasks_per_region); } mParcelSoldWithObjects = parcel->getSellWithObjects(); LLVector3 center = parcel->getCenterpoint(); mParcelLocation = llformat("%s %d,%d", mRegion->getName().c_str(), (int)center[VX], (int)center[VY] ); mParcelSnapshot = parcel->getSnapshotID(); updateNames(); bool haveEnoughCash = mParcelPrice <= mAgentCashBalance; S32 cashBuy = haveEnoughCash ? 0 : (mParcelPrice - mAgentCashBalance); mCurrency.setAmount(cashBuy, true); mCurrency.setZeroMessage(haveEnoughCash ? getString("none_needed") : LLStringUtil::null); // checks that we can buy the land if(mIsForGroup && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED)) { mCannotBuyReason = getString("cant_buy_for_group"); return; } if (!mIsClaim) { const LLUUID& authorizedBuyer = parcel->getAuthorizedBuyerID(); const LLUUID buyer = gAgent.getID(); const LLUUID newOwner = mIsForGroup ? gAgent.getGroupID() : buyer; if (!mParcelIsForSale || (mParcelPrice == 0 && authorizedBuyer.isNull())) { mCannotBuyReason = getString("parcel_not_for_sale"); return; } if (parcelOwner == newOwner) { if (mIsForGroup) { mCannotBuyReason = getString("group_already_owns"); } else { mCannotBuyReason = getString("you_already_own"); } return; } if (!authorizedBuyer.isNull() && buyer != authorizedBuyer) { // Maybe the parcel is set for sale to a group we are in. bool authorized_group = gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_DEED) && gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_SET_SALE_INFO); if (!authorized_group) { mCannotBuyReason = getString("set_to_sell_to_other"); return; } } } else { if (mParcelActualArea == 0) { mCannotBuyReason = getString("no_public_land"); return; } if (mParcel->hasOthersSelected()) { // Policy: Must not have someone else's land selected mCannotBuyReason = getString("not_owned_by_you"); return; } } mCanBuy = true; }
void LLFloaterBuyCurrencyUI::noTarget() { mHasTarget = false; mManager.setAmount(STANDARD_BUY_AMOUNT); }