Added preview buttons in profile panel to preview the About section, Picks and First Life introduction like others would see it, useful to preview links for example

master
chanayane 2025-01-09 16:53:41 +01:00
parent 819bdd72ea
commit 4178a36809
No known key found for this signature in database
GPG Key ID: F60C8AE3A90228FA
9 changed files with 243 additions and 2 deletions

View File

@ -345,6 +345,20 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Param
resetDirty();
}
// <AS:Chanayane> Preview button
void LLTextEditor::reparseText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params)
{
mParseOnTheFly = false;
LLTextBase::setText(utf8str, input_params);
mParseOnTheFly = true;
}
void LLTextEditor::reparseValue(const LLSD& value)
{
reparseText(value.asString());
}
// </AS:Chanayane>
// [SL:KB] - Patch: UI-FloaterSearchReplace | Checked: 2013-12-30 (Catznip-3.6)
std::string LLTextEditor::getSelectionString() const
{

View File

@ -187,6 +187,11 @@ public:
// Non-undoable
void setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params = LLStyle::Params());
// <AS:Chanayane> Preview button
void reparseText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params = LLStyle::Params());
void reparseValue(const LLSD& value);
// </AS:Chanayane>
// Removes text from the end of document
// Does not change highlight or cursor position.

View File

@ -717,6 +717,7 @@ LLPanelProfileSecondLife::LLPanelProfileSecondLife()
, mAllowPublish(false)
, mHideAge(false)
, mRlvBehaviorCallbackConnection() // <FS:Ansariel> RLVa support
, mPreview(false) // <AS:Chanayane> Preview button
{
}
@ -785,6 +786,7 @@ bool LLPanelProfileSecondLife::postBuild()
mIMButton = getChild<LLButton>("im");
mOverflowButton = getChild<LLMenuButton>("overflow_btn");
// </FS:Ansariel>
mPreviewButton = getChild<LLButton>("btn_preview"); // <AS:Chanayane> Preview button
// <FS:Ansariel> Fix LL UI/UX design accident
//mShowInSearchCombo->setCommitCallback([this](LLUICtrl*, void*) { onShowInSearchCallback(); }, nullptr);
@ -802,6 +804,9 @@ bool LLPanelProfileSecondLife::postBuild()
mPayButton->setCommitCallback([this](LLUICtrl*, void*) { onCommitMenu(LLSD("pay")); }, nullptr);
mIMButton->setCommitCallback([this](LLUICtrl*, void*) { onCommitMenu(LLSD("im")); }, nullptr);
// </FS:Ansariel>
// <AS:Chanayane> Preview button
mPreviewButton->setCommitCallback([this](LLUICtrl*, void*) { onCommitMenu(LLSD("preview")); }, nullptr);
// </AS:Chanayane>
mGroupList->setDoubleClickCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { LLPanelProfileSecondLife::openGroupProfile(); });
mGroupList->setReturnCallback([this](LLUICtrl*, const LLSD&) { LLPanelProfileSecondLife::openGroupProfile(); });
mSaveDescriptionChanges->setCommitCallback([this](LLUICtrl*, void*) { onSaveDescriptionChanges(); }, nullptr);
@ -856,6 +861,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key)
mDiscardDescriptionChanges->setVisible(own_profile);
mShowInSearchCheckbox->setVisible(own_profile);
// </FS:Ansariel>
mPreviewButton->setVisible(own_profile); // <AS:Chanayane> Preview button
if (own_profile)
{
@ -1785,6 +1791,7 @@ void LLPanelProfileSecondLife::setLoaded()
//{
// mHideAgeCombo->setEnabled(true);
mShowInSearchCheckbox->setEnabled(true);
mPreviewButton->setEnabled(true); // <AS:Chanayane> Preview button
if (mHideAgeCheckbox->getVisible())
{
mHideAgeCheckbox->setEnabled(true);
@ -1801,6 +1808,10 @@ void LLPanelProfileSecondLife::updateButtons()
{
mShowInSearchCheckbox->setVisible(true);
mShowInSearchCheckbox->setEnabled(true);
// <AS:Chanayane> Preview button
mPreviewButton->setVisible(true);
mPreviewButton->setEnabled(true);
// </AS:Chanayane>
mDescriptionEdit->setEnabled(true);
}
else
@ -2104,6 +2115,32 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata)
LLAvatarActions::report(agent_id);
}
// </FS:Ansariel>
// <AS:Chanayane> Preview button
else if (item_name == "preview")
{
mPreview = !mPreview;
mDescriptionEdit->setEnabled(!mPreview);
mDescriptionEdit->setParseHTML(mPreview);
if (mPreview) {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_Off");
if (mHasUnsavedDescriptionChanges) {
mSaveDescriptionChanges->setEnabled(false);
mDiscardDescriptionChanges->setEnabled(false);
}
mOriginalDescriptionText = mDescriptionEdit->getValue().asString();
reparseDescriptionText(mOriginalDescriptionText);
} else {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_On");
if (mHasUnsavedDescriptionChanges) {
mSaveDescriptionChanges->setEnabled(true);
mDiscardDescriptionChanges->setEnabled(true);
}
reparseDescriptionText(mOriginalDescriptionText);
}
}
// </AS:Chanayane>
}
bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata)
@ -2222,6 +2259,13 @@ void LLPanelProfileSecondLife::setDescriptionText(const std::string &text)
mDescriptionEdit->setValue(mDescriptionText);
}
// <AS:Chanayane> Preview button
void LLPanelProfileSecondLife::reparseDescriptionText(const std::string &text)
{
mDescriptionEdit->reparseValue(text);
}
// </AS:Chanayane>
void LLPanelProfileSecondLife::onSetDescriptionDirty()
{
mSaveDescriptionChanges->setEnabled(true);
@ -2679,6 +2723,7 @@ void LLPanelProfileWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e
LLPanelProfileFirstLife::LLPanelProfileFirstLife()
: LLPanelProfilePropertiesProcessorTab()
, mHasUnsavedChanges(false)
, mPreview(false) // <AS:Chanayane> Preview button
{
}
@ -2699,12 +2744,16 @@ bool LLPanelProfileFirstLife::postBuild()
mRemovePhoto = getChild<LLButton>("fl_remove_image");
mSaveChanges = getChild<LLButton>("fl_save_changes");
mDiscardChanges = getChild<LLButton>("fl_discard_changes");
mPreviewButton = getChild<LLButton>("btn_preview"); // <AS:Chanayane> Preview button
mUploadPhoto->setCommitCallback([this](LLUICtrl*, void*) { onUploadPhoto(); }, nullptr);
mChangePhoto->setCommitCallback([this](LLUICtrl*, void*) { onChangePhoto(); }, nullptr);
mRemovePhoto->setCommitCallback([this](LLUICtrl*, void*) { onRemovePhoto(); }, nullptr);
mSaveChanges->setCommitCallback([this](LLUICtrl*, void*) { onSaveDescriptionChanges(); }, nullptr);
mDiscardChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardDescriptionChanges(); }, nullptr);
// <AS:Chanayane> Preview button
mPreviewButton->setCommitCallback([this](LLUICtrl*, void*) { onClickPreview(); }, nullptr);
// </AS:Chanayane>
mDescriptionEdit->setKeystrokeCallback([this](LLTextEditor* caller) { onSetDescriptionDirty(); });
mPicture->setCommitCallback(boost::bind(&LLPanelProfileFirstLife::onFirstLifePicChanged, this)); // <FS:Zi> Allow proper texture swatch handling
@ -2720,6 +2769,7 @@ void LLPanelProfileFirstLife::onOpen(const LLSD& key)
// Otherwise as the only focusable element it will be selected
mDescriptionEdit->setTabStop(false);
}
mPreviewButton->setVisible(getSelfProfile()); // <AS:Chanayane> Preview button
// <FS:Zi> Allow proper texture swatch handling
mPicture->setEnabled(getSelfProfile());
@ -2893,6 +2943,13 @@ void LLPanelProfileFirstLife::setDescriptionText(const std::string &text)
mDescriptionEdit->setValue(mCurrentDescription);
}
// <AS:Chanayane> Preview button
void LLPanelProfileFirstLife::reparseDescriptionText(const std::string &text)
{
mDescriptionEdit->reparseValue(text);
}
// </AS:Chanayane>
void LLPanelProfileFirstLife::onSetDescriptionDirty()
{
mSaveChanges->setEnabled(true);
@ -2949,6 +3006,33 @@ void LLPanelProfileFirstLife::onDiscardDescriptionChanges()
setDescriptionText(mCurrentDescription);
}
// <AS:Chanayane> Preview button
void LLPanelProfileFirstLife::onClickPreview()
{
mPreview = !mPreview;
mDescriptionEdit->setEnabled(!mPreview);
mDescriptionEdit->setParseHTML(mPreview);
if (mPreview) {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_Off");
if (mHasUnsavedChanges) {
mSaveChanges->setEnabled(false);
mDiscardChanges->setEnabled(false);
}
mOriginalDescription = mDescriptionEdit->getValue().asString();
reparseDescriptionText(mOriginalDescription);
} else {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_On");
if (mHasUnsavedChanges) {
mSaveChanges->setEnabled(true);
mDiscardChanges->setEnabled(true);
}
reparseDescriptionText(mOriginalDescription);
}
}
// </AS:Chanayane>
void LLPanelProfileFirstLife::processProperties(void * data, EAvatarProcessorType type)
{
if (APT_PROPERTIES == type)
@ -3025,6 +3109,7 @@ void LLPanelProfileFirstLife::resetData()
// </FS:Beq>
mSaveChanges->setVisible(getSelfProfile());
mDiscardChanges->setVisible(getSelfProfile());
mPreviewButton->setVisible(getSelfProfile()); // <AS:Chanayane> Preview button
}
void LLPanelProfileFirstLife::setLoaded()
@ -3036,6 +3121,7 @@ void LLPanelProfileFirstLife::setLoaded()
mDescriptionEdit->setEnabled(true);
mPicture->setEnabled(true);
mRemovePhoto->setEnabled(mImageId.notNull());
mPreviewButton->setEnabled(true);
}
}

