diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 65 | ||||
-rw-r--r-- | indra/newview/llpanelprofile.h | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_profile_secondlife.xml | 240 |
3 files changed, 211 insertions, 106 deletions
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<LLGroupList>("group_list"); mShowInSearchCheckbox = getChild<LLCheckBoxCtrl>("show_in_search_checkbox"); mSecondLifePic = getChild<LLTextureCtrl>("2nd_life_pic"); + mSecondLifePicLayout = getChild<LLPanel>("image_stack"); mDescriptionEdit = getChild<LLTextBase>("sl_description_edit"); mTeleportButton = getChild<LLButton>("teleport"); mShowOnMapButton = getChild<LLButton>("show_on_map_btn"); @@ -397,7 +398,12 @@ void LLPanelProfileSecondLife::resetData() getChild<LLUICtrl>("register_date")->setValue(LLStringUtil::null); getChild<LLUICtrl>("acc_status_text")->setValue(LLStringUtil::null); getChild<LLUICtrl>("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<LLPanel>(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<LLPanel>* handle = (LLHandle<LLPanel>*)userdata; + + if (!handle->isDead()) + { + LLPanelProfileSecondLife* panel = static_cast<LLPanelProfileSecondLife*>(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" /> - <texture_picker - name="2nd_life_pic" - enabled="false" + <layout_stack + name="imagepositioner" top_pad="6" left_delta="0" - height="180" - width="180" - follows="top|left" - layout="topleft" - allow_no_texture="true" - default_image_name="None" - fallback_image="Generic_Person_Large" - /> - <text - name="status" - value="Status Unknown" - top_delta="1" - left_pad="4" - right="-6" - height="16" - follows="top|left" - layout="topleft" - halign="center" - text_color="LtGray_50" - /> - <text - name="label" - value="Second Life Birthdate:" - top_pad="2" - right="-6" - height="16" - follows="top|left" - layout="topleft" - /> - <text_editor - name="register_date" - value="(loading...)" - top_pad="0" - left_delta="2" - right="-6" - height="16" - follows="top|left|right" - layout="topleft" - allow_scroll="false" - bg_visible="false" - border_visible="true" - h_pad="2" - max_length="254" - read_only="true" - translate="false" - v_pad="2" - word_wrap="true" - /> - <text - name="label2" - value="Account:" - top_pad="5" - left_delta="-2" - right="-6" - height="16" - follows="top|left" - layout="topleft" - /> - <text_editor - name="acc_status_text" - top_pad="0" - left_delta="2" - right="-6" - height="44" - follows="top|left|right" - layout="topleft" - allow_scroll="false" - bg_visible="false" - border_visible="true" - h_pad="2" - read_only="true" - translate="false" - v_pad="2" - word_wrap="true" - /> - <text - name="partner_label" - value="Partner:" - top_pad="5" - left_delta="-2" - right="-6" - height="16" - follows="top|left" - layout="topleft" - /> - <text_editor - name="partner_text" - top_pad="0" - left_delta="0" - right="-6" - height="20" + right="-1" + height="158" follows="top|left|right" layout="topleft" - allow_scroll="false" - bg_visible="false" - border_visible="true" - parse_urls="true" - h_pad="0" - read_only="true" - translate="false" - v_pad="2" - max_length="254" - /> + orientation="horizontal" + > + <layout_panel + name="image_stack" + follows="all" + layout="topleft" + width="158" + height="158" + auto_resize="false" + user_resize="false" + > + <!-- 23 pixels (BTN_HEIGHT_SMALL) are reserved by label field of texture and shouldn't be visible--> + <texture_picker + name="2nd_life_pic" + enabled="false" + top="0" + left="0" + right="-1" + height="180" + follows="all" + layout="topleft" + allow_no_texture="true" + default_image_name="None" + fallback_image="Generic_Person_Large" + /> + </layout_panel> + <layout_panel + name="label_stack" + follows="all" + layout="topleft" + auto_resize="true" + user_resize="false" + > + <text + name="status" + value="Status Unknown" + top="1" + left="4" + right="-6" + height="16" + follows="top|left" + layout="topleft" + halign="center" + text_color="LtGray_50" + /> + <text + name="label" + value="Second Life Birthdate:" + top_pad="2" + right="-6" + height="16" + follows="top|left" + layout="topleft" + /> + <text_editor + name="register_date" + value="(loading...)" + top_pad="0" + left_delta="2" + right="-6" + height="16" + follows="top|left|right" + layout="topleft" + allow_scroll="false" + bg_visible="false" + border_visible="true" + h_pad="2" + max_length="254" + read_only="true" + translate="false" + v_pad="2" + word_wrap="true" + /> + <text + name="label2" + value="Account:" + top_pad="5" + left_delta="-2" + right="-6" + height="16" + follows="top|left" + layout="topleft" + /> + <text_editor + name="acc_status_text" + top_pad="0" + left_delta="2" + right="-6" + height="44" + follows="top|left|right" + layout="topleft" + allow_scroll="false" + bg_visible="false" + border_visible="true" + h_pad="2" + read_only="true" + translate="false" + v_pad="2" + word_wrap="true" + /> + <text + name="partner_label" + value="Partner:" + top_pad="5" + left_delta="-2" + right="-6" + height="16" + follows="top|left" + layout="topleft" + /> + <text_editor + name="partner_text" + top_pad="0" + left_delta="0" + right="-6" + height="20" + follows="top|left|right" + layout="topleft" + allow_scroll="false" + bg_visible="false" + border_visible="true" + parse_urls="true" + h_pad="0" + read_only="true" + translate="false" + v_pad="2" + max_length="254" + /> + </layout_panel> + </layout_stack> <text name="Groups:" value="Groups:" - top_pad="8" + top_pad="7" left="6" height="16" width="55" |