PageRenderTime 44ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/newview/llpanelplaceprofile.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 666 lines | 517 code | 94 blank | 55 comment | 42 complexity | db3774d8a453986b735b10b2d2ae877c MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpanelplaceprofile.cpp
  3. * @brief Displays place profile in Side Tray.
  4. *
  5. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llpanelplaceprofile.h"
  28. #include "llavatarnamecache.h"
  29. #include "llparcel.h"
  30. #include "message.h"
  31. #include "llexpandabletextbox.h"
  32. #include "lliconctrl.h"
  33. #include "lllineeditor.h"
  34. #include "lltextbox.h"
  35. #include "lltexteditor.h"
  36. #include "lltrans.h"
  37. #include "llaccordionctrl.h"
  38. #include "llaccordionctrltab.h"
  39. #include "llagent.h"
  40. #include "llagentui.h"
  41. #include "llappviewer.h"
  42. #include "llcallbacklist.h"
  43. #include "llbuycurrencyhtml.h"
  44. #include "llslurl.h"
  45. #include "llstatusbar.h"
  46. #include "llviewercontrol.h"
  47. #include "llviewerparcelmgr.h"
  48. #include "llviewerregion.h"
  49. static LLRegisterPanelClassWrapper<LLPanelPlaceProfile> t_place_profile("panel_place_profile");
  50. // Statics for textures filenames
  51. static std::string icon_pg;
  52. static std::string icon_m;
  53. static std::string icon_r;
  54. static std::string icon_voice;
  55. static std::string icon_voice_no;
  56. static std::string icon_fly;
  57. static std::string icon_fly_no;
  58. static std::string icon_push;
  59. static std::string icon_push_no;
  60. static std::string icon_build;
  61. static std::string icon_build_no;
  62. static std::string icon_scripts;
  63. static std::string icon_scripts_no;
  64. static std::string icon_damage;
  65. static std::string icon_damage_no;
  66. static std::string icon_see_avs_on;
  67. static std::string icon_see_avs_off;
  68. LLPanelPlaceProfile::LLPanelPlaceProfile()
  69. : LLPanelPlaceInfo(),
  70. mForSalePanel(NULL),
  71. mYouAreHerePanel(NULL),
  72. mSelectedParcelID(-1),
  73. mAccordionCtrl(NULL)
  74. {}
  75. // virtual
  76. LLPanelPlaceProfile::~LLPanelPlaceProfile()
  77. {
  78. gIdleCallbacks.deleteFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
  79. }
  80. // virtual
  81. BOOL LLPanelPlaceProfile::postBuild()
  82. {
  83. LLPanelPlaceInfo::postBuild();
  84. mForSalePanel = getChild<LLPanel>("for_sale_panel");
  85. mYouAreHerePanel = getChild<LLPanel>("here_panel");
  86. gIdleCallbacks.addFunction(&LLPanelPlaceProfile::updateYouAreHereBanner, this);
  87. //Icon value should contain sale price of last selected parcel.
  88. mForSalePanel->getChild<LLIconCtrl>("icon_for_sale")->
  89. setMouseDownCallback(boost::bind(&LLPanelPlaceProfile::onForSaleBannerClick, this));
  90. mParcelOwner = getChild<LLTextBox>("owner_value");
  91. mParcelRatingIcon = getChild<LLIconCtrl>("rating_icon");
  92. mParcelRatingText = getChild<LLTextBox>("rating_value");
  93. mVoiceIcon = getChild<LLIconCtrl>("voice_icon");
  94. mVoiceText = getChild<LLTextBox>("voice_value");
  95. mFlyIcon = getChild<LLIconCtrl>("fly_icon");
  96. mFlyText = getChild<LLTextBox>("fly_value");
  97. mPushIcon = getChild<LLIconCtrl>("push_icon");
  98. mPushText = getChild<LLTextBox>("push_value");
  99. mBuildIcon = getChild<LLIconCtrl>("build_icon");
  100. mBuildText = getChild<LLTextBox>("build_value");
  101. mScriptsIcon = getChild<LLIconCtrl>("scripts_icon");
  102. mScriptsText = getChild<LLTextBox>("scripts_value");
  103. mDamageIcon = getChild<LLIconCtrl>("damage_icon");
  104. mDamageText = getChild<LLTextBox>("damage_value");
  105. mSeeAVsIcon = getChild<LLIconCtrl>("see_avatars_icon");
  106. mSeeAVsText = getChild<LLTextBox>("see_avatars_value");
  107. mRegionNameText = getChild<LLTextBox>("region_name");
  108. mRegionTypeText = getChild<LLTextBox>("region_type");
  109. mRegionRatingIcon = getChild<LLIconCtrl>("region_rating_icon");
  110. mRegionRatingText = getChild<LLTextBox>("region_rating");
  111. mRegionOwnerText = getChild<LLTextBox>("region_owner");
  112. mRegionGroupText = getChild<LLTextBox>("region_group");
  113. mEstateNameText = getChild<LLTextBox>("estate_name");
  114. mEstateRatingText = getChild<LLTextBox>("estate_rating");
  115. mEstateOwnerText = getChild<LLTextBox>("estate_owner");
  116. mCovenantText = getChild<LLTextEditor>("covenant");
  117. mSalesPriceText = getChild<LLTextBox>("sales_price");
  118. mAreaText = getChild<LLTextBox>("area");
  119. mTrafficText = getChild<LLTextBox>("traffic");
  120. mPrimitivesText = getChild<LLTextBox>("primitives");
  121. mParcelScriptsText = getChild<LLTextBox>("parcel_scripts");
  122. mTerraformLimitsText = getChild<LLTextBox>("terraform_limits");
  123. mSubdivideText = getChild<LLTextEditor>("subdivide");
  124. mResaleText = getChild<LLTextEditor>("resale");
  125. mSaleToText = getChild<LLTextBox>("sale_to");
  126. mAccordionCtrl = getChild<LLAccordionCtrl>("advanced_info_accordion");
  127. icon_pg = getString("icon_PG");
  128. icon_m = getString("icon_M");
  129. icon_r = getString("icon_R");
  130. icon_voice = getString("icon_Voice");
  131. icon_voice_no = getString("icon_VoiceNo");
  132. icon_fly = getString("icon_Fly");
  133. icon_fly_no = getString("icon_FlyNo");
  134. icon_push = getString("icon_Push");
  135. icon_push_no = getString("icon_PushNo");
  136. icon_build = getString("icon_Build");
  137. icon_build_no = getString("icon_BuildNo");
  138. icon_scripts = getString("icon_Scripts");
  139. icon_scripts_no = getString("icon_ScriptsNo");
  140. icon_damage = getString("icon_Damage");
  141. icon_damage_no = getString("icon_DamageNo");
  142. icon_see_avs_on = getString("icon_SeeAVs_On");
  143. icon_see_avs_off = getString("icon_SeeAVs_Off");
  144. return TRUE;
  145. }
  146. // virtual
  147. void LLPanelPlaceProfile::resetLocation()
  148. {
  149. LLPanelPlaceInfo::resetLocation();
  150. mForSalePanel->setVisible(FALSE);
  151. mYouAreHerePanel->setVisible(FALSE);
  152. std::string loading = LLTrans::getString("LoadingData");
  153. mParcelOwner->setValue(loading);
  154. mParcelRatingIcon->setValue(loading);
  155. mParcelRatingText->setText(loading);
  156. mVoiceIcon->setValue(loading);
  157. mVoiceText->setText(loading);
  158. mFlyIcon->setValue(loading);
  159. mFlyText->setText(loading);
  160. mPushIcon->setValue(loading);
  161. mPushText->setText(loading);
  162. mBuildIcon->setValue(loading);
  163. mBuildText->setText(loading);
  164. mScriptsIcon->setValue(loading);
  165. mScriptsText->setText(loading);
  166. mDamageIcon->setValue(loading);
  167. mDamageText->setText(loading);
  168. mSeeAVsIcon->setValue(loading);
  169. mSeeAVsText->setText(loading);
  170. mRegionNameText->setValue(loading);
  171. mRegionTypeText->setValue(loading);
  172. mRegionRatingIcon->setValue(loading);
  173. mRegionRatingText->setValue(loading);
  174. mRegionOwnerText->setValue(loading);
  175. mRegionGroupText->setValue(loading);
  176. mEstateNameText->setValue(loading);
  177. mEstateRatingText->setValue(loading);
  178. mEstateOwnerText->setValue(loading);
  179. mCovenantText->setValue(loading);
  180. mSalesPriceText->setValue(loading);
  181. mAreaText->setValue(loading);
  182. mTrafficText->setValue(loading);
  183. mPrimitivesText->setValue(loading);
  184. mParcelScriptsText->setValue(loading);
  185. mTerraformLimitsText->setValue(loading);
  186. mSubdivideText->setValue(loading);
  187. mResaleText->setValue(loading);
  188. mSaleToText->setValue(loading);
  189. }
  190. // virtual
  191. void LLPanelPlaceProfile::setInfoType(EInfoType type)
  192. {
  193. bool is_info_type_agent = type == AGENT;
  194. mMaturityRatingIcon->setVisible(!is_info_type_agent);
  195. mMaturityRatingText->setVisible(!is_info_type_agent);
  196. getChild<LLTextBox>("owner_label")->setVisible(is_info_type_agent);
  197. mParcelOwner->setVisible(is_info_type_agent);
  198. getChild<LLAccordionCtrl>("advanced_info_accordion")->setVisible(is_info_type_agent);
  199. // If we came from search we want larger description area, approx. 10 lines (see STORM-1311).
  200. // Don't use the maximum available space because that leads to nasty artifacts
  201. // in text editor and expandable text box.
  202. {
  203. const S32 SEARCH_DESC_HEIGHT = 150;
  204. // Remember original geometry (once).
  205. static const S32 sOrigDescVPad = getChildView("parcel_title")->getRect().mBottom - mDescEditor->getRect().mTop;
  206. static const S32 sOrigDescHeight = mDescEditor->getRect().getHeight();
  207. static const S32 sOrigMRIconVPad = mDescEditor->getRect().mBottom - mMaturityRatingIcon->getRect().mTop;
  208. static const S32 sOrigMRTextVPad = mDescEditor->getRect().mBottom - mMaturityRatingText->getRect().mTop;
  209. // Resize the description.
  210. const S32 desc_height = is_info_type_agent ? sOrigDescHeight : SEARCH_DESC_HEIGHT;
  211. const S32 desc_top = getChildView("parcel_title")->getRect().mBottom - sOrigDescVPad;
  212. LLRect desc_rect = mDescEditor->getRect();
  213. desc_rect.setOriginAndSize(desc_rect.mLeft, desc_top - desc_height, desc_rect.getWidth(), desc_height);
  214. mDescEditor->reshape(desc_rect.getWidth(), desc_rect.getHeight());
  215. mDescEditor->setRect(desc_rect);
  216. mDescEditor->updateTextShape();
  217. // Move the maturity rating icon/text accordingly.
  218. const S32 mr_icon_bottom = mDescEditor->getRect().mBottom - sOrigMRIconVPad - mMaturityRatingIcon->getRect().getHeight();
  219. const S32 mr_text_bottom = mDescEditor->getRect().mBottom - sOrigMRTextVPad - mMaturityRatingText->getRect().getHeight();
  220. mMaturityRatingIcon->setOrigin(mMaturityRatingIcon->getRect().mLeft, mr_icon_bottom);
  221. mMaturityRatingText->setOrigin(mMaturityRatingText->getRect().mLeft, mr_text_bottom);
  222. }
  223. switch(type)
  224. {
  225. case AGENT:
  226. case PLACE:
  227. default:
  228. mCurrentTitle = getString("title_place");
  229. break;
  230. case TELEPORT_HISTORY:
  231. mCurrentTitle = getString("title_teleport_history");
  232. break;
  233. }
  234. if (mAccordionCtrl != NULL)
  235. {
  236. mAccordionCtrl->expandDefaultTab();
  237. }
  238. LLPanelPlaceInfo::setInfoType(type);
  239. }
  240. // virtual
  241. void LLPanelPlaceProfile::processParcelInfo(const LLParcelData& parcel_data)
  242. {
  243. LLPanelPlaceInfo::processParcelInfo(parcel_data);
  244. // HACK: Flag 0x2 == adult region,
  245. // Flag 0x1 == mature region, otherwise assume PG
  246. if (parcel_data.flags & 0x2)
  247. {
  248. mMaturityRatingIcon->setValue(icon_r);
  249. mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_ADULT));
  250. }
  251. else if (parcel_data.flags & 0x1)
  252. {
  253. mMaturityRatingIcon->setValue(icon_m);
  254. mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_MATURE));
  255. }
  256. else
  257. {
  258. mMaturityRatingIcon->setValue(icon_pg);
  259. mMaturityRatingText->setText(LLViewerRegion::accessToString(SIM_ACCESS_PG));
  260. }
  261. }
  262. // virtual
  263. void LLPanelPlaceProfile::handleVisibilityChange(BOOL new_visibility)
  264. {
  265. LLPanel::handleVisibilityChange(new_visibility);
  266. LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
  267. if (!parcel_mgr)
  268. return;
  269. // Remove land selection when panel hides.
  270. if (!new_visibility)
  271. {
  272. if (!parcel_mgr->selectionEmpty())
  273. {
  274. parcel_mgr->deselectUnused();
  275. }
  276. }
  277. }
  278. void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel,
  279. LLViewerRegion* region,
  280. const LLVector3d& pos_global,
  281. bool is_current_parcel)
  282. {
  283. if (!region || !parcel)
  284. return;
  285. // send EstateCovenantInfo message
  286. LLMessageSystem *msg = gMessageSystem;
  287. msg->newMessage("EstateCovenantRequest");
  288. msg->nextBlockFast(_PREHASH_AgentData);
  289. msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
  290. msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
  291. msg->sendReliable(region->getHost());
  292. LLParcelData parcel_data;
  293. // HACK: Converting sim access flags to the format
  294. // returned by remote parcel response.
  295. U8 sim_access = region->getSimAccess();
  296. switch(sim_access)
  297. {
  298. case SIM_ACCESS_MATURE:
  299. parcel_data.flags = 0x1;
  300. mParcelRatingIcon->setValue(icon_m);
  301. mRegionRatingIcon->setValue(icon_m);
  302. break;
  303. case SIM_ACCESS_ADULT:
  304. parcel_data.flags = 0x2;
  305. mParcelRatingIcon->setValue(icon_r);
  306. mRegionRatingIcon->setValue(icon_r);
  307. break;
  308. default:
  309. parcel_data.flags = 0;
  310. mParcelRatingIcon->setValue(icon_pg);
  311. mRegionRatingIcon->setValue(icon_pg);
  312. }
  313. std::string rating = LLViewerRegion::accessToString(sim_access);
  314. mParcelRatingText->setText(rating);
  315. mRegionRatingText->setText(rating);
  316. parcel_data.desc = parcel->getDesc();
  317. parcel_data.name = parcel->getName();
  318. parcel_data.sim_name = region->getName();
  319. parcel_data.snapshot_id = parcel->getSnapshotID();
  320. mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
  321. (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
  322. (F32)pos_global.mdV[VZ]);
  323. parcel_data.global_x = pos_global.mdV[VX];
  324. parcel_data.global_y = pos_global.mdV[VY];
  325. parcel_data.global_z = pos_global.mdV[VZ];
  326. std::string on = getString("on");
  327. std::string off = getString("off");
  328. LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance();
  329. // Processing parcel characteristics
  330. if (vpm->allowAgentVoice(region, parcel))
  331. {
  332. mVoiceIcon->setValue(icon_voice);
  333. mVoiceText->setText(on);
  334. }
  335. else
  336. {
  337. mVoiceIcon->setValue(icon_voice_no);
  338. mVoiceText->setText(off);
  339. }
  340. if (vpm->allowAgentFly(region, parcel))
  341. {
  342. mFlyIcon->setValue(icon_fly);
  343. mFlyText->setText(on);
  344. }
  345. else
  346. {
  347. mFlyIcon->setValue(icon_fly_no);
  348. mFlyText->setText(off);
  349. }
  350. if (vpm->allowAgentPush(region, parcel))
  351. {
  352. mPushIcon->setValue(icon_push);
  353. mPushText->setText(on);
  354. }
  355. else
  356. {
  357. mPushIcon->setValue(icon_push_no);
  358. mPushText->setText(off);
  359. }
  360. if (vpm->allowAgentBuild(parcel))
  361. {
  362. mBuildIcon->setValue(icon_build);
  363. mBuildText->setText(on);
  364. }
  365. else
  366. {
  367. mBuildIcon->setValue(icon_build_no);
  368. mBuildText->setText(off);
  369. }
  370. if (vpm->allowAgentScripts(region, parcel))
  371. {
  372. mScriptsIcon->setValue(icon_scripts);
  373. mScriptsText->setText(on);
  374. }
  375. else
  376. {
  377. mScriptsIcon->setValue(icon_scripts_no);
  378. mScriptsText->setText(off);
  379. }
  380. if (vpm->allowAgentDamage(region, parcel))
  381. {
  382. mDamageIcon->setValue(icon_damage);
  383. mDamageText->setText(on);
  384. }
  385. else
  386. {
  387. mDamageIcon->setValue(icon_damage_no);
  388. mDamageText->setText(off);
  389. }
  390. if (parcel->getSeeAVs())
  391. {
  392. mSeeAVsIcon->setValue(icon_see_avs_on);
  393. mSeeAVsText->setText(on);
  394. }
  395. else
  396. {
  397. mSeeAVsIcon->setValue(icon_see_avs_off);
  398. mSeeAVsText->setText(off);
  399. }
  400. mRegionNameText->setText(region->getName());
  401. mRegionTypeText->setText(region->getLocalizedSimProductName());
  402. // Determine parcel owner
  403. if (parcel->isPublic())
  404. {
  405. mParcelOwner->setText(getString("public"));
  406. mRegionOwnerText->setText(getString("public"));
  407. }
  408. else
  409. {
  410. if (parcel->getIsGroupOwned())
  411. {
  412. mRegionOwnerText->setText(getString("group_owned_text"));
  413. if(!parcel->getGroupID().isNull())
  414. {
  415. // FIXME: Using parcel group as region group.
  416. gCacheName->getGroup(parcel->getGroupID(),
  417. boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionGroupText, _2));
  418. gCacheName->getGroup(parcel->getGroupID(),
  419. boost::bind(&LLPanelPlaceInfo::onNameCache, mParcelOwner, _2));
  420. }
  421. else
  422. {
  423. std::string owner = getString("none_text");
  424. mRegionGroupText->setText(owner);
  425. mParcelOwner->setText(owner);
  426. }
  427. }
  428. else
  429. {
  430. // Figure out the owner's name
  431. std::string parcel_owner =
  432. LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
  433. mParcelOwner->setText(parcel_owner);
  434. LLAvatarNameCache::get(region->getOwner(),
  435. boost::bind(&LLPanelPlaceInfo::onAvatarNameCache,
  436. _1, _2, mRegionOwnerText));
  437. }
  438. if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
  439. {
  440. mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text"));
  441. }
  442. }
  443. mEstateRatingText->setText(region->getSimAccessString());
  444. S32 area;
  445. S32 claim_price;
  446. S32 rent_price;
  447. F32 dwell;
  448. BOOL for_sale;
  449. vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell);
  450. if (for_sale)
  451. {
  452. const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
  453. if(auth_buyer_id.notNull())
  454. {
  455. LLAvatarNameCache::get(auth_buyer_id,
  456. boost::bind(&LLPanelPlaceInfo::onAvatarNameCache,
  457. _1, _2, mSaleToText));
  458. // Show sales info to a specific person or a group he belongs to.
  459. if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id))
  460. {
  461. for_sale = FALSE;
  462. }
  463. }
  464. else
  465. {
  466. mSaleToText->setText(getString("anyone"));
  467. }
  468. mForSalePanel->setVisible(for_sale);
  469. const U8* sign = (U8*)getString("price_text").c_str();
  470. const U8* sqm = (U8*)getString("area_text").c_str();
  471. mSalesPriceText->setText(llformat("%s%d ", sign, parcel->getSalePrice()));
  472. mAreaText->setText(llformat("%d %s", area, sqm));
  473. mTrafficText->setText(llformat("%.0f", dwell));
  474. // Can't have more than region max tasks, regardless of parcel
  475. // object bonus factor.
  476. S32 primitives = llmin(llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
  477. (S32)region->getMaxTasks());
  478. const U8* available = (U8*)getString("available").c_str();
  479. const U8* allocated = (U8*)getString("allocated").c_str();
  480. mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available, parcel->getPrimCount(), allocated));
  481. if (parcel->getAllowOtherScripts())
  482. {
  483. mParcelScriptsText->setText(getString("all_residents_text"));
  484. }
  485. else if (parcel->getAllowGroupScripts())
  486. {
  487. mParcelScriptsText->setText(getString("group_text"));
  488. }
  489. else
  490. {
  491. mParcelScriptsText->setText(off);
  492. }
  493. mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off);
  494. if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
  495. {
  496. mSubdivideText->setText(getString("can_change"));
  497. }
  498. else
  499. {
  500. mSubdivideText->setText(getString("can_not_change"));
  501. }
  502. if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
  503. {
  504. mResaleText->setText(getString("can_not_resell"));
  505. }
  506. else
  507. {
  508. mResaleText->setText(getString("can_resell"));
  509. }
  510. }
  511. mSelectedParcelID = parcel->getLocalID();
  512. mLastSelectedRegionID = region->getRegionID();
  513. LLPanelPlaceInfo::processParcelInfo(parcel_data);
  514. mYouAreHerePanel->setVisible(is_current_parcel);
  515. getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale);
  516. }
  517. void LLPanelPlaceProfile::updateEstateName(const std::string& name)
  518. {
  519. mEstateNameText->setText(name);
  520. }
  521. void LLPanelPlaceProfile::updateEstateOwnerName(const std::string& name)
  522. {
  523. mEstateOwnerText->setText(name);
  524. }
  525. void LLPanelPlaceProfile::updateCovenantText(const std::string &text)
  526. {
  527. mCovenantText->setText(text);
  528. }
  529. void LLPanelPlaceProfile::onForSaleBannerClick()
  530. {
  531. LLViewerParcelMgr* mgr = LLViewerParcelMgr::getInstance();
  532. LLParcel* parcel = mgr->getFloatingParcelSelection()->getParcel();
  533. LLViewerRegion* selected_region = mgr->getSelectionRegion();
  534. if(parcel && selected_region)
  535. {
  536. if(parcel->getLocalID() == mSelectedParcelID &&
  537. mLastSelectedRegionID ==selected_region->getRegionID())
  538. {
  539. S32 price = parcel->getSalePrice();
  540. if(price - gStatusBar->getBalance() > 0)
  541. {
  542. LLStringUtil::format_map_t args;
  543. args["AMOUNT"] = llformat("%d", price);
  544. LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("buying_selected_land", args), price );
  545. }
  546. else
  547. {
  548. LLViewerParcelMgr::getInstance()->startBuyLand();
  549. }
  550. }
  551. else
  552. {
  553. LL_WARNS("Places") << "User is trying to buy remote parcel.Operation is not supported"<< LL_ENDL;
  554. }
  555. }
  556. }
  557. // static
  558. void LLPanelPlaceProfile::updateYouAreHereBanner(void* userdata)
  559. {
  560. //YouAreHere Banner should be displayed only for selected places,
  561. // If you want to display it for landmark or teleport history item, you should check by mParcelId
  562. LLPanelPlaceProfile* self = static_cast<LLPanelPlaceProfile*>(userdata);
  563. if(!self->getVisible())
  564. return;
  565. if(!gDisconnected && gAgent.getRegion())
  566. {
  567. static F32 radius = gSavedSettings.getF32("YouAreHereDistance");
  568. BOOL display_banner = gAgent.getRegion()->getRegionID() == self->mLastSelectedRegionID &&
  569. LLAgentUI::checkAgentDistance(self->mPosRegion, radius);
  570. self->mYouAreHerePanel->setVisible(display_banner);
  571. }
  572. }