SL-15312 Legacy profiles remake #8

Progress indicators, loading states and 'embedded' cleanup
master
Andrey Kleshchev 2022-04-16 01:01:01 +03:00
parent 3678678506
commit c9b83e8117
11 changed files with 133 additions and 102 deletions

View File

@ -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)
{

View File

@ -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;
};

View File

@ -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();

View File

@ -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();

View File

@ -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)

View File

@ -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(

View File

@ -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()

View File

@ -61,7 +61,7 @@ public:
/*virtual*/ void resetData();
/*virtual*/ void updateButtons();
void updateButtons();
/**
* Saves changes.

View File

@ -127,6 +127,17 @@
parameter="toggle_block_agent"/>
</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"

View File

@ -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"

View File

@ -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"