diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-04-16 01:01:01 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-04-16 01:01:01 +0300 |
commit | c9b83e8117026aa7fc70da3972049152a669b0fc (patch) | |
tree | ced3d08d70d22b03022e884121056faa13b2a524 /indra | |
parent | 3678678506d9d026ebdb88d3775920e6b0b32f8a (diff) |
SL-15312 Legacy profiles remake #8
Progress indicators, loading states and 'embedded' cleanup
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.h | 26 | ||||
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 106 | ||||
-rw-r--r-- | indra/newview/llpanelprofile.h | 5 | ||||
-rw-r--r-- | indra/newview/llpanelprofileclassifieds.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llpanelprofileclassifieds.h | 4 | ||||
-rw-r--r-- | indra/newview/llpanelprofilepicks.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llpanelprofilepicks.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_profile_other.xml | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_profile_firstlife.xml | 21 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_profile_secondlife.xml | 25 |
11 files changed, 133 insertions, 102 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index e25eba11d2..fada9cc98b 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -69,9 +69,7 @@ static LLDefaultChildRegistry::Register<LLProfileDropTarget> r("profile_drop_tar LLPanelProfileTab::LLPanelProfileTab() : LLPanel() , mAvatarId(LLUUID::null) -, mLoading(false) -, mLoaded(false) -, mEmbedded(false) +, mLoadingState(PROFILE_INIT) , mSelfProfile(false) { } @@ -107,11 +105,11 @@ void LLPanelProfileTab::onOpen(const LLSD& key) setApplyProgress(true); } -void LLPanelProfileTab::updateButtons() +void LLPanelProfileTab::setLoaded() { setApplyProgress(false); - mLoaded = true; + mLoadingState = PROFILE_LOADED; } void LLPanelProfileTab::setApplyProgress(bool started) @@ -120,7 +118,7 @@ void LLPanelProfileTab::setApplyProgress(bool started) if (indicator) { - indicator->setVisible(true); + indicator->setVisible(started); if (started) { diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index f73ea0643d..fb9ff26ca6 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -117,36 +117,38 @@ public: /*virtual*/ ~LLPanelProfileTab(); - void setEmbedded(bool embedded) { mEmbedded = embedded; } - protected: LLPanelProfileTab(); + enum ELoadingState + { + PROFILE_INIT, + PROFILE_LOADING, + PROFILE_LOADED, + }; + // mLoading: false: Initial state, can request // true: Data requested, skip duplicate requests (happens due to LLUI's habit of repeated callbacks) // mLoaded: false: Initial state, show loading indicator // true: Data recieved, which comes in a single message, hide indicator - bool getIsLoading() { return mLoading; } - void setIsLoading() { mLoading = true; } - bool getIsLoaded() { return mLoaded; } - void resetLoading() { mLoading = false; mLoaded = false; } + ELoadingState getLoadingState() { return mLoadingState; } + void setIsLoading() { mLoadingState = PROFILE_LOADING; } + virtual void setLoaded(); + void resetLoading() { mLoadingState = PROFILE_INIT; } - const bool getEmbedded() const { return mEmbedded; } + bool getStarted() { return mLoadingState != PROFILE_INIT; } + bool getIsLoaded() { return mLoadingState == PROFILE_LOADED; } const bool getSelfProfile() const { return mSelfProfile; } void setApplyProgress(bool started); - virtual void updateButtons(); - private: LLUUID mAvatarId; - bool mLoading; - bool mLoaded; - bool mEmbedded; + ELoadingState mLoadingState; bool mSelfProfile; }; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 3e7dd57965..175fb4dbdc 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -188,7 +188,7 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) LLPanelProfileWeb *panel_web = dynamic_cast<LLPanelProfileWeb*>(panel); if (panel_web) { - panel_web->updateButtons(); + panel_web->setLoaded(); } panel = floater_profile->findChild<LLPanel>(PANEL_FIRSTLIFE, TRUE); @@ -850,7 +850,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) childSetVisible("settings_panel", own_profile); childSetVisible("about_buttons_panel", own_profile); - if (own_profile && !getEmbedded()) + if (own_profile) { // Group list control cannot toggle ForAgent loading // Less than ideal, but viewing own profile via search is edge case @@ -875,7 +875,7 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) mAgentActionMenuButton->setMenu("menu_profile_other.xml", LLMenuButton::MP_BOTTOM_RIGHT); } - mDescriptionEdit->setParseHTML(!own_profile && !getEmbedded()); + mDescriptionEdit->setParseHTML(!own_profile); if (!own_profile) { @@ -884,15 +884,13 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) fillRightsData(); } - updateButtons(); - mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCache, this, _1, _2)); } void LLPanelProfileSecondLife::updateData() { LLUUID avatar_id = getAvatarId(); - if (!getIsLoading() && avatar_id.notNull() && !(getSelfProfile() && !getEmbedded())) + if (!getStarted() && avatar_id.notNull()) { setIsLoading(); @@ -961,20 +959,11 @@ void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avat fillAccountStatus(avatar_data); - updateButtons(); + setLoaded(); } void LLPanelProfileSecondLife::processGroupProperties(const LLAvatarGroups* avatar_groups) { - //KC: the group_list ctrl can handle all this for us on our own profile - if (getSelfProfile() && !getEmbedded()) - { - return; - } - - // *NOTE dzaporozhan - // Group properties may arrive in two callbacks, we need to save them across - // different calls. We can't do that in textbox as textbox may change the text. LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin(); const LLAvatarGroups::group_list_t::const_iterator it_end = avatar_groups->group_list.end(); @@ -1004,7 +993,16 @@ void LLPanelProfileSecondLife::onAvatarNameCache(const LLUUID& agent_id, const L void LLPanelProfileSecondLife::setProfileImageUploading(bool loading) { - // Todo: loading indicator here + LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("image_upload_indicator"); + indicator->setVisible(loading); + if (loading) + { + indicator->start(); + } + else + { + indicator->stop(); + } mWaitingForImageUpload = loading; } @@ -1028,8 +1026,7 @@ void LLPanelProfileSecondLife::setProfileImageUploaded(const LLUUID &image_asset FALSE); } - mWaitingForImageUpload = false; - // Todo: reset loading indicator here + setProfileImageUploading(false); } void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) @@ -1177,7 +1174,6 @@ void LLPanelProfileSecondLife::changed(U32 mask) { fillRightsData(); } - updateButtons(); } // virtual, called by LLVoiceClient @@ -1240,12 +1236,11 @@ void LLPanelProfileSecondLife::processOnlineStatus(bool online) { } -//todo: remove? -void LLPanelProfileSecondLife::updateButtons() +void LLPanelProfileSecondLife::setLoaded() { - LLPanelProfileTab::updateButtons(); + LLPanelProfileTab::setLoaded(); - if (getSelfProfile() && !getEmbedded()) + if (getSelfProfile()) { mShowInSearchCheckbox->setVisible(TRUE); mShowInSearchCheckbox->setEnabled(TRUE); @@ -1377,6 +1372,10 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) LLWString wstr = utf8str_to_wstring(getAvatarId().asString()); LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); } + else if (item_name == "agent_permissions") + { + onShowAgentPermissionsDialog(); + } else if (item_name == "copy_display_name" || item_name == "copy_username") { @@ -1467,6 +1466,10 @@ bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata) { return LLAvatarActions::canBlock(agent_id); } + else if (item_name == "agent_permissions") + { + return LLAvatarActions::isFriend(agent_id); + } else if (item_name == "copy_display_name" || item_name == "copy_username") { @@ -1626,7 +1629,7 @@ void LLPanelProfileWeb::processProperties(void* data, EAvatarProcessorType type) const LLAvatarData* avatar_data = static_cast<const LLAvatarData*>(data); if (avatar_data && getAvatarId() == avatar_data->avatar_id) { - updateButtons(); + setLoaded(); } } } @@ -1639,7 +1642,7 @@ void LLPanelProfileWeb::resetData() void LLPanelProfileWeb::updateData() { LLUUID avatar_id = getAvatarId(); - if (!getIsLoading() && avatar_id.notNull() && !mURLWebProfile.empty()) + if (!getStarted() && avatar_id.notNull() && !mURLWebProfile.empty()) { setIsLoading(); @@ -1732,16 +1735,6 @@ void LLPanelProfileWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e } } -void LLPanelProfileWeb::updateButtons() -{ - LLPanelProfileTab::updateButtons(); -} - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -1784,19 +1777,25 @@ void LLPanelProfileFirstLife::onOpen(const LLSD& key) void LLPanelProfileFirstLife::setProfileImageUploading(bool loading) { - mChangePhoto->setEnabled(loading); - mRemovePhoto->setEnabled(loading); + mChangePhoto->setEnabled(!loading); + mRemovePhoto->setEnabled(!loading); - // Todo: loading indicator here + LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("image_upload_indicator"); + indicator->setVisible(loading); + if (loading) + { + indicator->start(); + } + else + { + indicator->stop(); + } } void LLPanelProfileFirstLife::setProfileImageUploaded(const LLUUID &image_asset_id) { mPicture->setValue(image_asset_id); - mChangePhoto->setEnabled(TRUE); - mRemovePhoto->setEnabled(TRUE); - - // Todo: reset loading indicator here + setProfileImageUploading(false); } void LLPanelProfileFirstLife::onChangePhoto() @@ -1883,7 +1882,7 @@ void LLPanelProfileFirstLife::processProperties(const LLAvatarData* avatar_data) { mPicture->setValue("Generic_Person_Large"); } - updateButtons(); + setLoaded(); } void LLPanelProfileFirstLife::resetData() @@ -1897,11 +1896,11 @@ void LLPanelProfileFirstLife::resetData() mDiscardChanges->setVisible(getSelfProfile()); } -void LLPanelProfileFirstLife::updateButtons() +void LLPanelProfileFirstLife::setLoaded() { - LLPanelProfileTab::updateButtons(); + LLPanelProfileTab::setLoaded(); - if (getSelfProfile() && !getEmbedded()) + if (getSelfProfile()) { mDescriptionEdit->setEnabled(TRUE); mPicture->setEnabled(TRUE); @@ -1925,7 +1924,7 @@ LLPanelProfileNotes::~LLPanelProfileNotes() void LLPanelProfileNotes::updateData() { LLUUID avatar_id = getAvatarId(); - if (!getIsLoading() && avatar_id.notNull()) + if (!getStarted() && avatar_id.notNull()) { setIsLoading(); @@ -2030,7 +2029,7 @@ void LLPanelProfileNotes::processProperties(LLAvatarNotes* avatar_notes) { mNotesEditor->setValue(avatar_notes->notes); mNotesEditor->setEnabled(TRUE); - updateButtons(); + setLoaded(); } void LLPanelProfileNotes::resetData() @@ -2115,13 +2114,6 @@ void LLPanelProfile::onOpen(const LLSD& key) mPanelFirstlife->onOpen(avatar_id); mPanelNotes->onOpen(avatar_id); - mPanelSecondlife->setEmbedded(getEmbedded()); - mPanelWeb->setEmbedded(getEmbedded()); - mPanelPicks->setEmbedded(getEmbedded()); - mPanelClassifieds->setEmbedded(getEmbedded()); - mPanelFirstlife->setEmbedded(getEmbedded()); - mPanelNotes->setEmbedded(getEmbedded()); - // Always request the base profile info resetLoading(); updateData(); @@ -2138,7 +2130,7 @@ void LLPanelProfile::updateData() LLUUID avatar_id = getAvatarId(); // Todo: getIsloading functionality needs to be expanded to // include 'inited' or 'data_provided' state to not rerequest - if (!getIsLoading() && avatar_id.notNull()) + if (!getStarted() && avatar_id.notNull()) { setIsLoading(); diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 1d871415e8..630bfcfdbc 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -160,7 +160,7 @@ protected: void processOnlineStatus(bool online); private: - /*virtual*/ void updateButtons(); + /*virtual*/ void setLoaded(); void onCommitMenu(const LLSD& userdata); bool onEnableMenu(const LLSD& userdata); bool onCheckMenu(const LLSD& userdata); @@ -230,7 +230,6 @@ public: friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); protected: - /*virtual*/ void updateButtons(); void onCommitLoad(LLUICtrl* ctrl); private: @@ -269,7 +268,7 @@ public: friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); protected: - /*virtual*/ void updateButtons(); + /*virtual*/ void setLoaded(); void onChangePhoto(); void onRemovePhoto(); diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index 4bc104c421..268c99e91b 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -207,7 +207,7 @@ void LLPanelProfileClassifieds::onOpen(const LLSD& key) resetData(); - if (getSelfProfile() && !getEmbedded()) + if (getSelfProfile()) { mNewButton->setVisible(TRUE); mNewButton->setEnabled(FALSE); @@ -373,6 +373,7 @@ void LLPanelProfileClassifieds::processProperties(void* data, EAvatarProcessorTy mTabContainer->selectFirstTab(); } + setLoaded(); updateButtons(); } } @@ -386,9 +387,7 @@ void LLPanelProfileClassifieds::resetData() void LLPanelProfileClassifieds::updateButtons() { - LLPanelProfileTab::updateButtons(); - - if (getSelfProfile() && !getEmbedded()) + if (getSelfProfile()) { mNewButton->setEnabled(canAddNewClassified()); mDeleteButton->setEnabled(canDeleteClassified()); @@ -399,7 +398,7 @@ void LLPanelProfileClassifieds::updateData() { // Send picks request only once LLUUID avatar_id = getAvatarId(); - if (!getIsLoading() && avatar_id.notNull()) + if (!getStarted() && avatar_id.notNull()) { setIsLoading(); mNoItemsLabel->setValue(LLTrans::getString("PicksClassifiedsLoadingText")); @@ -732,6 +731,7 @@ void LLPanelProfileClassified::processProperties(void* data, EAvatarProcessorTyp // for just created classified - in case user opened edit panel before processProperties() callback mSaveButton->setLabelArg("[LABEL]", getString("save_label")); + setLoaded(); updateButtons(); if (mEditOnLoad) diff --git a/indra/newview/llpanelprofileclassifieds.h b/indra/newview/llpanelprofileclassifieds.h index 31ef1c65b3..a85781f4b5 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -84,7 +84,7 @@ public: /*virtual*/ void resetData(); - /*virtual*/ void updateButtons(); + void updateButtons(); /*virtual*/ void updateData(); @@ -213,7 +213,7 @@ protected: void resetControls(); - /*virtual*/ void updateButtons(); + void updateButtons(); void updateInfoRect(); static std::string createLocationText( diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index acf4ad5890..406ff2b8de 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -135,7 +135,7 @@ void LLPanelProfilePicks::onOpen(const LLSD& key) resetData(); - if (getSelfProfile() && !getEmbedded()) + if (getSelfProfile()) { mNewButton->setVisible(TRUE); mNewButton->setEnabled(FALSE); @@ -305,6 +305,7 @@ void LLPanelProfilePicks::processProperties(const LLAvatarPicks* avatar_picks) mTabContainer->selectFirstTab(); } + setLoaded(); updateButtons(); } @@ -316,9 +317,7 @@ void LLPanelProfilePicks::resetData() void LLPanelProfilePicks::updateButtons() { - LLPanelProfileTab::updateButtons(); - - if (getSelfProfile() && !getEmbedded()) + if (getSelfProfile()) { mNewButton->setEnabled(canAddNewPick()); mDeleteButton->setEnabled(canDeletePick()); @@ -344,7 +343,7 @@ void LLPanelProfilePicks::updateData() { // Send picks request only once LLUUID avatar_id = getAvatarId(); - if (!getIsLoading() && avatar_id.notNull()) + if (!getStarted() && avatar_id.notNull()) { setIsLoading(); mNoItemsLabel->setValue(LLTrans::getString("PicksClassifiedsLoadingText")); @@ -450,7 +449,7 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id) resetDirty(); - if (getSelfProfile() && !getEmbedded()) + if (getSelfProfile()) { mPickName->setEnabled(TRUE); mPickDescription->setEnabled(TRUE); @@ -518,7 +517,7 @@ void LLPanelProfilePick::processProperties(void* data, EAvatarProcessorType type mPickDescription->setParseHTML(true); mParcelId = pick_info->parcel_id; setSnapshotId(pick_info->snapshot_id); - if (!getSelfProfile() || getEmbedded()) + if (!getSelfProfile()) { mSnapshotCtrl->setEnabled(FALSE); } @@ -535,7 +534,7 @@ void LLPanelProfilePick::processProperties(void* data, EAvatarProcessorType type // edit the Pick and we have to update Pick info panel. // revomeObserver is called from onClickBack - updateButtons(); + setLoaded(); } void LLPanelProfilePick::apply() diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h index 061f947a28..aa58e46a9f 100644 --- a/indra/newview/llpanelprofilepicks.h +++ b/indra/newview/llpanelprofilepicks.h @@ -61,7 +61,7 @@ public: /*virtual*/ void resetData(); - /*virtual*/ void updateButtons(); + void updateButtons(); /** * Saves changes. diff --git a/indra/newview/skins/default/xui/en/menu_profile_other.xml b/indra/newview/skins/default/xui/en/menu_profile_other.xml index 7731ee65d1..fff1f7b614 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_other.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_other.xml @@ -128,6 +128,17 @@ </menu_item_check> <menu_item_separator name="separator_copy_options"/> <menu_item_call + label="Permissions" + layout="topleft" + name="agent_permissions"> + <menu_item_call.on_click + function="Profile.Commit" + parameter="agent_permissions"/> + <menu_item_call.on_visible + function="Profile.EnableItem" + parameter="agent_permissions"/> + </menu_item_call> + <menu_item_call label="Copy Display Name" layout="topleft" name="copy_display_name"> 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 e656fd7b07..a957a2b454 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml @@ -26,13 +26,22 @@ layout="topleft" top="10" left="8" - height="202" - width="202"/> + height="160" + width="160"/> + <loading_indicator + name="image_upload_indicator" + top="79" + left="77" + height="23" + width="23" + follows="top|left" + layout="topleft" + visible="false"/> <button name="fl_upload_image" label="Change Photo" - top="167" - left_pad="5" + top="127" + left="175" height="20" width="120" follows="top|left" @@ -50,7 +59,7 @@ name="fl_description_edit" trusted_content="false" enabled="false" - top="220" + top="180" left="6" right="-6" height="224" @@ -65,7 +74,7 @@ <button name="fl_save_changes" label="Save" - top="429" + top="389" right="-108" height="20" width="80" 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 cc59e12c4b..6c2460378e 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml @@ -71,6 +71,16 @@ Account: [ACCTTYPE] left="2" bottom="-1" right="-1"/> + + <loading_indicator + name="image_upload_indicator" + top="69" + left="69" + height="23" + width="23" + follows="top|left" + layout="topleft" + visible="false"/> </layout_panel> <layout_panel @@ -134,6 +144,16 @@ Account: [ACCTTYPE] follows="left|top|right" layout="topleft"/> + <loading_indicator + name="progress_indicator" + left="56" + bottom="-30" + height="23" + width="23" + follows="left|bottom" + layout="topleft" + visible="false"/> + <menu_button layout="topleft" follows="left|bottom" @@ -323,6 +343,7 @@ Account: [ACCTTYPE] follows="all" layout="topleft" width="200" + height="159" auto_resize="true" user_resize="false"> <!-- notes are only for other agents --> @@ -340,10 +361,10 @@ Account: [ACCTTYPE] trusted_content="false" always_show_icons="true" enabled="false" - top_pad="1" + top="18" left="1" right="-1" - bottom="-27" + bottom="-1" follows="all" layout="topleft" bg_readonly_color="Transparent" |