summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-03-15 15:50:36 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-03-15 16:04:39 +0200
commitcf15fa72f719a50e008d4310c93ee17643db3313 (patch)
treeada44a52d1968786fd7942d94bcac4231aefe82d
parent259c5e3ffe101f75775a9e574e5436b434af58c1 (diff)
SL-16937 New Profile capability, cap updates #3
-rw-r--r--indra/newview/llpanelprofile.cpp151
-rw-r--r--indra/newview/llpanelprofile.h13
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_profile.xml4
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_firstlife.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_notes.xml19
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_secondlife.xml2
6 files changed, 87 insertions, 104 deletions
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index e3dd27f102..d6f88047d1 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -84,6 +84,7 @@ static const std::string PANEL_PICKS = "panel_profile_picks";
static const std::string PANEL_CLASSIFIEDS = "panel_profile_classifieds";
static const std::string PANEL_FIRSTLIFE = "panel_profile_firstlife";
static const std::string PANEL_NOTES = "panel_profile_notes";
+static const std::string PANEL_PROFILE_VIEW = "panel_profile_view";
static const std::string PROFILE_PROPERTIES_CAP = "AgentProfile";
@@ -123,32 +124,59 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
return;
}
+ LLPanel *panel = floater_profile->findChild<LLPanel>(PANEL_PROFILE_VIEW, TRUE);
+ LLPanelProfile *panel_profile = dynamic_cast<LLPanelProfile*>(panel);
+ if (!panel_profile)
+ {
+ LL_WARNS() << PANEL_PROFILE_VIEW << " not found" << LL_ENDL;
+ return;
+ }
+
// Avatar Data
- LLAvatarData avatar_data;
+ LLAvatarData *avatar_data = &panel_profile->mAvatarData;
std::string birth_date;
- avatar_data.agent_id = agent_id;
- avatar_data.avatar_id = agent_id;
- avatar_data.image_id = result["sl_image_id"].asUUID();
- 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();
- 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());
+ avatar_data->agent_id = agent_id;
+ avatar_data->avatar_id = agent_id;
+ avatar_data->image_id = result["sl_image_id"].asUUID();
+ avatar_data->fl_image_id = result["fl_image_id"].asUUID();
+ avatar_data->partner_id = result["partner_id"].asUUID();
+ // Todo: new descriptio size is 65536, check if it actually fits or has scroll
+ 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());
- avatar_data.flags = 0;
- avatar_data.caption_index = 0;
+ avatar_data->flags = 0;
- LLPanel *panel = floater_profile->findChild<LLPanel>(PANEL_SECONDLIFE, TRUE);
+ if (result["online"].asBoolean())
+ {
+ avatar_data->flags |= AVATAR_ONLINE;
+ }
+ if (result["allow_publish"].asBoolean())
+ {
+ avatar_data->flags |= AVATAR_ALLOW_PUBLISH;
+ }
+
+ if (result["charter_member"].asBoolean())
+ {
+ const S32 TYPE_CHARTER_MEMBER = 2;
+ avatar_data->caption_index = TYPE_CHARTER_MEMBER;
+ }
+ else
+ {
+ const S32 TYPE_RESIDENT = 0; // See ACCT_TYPE
+ avatar_data->caption_index = TYPE_RESIDENT;
+ }
+
+ panel = floater_profile->findChild<LLPanel>(PANEL_SECONDLIFE, TRUE);
LLPanelProfileSecondLife *panel_sl = dynamic_cast<LLPanelProfileSecondLife*>(panel);
if (panel_sl)
{
- panel_sl->fillCommonData(&avatar_data);
- panel_sl->fillPartnerData(&avatar_data);
- panel_sl->updateButtons();
+ panel_sl->processProfileProperties(avatar_data);
}
panel = floater_profile->findChild<LLPanel>(PANEL_WEB, TRUE);
@@ -162,9 +190,9 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
LLPanelProfileFirstLife *panel_first = dynamic_cast<LLPanelProfileFirstLife*>(panel);
if (panel_first)
{
- panel_first->mCurrentDescription = avatar_data.fl_about_text;
+ panel_first->mCurrentDescription = avatar_data->fl_about_text;
panel_first->mDescriptionEdit->setValue(panel_first->mCurrentDescription);
- panel_first->mPicture->setValue(avatar_data.fl_image_id);
+ panel_first->mPicture->setValue(avatar_data->fl_image_id);
panel_first->updateButtons();
}
@@ -550,19 +578,19 @@ void LLPanelProfileSecondLife::apply(LLAvatarData* data)
{
params["sl_about_text"] = mDescriptionEdit->getValue().asString();
}
+ if ((bool)data->allow_publish != mShowInSearchCheckbox->getValue().asBoolean())
+ {
+ params["allow_publish"] = mShowInSearchCheckbox->getValue().asBoolean();
+ }
if (!params.emptyMap())
{
LLCoros::instance().launch("putAgentUserInfoCoro",
boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), params));
}
}
-
- if ((bool)data->allow_publish != mShowInSearchCheckbox->getValue().asBoolean())
+ else
{
- data->image_id = mSecondLifePic->getImageAssetID();
- data->about_text = mDescriptionEdit->getValue().asString();
- data->allow_publish = mShowInSearchCheckbox->getValue();
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(data);
+ LL_WARNS() << "Failed to update profile data, no cap found" << LL_ENDL;
}
}
}
@@ -579,9 +607,10 @@ void LLPanelProfileSecondLife::updateData()
{
LLCoros::instance().launch("requestAgentUserInfoCoro",
boost::bind(request_avatar_properties_coro, cap_url, avatar_id));
-
- // needed for online status for other avatars and 'payment' for self
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(avatar_id);
+ }
+ else
+ {
+ LL_WARNS() << "Failed to update profile data, no cap found" << LL_ENDL;
}
}
}
@@ -633,9 +662,9 @@ void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avat
processOnlineStatus(avatar_data->flags & AVATAR_ONLINE);
}
- //fillCommonData(avatar_data);
+ fillCommonData(avatar_data);
- //fillPartnerData(avatar_data);
+ fillPartnerData(avatar_data);
fillAccountStatus(avatar_data);
@@ -1503,7 +1532,6 @@ BOOL LLPanelProfileNotes::postBuild()
mMapRights = getChild<LLCheckBoxCtrl>("map_check");
mEditObjectRights = getChild<LLCheckBoxCtrl>("objects_check");
mNotesEditor = getChild<LLTextEditor>("notes_edit");
- mCharacterLimitWarning = getChild<LLTextBox>("character_limit_warning");
mEditObjectRights->setCommitCallback(boost::bind(&LLPanelProfileNotes::onCommitRights, this));
@@ -1552,11 +1580,18 @@ void LLPanelProfileNotes::fillRightsData()
void LLPanelProfileNotes::onCommitNotes()
{
std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP);
- if (getIsLoaded() && !cap_url.empty())
+ if (getIsLoaded())
{
- std::string notes = mNotesEditor->getValue().asString();
- LLCoros::instance().launch("putAgentUserInfoCoro",
- boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), LLSD().with("notes", notes)));
+ if (!cap_url.empty())
+ {
+ std::string notes = mNotesEditor->getValue().asString();
+ LLCoros::instance().launch("putAgentUserInfoCoro",
+ boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), LLSD().with("notes", notes)));
+ }
+ else
+ {
+ LL_WARNS() << "Failed to update notes, no cap found" << LL_ENDL;
+ }
}
}
@@ -1630,27 +1665,6 @@ void LLPanelProfileNotes::applyRights()
LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(getAvatarId(), rights);
}
-void LLPanelProfileNotes::updateWarning()
-{
- mCharacterLimitWarning->setText(std::string());
-
- std::string str = getString("header_symbol_limit");
- mCharacterLimitWarning->appendText(str, false, LLStyle::Params().color(LLColor4::yellow));
- mCharacterLimitWarning->appendText(" ", false, LLStyle::Params());
-
- LLStringUtil::format_map_t args;
- if (!mURLWebProfile.empty())
- {
- args["[PROFILE_URL]"] = mURLWebProfile;
- }
- else
- {
- args["[PROFILE_URL]"] = getProfileURL(getAvatarId().asString());
- }
- str = getString("body_symbol_limit", args);
- mCharacterLimitWarning->appendText(str, false, LLStyle::Params());
-}
-
void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType type)
{
if (APT_NOTES == type)
@@ -1669,16 +1683,6 @@ void LLPanelProfileNotes::processProperties(LLAvatarNotes* avatar_notes)
mNotesEditor->setValue(avatar_notes->notes);
mNotesEditor->setEnabled(TRUE);
updateButtons();
-
- /*if (avatar_notes->notes.size() > 1000)
- {
- mCharacterLimitWarning->setVisible(TRUE);
- updateWarning();
- }
- else
- {*/
- mCharacterLimitWarning->setVisible(FALSE);
- //}
}
void LLPanelProfileNotes::resetData()
@@ -1688,7 +1692,6 @@ void LLPanelProfileNotes::resetData()
mOnlineStatus->setValue(FALSE);
mMapRights->setValue(FALSE);
mEditObjectRights->setValue(FALSE);
- mCharacterLimitWarning->setVisible(FALSE);
mURLWebProfile.clear();
}
@@ -1735,11 +1738,6 @@ void LLPanelProfileNotes::onAvatarNameCache(const LLUUID& agent_id, const LLAvat
}
mURLWebProfile = getProfileURL(username, false);
-
- if (mCharacterLimitWarning->getVisible())
- {
- updateWarning();
- }
}
@@ -1847,9 +1845,6 @@ void LLPanelProfile::updateData()
{
LLCoros::instance().launch("requestAgentUserInfoCoro",
boost::bind(request_avatar_properties_coro, cap_url, avatar_id));
-
- // needed for online status for other avatars and 'payment' for self
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(avatar_id);
}
}
}
@@ -1860,11 +1855,9 @@ void LLPanelProfile::apply()
{
//KC - AvatarData is spread over 3 different panels
// collect data from the last 2 and give to the first to save
- LLAvatarData data = LLAvatarData();
- data.avatar_id = gAgentID;
- mPanelFirstlife->apply(&data);
- mPanelWeb->apply(&data);
- mPanelSecondlife->apply(&data);
+ mPanelFirstlife->apply(&mAvatarData);
+ mPanelWeb->apply(&mAvatarData);
+ mPanelSecondlife->apply(&mAvatarData);
mPanelInterests->apply();
mPanelPicks->apply();
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 8dfee98bad..beec2f91c8 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -384,13 +384,11 @@ protected:
void enableCheckboxes(bool enable);
void applyRights();
- void updateWarning();
LLCheckBoxCtrl* mOnlineStatus;
LLCheckBoxCtrl* mMapRights;
LLCheckBoxCtrl* mEditObjectRights;
LLTextEditor* mNotesEditor;
- LLTextBox* mCharacterLimitWarning;
std::string mURLWebProfile;
@@ -429,6 +427,10 @@ public:
void showClassified(const LLUUID& classified_id = LLUUID::null, bool edit = false);
+ LLAvatarData getAvatarData() { return mAvatarData; };
+
+ friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id);
+
private:
void onTabChange();
@@ -440,6 +442,13 @@ private:
LLPanelProfileFirstLife* mPanelFirstlife;
LLPanelProfileNotes* mPanelNotes;
LLTabContainer* mTabContainer;
+
+ // Todo: due to server taking minutes to update this needs a more long term storage
+ // to reuse recently saved values if user opens floater again
+ // Storage implementation depends onto how a cap will be implemented, if cap will be
+ // enought to fully update LLAvatarPropertiesProcessor, then this storage can be
+ // implemented there.
+ LLAvatarData mAvatarData;
};
#endif //LL_LLPANELPROFILE_H
diff --git a/indra/newview/skins/default/xui/en/panel_edit_profile.xml b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
index 2c7c8133d1..3680759536 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
@@ -245,7 +245,7 @@
layout="topleft"
left="123"
top="90"
- max_length="512"
+ max_length="65000"
name="sl_description_edit"
width="157"
word_wrap="true">
@@ -300,7 +300,7 @@
height="102"
layout="topleft"
left="123"
- max_length="512"
+ max_length="65000"
top="223"
name="fl_description_edit"
width="157"
diff --git a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
index 7bda6d1718..108eb9443d 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
@@ -44,7 +44,7 @@
layout="topleft"
bg_readonly_color="Transparent"
border_visible="true"
- max_length="253"
+ max_length="65000"
parse_urls="true"
word_wrap="true"
/>
diff --git a/indra/newview/skins/default/xui/en/panel_profile_notes.xml b/indra/newview/skins/default/xui/en/panel_profile_notes.xml
index a83635f954..c7dfaa1e67 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_notes.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_notes.xml
@@ -9,14 +9,6 @@
follows="all"
layout="topleft"
>
- <!--these strings will be combined into one with different styles-->
- <string name="header_symbol_limit">
-Warning: Your notes contain more than 1000 characters.
- </string>
- <string name="body_symbol_limit">
-Only first 1000 characters are shown here. If you edit your notes and click OK, the extra characters will be lost. To preserve the extra characters, you must edit it [[PROFILE_URL] on the web]
- </string>
-
<loading_indicator
name="progress_indicator"
top="3"
@@ -51,17 +43,6 @@ Only first 1000 characters are shown here. If you edit your notes and click OK,
word_wrap="true"
/>
<text
- layout="topleft"
- follows="left|bottom|right"
- top_pad="2"
- left="6"
- right="-6"
- height ="28"
- name="character_limit_warning"
- word_wrap="true">
- Placeholder: Your notes contain more than 1000 characters. Only first 1000 characters are shown here. If you edit your notes and click OK, the extra characters will be lost. To preserve the extra characters, you must edit it [https://my.secondlife.com/settings/profile on the web]
- </text>
- <text
name="status_message2"
value="Allow this avatar to:"
top_pad="11"
diff --git a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
index 1b038196ef..816b0b8f5c 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
@@ -375,7 +375,7 @@
border_visible="true"
font="SansSerifSmall"
h_pad="2"
- max_length="510"
+ max_length="65000"
parse_urls="true"
word_wrap="true"
/>