From 5143456f51d32b90a94b6c01aebb74c3503a3e27 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 25 Mar 2019 18:09:23 +0200 Subject: SL-10799 [Legacy Profiles] added 3x4 image dimentions support --- indra/newview/llpanelprofile.cpp | 65 ++++++ indra/newview/llpanelprofile.h | 12 +- .../default/xui/en/panel_profile_secondlife.xml | 240 ++++++++++++--------- 3 files changed, 211 insertions(+), 106 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 4933b0d25e..b03fcabd92 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -257,6 +257,7 @@ BOOL LLPanelProfileSecondLife::postBuild() mGroupList = getChild("group_list"); mShowInSearchCheckbox = getChild("show_in_search_checkbox"); mSecondLifePic = getChild("2nd_life_pic"); + mSecondLifePicLayout = getChild("image_stack"); mDescriptionEdit = getChild("sl_description_edit"); mTeleportButton = getChild("teleport"); mShowOnMapButton = getChild("show_on_map_btn"); @@ -397,7 +398,12 @@ void LLPanelProfileSecondLife::resetData() getChild("register_date")->setValue(LLStringUtil::null); getChild("acc_status_text")->setValue(LLStringUtil::null); getChild("partner_text")->setValue(LLStringUtil::null); + + // Set default image and 1:1 dimensions for it mSecondLifePic->setValue(mSecondLifePic->getDefaultImageAssetID()); + LLRect imageRect = mSecondLifePicLayout->getRect(); + mSecondLifePicLayout->reshape(imageRect.getHeight(), imageRect.getHeight()); + mDescriptionEdit->setValue(LLStringUtil::null); mStatusText->setVisible(FALSE); mGroups.clear(); @@ -480,6 +486,23 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) mDescriptionEdit->setValue(avatar_data->about_text); mSecondLifePic->setValue(avatar_data->image_id); + //Don't bother about boost level, picker will set it + LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(avatar_data->image_id); + if (imagep->getHeight()) + { + onImageLoaded(true, imagep); + } + else + { + imagep->setLoadedCallback(onImageLoaded, + MAX_DISCARD_LEVEL, + FALSE, + FALSE, + new LLHandle(getHandle()), + NULL, + FALSE); + } + if (getSelfProfile()) { mShowInSearchCheckbox->setValue((BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH)); @@ -555,6 +578,48 @@ void LLPanelProfileSecondLife::onGroupInvite() LLAvatarActions::inviteToGroup(getAvatarId()); } +void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) +{ + LLRect imageRect = mSecondLifePicLayout->getRect(); + if (!success || imagep->getWidth() == imagep->getHeight()) + { + mSecondLifePicLayout->reshape(imageRect.getHeight(), imageRect.getHeight()); + } + else + { + // assume 3:4, for sake of firestorm + mSecondLifePicLayout->reshape(imageRect.getHeight() * 4 / 3, imageRect.getHeight()); + } +} + +//static +void LLPanelProfileSecondLife::onImageLoaded(BOOL success, + LLViewerFetchedTexture *src_vi, + LLImageRaw* src, + LLImageRaw* aux_src, + S32 discard_level, + BOOL final, + void* userdata) +{ + if (!userdata) return; + + LLHandle* handle = (LLHandle*)userdata; + + if (!handle->isDead()) + { + LLPanelProfileSecondLife* panel = static_cast(handle->get()); + if (panel) + { + panel->onImageLoaded(success, src_vi); + } + } + + if (final || !success) + { + delete handle; + } +} + // virtual, called by LLAvatarTracker void LLPanelProfileSecondLife::changed(U32 mask) { diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 34d9045b2f..f346dcf937 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -58,7 +58,7 @@ class LLLineEditor; class LLTextEditor; class LLPanelProfileClassifieds; class LLPanelProfilePicks; - +class LLViewerFetchedTexture; /** * Panel for displaying Avatar's second life related info. @@ -148,6 +148,15 @@ protected: void onGroupInvite(); + void onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep); + static void onImageLoaded(BOOL success, + LLViewerFetchedTexture *src_vi, + LLImageRaw* src, + LLImageRaw* aux_src, + S32 discard_level, + BOOL final, + void* userdata); + bool isGrantedToSeeOnlineStatus(); /** @@ -179,6 +188,7 @@ private: LLGroupList* mGroupList; LLCheckBoxCtrl* mShowInSearchCheckbox; LLTextureCtrl* mSecondLifePic; + LLPanel* mSecondLifePicLayout; LLTextBase* mDescriptionEdit; LLButton* mTeleportButton; LLButton* mShowOnMapButton; 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 1232439b1e..8ebb1522b4 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml @@ -129,118 +129,148 @@ v_pad="2" max_length="254" /> - - - - - - - - + orientation="horizontal" + > + + + + + + + + + + + + + +