View File

@ -203,6 +203,9 @@ private:
void onAvatarNameCacheSetName(const LLUUID& id, const LLAvatarName& av_name);
void setDescriptionText(const std::string &text);
// <AS:Chanayane> Preview button
void reparseDescriptionText(const std::string& text);
// </AS:Chanayane>
void onSetDescriptionDirty();
void onShowInSearchCallback();
void onHideAgeCallback();
@ -266,6 +269,7 @@ private:
LLButton* mIMButton;
LLMenuButton* mOverflowButton;
// </FS:Ansariel>
LLButton* mPreviewButton; // <AS:Chanayane> Preview button
LLHandle<LLFloater> mFloaterPermissionsHandle;
LLHandle<LLFloater> mFloaterProfileTextureHandle;
@ -275,8 +279,10 @@ private:
bool mVoiceStatus;
bool mWaitingForImageUpload;
bool mAllowPublish;
bool mPreview; // <AS:Chanayane> Preview button
bool mHideAge;
std::string mDescriptionText;
std::string mOriginalDescriptionText; // <AS:Chanayane> Preview button
LLUUID mImageId;
boost::signals2::connection mAvatarNameCacheConnection;
@ -366,9 +372,13 @@ protected:
void onFirstLifePicChanged(); // <FS:Zi> Allow proper texture swatch handling
void onCommitPhoto(const LLUUID& id);
void setDescriptionText(const std::string &text);
// <AS:Chanayane> Preview button
void reparseDescriptionText(const std::string& text);
// </AS:Chanayane>
void onSetDescriptionDirty();
void onSaveDescriptionChanges();
void onDiscardDescriptionChanges();
void onClickPreview(); // <AS:Chanayane> Preview button
LLTextEditor* mDescriptionEdit;
// <FS:Zi> Allow proper texture swatch handling
@ -380,12 +390,17 @@ protected:
LLButton* mRemovePhoto;
LLButton* mSaveChanges;
LLButton* mDiscardChanges;
LLButton* mPreviewButton; // <AS:Chanayane> Preview button
LLHandle<LLFloater> mFloaterTexturePickerHandle;
std::string mCurrentDescription;
LLUUID mImageId;
bool mHasUnsavedChanges;
// <AS:Chanayane> Preview button
bool mPreview;
std::string mOriginalDescription;
// </AS:Chanayane>
};
/**

View File

@ -543,6 +543,9 @@ LLPanelProfilePick::LLPanelProfilePick()
, mIsEditing(false)
, mRegionCallbackConnection()
, mParcelCallbackConnection()
// <AS:Chanayane> Preview button
, mPreview(false)
// </AS:Chanayane>
{
}
@ -622,6 +625,11 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id)
resetDirty();
// <AS:Chanayane> Preview button
mPreviewButton->setVisible(getSelfProfile());
mPreviewButton->setEnabled(getSelfProfile());
// </AS:Chanayane>
if (getSelfProfile())
{
mPickName->setEnabled(true);
@ -645,6 +653,7 @@ bool LLPanelProfilePick::postBuild()
mCreateButton = getChild<LLButton>("create_changes_btn");
mCancelButton = getChild<LLButton>("cancel_changes_btn");
mSetCurrentLocationButton = getChild<LLButton>("set_to_curr_location_btn"); // <FS:Ansariel> Keep set location button
mPreviewButton = getChild<LLButton>("btn_preview"); // <AS:Chanayane> Preview button
mSnapshotCtrl = getChild<LLTextureCtrl>("pick_snapshot");
mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelProfilePick::onSnapshotChanged, this));
@ -658,6 +667,9 @@ bool LLPanelProfilePick::postBuild()
mCreateButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
mCancelButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickCancel, this));
mSetCurrentLocationButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSetLocation, this)); // <FS:Ansariel> Keep set location button
// <AS:Chanayane> Preview button
mPreviewButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickPreview, this));
// </AS:Chanayane>
mPickName->setKeystrokeCallback(boost::bind(&LLPanelProfilePick::onPickChanged, this, _1), NULL);
mPickName->setEnabled(false);
@ -752,6 +764,13 @@ void LLPanelProfilePick::setPickDesc(const std::string& desc)
mPickDescription->setValue(desc);
}
// <AS:Chanayane> Preview button
void LLPanelProfilePick::reparseDescription(const std::string& desc)
{
mPickDescription->reparseValue(desc);
}
// </AS:Chanayane>
void LLPanelProfilePick::setPickLocation(const std::string& location)
{
getChild<LLUICtrl>("pick_location")->setValue(location);
@ -848,6 +867,28 @@ void LLPanelProfilePick::onClickSetLocation()
}
// </FS:Ansariel>
// <AS:Chanayane> Preview button
void LLPanelProfilePick::onClickPreview()
{
mPreview = !mPreview;
if (mPreview) { // Then we switch to preview mode
mPreviewButton->setImageOverlay("Profile_Group_Visibility_Off");
mOriginalPickText = mPickDescription->getValue().asString();
mPickDescription->setEnabled(!mPreview);
mPickDescription->setParseHTML(mPreview);
reparseDescription(mOriginalPickText);
enableSaveButton(false);
} else { // we switch to edit mode, restoring the dirty state if necessary
mPreviewButton->setImageOverlay("Profile_Group_Visibility_On");
mPickDescription->setEnabled(!mPreview);
mPickDescription->setParseHTML(mPreview);
reparseDescription(mOriginalPickText);
enableSaveButton(isDirty()); // re-check if whole pick is dirty
}
}
// </AS:Chanayane>
void LLPanelProfilePick::onClickSave()
{
if (mRegionCallbackConnection.connected())

View File

@ -173,6 +173,9 @@ public:
*/
virtual void setSnapshotId(const LLUUID& id);
virtual void setPickDesc(const std::string& desc);
// <AS:Chanayane> Preview button
virtual void reparseDescription(const std::string& desc);
// </AS:Chanayane>
virtual void setPickLocation(const std::string& location);
virtual void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
@ -215,6 +218,13 @@ public:
void onClickSetLocation();
// <FS:Ansariel>
// <AS:Chanayane> Preview button
/**
* Callback for "Preview" button click
*/
void onClickPreview();
// </AS:Chanayane>
/**
* Callback for "Save" and "Create" button click
*/
@ -241,6 +251,7 @@ protected:
LLButton* mSaveButton;
LLButton* mCreateButton;
LLButton* mCancelButton;
LLButton* mPreviewButton; // <AS:Chanayane> Preview button
LLVector3d mPosGlobal;
LLUUID mParcelId;
@ -254,6 +265,10 @@ protected:
bool mLocationChanged;
bool mNewPick;
bool mIsEditing;
// <AS:Chanayane> Preview button
bool mPreview;
std::string mOriginalPickText;
// </AS:Chanayane>
void onDescriptionFocusReceived();
};

