summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-07-26 16:14:23 +0300
committerSergei Litovchuk <slitovchuk@productengine.com>2010-07-26 16:14:23 +0300
commit9908fc1518e898cc7c4756124fee2e6078bcfd82 (patch)
tree11e9a681a09edd5a9b8d65218d428b709f3b8cc5
parentd6726e6e4b40efaee35b8df5ac9d1098f208bcac (diff)
EXT-8391 FIXED Landmark creation and error handling.
- Added displaying error messages in Create Landmark panel upon remote parcel request fail. - Moved landmark creation from LLPanelLandmarkInfo::processParcelInfo() because we use only agent's current coordinates instead of waiting for remote parcel request to complete. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/793/. --HG-- branch : product-engine
-rw-r--r--indra/newview/llpanellandmarkinfo.cpp65
-rw-r--r--indra/newview/llpanelplaceinfo.cpp16
2 files changed, 58 insertions, 23 deletions
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 4ffd43cb0f..c05cffc59e 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -123,11 +123,54 @@ void LLPanelLandmarkInfo::setInfoType(EInfoType type)
switch(type)
{
case CREATE_LANDMARK:
+ {
mCurrentTitle = getString("title_create_landmark");
mLandmarkTitle->setVisible(FALSE);
mLandmarkTitleEditor->setVisible(TRUE);
mNotesEditor->setEnabled(TRUE);
+
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ std::string name = parcel_mgr->getAgentParcelName();
+ LLVector3 agent_pos = gAgent.getPositionAgent();
+
+ if (name.empty())
+ {
+ S32 region_x = llround(agent_pos.mV[VX]);
+ S32 region_y = llround(agent_pos.mV[VY]);
+ S32 region_z = llround(agent_pos.mV[VZ]);
+
+ std::string region_name;
+ LLViewerRegion* region = parcel_mgr->getSelectionRegion();
+ if (region)
+ {
+ region_name = region->getName();
+ }
+ else
+ {
+ region_name = getString("unknown");
+ }
+
+ mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
+ region_name.c_str(), region_x, region_y, region_z));
+ }
+ else
+ {
+ mLandmarkTitleEditor->setText(name);
+ }
+
+ std::string desc;
+ LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_FULL, agent_pos);
+ mNotesEditor->setText(desc);
+
+ // Moved landmark creation here from LLPanelLandmarkInfo::processParcelInfo()
+ // because we use only agent's current coordinates instead of waiting for
+ // remote parcel request to complete.
+ if (!LLLandmarkActions::landmarkAlreadyExists())
+ {
+ createLandmark(LLUUID());
+ }
+ }
break;
case LANDMARK:
@@ -192,28 +235,6 @@ void LLPanelLandmarkInfo::processParcelInfo(const LLParcelData& parcel_data)
info["global_y"] = parcel_data.global_y;
info["global_z"] = parcel_data.global_z;
notifyParent(info);
-
- if (mInfoType == CREATE_LANDMARK)
- {
- if (parcel_data.name.empty())
- {
- mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
- parcel_data.sim_name.c_str(), region_x, region_y, region_z));
- }
- else
- {
- mLandmarkTitleEditor->setText(parcel_data.name);
- }
-
- std::string desc;
- LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_FULL, gAgent.getPositionAgent());
- mNotesEditor->setText(desc);
-
- if (!LLLandmarkActions::landmarkAlreadyExists())
- {
- createLandmark(mFolderCombo->getValue().asUUID());
- }
- }
}
void LLPanelLandmarkInfo::displayItemInfo(const LLInventoryItem* pItem)
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 8c1f5d0915..38ad112438 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -103,11 +103,11 @@ void LLPanelPlaceInfo::resetLocation()
mPosRegion.clearVec();
std::string loading = LLTrans::getString("LoadingData");
- mMaturityRatingIcon->setValue(loading);
mMaturityRatingText->setValue(loading);
mRegionName->setText(loading);
mParcelName->setText(loading);
mDescEditor->setText(loading);
+ mMaturityRatingIcon->setValue(LLUUID::null);
mSnapshotCtrl->setImageAssetID(LLUUID::null);
}
@@ -185,7 +185,21 @@ void LLPanelPlaceInfo::setErrorStatus(U32 status, const std::string& reason)
{
error_text = getString("server_forbidden_text");
}
+ else
+ {
+ error_text = getString("server_error_text");
+ }
+
mDescEditor->setText(error_text);
+
+ std::string not_available = getString("not_available");
+ mMaturityRatingText->setValue(not_available);
+ mRegionName->setText(not_available);
+ mParcelName->setText(not_available);
+ mMaturityRatingIcon->setValue(LLUUID::null);
+
+ // Enable "Back" button that was disabled when parcel request was sent.
+ getChild<LLButton>("back_btn")->setEnabled(TRUE);
}
// virtual