summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2009-12-15 18:36:53 +0200
committerSergei Litovchuk <slitovchuk@productengine.com>2009-12-15 18:36:53 +0200
commit08477892228084d955f498f170578a7d1e3c6ddc (patch)
treefc5ff01ccda7009196755a4cdf6463ecb9a86822 /indra
parente303864c1792a69d25f42b9bc44bc59827cfdbd1 (diff)
Fixed normal bug EXT-3409 "Places panel: pick for remote location created with current agent's coordinates".
- Fixed storing global position for remote location pick. - Fixed setting current location to the pick. - Fixed pick location text. Added resolving remote parcel name from ID. - Cleaned up unused code in llpanelpick. --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelpick.cpp86
-rw-r--r--indra/newview/llpanelpick.h12
-rw-r--r--indra/newview/llpanelplaceinfo.cpp13
-rw-r--r--indra/newview/llpanelplaceinfo.h1
4 files changed, 67 insertions, 45 deletions
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index 541361324a..839452d061 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -91,12 +91,19 @@ LLPanelPickInfo::LLPanelPickInfo()
, mAvatarId(LLUUID::null)
, mSnapshotCtrl(NULL)
, mPickId(LLUUID::null)
+ , mParcelId(LLUUID::null)
+ , mRequestedId(LLUUID::null)
{
}
LLPanelPickInfo::~LLPanelPickInfo()
{
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
+
+ if (mParcelId.notNull())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this);
+ }
}
void LLPanelPickInfo::onOpen(const LLSD& key)
@@ -156,12 +163,14 @@ void LLPanelPickInfo::processProperties(void* data, EAvatarProcessorType type)
return;
}
+ mParcelId = pick_info->parcel_id;
setSnapshotId(pick_info->snapshot_id);
setPickName(pick_info->name);
setPickDesc(pick_info->desc);
setPosGlobal(pick_info->pos_global);
- setPickLocation(createLocationText(pick_info->user_name, pick_info->original_name,
- pick_info->sim_name, pick_info->pos_global));
+
+ // Send remote parcel info request to get parcel name and sim (region) name.
+ sendParcelInfoRequest();
// *NOTE dzaporozhan
// We want to keep listening to APT_PICK_INFO because user may
@@ -169,6 +178,17 @@ void LLPanelPickInfo::processProperties(void* data, EAvatarProcessorType type)
// revomeObserver is called from onClickBack
}
+void LLPanelPickInfo::sendParcelInfoRequest()
+{
+ if (mParcelId != mRequestedId)
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->addObserver(mParcelId, this);
+ LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(mParcelId);
+
+ mRequestedId = mParcelId;
+ }
+}
+
void LLPanelPickInfo::setExitCallback(const commit_callback_t& cb)
{
getChild<LLButton>("back_btn")->setClickedCallback(cb);
@@ -176,21 +196,16 @@ void LLPanelPickInfo::setExitCallback(const commit_callback_t& cb)
void LLPanelPickInfo::processParcelInfo(const LLParcelData& parcel_data)
{
- // HACK: Flag 0x2 == adult region,
- // Flag 0x1 == mature region, otherwise assume PG
- std::string rating_icon = "icon_event.tga";
- if (parcel_data.flags & 0x2)
- {
- rating_icon = "icon_event_adult.tga";
- }
- else if (parcel_data.flags & 0x1)
- {
- rating_icon = "icon_event_mature.tga";
- }
+ setPickLocation(createLocationText(LLStringUtil::null, parcel_data.name,
+ parcel_data.sim_name, getPosGlobal()));
- childSetValue("maturity", rating_icon);
+ // We have received parcel info for the requested ID so clear it now.
+ mRequestedId.setNull();
- //*NOTE we don't removeObserver(...) ourselves cause LLRemoveParcelProcessor does it for us
+ if (mParcelId.notNull())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this);
+ }
}
void LLPanelPickInfo::setEditPickCallback(const commit_callback_t& cb)
@@ -222,7 +237,8 @@ void LLPanelPickInfo::resetData()
setPickId(LLUUID::null);
setSnapshotId(LLUUID::null);
mPosGlobal.clearVec();
- childSetValue("maturity", LLStringUtil::null);
+ mParcelId.setNull();
+ mRequestedId.setNull();
}
// static
@@ -273,9 +289,6 @@ void LLPanelPickInfo::setPickDesc(const std::string& desc)
void LLPanelPickInfo::setPickLocation(const std::string& location)
{
childSetValue(XML_LOCATION, location);
-
- //preserving non-wrapped text for info/edit modes switching
- mLocation = location;
}
void LLPanelPickInfo::onClickMap()
@@ -340,7 +353,7 @@ void LLPanelPickEdit::onOpen(const LLSD& key)
setPosGlobal(gAgent.getPositionGlobal());
LLUUID parcel_id = LLUUID::null, snapshot_id = LLUUID::null;
- std::string pick_name, pick_desc;
+ std::string pick_name, pick_desc, region_name;
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if(parcel)
@@ -351,21 +364,17 @@ void LLPanelPickEdit::onOpen(const LLSD& key)
snapshot_id = parcel->getSnapshotID();
}
- if(pick_name.empty())
+ LLViewerRegion* region = gAgent.getRegion();
+ if(region)
{
- LLViewerRegion* region = gAgent.getRegion();
- if(region)
- {
- pick_name = region->getName();
- }
+ region_name = region->getName();
}
setParcelID(parcel_id);
- childSetValue("pick_name", pick_name);
+ childSetValue("pick_name", pick_name.empty() ? region_name : pick_name);
childSetValue("pick_desc", pick_desc);
setSnapshotId(snapshot_id);
- setPickLocation(createLocationText(LLStringUtil::null, SET_LOCATION_NOTICE,
- pick_name, getPosGlobal()));
+ setPickLocation(createLocationText(SET_LOCATION_NOTICE, pick_name, region_name, getPosGlobal()));
enableSaveButton(true);
}
@@ -394,8 +403,9 @@ void LLPanelPickEdit::setPickData(const LLPickData* pick_data)
childSetValue("pick_name", pick_data->name);
childSetValue("pick_desc", pick_data->desc);
setSnapshotId(pick_data->snapshot_id);
- setPickLocation(createLocationText(pick_data->user_name, pick_data->original_name, /*pick_data->sim_name,*/
- pick_data->name, pick_data->pos_global));
+ setPosGlobal(pick_data->pos_global);
+ setPickLocation(createLocationText(LLStringUtil::null, pick_data->name,
+ pick_data->sim_name, pick_data->pos_global));
}
BOOL LLPanelPickEdit::postBuild()
@@ -519,14 +529,22 @@ void LLPanelPickEdit::onClickSetLocation()
// Save location for later use.
setPosGlobal(gAgent.getPositionGlobal());
+ std::string parcel_name, region_name;
+
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (parcel)
{
mParcelId = parcel->getID();
- mSimName = parcel->getName();
+ parcel_name = parcel->getName();
}
- setPickLocation(createLocationText(
- LLStringUtil::null, SET_LOCATION_NOTICE, mSimName, getPosGlobal()));
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if(region)
+ {
+ region_name = region->getName();
+ }
+
+ setPickLocation(createLocationText(SET_LOCATION_NOTICE, parcel_name, region_name, getPosGlobal()));
mLocationChanged = true;
enableSaveButton(TRUE);
diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h
index 2c0830f2ac..95add387d0 100644
--- a/indra/newview/llpanelpick.h
+++ b/indra/newview/llpanelpick.h
@@ -72,6 +72,11 @@ public:
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
/**
+ * Sends remote parcel info request to resolve parcel name from its ID.
+ */
+ void sendParcelInfoRequest();
+
+ /**
* Sets "Back" button click callback
*/
virtual void setExitCallback(const commit_callback_t& cb);
@@ -81,9 +86,9 @@ public:
*/
virtual void setEditPickCallback(const commit_callback_t& cb);
- //This stuff we got from LLRemoteParcelObserver, in the last two we intentionally do nothing
+ //This stuff we got from LLRemoteParcelObserver, in the last one we intentionally do nothing
/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
- /*virtual*/ void setParcelID(const LLUUID& parcel_id) {};
+ /*virtual*/ void setParcelID(const LLUUID& parcel_id) { mParcelId = parcel_id; }
/*virtual*/ void setErrorStatus(U32 status, const std::string& reason) {};
protected:
@@ -154,8 +159,7 @@ protected:
LLVector3d mPosGlobal;
LLUUID mParcelId;
LLUUID mPickId;
- std::string mSimName;
- std::string mLocation;
+ LLUUID mRequestedId;
};
/**
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index b845f38ace..b80eb9db38 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -233,8 +233,10 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
if (!parcel_data.name.empty())
{
+ mParcelTitle = parcel_data.name;
+
mParcelName->setText(llformat("%s (%d, %d, %d)",
- parcel_data.name.c_str(), region_x, region_y, region_z));
+ mParcelTitle.c_str(), region_x, region_y, region_z));
}
else
{
@@ -284,15 +286,12 @@ void LLPanelPlaceInfo::handleVisibilityChange(BOOL new_visibility)
void LLPanelPlaceInfo::createPick(const LLVector3d& pos_global, LLPanelPickEdit* pick_panel)
{
- std::string name = mParcelName->getText();
- if (name.empty())
- {
- name = mRegionName->getText();
- }
+ std::string region_name = mRegionName->getText();
LLPickData data;
data.pos_global = pos_global;
- data.name = name;
+ data.name = mParcelTitle.empty() ? region_name : mParcelTitle;
+ data.sim_name = region_name;
data.desc = mDescEditor->getText();
data.snapshot_id = mSnapshotCtrl->getImageAssetID();
data.parcel_id = mParcelID;
diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h
index b9bf92b534..7dfc7b2444 100644
--- a/indra/newview/llpanelplaceinfo.h
+++ b/indra/newview/llpanelplaceinfo.h
@@ -111,6 +111,7 @@ protected:
LLUUID mParcelID;
LLUUID mRequestedID;
LLVector3 mPosRegion;
+ std::string mParcelTitle; // used for pick title without coordinates
std::string mCurrentTitle;
S32 mScrollingPanelMinHeight;
S32 mScrollingPanelWidth;