aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelplace.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:16 -0500
committerJacek Antonelli2008-08-15 23:45:16 -0500
commit3f27ba891ac4d032753b219b4b96d1ffbc9fb488 (patch)
tree504932ee91a0356fba7ea48798887c96867e492f /linden/indra/newview/llpanelplace.cpp
parentSecond Life viewer sources 1.18.4.3 (diff)
downloadmeta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.zip
meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.gz
meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.bz2
meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.xz
Second Life viewer sources 1.18.5.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpanelplace.cpp167
1 files changed, 151 insertions, 16 deletions
diff --git a/linden/indra/newview/llpanelplace.cpp b/linden/indra/newview/llpanelplace.cpp
index 93a86dc..d08d25e 100644
--- a/linden/indra/newview/llpanelplace.cpp
+++ b/linden/indra/newview/llpanelplace.cpp
@@ -38,6 +38,8 @@
38#include "message.h" 38#include "message.h"
39#include "llui.h" 39#include "llui.h"
40#include "llsecondlifeurls.h" 40#include "llsecondlifeurls.h"
41#include "llremoteparcelrequest.h"
42#include "llfloater.h"
41 43
42#include "llagent.h" 44#include "llagent.h"
43#include "llviewerwindow.h" 45#include "llviewerwindow.h"
@@ -53,6 +55,7 @@
53#include "llvieweruictrlfactory.h" 55#include "llvieweruictrlfactory.h"
54//#include "llviewermenu.h" // create_landmark() 56//#include "llviewermenu.h" // create_landmark()
55#include "llweb.h" 57#include "llweb.h"
58#include "llsdutil.h"
56 59
57//static 60//static
58std::list<LLPanelPlace*> LLPanelPlace::sAllPanels; 61std::list<LLPanelPlace*> LLPanelPlace::sAllPanels;
@@ -60,8 +63,12 @@ std::list<LLPanelPlace*> LLPanelPlace::sAllPanels;
60LLPanelPlace::LLPanelPlace() 63LLPanelPlace::LLPanelPlace()
61: LLPanel("Places Panel"), 64: LLPanel("Places Panel"),
62 mParcelID(), 65 mParcelID(),
66 mRequestedID(),
67 mRegionID(),
63 mPosGlobal(), 68 mPosGlobal(),
64 mAuctionID(0) 69 mPosRegion(),
70 mAuctionID(0),
71 mLandmarkAssetID()
65{ 72{
66 sAllPanels.push_back(this); 73 sAllPanels.push_back(this);
67} 74}
@@ -81,13 +88,13 @@ BOOL LLPanelPlace::postBuild()
81 mSnapshotCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl"); 88 mSnapshotCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this, "snapshot_ctrl");
82 mSnapshotCtrl->setEnabled(FALSE); 89 mSnapshotCtrl->setEnabled(FALSE);
83 90
84 mNameEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "name_editor"); 91 mNameEditor = LLViewerUICtrlFactory::getTextBoxByName(this, "name_editor");
85 92
86 mDescEditor = LLUICtrlFactory::getTextEditorByName(this, "desc_editor"); 93 mDescEditor = LLUICtrlFactory::getTextEditorByName(this, "desc_editor");
87 94
88 mInfoEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "info_editor"); 95 mInfoEditor = LLViewerUICtrlFactory::getTextBoxByName(this, "info_editor");
89 96
90 mLocationEditor = LLViewerUICtrlFactory::getLineEditorByName(this, "location_editor"); 97 mLocationEditor = LLViewerUICtrlFactory::getTextBoxByName(this, "location_editor");
91 98
92 mTeleportBtn = LLViewerUICtrlFactory::getButtonByName(this, "teleport_btn"); 99 mTeleportBtn = LLViewerUICtrlFactory::getButtonByName(this, "teleport_btn");
93 mTeleportBtn->setClickedCallback(onClickTeleport); 100 mTeleportBtn->setClickedCallback(onClickTeleport);
@@ -108,16 +115,54 @@ BOOL LLPanelPlace::postBuild()
108 // Default to no auction button. We'll show it if we get an auction id 115 // Default to no auction button. We'll show it if we get an auction id
109 mAuctionBtn->setVisible(FALSE); 116 mAuctionBtn->setVisible(FALSE);
110 117
118 // Temporary text to explain why the description panel is blank.
119 // mDescEditor->setText("Parcel information not available without server update");
120
111 return TRUE; 121 return TRUE;
112} 122}
113 123
124void LLPanelPlace::displayItemInfo(const LLInventoryItem* pItem)
125{
126 mNameEditor->setText(pItem->getName());
127 mDescEditor->setText(pItem->getDescription());
128}
114 129
130// Use this for search directory clicks, because we are totally
131// recycling the panel and don't need to use what's there.
132//
133// For SLURL clicks, don't call this, because we need to cache
134// the location info from the user.
135void LLPanelPlace::resetLocation()
136{
137 mParcelID.setNull();
138 mRequestedID.setNull();
139 mRegionID.setNull();
140 mLandmarkAssetID.setNull();
141 mPosGlobal.clearVec();
142 mPosRegion.clearVec();
143 mAuctionID = 0;
144}
115 145
116void LLPanelPlace::setParcelID(const LLUUID& parcel_id) 146void LLPanelPlace::setParcelID(const LLUUID& parcel_id)
117{ 147{
118 mParcelID = parcel_id; 148 mParcelID = parcel_id;
149 sendParcelInfoRequest();
150}
151
152void LLPanelPlace::setSnapshot(const LLUUID& snapshot_id)
153{
154 mSnapshotCtrl->setImageAssetID(snapshot_id);
155}
156
157void LLPanelPlace::setName(const std::string& name)
158{
159 mNameEditor->setText(name);
119} 160}
120 161
162void LLPanelPlace::setLocationString(const std::string& location)
163{
164 mLocationEditor->setText(location);
165}
121 166
122void LLPanelPlace::sendParcelInfoRequest() 167void LLPanelPlace::sendParcelInfoRequest()
123{ 168{
@@ -136,6 +181,20 @@ void LLPanelPlace::sendParcelInfoRequest()
136 } 181 }
137} 182}
138 183
184void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason)
185{
186 // We only really handle 404 and 499 errors
187 LLString error_text;
188 if(status == 404)
189 {
190 error_text = childGetText("server_error_text");
191 }
192 else if(status == 499)
193 {
194 error_text = childGetText("server_forbidden_text");
195 }
196 mDescEditor->setText(error_text);
197}
139 198
140//static 199//static
141void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) 200void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
@@ -184,19 +243,28 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
184 msg->getS32 ("Data", "SalePrice", sale_price); 243 msg->getS32 ("Data", "SalePrice", sale_price);
185 msg->getS32 ("Data", "AuctionID", auction_id); 244 msg->getS32 ("Data", "AuctionID", auction_id);
186 245
187 self->mPosGlobal.setVec(global_x, global_y, global_z);
188 246
189 self->mAuctionID = auction_id; 247 self->mAuctionID = auction_id;
190 248
191 self->mSnapshotCtrl->setImageAssetID(snapshot_id); 249 if(snapshot_id.notNull())
250 {
251 self->mSnapshotCtrl->setImageAssetID(snapshot_id);
252 }
253
254 // Only assign the name and description if they are not empty and there is not a
255 // value present (passed in from a landmark, e.g.)
256 std::string name_str(name);
257 std::string desc_str(desc);
192 258
193 self->mNameEditor->setText(LLString(name)); 259 if(! name_str.empty() && ! self->mNameEditor->getText().empty())
260 self->mNameEditor->setText(name_str);
194 261
195 self->mDescEditor->setText(LLString(desc)); 262 if(! desc_str.empty() && ! self->mDescEditor->getText().empty())
263 self->mDescEditor->setText(desc_str);
196 264
197 LLString info_text; 265 LLString info_text;
198 LLUIString traffic = self->getUIString("traffic_text"); 266 LLUIString traffic = self->getUIString("traffic_text");
199 traffic.setArg("[TRAFFIC]", llformat("%.0f", dwell)); 267 traffic.setArg("[TRAFFIC]", llformat("%d ", (int)dwell));
200 info_text = traffic; 268 info_text = traffic;
201 LLUIString area = self->getUIString("area_text"); 269 LLUIString area = self->getUIString("area_text");
202 area.setArg("[AREA]", llformat("%d", actual_area)); 270 area.setArg("[AREA]", llformat("%d", actual_area));
@@ -210,14 +278,11 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
210 if (auction_id != 0) 278 if (auction_id != 0)
211 { 279 {
212 LLUIString auction = self->getUIString("auction_text"); 280 LLUIString auction = self->getUIString("auction_text");
213 auction.setArg("[ID]", llformat("%010d", auction_id)); 281 auction.setArg("[ID]", llformat("%010d ", auction_id));
214 info_text += auction; 282 info_text += auction;
215 } 283 }
216 self->mInfoEditor->setText(info_text); 284 self->mInfoEditor->setText(info_text);
217 285
218 S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
219 S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
220 S32 region_z = llround(global_z);
221 286
222 // HACK: Flag 0x1 == mature region, otherwise assume PG 287 // HACK: Flag 0x1 == mature region, otherwise assume PG
223 const char* rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); 288 const char* rating = LLViewerRegion::accessToString(SIM_ACCESS_PG);
@@ -226,8 +291,26 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
226 rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE); 291 rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE);
227 } 292 }
228 293
229 LLString location = llformat("%s %d, %d, %d (%s)", 294 // Just use given region position for display
230 sim_name, region_x, region_y, region_z, rating); 295 S32 region_x = llround(self->mPosRegion.mV[0]);
296 S32 region_y = llround(self->mPosRegion.mV[1]);
297 S32 region_z = llround(self->mPosRegion.mV[2]);
298
299 // If the region position is zero, grab position from the global
300 if(self->mPosRegion.isExactlyZero())
301 {
302 region_x = llround(global_x) % REGION_WIDTH_UNITS;
303 region_y = llround(global_y) % REGION_WIDTH_UNITS;
304 region_z = llround(global_z);
305 }
306
307 if(self->mPosGlobal.isExactlyZero())
308 {
309 self->mPosGlobal.setVec(global_x, global_y, global_z);
310 }
311
312 LLString location = llformat("%s %d, %d, %d (%s)",
313 sim_name, region_x, region_y, region_z, rating);
231 self->mLocationEditor->setText(location); 314 self->mLocationEditor->setText(location);
232 315
233 BOOL show_auction = (auction_id > 0); 316 BOOL show_auction = (auction_id > 0);
@@ -236,12 +319,58 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
236} 319}
237 320
238 321
322void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region,
323 const LLUUID& landmark_asset_id,
324 const LLUUID& region_id,
325 const LLVector3d& pos_global)
326{
327 LLSD body;
328 mPosRegion = pos_region;
329 mPosGlobal = pos_global;
330 mLandmarkAssetID = landmark_asset_id;
331 std::string url = gAgent.getRegion()->getCapability("RemoteParcelRequest");
332 if (!url.empty())
333 {
334 body["location"] = ll_sd_from_vector3(pos_region);
335 if (!region_id.isNull())
336 {
337 body["region_id"] = region_id;
338 }
339 if (!pos_global.isExactlyZero())
340 {
341 U64 region_handle = to_region_handle(pos_global);
342 body["region_handle"] = ll_sd_from_U64(region_handle);
343 }
344 LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(this->getHandle()));
345 }
346 else
347 {
348 mDescEditor->setText(childGetText("server_update_text"));
349 }
350 mSnapshotCtrl->setImageAssetID(LLUUID::null);
351}
352
353
239// static 354// static
240void LLPanelPlace::onClickTeleport(void* data) 355void LLPanelPlace::onClickTeleport(void* data)
241{ 356{
242 LLPanelPlace* self = (LLPanelPlace*)data; 357 LLPanelPlace* self = (LLPanelPlace*)data;
243 358
244 if (!self->mPosGlobal.isExactlyZero()) 359 LLView* parent_viewp = self->getParent();
360 if (parent_viewp->getWidgetType() == WIDGET_TYPE_FLOATER)
361 {
362 LLFloater* parent_floaterp = (LLFloater*)parent_viewp;
363 parent_floaterp->close();
364 }
365 // LLFloater* parent_floaterp = (LLFloater*)self->getParent();
366 parent_viewp->setVisible(false);
367 if(self->mLandmarkAssetID.notNull())
368 {
369 gAgent.teleportViaLandmark(self->mLandmarkAssetID);
370 gFloaterWorldMap->trackLandmark(self->mLandmarkAssetID);
371
372 }
373 else if (!self->mPosGlobal.isExactlyZero())
245 { 374 {
246 gAgent.teleportViaLocation(self->mPosGlobal); 375 gAgent.teleportViaLocation(self->mPosGlobal);
247 gFloaterWorldMap->trackLocation(self->mPosGlobal); 376 gFloaterWorldMap->trackLocation(self->mPosGlobal);
@@ -252,6 +381,12 @@ void LLPanelPlace::onClickTeleport(void* data)
252void LLPanelPlace::onClickMap(void* data) 381void LLPanelPlace::onClickMap(void* data)
253{ 382{
254 LLPanelPlace* self = (LLPanelPlace*)data; 383 LLPanelPlace* self = (LLPanelPlace*)data;
384 LLView* parent_viewp = self->getParent();
385 if (parent_viewp->getWidgetType() == WIDGET_TYPE_FLOATER)
386 {
387 LLFloater* parent_floaterp = (LLFloater*)parent_viewp;
388 parent_floaterp->close();
389 }
255 390
256 if (!self->mPosGlobal.isExactlyZero()) 391 if (!self->mPosGlobal.isExactlyZero())
257 { 392 {