From cf15fa72f719a50e008d4310c93ee17643db3313 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 15 Mar 2022 15:50:36 +0200 Subject: SL-16937 New Profile capability, cap updates #3 --- indra/newview/llpanelprofile.cpp | 151 ++++++++++----------- indra/newview/llpanelprofile.h | 13 +- .../skins/default/xui/en/panel_edit_profile.xml | 4 +- .../default/xui/en/panel_profile_firstlife.xml | 2 +- .../skins/default/xui/en/panel_profile_notes.xml | 19 --- .../default/xui/en/panel_profile_secondlife.xml | 2 +- 6 files changed, 87 insertions(+), 104 deletions(-) (limited to 'indra') 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(PANEL_PROFILE_VIEW, TRUE); + LLPanelProfile *panel_profile = dynamic_cast(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(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(PANEL_SECONDLIFE, TRUE); LLPanelProfileSecondLife *panel_sl = dynamic_cast(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(PANEL_WEB, TRUE); @@ -162,9 +190,9 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) LLPanelProfileFirstLife *panel_first = dynamic_cast(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("map_check"); mEditObjectRights = getChild("objects_check"); mNotesEditor = getChild("notes_edit"); - mCharacterLimitWarning = getChild("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" > - - -Warning: 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 [[PROFILE_URL] on the web] - - - - 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] - -- cgit v1.2.3