aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterland.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterland.cpp')
-rw-r--r--linden/indra/newview/llfloaterland.cpp474
1 files changed, 109 insertions, 365 deletions
diff --git a/linden/indra/newview/llfloaterland.cpp b/linden/indra/newview/llfloaterland.cpp
index 447571d..c75917b 100644
--- a/linden/indra/newview/llfloaterland.cpp
+++ b/linden/indra/newview/llfloaterland.cpp
@@ -31,8 +31,6 @@
31 31
32#include "llviewerprecompiledheaders.h" 32#include "llviewerprecompiledheaders.h"
33 33
34#include <sstream>
35
36#include "llfloaterland.h" 34#include "llfloaterland.h"
37 35
38#include "llcachename.h" 36#include "llcachename.h"
@@ -53,6 +51,7 @@
53#include "lllineeditor.h" 51#include "lllineeditor.h"
54#include "llnamelistctrl.h" 52#include "llnamelistctrl.h"
55#include "llnotify.h" 53#include "llnotify.h"
54#include "llpanellandmedia.h"
56#include "llradiogroup.h" 55#include "llradiogroup.h"
57#include "llscrolllistctrl.h" 56#include "llscrolllistctrl.h"
58#include "llselectmgr.h" 57#include "llselectmgr.h"
@@ -68,10 +67,39 @@
68#include "llviewerstats.h" 67#include "llviewerstats.h"
69#include "llviewertexteditor.h" 68#include "llviewertexteditor.h"
70#include "llviewerwindow.h" 69#include "llviewerwindow.h"
71#include "llmediaengine.h"
72#include "llviewercontrol.h" 70#include "llviewercontrol.h"
73#include "roles_constants.h" 71#include "roles_constants.h"
74 72
73#include <sstream>
74#include <time.h>
75
76static const S32 EDIT_HEIGHT = 16;
77static const S32 LEFT = HPAD;
78static const S32 BOTTOM = VPAD;
79static const S32 RULER0 = LEFT;
80static const S32 RULER05 = RULER0 + 24;
81static const S32 RULER1 = RULER05 + 16;
82static const S32 RULER15 = RULER1 + 20;
83static const S32 RULER2 = RULER1 + 32;
84static const S32 RULER205= RULER2 + 32;
85static const S32 RULER20 = RULER2 + 64;
86static const S32 RULER21 = RULER20 + 16;
87static const S32 RULER22 = RULER21 + 32;
88static const S32 RULER225 = RULER20 + 64;
89static const S32 RULER23 = RULER22 + 64;
90static const S32 RULER24 = RULER23 + 26;
91static const S32 RULER3 = RULER2 + 102;
92static const S32 RULER4 = RULER3 + 8;
93static const S32 RULER5 = RULER4 + 50;
94static const S32 RULER6 = RULER5 + 52;
95static const S32 RULER7 = RULER6 + 24;
96static const S32 RIGHT = LEFT + 278;
97static const S32 FAR_RIGHT = LEFT + 324 + 40;
98
99static const char PRICE[] = "Price:";
100static const char NO_PRICE[] = "";
101static const char AREA[] = "Area:";
102
75static const char OWNER_ONLINE[] = "0"; 103static const char OWNER_ONLINE[] = "0";
76static const char OWNER_OFFLINE[] = "1"; 104static const char OWNER_OFFLINE[] = "1";
77static const char OWNER_GROUP[] = "2"; 105static const char OWNER_GROUP[] = "2";
@@ -80,20 +108,11 @@ static const char OWNER_GROUP[] = "2";
80static const BOOL BUY_GROUP_LAND = TRUE; 108static const BOOL BUY_GROUP_LAND = TRUE;
81static const BOOL BUY_PERSONAL_LAND = FALSE; 109static const BOOL BUY_PERSONAL_LAND = FALSE;
82 110
83// Values for the parcel voice settings radio group
84enum
85{
86 kRadioVoiceChatEstate = 0,
87 kRadioVoiceChatPrivate = 1,
88 kRadioVoiceChatDisable = 2
89};
90
91// Statics 111// Statics
92LLFloaterLand* LLFloaterLand::sInstance = NULL;
93LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL; 112LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL;
94S32 LLFloaterLand::sLastTab = 0; 113S32 LLFloaterLand::sLastTab = 0;
95 114
96LLViewHandle LLPanelLandGeneral::sBuyPassDialogHandle; 115LLHandle<LLFloater> LLPanelLandGeneral::sBuyPassDialogHandle;
97 116
98// Local classes 117// Local classes
99class LLParcelSelectionObserver : public LLParcelObserver 118class LLParcelSelectionObserver : public LLParcelObserver
@@ -150,64 +169,38 @@ void send_parcel_select_objects(S32 parcel_local_id, S32 return_type,
150} 169}
151 170
152 171
153// static
154void LLFloaterLand::show()
155{
156 if (!sInstance)
157 {
158 sInstance = new LLFloaterLand();
159
160 // Select tab from last view
161 sInstance->mTabLand->selectTab(sLastTab);
162
163 sObserver = new LLParcelSelectionObserver();
164 gParcelMgr->addObserver( sObserver );
165 }
166
167 sInstance->open(); /*Flawfinder: ignore*/
168
169 // Done automatically when the selected parcel's properties arrive
170 // (and hence we have the local id).
171 // gParcelMgr->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER);
172
173 sInstance->mParcel = gParcelMgr->getFloatingParcelSelection();
174
175 // Refresh even if not over a region so we don't get an
176 // uninitialized dialog. The dialog is 0-region aware.
177 sInstance->refresh();
178}
179
180//static 172//static
181LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects() 173LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects()
182{ 174{
183 if (!sInstance) 175 return LLFloaterLand::getInstance()->mPanelObjects;
184 {
185 return NULL;
186 }
187
188 return sInstance->mPanelObjects;
189} 176}
190 177
191//static 178//static
192LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant() 179LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant()
193{ 180{
194 if (!sInstance) 181 return LLFloaterLand::getInstance()->mPanelCovenant;
195 {
196 return NULL;
197 }
198
199 return sInstance->mPanelCovenant;
200} 182}
201 183
202// static 184// static
203void LLFloaterLand::refreshAll() 185void LLFloaterLand::refreshAll()
204{ 186{
205 if (sInstance) 187 LLFloaterLand::getInstance()->refresh();
206 {
207 sInstance->refresh();
208 }
209} 188}
210 189
190void LLFloaterLand::onOpen()
191{
192 // Done automatically when the selected parcel's properties arrive
193 // (and hence we have the local id).
194 // gParcelMgr->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER);
195
196 mParcel = gParcelMgr->getFloatingParcelSelection();
197
198 // Refresh even if not over a region so we don't get an
199 // uninitialized dialog. The dialog is 0-region aware.
200 refresh();
201}
202
203
211// virtual 204// virtual
212void LLFloaterLand::onClose(bool app_quitting) 205void LLFloaterLand::onClose(bool app_quitting)
213{ 206{
@@ -225,7 +218,7 @@ void LLFloaterLand::onClose(bool app_quitting)
225} 218}
226 219
227 220
228LLFloaterLand::LLFloaterLand() 221LLFloaterLand::LLFloaterLand(const LLSD& seed)
229: LLFloater("floaterland", "FloaterLandRect5", "About Land") 222: LLFloater("floaterland", "FloaterLandRect5", "About Land")
230{ 223{
231 224
@@ -240,10 +233,15 @@ LLFloaterLand::LLFloaterLand()
240 factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); 233 factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this);
241 factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); 234 factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this);
242 235
243 gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map); 236 gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map, false);
244 237
238 sObserver = new LLParcelSelectionObserver();
239 gParcelMgr->addObserver( sObserver );
240}
245 241
246 LLTabContainerCommon* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab"); 242BOOL LLFloaterLand::postBuild()
243{
244 LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(this, "landtab");
247 245
248 mTabLand = (LLTabContainer*) tab; 246 mTabLand = (LLTabContainer*) tab;
249 247
@@ -252,16 +250,16 @@ LLFloaterLand::LLFloaterLand()
252 { 250 {
253 tab->selectTab(sLastTab); 251 tab->selectTab(sLastTab);
254 } 252 }
253
254 return TRUE;
255} 255}
256 256
257 257
258// virtual 258// virtual
259LLFloaterLand::~LLFloaterLand() 259LLFloaterLand::~LLFloaterLand()
260{ 260{
261 sInstance = NULL;
262} 261}
263 262
264
265// public 263// public
266void LLFloaterLand::refresh() 264void LLFloaterLand::refresh()
267{ 265{
@@ -481,7 +479,7 @@ void LLPanelLandGeneral::refresh()
481 mCheckContributeWithDeed->setEnabled(FALSE); 479 mCheckContributeWithDeed->setEnabled(FALSE);
482 480
483 mTextOwner->setText(LLString::null); 481 mTextOwner->setText(LLString::null);
484 mBtnProfile->setLabel(childGetText("profile_text")); 482 mBtnProfile->setLabel(getString("profile_text"));
485 mBtnProfile->setEnabled(FALSE); 483 mBtnProfile->setEnabled(FALSE);
486 484
487 mTextClaimDate->setText(LLString::null); 485 mTextClaimDate->setText(LLString::null);
@@ -535,12 +533,12 @@ void LLPanelLandGeneral::refresh()
535 { 533 {
536 mTextSalePending->setText(LLString::null); 534 mTextSalePending->setText(LLString::null);
537 mTextSalePending->setEnabled(FALSE); 535 mTextSalePending->setEnabled(FALSE);
538 mTextOwner->setText(childGetText("public_text")); 536 mTextOwner->setText(getString("public_text"));
539 mTextOwner->setEnabled(FALSE); 537 mTextOwner->setEnabled(FALSE);
540 mBtnProfile->setEnabled(FALSE); 538 mBtnProfile->setEnabled(FALSE);
541 mTextClaimDate->setText(LLString::null); 539 mTextClaimDate->setText(LLString::null);
542 mTextClaimDate->setEnabled(FALSE); 540 mTextClaimDate->setEnabled(FALSE);
543 mTextGroup->setText(childGetText("none_text")); 541 mTextGroup->setText(getString("none_text"));
544 mTextGroup->setEnabled(FALSE); 542 mTextGroup->setEnabled(FALSE);
545 mBtnStartAuction->setEnabled(FALSE); 543 mBtnStartAuction->setEnabled(FALSE);
546 } 544 }
@@ -548,12 +546,12 @@ void LLPanelLandGeneral::refresh()
548 { 546 {
549 if(!is_leased && (owner_id == gAgent.getID())) 547 if(!is_leased && (owner_id == gAgent.getID()))
550 { 548 {
551 mTextSalePending->setText(childGetText("need_tier_to_modify")); 549 mTextSalePending->setText(getString("need_tier_to_modify"));
552 mTextSalePending->setEnabled(TRUE); 550 mTextSalePending->setEnabled(TRUE);
553 } 551 }
554 else if(parcel->getAuctionID()) 552 else if(parcel->getAuctionID())
555 { 553 {
556 mTextSalePending->setText(childGetText("auction_id_text")); 554 mTextSalePending->setText(getString("auction_id_text"));
557 mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID())); 555 mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID()));
558 mTextSalePending->setEnabled(TRUE); 556 mTextSalePending->setEnabled(TRUE);
559 } 557 }
@@ -572,15 +570,15 @@ void LLPanelLandGeneral::refresh()
572 if (parcel->getGroupID().isNull()) 570 if (parcel->getGroupID().isNull())
573 { 571 {
574 // Not group owned, so "Profile" 572 // Not group owned, so "Profile"
575 mBtnProfile->setLabel(childGetText("profile_text")); 573 mBtnProfile->setLabel(getString("profile_text"));
576 574
577 mTextGroup->setText(childGetText("none_text")); 575 mTextGroup->setText(getString("none_text"));
578 mTextGroup->setEnabled(FALSE); 576 mTextGroup->setEnabled(FALSE);
579 } 577 }
580 else 578 else
581 { 579 {
582 // Group owned, so "Info" 580 // Group owned, so "Info"
583 mBtnProfile->setLabel(childGetText("info_text")); 581 mBtnProfile->setLabel(getString("info_text"));
584 582
585 //mTextGroup->setText("HIPPOS!");//parcel->getGroupName()); 583 //mTextGroup->setText("HIPPOS!");//parcel->getGroupName());
586 mTextGroup->setEnabled(TRUE); 584 mTextGroup->setEnabled(TRUE);
@@ -690,9 +688,9 @@ void LLPanelLandGeneral::refresh()
690 &dwell); 688 &dwell);
691 689
692 // Area 690 // Area
693 LLUIString price = childGetText("area_size_text"); 691 LLUIString price = getString("area_size_text");
694 price.setArg("[AREA]", llformat("%d",area)); 692 price.setArg("[AREA]", llformat("%d",area));
695 mTextPriceLabel->setText(childGetText("area_text")); 693 mTextPriceLabel->setText(getString("area_text"));
696 mTextPrice->setText(price.getString()); 694 mTextPrice->setText(price.getString());
697 695
698 mTextDwell->setText(llformat("%.0f", dwell)); 696 mTextDwell->setText(llformat("%.0f", dwell));
@@ -730,29 +728,24 @@ void LLPanelLandGeneral::refreshNames()
730 LLString owner; 728 LLString owner;
731 if (parcel->getIsGroupOwned()) 729 if (parcel->getIsGroupOwned())
732 { 730 {
733 owner = childGetText("group_owned_text"); 731 owner = getString("group_owned_text");
734 } 732 }
735 else 733 else
736 { 734 {
737 // Figure out the owner's name 735 // Figure out the owner's name
738 char owner_first[MAX_STRING]; /*Flawfinder: ignore*/ 736 gCacheName->getFullName(parcel->getOwnerID(), owner);
739 char owner_last[MAX_STRING]; /*Flawfinder: ignore*/
740 gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last);
741 owner = llformat("%s %s", owner_first, owner_last);
742 } 737 }
743 738
744 if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) 739 if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
745 { 740 {
746 owner += childGetText("sale_pending_text"); 741 owner += getString("sale_pending_text");
747 } 742 }
748 mTextOwner->setText(owner); 743 mTextOwner->setText(owner);
749 744
750 LLString group; 745 LLString group;
751 if(!parcel->getGroupID().isNull()) 746 if(!parcel->getGroupID().isNull())
752 { 747 {
753 char buffer[MAX_STRING]; /*Flawfinder: ignore*/ 748 gCacheName->getGroupName(parcel->getGroupID(), group);
754 gCacheName->getGroupName(parcel->getGroupID(), buffer);
755 group = buffer;
756 } 749 }
757 mTextGroup->setText(group); 750 mTextGroup->setText(group);
758 751
@@ -760,18 +753,12 @@ void LLPanelLandGeneral::refreshNames()
760 if(auth_buyer_id.notNull()) 753 if(auth_buyer_id.notNull())
761 { 754 {
762 LLString name; 755 LLString name;
763 char firstname[MAX_STRING]; /*Flawfinder: ignore*/ 756 gCacheName->getFullName(auth_buyer_id, name);
764 char lastname[MAX_STRING]; /*Flawfinder: ignore*/
765 gCacheName->getName(auth_buyer_id, firstname, lastname);
766 name.assign(firstname);
767 name.append(" ");
768 name.append(lastname);
769
770 mSaleInfoForSale2->setTextArg("[BUYER]", name); 757 mSaleInfoForSale2->setTextArg("[BUYER]", name);
771 } 758 }
772 else 759 else
773 { 760 {
774 mSaleInfoForSale2->setTextArg("[BUYER]", childGetText("anyone")); 761 mSaleInfoForSale2->setTextArg("[BUYER]", getString("anyone"));
775 } 762 }
776} 763}
777 764
@@ -947,7 +934,7 @@ void LLPanelLandGeneral::cbBuyPass(S32 option, void* data)
947//static 934//static
948BOOL LLPanelLandGeneral::buyPassDialogVisible() 935BOOL LLPanelLandGeneral::buyPassDialogVisible()
949{ 936{
950 return LLFloater::getFloaterByHandle(sBuyPassDialogHandle) != NULL; 937 return sBuyPassDialogHandle.get() != NULL;
951} 938}
952 939
953// static 940// static
@@ -1069,7 +1056,7 @@ BOOL LLPanelLandObjects::postBuild()
1069 image_id.set( gViewerArt.getString("icon_group.tga") ); 1056 image_id.set( gViewerArt.getString("icon_group.tga") );
1070 mIconGroup = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); 1057 mIconGroup = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE);
1071 1058
1072 mOwnerList = LLUICtrlFactory::getNameListByName(this, "owner list"); 1059 mOwnerList = getChild<LLNameListCtrl>("owner list");
1073 mOwnerList->sortByColumn(3, FALSE); 1060 mOwnerList->sortByColumn(3, FALSE);
1074 childSetCommitCallback("owner list", onCommitList, this); 1061 childSetCommitCallback("owner list", onCommitList, this);
1075 mOwnerList->setDoubleClickCallback(onDoubleClickOwner); 1062 mOwnerList->setDoubleClickCallback(onDoubleClickOwner);
@@ -1179,12 +1166,12 @@ void LLPanelLandObjects::refresh()
1179 1166
1180 if (sw_total > sw_max) 1167 if (sw_total > sw_max)
1181 { 1168 {
1182 mSWTotalObjects->setText(childGetText("objects_deleted_text")); 1169 mSWTotalObjects->setText(getString("objects_deleted_text"));
1183 mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max)); 1170 mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max));
1184 } 1171 }
1185 else 1172 else
1186 { 1173 {
1187 mSWTotalObjects->setText(childGetText("objects_available_text")); 1174 mSWTotalObjects->setText(getString("objects_available_text"));
1188 mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total)); 1175 mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total));
1189 } 1176 }
1190 mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total)); 1177 mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total));
@@ -1309,8 +1296,7 @@ void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata)
1309 } 1296 }
1310 else 1297 else
1311 { 1298 {
1312 char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 1299 std::string first, last;
1313 char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
1314 gCacheName->getName(owner_id, first, last); 1300 gCacheName->getName(owner_id, first, last);
1315 args["[FIRST]"] = first; 1301 args["[FIRST]"] = first;
1316 args["[LAST]"] = last; 1302 args["[LAST]"] = last;
@@ -1334,7 +1320,7 @@ void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata)
1334 { 1320 {
1335 if (parcel) 1321 if (parcel)
1336 { 1322 {
1337 char group_name[MAX_STRING]; /*Flawfinder: ignore*/ 1323 std::string group_name;
1338 gCacheName->getGroupName(parcel->getGroupID(), group_name); 1324 gCacheName->getGroupName(parcel->getGroupID(), group_name);
1339 LLString::format_map_t args; 1325 LLString::format_map_t args;
1340 args["[GROUPNAME]"] = group_name; 1326 args["[GROUPNAME]"] = group_name;
@@ -1637,12 +1623,8 @@ void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata)
1637 } 1623 }
1638 else 1624 else
1639 { 1625 {
1640 char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 1626 std::string name;
1641 char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 1627 gCacheName->getFullName(owner_id, name);
1642 gCacheName->getName(owner_id, first, last);
1643 std::string name = first;
1644 name += " ";
1645 name += last;
1646 args["[NAME]"] = name; 1628 args["[NAME]"] = name;
1647 gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerObjects, userdata); 1629 gViewerWindow->alertXml("ReturnObjectsOwnedByUser", args, callbackReturnOwnerObjects, userdata);
1648 } 1630 }
@@ -1657,7 +1639,7 @@ void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata)
1657 1639
1658 send_parcel_select_objects(parcel->getLocalID(), RT_GROUP); 1640 send_parcel_select_objects(parcel->getLocalID(), RT_GROUP);
1659 1641
1660 char group_name[MAX_STRING]; /*Flawfinder: ignore*/ 1642 std::string group_name;
1661 gCacheName->getGroupName(parcel->getGroupID(), group_name); 1643 gCacheName->getGroupName(parcel->getGroupID(), group_name);
1662 1644
1663 LLStringBase<char>::format_map_t args; 1645 LLStringBase<char>::format_map_t args;
@@ -1686,7 +1668,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
1686 1668
1687 if (parcel->getIsGroupOwned()) 1669 if (parcel->getIsGroupOwned())
1688 { 1670 {
1689 char group_name[MAX_STRING]; /*Flawfinder: ignore*/ 1671 std::string group_name;
1690 gCacheName->getGroupName(parcel->getGroupID(), group_name); 1672 gCacheName->getGroupName(parcel->getGroupID(), group_name);
1691 args["[NAME]"] = group_name; 1673 args["[NAME]"] = group_name;
1692 1674
@@ -1702,13 +1684,8 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
1702 } 1684 }
1703 else 1685 else
1704 { 1686 {
1705 char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
1706 char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
1707 gCacheName->getName(owner_id, first, last);
1708 std::string name; 1687 std::string name;
1709 name += first; 1688 gCacheName->getFullName(owner_id, name);
1710 name += " ";
1711 name += last;
1712 args["[NAME]"] = name; 1689 args["[NAME]"] = name;
1713 1690
1714 gViewerWindow->alertXml("ReturnObjectsNotOwnedByUser", args, callbackReturnOtherObjects, userdata); 1691 gViewerWindow->alertXml("ReturnObjectsNotOwnedByUser", args, callbackReturnOtherObjects, userdata);
@@ -1855,7 +1832,7 @@ BOOL LLPanelLandOptions::postBuild()
1855 }*/ 1832 }*/
1856 1833
1857 1834
1858 mSnapshotCtrl = LLUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); 1835 mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
1859 if (mSnapshotCtrl) 1836 if (mSnapshotCtrl)
1860 { 1837 {
1861 mSnapshotCtrl->setCommitCallback( onCommitAny ); 1838 mSnapshotCtrl->setCommitCallback( onCommitAny );
@@ -1946,7 +1923,7 @@ void LLPanelLandOptions::refresh()
1946 mSnapshotCtrl->setImageAssetID(LLUUID::null); 1923 mSnapshotCtrl->setImageAssetID(LLUUID::null);
1947 mSnapshotCtrl->setEnabled(FALSE); 1924 mSnapshotCtrl->setEnabled(FALSE);
1948 1925
1949 mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none")); 1926 mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
1950 mSetBtn->setEnabled(FALSE); 1927 mSetBtn->setEnabled(FALSE);
1951 mClearBtn->setEnabled(FALSE); 1928 mClearBtn->setEnabled(FALSE);
1952 1929
@@ -1993,13 +1970,13 @@ void LLPanelLandOptions::refresh()
1993 mPushRestrictionCtrl->set( parcel->getRestrictPushObject() ); 1970 mPushRestrictionCtrl->set( parcel->getRestrictPushObject() );
1994 if(parcel->getRegionPushOverride()) 1971 if(parcel->getRegionPushOverride())
1995 { 1972 {
1996 mPushRestrictionCtrl->setLabel(childGetText("push_restrict_region_text")); 1973 mPushRestrictionCtrl->setLabel(getString("push_restrict_region_text"));
1997 mPushRestrictionCtrl->setEnabled(false); 1974 mPushRestrictionCtrl->setEnabled(false);
1998 mPushRestrictionCtrl->set(TRUE); 1975 mPushRestrictionCtrl->set(TRUE);
1999 } 1976 }
2000 else 1977 else
2001 { 1978 {
2002 mPushRestrictionCtrl->setLabel(childGetText("push_restrict_text")); 1979 mPushRestrictionCtrl->setLabel(getString("push_restrict_text"));
2003 mPushRestrictionCtrl->setEnabled(can_change_options); 1980 mPushRestrictionCtrl->setEnabled(can_change_options);
2004 } 1981 }
2005 1982
@@ -2023,7 +2000,7 @@ void LLPanelLandOptions::refresh()
2023 LLVector3 pos = parcel->getUserLocation(); 2000 LLVector3 pos = parcel->getUserLocation();
2024 if (pos.isExactlyZero()) 2001 if (pos.isExactlyZero())
2025 { 2002 {
2026 mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none")); 2003 mLocationText->setTextArg("[LANDING]", getString("landing_point_none"));
2027 } 2004 }
2028 else 2005 else
2029 { 2006 {
@@ -2214,240 +2191,8 @@ void LLPanelLandOptions::onClickPublishHelp(void*)
2214 } 2191 }
2215} 2192}
2216 2193
2217//---------------------------------------------------------------------------
2218// LLPanelLandMedia
2219//---------------------------------------------------------------------------
2220
2221LLPanelLandMedia::LLPanelLandMedia(LLParcelSelectionHandle& parcel)
2222: LLPanel("land_media_panel"), mParcel(parcel)
2223{
2224}
2225
2226
2227 2194
2228 2195
2229BOOL LLPanelLandMedia::postBuild()
2230{
2231
2232 mCheckSoundLocal = LLUICtrlFactory::getCheckBoxByName(this, "check sound local");
2233 childSetCommitCallback("check sound local", onCommitAny, this);
2234
2235 mRadioVoiceChat = LLUICtrlFactory::getRadioGroupByName(this, "parcel_voice_channel");
2236 childSetCommitCallback("parcel_voice_channel", onCommitAny, this);
2237
2238 mMusicURLEdit = LLUICtrlFactory::getLineEditorByName(this, "music_url");
2239 childSetCommitCallback("music_url", onCommitAny, this);
2240
2241
2242 mMediaTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this, "media texture");
2243 if (mMediaTextureCtrl)
2244 {
2245 mMediaTextureCtrl->setCommitCallback( onCommitAny );
2246 mMediaTextureCtrl->setCallbackUserData( this );
2247 mMediaTextureCtrl->setAllowNoTexture ( TRUE );
2248 mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
2249 mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
2250 }
2251 else
2252 {
2253 llwarns << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'media texure'" << llendl;
2254 }
2255
2256 mMediaAutoScaleCheck = LLUICtrlFactory::getCheckBoxByName(this, "media_auto_scale");
2257 childSetCommitCallback("media_auto_scale", onCommitAny, this);
2258
2259 mMediaURLEdit = LLUICtrlFactory::getLineEditorByName(this, "media_url");
2260 childSetCommitCallback("media_url", onCommitAny, this);
2261
2262 return TRUE;
2263}
2264
2265
2266// virtual
2267LLPanelLandMedia::~LLPanelLandMedia()
2268{ }
2269
2270
2271// public
2272void LLPanelLandMedia::refresh()
2273{
2274 LLParcel *parcel = mParcel->getParcel();
2275
2276 if (!parcel)
2277 {
2278 mCheckSoundLocal->set(FALSE);
2279 mCheckSoundLocal->setEnabled(FALSE);
2280
2281 mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatEstate);
2282 mRadioVoiceChat->setEnabled(FALSE);
2283
2284 mMusicURLEdit->setText(LLString::null);
2285 mMusicURLEdit->setEnabled(FALSE);
2286
2287 mMediaURLEdit->setText(LLString::null);
2288 mMediaURLEdit->setEnabled(FALSE);
2289
2290 mMediaAutoScaleCheck->set ( FALSE );
2291 mMediaAutoScaleCheck->setEnabled(FALSE);
2292
2293 mMediaTextureCtrl->clear();
2294 mMediaTextureCtrl->setEnabled(FALSE);
2295
2296 #if 0
2297 mMediaStopButton->setEnabled ( FALSE );
2298 mMediaStartButton->setEnabled ( FALSE );
2299 #endif
2300 }
2301 else
2302 {
2303 // something selected, hooray!
2304
2305 // Display options
2306 BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA);
2307
2308 mCheckSoundLocal->set( parcel->getSoundLocal() );
2309 mCheckSoundLocal->setEnabled( can_change_media );
2310
2311 LLViewerRegion* selection_region = gParcelMgr->getSelectionRegion();
2312 BOOL region_allows_voice = FALSE;
2313 if (selection_region)
2314 {
2315 region_allows_voice = selection_region->isVoiceEnabled();
2316 }
2317
2318 if(parcel->getVoiceEnabled())
2319 {
2320 if(parcel->getVoiceUseEstateChannel())
2321 mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatEstate);
2322 else
2323 mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatPrivate);
2324 }
2325 else
2326 {
2327 mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatDisable);
2328 }
2329
2330 mRadioVoiceChat->setEnabled( can_change_media && region_allows_voice );
2331
2332 // don't display urls if you're not able to change it
2333 // much requested change in forums so people can't 'steal' urls
2334 // NOTE: bug#2009 means this is still vunerable - however, bug
2335 // should be closed since this bug opens up major security issues elsewhere.
2336 if ( can_change_media )
2337 {
2338 mMusicURLEdit->setDrawAsterixes ( FALSE );
2339 mMediaURLEdit->setDrawAsterixes ( FALSE );
2340 }
2341 else
2342 {
2343 mMusicURLEdit->setDrawAsterixes ( TRUE );
2344 mMediaURLEdit->setDrawAsterixes ( TRUE );
2345 }
2346
2347 mMusicURLEdit->setText(parcel->getMusicURL());
2348 mMusicURLEdit->setEnabled( can_change_media );
2349
2350 mMediaURLEdit->setText(parcel->getMediaURL());
2351 mMediaURLEdit->setEnabled( can_change_media );
2352
2353 mMediaAutoScaleCheck->set ( parcel->getMediaAutoScale () );
2354 mMediaAutoScaleCheck->setEnabled ( can_change_media );
2355
2356 LLUUID tmp = parcel->getMediaID();
2357 mMediaTextureCtrl->setImageAssetID ( parcel->getMediaID() );
2358 mMediaTextureCtrl->setEnabled( can_change_media );
2359
2360 #if 0
2361 // there is a media url and a media texture selected
2362 if ( ( ! ( std::string ( parcel->getMediaURL() ).empty () ) ) && ( ! ( parcel->getMediaID ().isNull () ) ) )
2363 {
2364 // turn on transport controls if allowed for this parcel
2365 mMediaStopButton->setEnabled ( editable );
2366 mMediaStartButton->setEnabled ( editable );
2367 }
2368 else
2369 {
2370 // no media url or no media texture
2371 mMediaStopButton->setEnabled ( FALSE );
2372 mMediaStartButton->setEnabled ( FALSE );
2373 };
2374 #endif
2375 }
2376}
2377
2378// static
2379void LLPanelLandMedia::onCommitAny(LLUICtrl *ctrl, void *userdata)
2380{
2381 LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
2382
2383 LLParcel* parcel = self->mParcel->getParcel();
2384 if (!parcel)
2385 {
2386 return;
2387 }
2388
2389 // Extract data from UI
2390 BOOL sound_local = self->mCheckSoundLocal->get();
2391 int voice_setting = self->mRadioVoiceChat->getSelectedIndex();
2392 std::string music_url = self->mMusicURLEdit->getText();
2393 std::string media_url = self->mMediaURLEdit->getText();
2394 U8 media_auto_scale = self->mMediaAutoScaleCheck->get();
2395 LLUUID media_id = self->mMediaTextureCtrl->getImageAssetID();
2396
2397 BOOL voice_enabled;
2398 BOOL voice_estate_chan;
2399
2400 switch(voice_setting)
2401 {
2402 default:
2403 case kRadioVoiceChatEstate:
2404 voice_enabled = TRUE;
2405 voice_estate_chan = TRUE;
2406 break;
2407 case kRadioVoiceChatPrivate:
2408 voice_enabled = TRUE;
2409 voice_estate_chan = FALSE;
2410 break;
2411 case kRadioVoiceChatDisable:
2412 voice_enabled = FALSE;
2413 voice_estate_chan = FALSE;
2414 break;
2415 }
2416
2417 // Remove leading/trailing whitespace (common when copying/pasting)
2418 LLString::trim(music_url);
2419 LLString::trim(media_url);
2420
2421 // Push data into current parcel
2422 parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, voice_enabled);
2423 parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, voice_estate_chan);
2424 parcel->setParcelFlag(PF_SOUND_LOCAL, sound_local);
2425 parcel->setMusicURL(music_url.c_str());
2426 parcel->setMediaURL(media_url.c_str());
2427 parcel->setMediaID(media_id);
2428 parcel->setMediaAutoScale ( media_auto_scale );
2429
2430 // Send current parcel data upstream to server
2431 gParcelMgr->sendParcelPropertiesUpdate( parcel );
2432
2433 // Might have changed properties, so let's redraw!
2434 self->refresh();
2435}
2436
2437void LLPanelLandMedia::onClickStopMedia ( void* data )
2438{
2439 LLMediaEngine::getInstance ()->stop ();
2440}
2441
2442void LLPanelLandMedia::onClickStartMedia ( void* data )
2443{
2444 // force a commit
2445 gFocusMgr.setKeyboardFocus ( NULL );
2446
2447 // force a reload
2448 LLMediaEngine::getInstance ()->convertImageAndLoadUrl ( true, false, std::string());
2449}
2450
2451//--------------------------------------------------------------------------- 2196//---------------------------------------------------------------------------
2452// LLPanelLandAccess 2197// LLPanelLandAccess
2453//--------------------------------------------------------------------------- 2198//---------------------------------------------------------------------------
@@ -2475,11 +2220,11 @@ BOOL LLPanelLandAccess::postBuild()
2475 childSetAction("add_banned", onClickAddBanned, this); 2220 childSetAction("add_banned", onClickAddBanned, this);
2476 childSetAction("remove_banned", onClickRemoveBanned, this); 2221 childSetAction("remove_banned", onClickRemoveBanned, this);
2477 2222
2478 mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList"); 2223 mListAccess = getChild<LLNameListCtrl>("AccessList");
2479 if (mListAccess) 2224 if (mListAccess)
2480 mListAccess->sortByColumn(0, TRUE); // ascending 2225 mListAccess->sortByColumn(0, TRUE); // ascending
2481 2226
2482 mListBanned = LLUICtrlFactory::getNameListByName(this, "BannedList"); 2227 mListBanned = getChild<LLNameListCtrl>("BannedList");
2483 if (mListBanned) 2228 if (mListBanned)
2484 mListBanned->sortByColumn(0, TRUE); // ascending 2229 mListBanned->sortByColumn(0, TRUE); // ascending
2485 2230
@@ -2510,9 +2255,9 @@ void LLPanelLandAccess::refresh()
2510 childSetValue("public_access", public_access ); 2255 childSetValue("public_access", public_access );
2511 childSetValue("GroupCheck", use_group ); 2256 childSetValue("GroupCheck", use_group );
2512 2257
2513 char group_name[MAX_STRING]; /*Flawfinder: ignore*/ 2258 std::string group_name;
2514 gCacheName->getGroupName(parcel->getGroupID(), group_name); 2259 gCacheName->getGroupName(parcel->getGroupID(), group_name);
2515 childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name) ); 2260 childSetLabelArg("GroupCheck", "[GROUP]", group_name );
2516 2261
2517 // Allow list 2262 // Allow list
2518 { 2263 {
@@ -2733,13 +2478,12 @@ void LLPanelLandAccess::refresh_ui()
2733void LLPanelLandAccess::refreshNames() 2478void LLPanelLandAccess::refreshNames()
2734{ 2479{
2735 LLParcel* parcel = mParcel->getParcel(); 2480 LLParcel* parcel = mParcel->getParcel();
2736 char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ 2481 std::string group_name;
2737 group_name[0] = '\0';
2738 if(parcel) 2482 if(parcel)
2739 { 2483 {
2740 gCacheName->getGroupName(parcel->getGroupID(), group_name); 2484 gCacheName->getGroupName(parcel->getGroupID(), group_name);
2741 } 2485 }
2742 childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name)); 2486 childSetLabelArg("GroupCheck", "[GROUP]", group_name);
2743} 2487}
2744 2488
2745 2489
@@ -2791,7 +2535,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
2791 BOOL use_access_group = self->childGetValue("GroupCheck").asBoolean(); 2535 BOOL use_access_group = self->childGetValue("GroupCheck").asBoolean();
2792 if (use_access_group) 2536 if (use_access_group)
2793 { 2537 {
2794 char group_name[MAX_STRING]; /*Flawfinder: ignore*/ 2538 std::string group_name;
2795 if (!gCacheName->getGroupName(parcel->getGroupID(), group_name)) 2539 if (!gCacheName->getGroupName(parcel->getGroupID(), group_name))
2796 { 2540 {
2797 use_access_group = FALSE; 2541 use_access_group = FALSE;
@@ -2968,35 +2712,35 @@ void LLPanelLandCovenant::refresh()
2968 LLViewerRegion* region = gParcelMgr->getSelectionRegion(); 2712 LLViewerRegion* region = gParcelMgr->getSelectionRegion();
2969 if(!region) return; 2713 if(!region) return;
2970 2714
2971 LLTextBox* region_name = (LLTextBox*)getChildByName("region_name_text"); 2715 LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
2972 if (region_name) 2716 if (region_name)
2973 { 2717 {
2974 region_name->setText(region->getName()); 2718 region_name->setText(region->getName());
2975 } 2719 }
2976 2720
2977 LLTextBox* resellable_clause = (LLTextBox*)getChildByName("resellable_clause"); 2721 LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause");
2978 if (resellable_clause) 2722 if (resellable_clause)
2979 { 2723 {
2980 if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) 2724 if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
2981 { 2725 {
2982 resellable_clause->setText(childGetText("can_not_resell")); 2726 resellable_clause->setText(getString("can_not_resell"));
2983 } 2727 }
2984 else 2728 else
2985 { 2729 {
2986 resellable_clause->setText(childGetText("can_resell")); 2730 resellable_clause->setText(getString("can_resell"));
2987 } 2731 }
2988 } 2732 }
2989 2733
2990 LLTextBox* changeable_clause = (LLTextBox*)getChildByName("changeable_clause"); 2734 LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause");
2991 if (changeable_clause) 2735 if (changeable_clause)
2992 { 2736 {
2993 if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) 2737 if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
2994 { 2738 {
2995 changeable_clause->setText(childGetText("can_change")); 2739 changeable_clause->setText(getString("can_change"));
2996 } 2740 }
2997 else 2741 else
2998 { 2742 {
2999 changeable_clause->setText(childGetText("can_not_change")); 2743 changeable_clause->setText(getString("can_not_change"));
3000 } 2744 }
3001 } 2745 }
3002 2746
@@ -3015,7 +2759,7 @@ void LLPanelLandCovenant::updateCovenantText(const std::string &string)
3015 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); 2759 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
3016 if (self) 2760 if (self)
3017 { 2761 {
3018 LLViewerTextEditor* editor = (LLViewerTextEditor*)self->getChildByName("covenant_editor"); 2762 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor");
3019 if (editor) 2763 if (editor)
3020 { 2764 {
3021 editor->setHandleEditKeysDirectly(TRUE); 2765 editor->setHandleEditKeysDirectly(TRUE);
@@ -3030,7 +2774,7 @@ void LLPanelLandCovenant::updateEstateName(const std::string& name)
3030 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); 2774 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
3031 if (self) 2775 if (self)
3032 { 2776 {
3033 LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_name_text"); 2777 LLTextBox* editor = self->getChild<LLTextBox>("estate_name_text");
3034 if (editor) editor->setText(name); 2778 if (editor) editor->setText(name);
3035 } 2779 }
3036} 2780}
@@ -3041,7 +2785,7 @@ void LLPanelLandCovenant::updateLastModified(const std::string& text)
3041 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); 2785 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
3042 if (self) 2786 if (self)
3043 { 2787 {
3044 LLTextBox* editor = (LLTextBox*)self->getChildByName("covenant_timestamp_text"); 2788 LLTextBox* editor = self->getChild<LLTextBox>("covenant_timestamp_text");
3045 if (editor) editor->setText(text); 2789 if (editor) editor->setText(text);
3046 } 2790 }
3047} 2791}
@@ -3052,7 +2796,7 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name)
3052 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); 2796 LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
3053 if (self) 2797 if (self)
3054 { 2798 {
3055 LLTextBox* editor = (LLTextBox*)self->getChildByName("estate_owner_text"); 2799 LLTextBox* editor = self->getChild<LLTextBox>("estate_owner_text");
3056 if (editor) editor->setText(name); 2800 if (editor) editor->setText(name);
3057 } 2801 }
3058} 2802}