From d4a799a1a8ce11a808c97d73c03f16d3b3e41597 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <andreykproductengine@lindenlab.com> Date: Fri, 27 May 2022 17:55:04 +0300 Subject: [PATCH] SL-15312 Online status --- indra/newview/llpanelprofile.cpp | 55 +++++---- indra/newview/llpanelprofile.h | 4 +- .../textures/icons/Profile_Friend_Offline.png | Bin 0 -> 208 bytes .../textures/icons/Profile_Friend_Online.png | Bin 0 -> 189 bytes .../skins/default/textures/textures.xml | 2 + .../xui/en/panel_profile_secondlife.xml | 108 ++++++++++++++++-- 6 files changed, 128 insertions(+), 41 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png create mode 100644 indra/newview/skins/default/textures/icons/Profile_Friend_Online.png diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 38308f24981..8a07315035c 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -946,12 +946,13 @@ void LLPanelProfileSecondLife::resetData() void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avatar_data) { LLUUID avatar_id = getAvatarId(); - if (!LLAvatarActions::isFriend(avatar_id) && !getSelfProfile()) + const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + if (relationship != NULL && !getSelfProfile()) { // subscribe observer to get online status. Request will be sent by LLPanelProfileSecondLife itself. // do not subscribe for friend avatar because online status can be wrong overridden // via LLAvatarData::flags if Preferences: "Only Friends & Groups can see when I am online" is set. - processOnlineStatus(avatar_data->flags & AVATAR_ONLINE); + processOnlineStatus(relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS), avatar_data->flags & AVATAR_ONLINE); } fillCommonData(avatar_data); @@ -1141,6 +1142,10 @@ void LLPanelProfileSecondLife::fillRightsData() } childSetVisible("permissions_panel", NULL != relation); + childSetVisible("spacer_layout", NULL == relation); + childSetVisible("frind_layout", NULL != relation); + childSetVisible("online_layout", false); + childSetVisible("offline_layout", false); } void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) @@ -1188,10 +1193,7 @@ void LLPanelProfileSecondLife::onImageLoaded(BOOL success, // virtual, called by LLAvatarTracker void LLPanelProfileSecondLife::changed(U32 mask) { - if (mask & LLFriendObserver::ONLINE) - { - updateOnlineStatus(); - } + updateOnlineStatus(); if (mask != LLFriendObserver::ONLINE) { fillRightsData(); @@ -1227,35 +1229,32 @@ void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id) } } -bool LLPanelProfileSecondLife::isGrantedToSeeOnlineStatus() -{ - // set text box visible to show online status for non-friends who has not set in Preferences - // "Only Friends & Groups can see when I am online" - if (!LLAvatarActions::isFriend(getAvatarId())) - { - return true; - } - - // *NOTE: GRANT_ONLINE_STATUS is always set to false while changing any other status. - // When avatar disallow me to see her online status processOfflineNotification Message is received by the viewer - // see comments for ChangeUserRights template message. EXT-453. - // If GRANT_ONLINE_STATUS flag is changed it will be applied when viewer restarts. EXT-3880 - const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - return relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS); -} - // method was disabled according to EXT-2022. Re-enabled & improved according to EXT-3880 void LLPanelProfileSecondLife::updateOnlineStatus() { - if (!LLAvatarActions::isFriend(getAvatarId())) return; - // For friend let check if he allowed me to see his status const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - bool online = relationship->isOnline(); - processOnlineStatus(online); + if (relationship != NULL) + { + // For friend let check if he allowed me to see his status + bool online = relationship->isOnline(); + bool perm_granted = relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS); + processOnlineStatus(perm_granted, online); + } + else + { + childSetVisible("spacer_layout", true); + childSetVisible("frind_layout", false); + childSetVisible("online_layout", false); + childSetVisible("offline_layout", false); + } } -void LLPanelProfileSecondLife::processOnlineStatus(bool online) +void LLPanelProfileSecondLife::processOnlineStatus(bool show_online, bool online) { + childSetVisible("spacer_layout", false); + childSetVisible("frind_layout", true); + childSetVisible("online_layout", online && show_online); + childSetVisible("offline_layout", !online && show_online); } void LLPanelProfileSecondLife::setLoaded() diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index b53a892ba60..cf3b6c0eb1d 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -147,8 +147,6 @@ class LLPanelProfileSecondLife BOOL final, void* userdata); - bool isGrantedToSeeOnlineStatus(); - /** * Displays avatar's online status if possible. * @@ -162,7 +160,7 @@ class LLPanelProfileSecondLife * - Else: Offline */ void updateOnlineStatus(); - void processOnlineStatus(bool online); + void processOnlineStatus(bool show_online, bool online); private: /*virtual*/ void setLoaded(); diff --git a/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png b/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png new file mode 100644 index 0000000000000000000000000000000000000000..aeba6b70f785ed9b7f01bb8662710c5f31ebf48f GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4NtU=qlmzFem6RtIr7}3C<R_&n zc;+Uirv{}arc@T5Otk?jD)Mx345_%4WK;Z%huN@!vvV!ik?h7F$|CDqyBZm}r-ZRT z5_ZsOSYpW0F}L9cQ%C+GpB(347G|aZ%N<wsD&{<Id*`;uW;1*Ltk@G=s~dkXi@C}# zC@N?*U$8Hl{mA@<6|y03*or<h9Pm}(JC<ti(7?!W{DP?2CyQqVK-(ESUHx3vIVCg! E01)~}GXMYp literal 0 HcmV?d00001 diff --git a/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png b/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png new file mode 100644 index 0000000000000000000000000000000000000000..d668fd8dfa0460456e5b17b80fd63aac95d1c841 GIT binary patch literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4NtU=qlmzFem6RtIr7}3C<R_&n zc;+Uirv{}arc@T5Otk?jiuZJJ45_%4l=9=egGho?(rTuUQ40S!j%F`R3iu%3bG7k@ zt-#{L-vcan9NHQoa_~V^N~`=wjXyj=hmRa^n3ewRLEvWYo5oTVHj5kIxXn24$oHS+ lX!b)pwj{SCW*LP8416}>50e7tCj+fw@O1TaS?83{1OUxUMMVGr literal 0 HcmV?d00001 diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 02d48bb0d66..a21099ca9be 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -510,6 +510,8 @@ with the same filename but different name <texture name="Profile_Group_Visibility_Off_Pressed" file_name="icons/profile_group_visibility_eye_off_pressed.png" preload="true"/> <texture name="Profile_Group_Visibility_On" file_name="icons/profile_group_visibility_eye_on.png" preload="true"/> <texture name="Profile_Group_Visibility_On_Pressed" file_name="icons/profile_group_visibility_eye_on_pressed.png" preload="true"/> + <texture name="Profile_Friend_Offline" file_name="icons/Profile_Friend_Offline.png" preload="true"/> + <texture name="Profile_Friend_Online" file_name="icons/Profile_Friend_Online.png" preload="true"/> <texture name="Profile_Perm_Find_Disabled" file_name="icons/Profile_Perm_Find_Disabled.png" preload="true"/> <texture name="Profile_Perm_Find_Enabled" file_name="icons/Profile_Perm_Find_Enabled.png" preload="true"/> <texture name="Profile_Perm_Objects_Disabled" file_name="icons/Profile_Perm_Objects_Disabled.png" preload="true"/> 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 56cf673e191..853e782de1d 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml @@ -123,10 +123,11 @@ Account: [ACCTTYPE] top_pad="0" left_delta="0" right="-1" - height="64" + height="80" follows="left|top|right" layout="topleft" animate="false" + border_size="0" orientation="vertical"> <layout_panel name="partner_layout" @@ -150,18 +151,105 @@ Account: [ACCTTYPE] use_ellipses="true" visible="true"/> </layout_panel> - + <layout_panel + name="spacer_layout" + follows="all" + layout="topleft" + height="14" + auto_resize="false" + user_resize="false" + visible="true"> + </layout_panel> + <layout_panel + name="frind_layout" + follows="all" + layout="topleft" + height="16" + auto_resize="false" + user_resize="false" + visible="false"> + <text + name="frind_text" + value="You are friends" + text_color="Green" + top="0" + left="0" + right="-1" + height="16" + follows="left|top|right" + layout="topleft" + translate="false" + visible="true"/> + </layout_panel> + <layout_panel + name="online_layout" + follows="all" + layout="topleft" + height="16" + auto_resize="false" + user_resize="false" + visible="false"> + <icon + name="online_icon" + image_name="Profile_Friend_Online" + layout="topleft" + follows="left|top" + top="0" + left="0" + height="10" + width="10"/> + <text + name="online_text" + value="Online" + top="0" + left="13" + right="-1" + height="16" + follows="left|top|right" + layout="topleft" + translate="false" + visible="true"/> + </layout_panel> + <layout_panel + name="offline_layout" + follows="all" + layout="topleft" + height="16" + auto_resize="false" + user_resize="false" + visible="false"> + <icon + name="offline_icon" + image_name="Profile_Friend_Offline" + layout="topleft" + follows="left|top" + top="0" + left="0" + height="10" + width="10"/> + <text + name="offline_text" + value="Offline" + top="0" + left="13" + right="-1" + height="16" + follows="left|top|right" + layout="topleft" + translate="false" + visible="true"/> + </layout_panel> <layout_panel name="account_layout" follows="all" layout="topleft" - height="48" + height="33" auto_resize="false" user_resize="false"> <text name="account_info" value="Account: (loading...)" - top="15" + top="0" left="0" right="-1" height="16" @@ -207,7 +295,7 @@ Account: [ACCTTYPE] user_resize="false"> <icon - tool_tip="Can see online status" + tool_tip="Friend can see my online status" mouse_opaque="true" name="can_see_online" image_name="Profile_Perm_Online_Enabled" @@ -220,7 +308,7 @@ Account: [ACCTTYPE] left_pad="2" /> <icon - tool_tip="Can not see online status" + tool_tip="Friend can not see my online status" mouse_opaque="true" name="cant_see_online" image_name="Profile_Perm_Online_Disabled" @@ -233,7 +321,7 @@ Account: [ACCTTYPE] left_pad="2" /> <icon - tool_tip="Can see on map" + tool_tip="Friend can see me on map" mouse_opaque="true" name="can_see_on_map" image_name="Profile_Perm_Find_Enabled" @@ -246,7 +334,7 @@ Account: [ACCTTYPE] left_pad="2" /> <icon - tool_tip="Can not see on map" + tool_tip="Friend can not see me on map" mouse_opaque="true" name="cant_see_on_map" image_name="Profile_Perm_Find_Disabled" @@ -259,7 +347,7 @@ Account: [ACCTTYPE] left_pad="2" /> <icon - tool_tip="Can edit my objects" + tool_tip="Friend can edit my objects" mouse_opaque="true" name="can_edit_objects" image_name="Profile_Perm_Objects_Enabled" @@ -272,7 +360,7 @@ Account: [ACCTTYPE] left_pad="2" /> <icon - tool_tip="Can not edit my objects" + tool_tip="Friend can not edit my objects" mouse_opaque="true" name="cant_edit_objects" image_name="Profile_Perm_Objects_Disabled" -- GitLab