summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersellland.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersellland.cpp')
-rw-r--r--indra/newview/llfloatersellland.cpp88
1 files changed, 49 insertions, 39 deletions
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index 9dddbd998a..a10b9eac63 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -33,6 +33,7 @@
#include "llfloatersellland.h"
+#include "llavatarnamecache.h"
#include "llfloateravatarpicker.h"
#include "llfloaterreg.h"
#include "llfloaterland.h"
@@ -47,6 +48,8 @@
#include "lluictrlfactory.h"
#include "llviewerwindow.h"
+class LLAvatarName;
+
// defined in llfloaterland.cpp
void send_parcel_select_objects(S32 parcel_local_id, U32 return_type,
uuid_list_t* return_ids = NULL);
@@ -95,7 +98,9 @@ private:
bool onConfirmSale(const LLSD& notification, const LLSD& response);
static void doShowObjects(void *userdata);
- void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids);
+ void callbackAvatarPick(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+
+ void onBuyerNameCache(const LLAvatarName& av_name);
public:
virtual BOOL postBuild();
@@ -163,7 +168,7 @@ BOOL LLFloaterSellLandUI::postBuild()
{
childSetCommitCallback("sell_to", onChangeValue, this);
childSetCommitCallback("price", onChangeValue, this);
- childSetPrevalidate("price", LLTextValidate::validateNonNegativeS32);
+ getChild<LLLineEditor>("price")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
childSetCommitCallback("sell_objects", onChangeValue, this);
childSetAction("sell_to_select_agent", boost::bind( &LLFloaterSellLandUI::doSelectAgent, this));
childSetAction("cancel_btn", doCancel, this);
@@ -207,20 +212,20 @@ void LLFloaterSellLandUI::updateParcelInfo()
mParcelSoldWithObjects = parcelp->getSellWithObjects();
if (mParcelIsForSale)
{
- childSetValue("price", mParcelPrice);
+ getChild<LLUICtrl>("price")->setValue(mParcelPrice);
if (mParcelSoldWithObjects)
{
- childSetValue("sell_objects", "yes");
+ getChild<LLUICtrl>("sell_objects")->setValue("yes");
}
else
{
- childSetValue("sell_objects", "no");
+ getChild<LLUICtrl>("sell_objects")->setValue("no");
}
}
else
{
- childSetValue("price", "");
- childSetValue("sell_objects", "none");
+ getChild<LLUICtrl>("price")->setValue("");
+ getChild<LLUICtrl>("sell_objects")->setValue("none");
}
mParcelSnapshot = parcelp->getSnapshotID();
@@ -230,12 +235,17 @@ void LLFloaterSellLandUI::updateParcelInfo()
if(mSellToBuyer)
{
- std::string name;
- gCacheName->getFullName(mAuthorizedBuyer, name);
- childSetText("sell_to_agent", name);
+ LLAvatarNameCache::get(mAuthorizedBuyer,
+ boost::bind(&LLFloaterSellLandUI::onBuyerNameCache, this, _2));
}
}
+void LLFloaterSellLandUI::onBuyerNameCache(const LLAvatarName& av_name)
+{
+ getChild<LLUICtrl>("sell_to_agent")->setValue(av_name.getCompleteName());
+ getChild<LLUICtrl>("sell_to_agent")->setToolTip(av_name.mUsername);
+}
+
void LLFloaterSellLandUI::setBadge(const char* id, Badge badge)
{
static std::string badgeOK("badge_ok.j2c");
@@ -253,7 +263,7 @@ void LLFloaterSellLandUI::setBadge(const char* id, Badge badge)
case BADGE_ERROR: badgeName = badgeError; break;
}
- childSetValue(id, badgeName);
+ getChild<LLUICtrl>(id)->setValue(badgeName);
}
void LLFloaterSellLandUI::refreshUI()
@@ -264,10 +274,10 @@ void LLFloaterSellLandUI::refreshUI()
LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
snapshot->setImageAssetID(mParcelSnapshot);
- childSetText("info_parcel", parcelp->getName());
- childSetTextArg("info_size", "[AREA]", llformat("%d", mParcelActualArea));
+ getChild<LLUICtrl>("info_parcel")->setValue(parcelp->getName());
+ getChild<LLUICtrl>("info_size")->setTextArg("[AREA]", llformat("%d", mParcelActualArea));
- std::string price_str = childGetValue("price").asString();
+ std::string price_str = getChild<LLUICtrl>("price")->getValue().asString();
bool valid_price = false;
valid_price = (price_str != "") && LLTextValidate::validateNonNegativeS32(utf8str_to_wstring(price_str));
@@ -275,14 +285,14 @@ void LLFloaterSellLandUI::refreshUI()
{
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");
+ getChild<LLUICtrl>("price_per_m")->setTextArg("[PER_METER]", llformat("%0.2f", per_meter_price));
+ getChildView("price_per_m")->setVisible(TRUE);
setBadge("step_price", BADGE_OK);
}
else
{
- childHide("price_per_m");
+ getChildView("price_per_m")->setVisible(FALSE);
if ("" == price_str)
{
@@ -296,26 +306,26 @@ void LLFloaterSellLandUI::refreshUI()
if (mSellToBuyer)
{
- childSetValue("sell_to", "user");
- childShow("sell_to_agent");
- childShow("sell_to_select_agent");
+ getChild<LLUICtrl>("sell_to")->setValue("user");
+ getChildView("sell_to_agent")->setVisible(TRUE);
+ getChildView("sell_to_select_agent")->setVisible(TRUE);
}
else
{
if (mChoseSellTo)
{
- childSetValue("sell_to", "anyone");
+ getChild<LLUICtrl>("sell_to")->setValue("anyone");
}
else
{
- childSetValue("sell_to", "select");
+ getChild<LLUICtrl>("sell_to")->setValue("select");
}
- childHide("sell_to_agent");
- childHide("sell_to_select_agent");
+ getChildView("sell_to_agent")->setVisible(FALSE);
+ getChildView("sell_to_select_agent")->setVisible(FALSE);
}
// Must select Sell To: Anybody, or User (with a specified username)
- std::string sell_to = childGetValue("sell_to").asString();
+ std::string sell_to = getChild<LLUICtrl>("sell_to")->getValue().asString();
bool valid_sell_to = "select" != sell_to &&
("user" != sell_to || mAuthorizedBuyer.notNull());
@@ -328,7 +338,7 @@ void LLFloaterSellLandUI::refreshUI()
setBadge("step_sell_to", BADGE_OK);
}
- bool valid_sell_objects = ("none" != childGetValue("sell_objects").asString());
+ bool valid_sell_objects = ("none" != getChild<LLUICtrl>("sell_objects")->getValue().asString());
if (!valid_sell_objects)
{
@@ -341,11 +351,11 @@ void LLFloaterSellLandUI::refreshUI()
if (valid_sell_to && valid_price && valid_sell_objects)
{
- childEnable("sell_btn");
+ getChildView("sell_btn")->setEnabled(TRUE);
}
else
{
- childDisable("sell_btn");
+ getChildView("sell_btn")->setEnabled(FALSE);
}
}
@@ -354,7 +364,7 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata)
{
LLFloaterSellLandUI *self = (LLFloaterSellLandUI *)userdata;
- std::string sell_to = self->childGetValue("sell_to").asString();
+ std::string sell_to = self->getChild<LLUICtrl>("sell_to")->getValue().asString();
if (sell_to == "user")
{
@@ -371,9 +381,9 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata)
self->mSellToBuyer = false;
}
- self->mParcelPrice = self->childGetValue("price");
+ self->mParcelPrice = self->getChild<LLUICtrl>("price")->getValue();
- if ("yes" == self->childGetValue("sell_objects").asString())
+ if ("yes" == self->getChild<LLUICtrl>("sell_objects")->getValue().asString())
{
self->mParcelSoldWithObjects = true;
}
@@ -391,7 +401,7 @@ void LLFloaterSellLandUI::doSelectAgent()
addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE));
}
-void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids)
+void LLFloaterSellLandUI::callbackAvatarPick(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
LLParcel* parcel = mParcelSelection->getParcel();
@@ -402,7 +412,7 @@ void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& nam
mAuthorizedBuyer = ids[0];
- childSetText("sell_to_agent", names[0]);
+ getChild<LLUICtrl>("sell_to_agent")->setValue(names[0].getCompleteName());
refreshUI();
}
@@ -445,13 +455,13 @@ void LLFloaterSellLandUI::doSellLand(void *userdata)
LLParcel* parcel = self->mParcelSelection->getParcel();
// Do a confirmation
- S32 sale_price = self->childGetValue("price");
+ S32 sale_price = self->getChild<LLUICtrl>("price")->getValue();
S32 area = parcel->getArea();
std::string authorizedBuyerName = "Anyone";
bool sell_to_anyone = true;
- if ("user" == self->childGetValue("sell_to").asString())
+ if ("user" == self->getChild<LLUICtrl>("sell_to")->getValue().asString())
{
- authorizedBuyerName = self->childGetText("sell_to_agent");
+ authorizedBuyerName = self->getChild<LLUICtrl>("sell_to_agent")->getValue().asString();
sell_to_anyone = false;
}
@@ -498,7 +508,7 @@ bool LLFloaterSellLandUI::onConfirmSale(const LLSD& notification, const LLSD& re
{
return false;
}
- S32 sale_price = childGetValue("price");
+ S32 sale_price = getChild<LLUICtrl>("price")->getValue();
// Valid extracted data
if (sale_price < 0)
@@ -520,12 +530,12 @@ bool LLFloaterSellLandUI::onConfirmSale(const LLSD& notification, const LLSD& re
parcel->setParcelFlag(PF_FOR_SALE, TRUE);
parcel->setSalePrice(sale_price);
bool sell_with_objects = false;
- if ("yes" == childGetValue("sell_objects").asString())
+ if ("yes" == getChild<LLUICtrl>("sell_objects")->getValue().asString())
{
sell_with_objects = true;
}
parcel->setSellWithObjects(sell_with_objects);
- if ("user" == childGetValue("sell_to").asString())
+ if ("user" == getChild<LLUICtrl>("sell_to")->getValue().asString())
{
parcel->setAuthorizedBuyerID(mAuthorizedBuyer);
}