View File

@ -43,7 +43,17 @@
follows="top|left"
layout="topleft"
visible="false"/>
<!-- [AS:chanayane] Preview button -->
<button
name="fl_upload_image"
label="Upload Photo"
top="55"
left="285"
height="20"
width="120"
follows="top|left"
layout="topleft"/>
<!-- <button
name="fl_upload_image"
label="Upload Photo"
top="80"
@ -51,7 +61,8 @@
height="20"
width="120"
follows="top|left"
layout="topleft"/>
layout="topleft"/> -->
<!-- [AS:chanayane] Preview button -->
<button
name="fl_change_image"
label="Change Photo"
@ -70,6 +81,21 @@
width="120"
follows="top|left"
layout="topleft"/>
<!-- [AS:chanayane] Preview button -->
<button
name="btn_preview"
tool_tip="Toggle preview of your first life introduction"
top_pad="5"
left_delta="0"
height="20"
width="120"
follows="top|left"
layout="topleft"
image_overlay="Profile_Group_Visibility_On"
is_toggle="true"
enabled="false"
visible="false"/>
<!-- [/AS:chanayane] -->
<text_editor
name="fl_description_edit"
trusted_content="false"

View File

@ -84,6 +84,21 @@
>
Description:
</text>
<!-- [AS:chanayane] Preview button -->
<button
name="btn_preview"
tool_tip="Toggle preview of your pick description"
top_pad="-18"
left="280"
height="20"
width="20"
follows="top|right"
layout="topleft"
image_overlay="Profile_Group_Visibility_On"
is_toggle="true"
enabled="false"
visible="false"/>
<!-- [/AS:chanayane] -->
<text_editor
name="pick_desc"
trusted_content="false"

View File

@ -601,8 +601,22 @@
follows="left|top"
layout="topleft"
halign="right"/>
<!-- [AS:chanayane] Preview button -->
<button
name="btn_preview"
tool_tip="Toggle preview of your profile 'about' section"
top_delta="20"
left="35"
height="20"
width="20"
follows="left|top"
layout="topleft"
image_overlay="Profile_Group_Visibility_On"
is_toggle="true"
enabled="false"
visible="false"/>
<view_border
top_delta="-4"
top_delta="-24"
left="59"
right="-5"
height="103"
@ -610,6 +624,16 @@
follows="all"
name="info_border_sl_description_edit"
bevel_style="in"/>
<!-- <view_border
top_delta="-4"
left="59"
right="-5"
height="103"
layout="topleft"
follows="all"
name="info_border_sl_description_edit"
bevel_style="in"/> -->
<!-- [/AS:chanayane] -->
<text_editor
name="sl_description_edit"
trusted_content="false"