Restore option to change location of existing pick

master
Ansariel Hiller 2024-09-20 19:07:02 +02:00 committed by Ansariel
parent 8c5d144f99
commit b489134119
3 changed files with 71 additions and 1 deletions

View File

@ -248,6 +248,8 @@ void LLPanelProfilePicks::onClickNewBtn()
select_tab(true).
label(pick_panel->getPickName()));
updateButtons();
pick_panel->addLocationChangedCallbacks();
}
void LLPanelProfilePicks::onClickDelete()
@ -607,10 +609,12 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id)
{
mPickName->setEnabled(true);
mPickDescription->setEnabled(true);
mSetCurrentLocationButton->setVisible(true);
}
else
{
mSnapshotCtrl->setEnabled(false);
mSetCurrentLocationButton->setVisible(false);
}
}
@ -621,6 +625,7 @@ bool LLPanelProfilePick::postBuild()
mSaveButton = getChild<LLButton>("save_changes_btn");
mCreateButton = getChild<LLButton>("create_changes_btn");
mCancelButton = getChild<LLButton>("cancel_changes_btn");
mSetCurrentLocationButton = getChild<LLButton>("set_to_curr_location_btn");
mSnapshotCtrl = getChild<LLTextureCtrl>("pick_snapshot");
mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelProfilePick::onSnapshotChanged, this));
@ -633,6 +638,7 @@ bool LLPanelProfilePick::postBuild()
mSaveButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
mCreateButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
mCancelButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickCancel, this));
mSetCurrentLocationButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSetLocation, this));
mPickName->setKeystrokeCallback(boost::bind(&LLPanelProfilePick::onPickChanged, this, _1), NULL);
mPickName->setEnabled(false);
@ -811,6 +817,32 @@ bool LLPanelProfilePick::isDirty() const
return false;
}
void LLPanelProfilePick::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();
parcel_name = parcel->getName();
}
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
region_name = region->getName();
}
setPickLocation(createLocationText(getLocationNotice(), parcel_name, region_name, getPosGlobal()));
mLocationChanged = true;
enableSaveButton(true);
}
void LLPanelProfilePick::onClickSave()
{
if (mRegionCallbackConnection.connected())
@ -821,6 +853,10 @@ void LLPanelProfilePick::onClickSave()
{
mParcelCallbackConnection.disconnect();
}
if (mLocationChanged)
{
onClickSetLocation();
}
sendUpdate();
mLocationChanged = false;
@ -871,6 +907,12 @@ void LLPanelProfilePick::processParcelInfo(const LLParcelData& parcel_data)
}
}
void LLPanelProfilePick::addLocationChangedCallbacks()
{
mRegionCallbackConnection = gAgent.addRegionChangedCallback([this]() { onClickSetLocation(); });
mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onClickSetLocation(); });
}
void LLPanelProfilePick::setParcelID(const LLUUID& parcel_id)
{
if (mParcelId != parcel_id)

View File

@ -141,6 +141,8 @@ public:
LLUUID getParcelID() const { return mParcelId; }
void setErrorStatus(S32 status, const std::string& reason) override {};
void addLocationChangedCallbacks();
protected:
/**
@ -202,6 +204,11 @@ public:
*/
void resetDirty() override;
/**
* Callback for "Set Location" button click
*/
void onClickSetLocation();
/**
* Callback for "Save" and "Create" button click
*/
@ -224,6 +231,7 @@ protected:
LLTextureCtrl* mSnapshotCtrl;
LLLineEditor* mPickName;
LLTextEditor* mPickDescription;
LLButton* mSetCurrentLocationButton;
LLButton* mSaveButton;
LLButton* mCreateButton;
LLButton* mCancelButton;
@ -241,7 +249,7 @@ protected:
bool mLocationChanged;
bool mNewPick;
bool mIsEditing;
bool mIsEditing;
void onDescriptionFocusReceived();
};

View File

@ -198,6 +198,26 @@
/>
</layout_panel>
<layout_panel
follows="all"
layout="bottomleft"
left_pad="2"
name="set_to_curr_location_btn_lp"
auto_resize="false"
width="100">
<button
name="set_to_curr_location_btn"
label="Set Location"
tool_tip="Set to Current Location"
left="0"
top="0"
height="23"
width="100"
follows="left|top"
layout="topleft"
/>
</layout_panel>
<layout_panel
follows="all"
layout="topleft"