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(); }
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 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::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"); } }