SL-15312 Legacy profiles remake #10

Fixed Typo
changed 'show in search' checkbox into combobox, implemented commit
Fixed fl textbox setting sl text instead of fl text
Fixed fl save/discard buttons not following resize
master
Andrey Kleshchev 2022-04-18 21:35:41 +03:00
parent 65ea8e1351
commit 8a39aaa3a4
10 changed files with 73 additions and 37 deletions

View File

@ -121,12 +121,12 @@ void LLPanelProfileTab::setApplyProgress(bool started)
}
}
LLPanelProfilePropertiesPeocessorTab::LLPanelProfilePropertiesPeocessorTab()
LLPanelProfilePropertiesProcessorTab::LLPanelProfilePropertiesProcessorTab()
: LLPanelProfileTab()
{
}
LLPanelProfilePropertiesPeocessorTab::~LLPanelProfilePropertiesPeocessorTab()
LLPanelProfilePropertiesProcessorTab::~LLPanelProfilePropertiesProcessorTab()
{
if (getAvatarId().notNull())
{
@ -134,7 +134,7 @@ LLPanelProfilePropertiesPeocessorTab::~LLPanelProfilePropertiesPeocessorTab()
}
}
void LLPanelProfilePropertiesPeocessorTab::setAvatarId(const LLUUID & avatar_id)
void LLPanelProfilePropertiesProcessorTab::setAvatarId(const LLUUID & avatar_id)
{
if (avatar_id.notNull())
{

View File

@ -146,13 +146,13 @@ private:
bool mSelfProfile;
};
class LLPanelProfilePropertiesPeocessorTab
class LLPanelProfilePropertiesProcessorTab
: public LLPanelProfileTab
, public LLAvatarPropertiesObserver
{
public:
LLPanelProfilePropertiesPeocessorTab();
~LLPanelProfilePropertiesPeocessorTab();
LLPanelProfilePropertiesProcessorTab();
~LLPanelProfilePropertiesProcessorTab();
/*virtual*/ void setAvatarId(const LLUUID& avatar_id);

View File

@ -37,6 +37,7 @@
#include "llavatariconctrl.h"
#include "llclipboard.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "lllineeditor.h"
#include "llloadingindicator.h"
#include "llmenubutton.h"
@ -116,6 +117,8 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
LL_DEBUGS("AvatarProperties") << "Agent id: " << agent_id << " Result: " << httpResults << LL_ENDL;
if (!status
|| !result.has("id")
|| agent_id != result["id"].asUUID())
@ -151,7 +154,6 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
avatar_data->fl_image_id = result["fl_image_id"].asUUID();
avatar_data->partner_id = result["partner_id"].asUUID();
avatar_data->about_text = result["sl_about_text"].asString();
// Todo: new descriptio size is 65536, check if it actually fits or has scroll
avatar_data->fl_about_text = result["fl_about_text"].asString();
avatar_data->born_on = result["member_since"].asDate();
avatar_data->profile_url = getProfileURL(agent_id.asString());
@ -248,7 +250,6 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
avatar_notes.agent_id = agent_id;
avatar_notes.target_id = agent_id;
// Todo: new notes size is 65536, check that field has a scroll
avatar_notes.notes = result["notes"].asString();
panel = floater_profile->findChild<LLPanel>(PANEL_NOTES, TRUE);
@ -284,9 +285,11 @@ void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLSD data)
if (!status)
{
LL_WARNS("AvatarProperties") << "Failed to put agent information for id " << agent_id << LL_ENDL;
LL_WARNS("AvatarProperties") << "Failed to put agent information " << data << " for id " << agent_id << LL_ENDL;
return;
}
LL_DEBUGS("AvatarProperties") << "Agent id: " << agent_id << " Data: " << data << " Result: " << httpResults << LL_ENDL;
}
LLUUID post_profile_image(std::string cap_url, const LLSD &first_data, std::string path_to_image, LLHandle<LLPanel> *handle)
@ -810,7 +813,7 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife()
BOOL LLPanelProfileSecondLife::postBuild()
{
mGroupList = getChild<LLGroupList>("group_list");
mShowInSearchCheckbox = getChild<LLCheckBoxCtrl>("show_in_search_checkbox");
mShowInSearchCombo = getChild<LLComboBox>("show_in_search");
mSecondLifePic = getChild<LLIconCtrl>("2nd_life_pic");
mSecondLifePicLayout = getChild<LLPanel>("image_stack");
mDescriptionEdit = getChild<LLTextEditor>("sl_description_edit");
@ -821,6 +824,7 @@ BOOL LLPanelProfileSecondLife::postBuild()
mSeeOnMapToggle = getChild<LLButton>("allow_to_see_on_map");
mEditObjectsToggle = getChild<LLButton>("allow_edit_my_objects");
mShowInSearchCombo->setCommitCallback([this](LLUICtrl*, void*) { onShowInSearchCallback(); }, nullptr);
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);
@ -1052,7 +1056,7 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
if (getSelfProfile())
{
mShowInSearchCheckbox->setValue((BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH));
mShowInSearchCombo->setValue((BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH));
}
}
@ -1225,8 +1229,7 @@ void LLPanelProfileSecondLife::setLoaded()
if (getSelfProfile())
{
mShowInSearchCheckbox->setVisible(TRUE);
mShowInSearchCheckbox->setEnabled(TRUE);
mShowInSearchCombo->setEnabled(TRUE);
mDescriptionEdit->setEnabled(TRUE);
}
}
@ -1525,6 +1528,22 @@ void LLPanelProfileSecondLife::onSetDescriptionDirty()
mDiscardDescriptionChanges->setEnabled(TRUE);
}
void LLPanelProfileSecondLife::onShowInSearchCallback()
{
std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
if (!cap_url.empty())
{
LLSD data;
data["allow_publish"] = mShowInSearchCombo->getValue().asBoolean();
LLCoros::instance().launch("putAgentUserInfoCoro",
boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), data));
}
else
{
LL_WARNS("AvatarProperties") << "Failed to update profile data, no cap found" << LL_ENDL;
}
}
void LLPanelProfileSecondLife::onSaveDescriptionChanges()
{
mDescriptionText = mDescriptionEdit->getValue().asString();
@ -1814,7 +1833,7 @@ void LLPanelProfileFirstLife::onSaveDescriptionChanges()
if (!cap_url.empty())
{
LLCoros::instance().launch("putAgentUserInfoCoro",
boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), LLSD().with("sl_about_text", mCurrentDescription)));
boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), LLSD().with("fl_about_text", mCurrentDescription)));
}
else
{

View File

@ -47,6 +47,7 @@
class LLAvatarName;
class LLButton;
class LLCheckBoxCtrl;
class LLComboBox;
class LLIconCtrl;
class LLTabContainer;
class LLTextBox;
@ -166,6 +167,7 @@ private:
void setDescriptionText(const std::string &text);
void onSetDescriptionDirty();
void onShowInSearchCallback();
void onSaveDescriptionChanges();
void onDiscardDescriptionChanges();
void onShowAgentPermissionsDialog();
@ -176,7 +178,7 @@ private:
void openGroupProfile();
LLGroupList* mGroupList;
LLCheckBoxCtrl* mShowInSearchCheckbox;
LLComboBox* mShowInSearchCombo;
LLIconCtrl* mSecondLifePic;
LLPanel* mSecondLifePicLayout;
LLTextEditor* mDescriptionEdit;

View File

@ -191,7 +191,7 @@ LLClassifiedHandler gClassifiedHandler;
//-----------------------------------------------------------------------------
LLPanelProfileClassifieds::LLPanelProfileClassifieds()
: LLPanelProfilePropertiesPeocessorTab()
: LLPanelProfilePropertiesProcessorTab()
, mClassifiedToSelectOnLoad(LLUUID::null)
, mClassifiedEditOnLoad(false)
{
@ -473,7 +473,7 @@ static const S32 CB_ITEM_MATURE = 0;
static const S32 CB_ITEM_PG = 1;
LLPanelProfileClassified::LLPanelProfileClassified()
: LLPanelProfilePropertiesPeocessorTab()
: LLPanelProfilePropertiesProcessorTab()
, mInfoLoaded(false)
, mTeleportClicksOld(0)
, mMapClicksOld(0)

View File

@ -68,7 +68,7 @@ public:
* Panel for displaying Avatar's picks.
*/
class LLPanelProfileClassifieds
: public LLPanelProfilePropertiesPeocessorTab
: public LLPanelProfilePropertiesProcessorTab
{
public:
LLPanelProfileClassifieds();
@ -109,7 +109,7 @@ private:
class LLPanelProfileClassified
: public LLPanelProfilePropertiesPeocessorTab
: public LLPanelProfilePropertiesProcessorTab
{
public:

View File

@ -120,7 +120,7 @@ LLPickHandler gPickHandler;
//-----------------------------------------------------------------------------
LLPanelProfilePicks::LLPanelProfilePicks()
: LLPanelProfilePropertiesPeocessorTab()
: LLPanelProfilePropertiesProcessorTab()
, mPickToSelectOnLoad(LLUUID::null)
{
}
@ -370,7 +370,7 @@ bool LLPanelProfilePicks::canDeletePick()
//-----------------------------------------------------------------------------
LLPanelProfilePick::LLPanelProfilePick()
: LLPanelProfilePropertiesPeocessorTab()
: LLPanelProfilePropertiesProcessorTab()
, LLRemoteParcelInfoObserver()
, mSnapshotCtrl(NULL)
, mPickId(LLUUID::null)

View File

@ -44,7 +44,7 @@ class LLTextEditor;
* Panel for displaying Avatar's picks.
*/
class LLPanelProfilePicks
: public LLPanelProfilePropertiesPeocessorTab
: public LLPanelProfilePropertiesProcessorTab
{
public:
LLPanelProfilePicks();
@ -93,7 +93,7 @@ private:
class LLPanelProfilePick
: public LLPanelProfilePropertiesPeocessorTab
: public LLPanelProfilePropertiesProcessorTab
, public LLRemoteParcelInfoObserver
{
public:

View File

@ -74,12 +74,12 @@
<button
name="fl_save_changes"
label="Save"
top="389"
top_pad="5"
right="-108"
height="20"
width="80"
enabled="false"
follows="top|right"
follows="right|bottom"
layout="topleft"/>
<button
name="fl_discard_changes"
@ -89,6 +89,6 @@
height="20"
width="100"
enabled="false"
follows="top|right"
follows="right|bottom"
layout="topleft"/>
</panel>

View File

@ -381,26 +381,41 @@ Account: [ACCTTYPE]
follows="all"
layout="topleft"
width="200"
auto_resize="true"
auto_resize="false"
user_resize="false">
<!-- settings will be here -->
<check_box
name="show_in_search_checkbox"
label="Show in search"
<!-- only for self -->
<text
name="search_label"
value="Show my profile in search:"
top="1"
left="1"
right="-1"
height="16"
follows="left|top|right"
layout="topleft"/>
<combo_box
name="show_in_search"
tool_tip="Let people see you in search results"
left="1"
top="1"
height="16"
width="130"
top="18"
height="23"
width="140"
follows="left|top"
layout="topleft"
visible="true"
enabled="false"/>
enabled="false">
<combo_box.item
name="Hide"
label="Hide"
value="0" />
<combo_box.item
name="Show"
label="Show"
value="1" />
</combo_box>
</layout_panel>
</layout_stack>
</layout_panel>
</layout_stack>