Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added preview buttons in profile panel #64

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions indra/newview/llpanelprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ LLPanelProfileSecondLife::LLPanelProfileSecondLife()
, mAllowPublish(false)
, mHideAge(false)
, mRlvBehaviorCallbackConnection() // <FS:Ansariel> RLVa support
, mPreview(false) // <AS:Chanayane> Preview button
{
}

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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();
mDescriptionEdit->setValue(mOriginalDescriptionText);
} else {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_On");
if (mHasUnsavedDescriptionChanges) {
mSaveDescriptionChanges->setEnabled(true);
mDiscardDescriptionChanges->setEnabled(true);
}
mDescriptionEdit->setValue(mOriginalDescriptionText);
}
}
// </AS:Chanayane>
}

bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata)
Expand Down Expand Up @@ -2679,6 +2716,7 @@ void LLPanelProfileWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e
LLPanelProfileFirstLife::LLPanelProfileFirstLife()
: LLPanelProfilePropertiesProcessorTab()
, mHasUnsavedChanges(false)
, mPreview(false) // <AS:Chanayane> Preview button
{
}

Expand All @@ -2699,12 +2737,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

Expand All @@ -2720,6 +2762,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());
Expand Down Expand Up @@ -2949,6 +2992,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();
mDescriptionEdit->setValue(mOriginalDescription);
} else {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_On");
if (mHasUnsavedChanges) {
mSaveChanges->setEnabled(true);
mDiscardChanges->setEnabled(true);
}
mDescriptionEdit->setValue(mOriginalDescription);
}
}
// </AS:Chanayane>

void LLPanelProfileFirstLife::processProperties(void * data, EAvatarProcessorType type)
{
if (APT_PROPERTIES == type)
Expand Down Expand Up @@ -3025,6 +3095,7 @@ void LLPanelProfileFirstLife::resetData()
// </FS:Beq>
mSaveChanges->setVisible(getSelfProfile());
mDiscardChanges->setVisible(getSelfProfile());
mPreviewButton->setVisible(getSelfProfile()); // <AS:Chanayane> Preview button
}

void LLPanelProfileFirstLife::setLoaded()
Expand All @@ -3036,6 +3107,7 @@ void LLPanelProfileFirstLife::setLoaded()
mDescriptionEdit->setEnabled(true);
mPicture->setEnabled(true);
mRemovePhoto->setEnabled(mImageId.notNull());
mPreviewButton->setEnabled(true);
}
}

Expand Down
9 changes: 9 additions & 0 deletions indra/newview/llpanelprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class LLPanelProfileSecondLife
LLButton* mIMButton;
LLMenuButton* mOverflowButton;
// </FS:Ansariel>
LLButton* mPreviewButton; // <AS:Chanayane> Preview button

LLHandle<LLFloater> mFloaterPermissionsHandle;
LLHandle<LLFloater> mFloaterProfileTextureHandle;
Expand All @@ -275,8 +276,10 @@ class LLPanelProfileSecondLife
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;
Expand Down Expand Up @@ -369,6 +372,7 @@ class LLPanelProfileFirstLife
void onSetDescriptionDirty();
void onSaveDescriptionChanges();
void onDiscardDescriptionChanges();
void onClickPreview(); // <AS:Chanayane> Preview button

LLTextEditor* mDescriptionEdit;
// <FS:Zi> Allow proper texture swatch handling
Expand All @@ -380,12 +384,17 @@ class LLPanelProfileFirstLife
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>
};

/**
Expand Down
42 changes: 42 additions & 0 deletions indra/newview/llpanelprofilepicks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ LLPanelProfilePick::LLPanelProfilePick()
, mIsEditing(false)
, mRegionCallbackConnection()
, mParcelCallbackConnection()
// <AS:Chanayane> Preview button
, mPreview(false)
, mWasDirty(false)
// </AS:Chanayane>
{
}

Expand Down Expand Up @@ -622,6 +626,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);
Expand All @@ -645,6 +654,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));
Expand All @@ -658,6 +668,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);
Expand Down Expand Up @@ -848,6 +861,35 @@ void LLPanelProfilePick::onClickSetLocation()
}
// </FS:Ansariel>

// <AS:Chanayane> Preview button
void LLPanelProfilePick::onClickPreview()
{
mPreview = !mPreview;
mWasDirty = isDirty();

if (mPreview) {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_Off");
mOriginalPickText = mPickDescription->getValue().asString();
mPickDescription->setEnabled(!mPreview);
mPickDescription->setParseHTML(mPreview);
mPickDescription->setValue(mOriginalPickText);
enableSaveButton(false);
if (mWasDirty) {
mPickDescription->getViewModel()->setDirty();
}
} else {
mPreviewButton->setImageOverlay("Profile_Group_Visibility_On");
mPickDescription->setEnabled(!mPreview);
mPickDescription->setParseHTML(mPreview);
mPickDescription->setValue(mOriginalPickText);
if (mWasDirty) {
mPickDescription->getViewModel()->setDirty();
}
enableSaveButton(isDirty());
}
}
// </AS:Chanayane>

void LLPanelProfilePick::onClickSave()
{
if (mRegionCallbackConnection.connected())
Expand Down
13 changes: 13 additions & 0 deletions indra/newview/llpanelprofilepicks.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ class LLPanelProfilePick
void onClickSetLocation();
// <FS:Ansariel>

// <AS:Chanayane> Preview button
/**
* Callback for "Preview" button click
*/
void onClickPreview();
// </AS:Chanayane>

/**
* Callback for "Save" and "Create" button click
*/
Expand All @@ -241,6 +248,7 @@ class LLPanelProfilePick
LLButton* mSaveButton;
LLButton* mCreateButton;
LLButton* mCancelButton;
LLButton* mPreviewButton; // <AS:Chanayane> Preview button

LLVector3d mPosGlobal;
LLUUID mParcelId;
Expand All @@ -254,6 +262,11 @@ class LLPanelProfilePick
bool mLocationChanged;
bool mNewPick;
bool mIsEditing;
// <AS:Chanayane> Preview button
bool mPreview;
bool mWasDirty;
std::string mOriginalPickText;
// </AS:Chanayane>

void onDescriptionFocusReceived();
};
Expand Down
28 changes: 27 additions & 1 deletion indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,26 @@
follows="top|left"
layout="topleft"
visible="false"/>
<!-- [AS:chanayane] Preview button -->
<button
name="fl_upload_image"
label="Upload Photo"
top="80"
top="55"
left="285"
height="20"
width="120"
follows="top|left"
layout="topleft"/>
<!-- <button
name="fl_upload_image"
label="Upload Photo"
top="80"
left="285"
height="20"
width="120"
follows="top|left"
layout="topleft"/> -->
<!-- [AS:chanayane] Preview button -->
<button
name="fl_change_image"
label="Change Photo"
Expand All @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions indra/newview/skins/default/xui/en/panel_profile_pick.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading