diff options
author | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-07-26 16:14:23 +0300 |
---|---|---|
committer | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-07-26 16:14:23 +0300 |
commit | 75addb32d6b1b6af07a2c8f66722b651602e661a (patch) | |
tree | 11e9a681a09edd5a9b8d65218d428b709f3b8cc5 | |
parent | 85b677823f1515f242e403a6c160af4a9f3ee595 (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.cpp | 65 | ||||
-rw-r--r-- | indra/newview/llpanelplaceinfo.cpp | 16 |
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 |