Skip to content

Commit ab3d986

Browse files
committed
SL-15312 Tweaks and fixes #2
- changed 'is friend' color - fixed off/online status vanishing - changed user name format - fixed rights behavior - cleaned up some unused code - readded click functionality to permission icons (might need to return buttons instead)
1 parent 4ffc6c3 commit ab3d986

File tree

3 files changed

+87
-147
lines changed

3 files changed

+87
-147
lines changed

indra/newview/llpanelprofile.cpp

+74-133
Original file line numberDiff line numberDiff line change
@@ -468,123 +468,8 @@ class LLProfileHandler : public LLCommandHandler
468468
};
469469
LLProfileHandler gProfileHandler;
470470

471-
472-
//////////////////////////////////////////////////////////////////////////
473-
// LLAgentHandler
474-
475-
class LLAgentHandler : public LLCommandHandler
476-
{
477-
public:
478-
// requires trusted browser to trigger
479-
LLAgentHandler() : LLCommandHandler("agent", UNTRUSTED_THROTTLE) { }
480-
481-
bool handle(const LLSD& params, const LLSD& query_map,
482-
LLMediaCtrl* web)
483-
{
484-
if (params.size() < 2) return false;
485-
LLUUID avatar_id;
486-
if (!avatar_id.set(params[0], FALSE))
487-
{
488-
return false;
489-
}
490-
491-
const std::string verb = params[1].asString();
492-
if (verb == "about")
493-
{
494-
LLAvatarActions::showProfile(avatar_id);
495-
return true;
496-
}
497-
498-
if (verb == "inspect")
499-
{
500-
LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
501-
return true;
502-
}
503-
504-
if (verb == "im")
505-
{
506-
LLAvatarActions::startIM(avatar_id);
507-
return true;
508-
}
509-
510-
if (verb == "pay")
511-
{
512-
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarPay"))
513-
{
514-
LLNotificationsUtil::add("NoAvatarPay", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
515-
return true;
516-
}
517-
518-
LLAvatarActions::pay(avatar_id);
519-
return true;
520-
}
521-
522-
if (verb == "offerteleport")
523-
{
524-
LLAvatarActions::offerTeleport(avatar_id);
525-
return true;
526-
}
527-
528-
if (verb == "requestfriend")
529-
{
530-
LLAvatarActions::requestFriendshipDialog(avatar_id);
531-
return true;
532-
}
533-
534-
if (verb == "removefriend")
535-
{
536-
LLAvatarActions::removeFriendDialog(avatar_id);
537-
return true;
538-
}
539-
540-
if (verb == "mute")
541-
{
542-
if (! LLAvatarActions::isBlocked(avatar_id))
543-
{
544-
LLAvatarActions::toggleBlock(avatar_id);
545-
}
546-
return true;
547-
}
548-
549-
if (verb == "unmute")
550-
{
551-
if (LLAvatarActions::isBlocked(avatar_id))
552-
{
553-
LLAvatarActions::toggleBlock(avatar_id);
554-
}
555-
return true;
556-
}
557-
558-
if (verb == "block")
559-
{
560-
if (params.size() > 2)
561-
{
562-
const std::string object_name = LLURI::unescape(params[2].asString());
563-
LLMute mute(avatar_id, object_name, LLMute::OBJECT);
564-
LLMuteList::getInstance()->add(mute);
565-
LLPanelBlockedList::showPanelAndSelect(mute.mID);
566-
}
567-
return true;
568-
}
569-
570-
if (verb == "unblock")
571-
{
572-
if (params.size() > 2)
573-
{
574-
const std::string object_name = params[2].asString();
575-
LLMute mute(avatar_id, object_name, LLMute::OBJECT);
576-
LLMuteList::getInstance()->remove(mute);
577-
}
578-
return true;
579-
}
580-
return false;
581-
}
582-
};
583-
LLAgentHandler gAgentHandler;
584-
585-
586471
///----------------------------------------------------------------------------
587-
/// LLFloaterInventoryFinder
472+
/// LLFloaterProfilePermissions
588473
///----------------------------------------------------------------------------
589474

590475
class LLFloaterProfilePermissions
@@ -605,7 +490,8 @@ class LLFloaterProfilePermissions
605490
void fillRightsData();
606491
void rightsConfirmationCallback(const LLSD& notification, const LLSD& response);
607492
void confirmModifyRights(bool grant);
608-
void onCommitRights();
493+
void onCommitSeeOnlineRights();
494+
void onCommitEditRights();
609495

610496
void onApplyRights();
611497
void onCancel();
@@ -651,7 +537,8 @@ BOOL LLFloaterProfilePermissions::postBuild()
651537
mOkBtn = getChild<LLButton>("perms_btn_ok");
652538
mCancelBtn = getChild<LLButton>("perms_btn_cancel");
653539

654-
mEditObjectRights->setCommitCallback([this](LLUICtrl*, void*) { onCommitRights(); }, nullptr);
540+
mOnlineStatus->setCommitCallback([this](LLUICtrl*, void*) { onCommitSeeOnlineRights(); }, nullptr);
541+
mEditObjectRights->setCommitCallback([this](LLUICtrl*, void*) { onCommitEditRights(); }, nullptr);
655542
mOkBtn->setCommitCallback([this](LLUICtrl*, void*) { onApplyRights(); }, nullptr);
656543
mCancelBtn->setCommitCallback([this](LLUICtrl*, void*) { onCancel(); }, nullptr);
657544

@@ -704,7 +591,9 @@ void LLFloaterProfilePermissions::fillRightsData()
704591
{
705592
S32 rights = relation->getRightsGrantedTo();
706593

707-
mOnlineStatus->setValue(LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE);
594+
BOOL see_online = LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE;
595+
mOnlineStatus->setValue(see_online);
596+
mMapRights->setEnabled(see_online);
708597
mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE);
709598
mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE);
710599
}
@@ -733,13 +622,38 @@ void LLFloaterProfilePermissions::confirmModifyRights(bool grant)
733622
boost::bind(&LLFloaterProfilePermissions::rightsConfirmationCallback, this, _1, _2));
734623
}
735624

736-
void LLFloaterProfilePermissions::onCommitRights()
625+
void LLFloaterProfilePermissions::onCommitSeeOnlineRights()
626+
{
627+
bool see_online = mOnlineStatus->getValue().asBoolean();
628+
mMapRights->setEnabled(see_online);
629+
if (see_online)
630+
{
631+
const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(mAvatarID);
632+
if (relation)
633+
{
634+
S32 rights = relation->getRightsGrantedTo();
635+
mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE);
636+
}
637+
else
638+
{
639+
closeFloater();
640+
LL_INFOS("ProfilePermissions") << "Floater closing since agent is no longer a friend" << LL_ENDL;
641+
}
642+
}
643+
else
644+
{
645+
mMapRights->setValue(FALSE);
646+
}
647+
}
648+
649+
void LLFloaterProfilePermissions::onCommitEditRights()
737650
{
738651
const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(mAvatarID);
739652

740653
if (!buddy_relationship)
741654
{
742-
LL_WARNS("ProfilePermissions") << "Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL;
655+
LL_WARNS("ProfilePermissions") << "Trying to modify rights for non-friend avatar. Closing floater." << LL_ENDL;
656+
closeFloater();
743657
return;
744658
}
745659

@@ -844,6 +758,13 @@ BOOL LLPanelProfileSecondLife::postBuild()
844758

845759
getChild<LLButton>("open_notes")->setCommitCallback([this](LLUICtrl*, void*) { onOpenNotes(); }, nullptr);
846760

761+
mCanSeeOnlineIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
762+
mCantSeeOnlineIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
763+
mCanSeeOnMapIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
764+
mCantSeeOnMapIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
765+
mCanEditObjectsIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
766+
mCantEditObjectsIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
767+
847768
return TRUE;
848769
}
849770

@@ -995,9 +916,10 @@ void LLPanelProfileSecondLife::openGroupProfile()
995916
void LLPanelProfileSecondLife::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
996917
{
997918
mAvatarNameCacheConnection.disconnect();
998-
// Should be possible to get this from AgentProfile capability
999-
getChild<LLUICtrl>("display_name")->setValue( av_name.getDisplayName() );
1000-
getChild<LLUICtrl>("user_name")->setValue(av_name.getAccountName());
919+
if (getIsLoaded())
920+
{
921+
fillNameAgeData(av_name, mBornOn);
922+
}
1001923
}
1002924

1003925
void LLPanelProfileSecondLife::setNotesSnippet(std::string &notes)
@@ -1049,10 +971,21 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
1049971
// and to make sure icons in text will be up to date
1050972
LLAvatarIconIDCache::getInstance()->add(avatar_data->avatar_id, avatar_data->image_id);
1051973

1052-
LLStringUtil::format_map_t args;
1053-
args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now());
1054-
std::string register_date = getString("AgeFormat", args);
1055-
getChild<LLUICtrl>("user_age")->setValue(register_date);
974+
mBornOn = avatar_data->born_on;
975+
976+
// Should be possible to get user and display names from AgentProfile capability
977+
// but at the moment contraining this to limits of LLAvatarData
978+
LLAvatarName av_name;
979+
if (LLAvatarNameCache::get(avatar_data->avatar_id, &av_name))
980+
{
981+
fillNameAgeData(av_name, mBornOn);
982+
}
983+
else if (!mAvatarNameCacheConnection.connected())
984+
{
985+
// shouldn't happen, but just in case
986+
mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCache, this, _1, _2));
987+
}
988+
1056989
setDescriptionText(avatar_data->about_text);
1057990

1058991
if (avatar_data->image_id.notNull())
@@ -1144,10 +1077,16 @@ void LLPanelProfileSecondLife::fillRightsData()
11441077
}
11451078

11461079
childSetVisible("permissions_panel", NULL != relation);
1147-
childSetVisible("spacer_layout", NULL == relation);
1148-
childSetVisible("frind_layout", NULL != relation);
1149-
childSetVisible("online_layout", false);
1150-
childSetVisible("offline_layout", false);
1080+
}
1081+
1082+
void LLPanelProfileSecondLife::fillNameAgeData(const LLAvatarName &av_name, const LLDate &born_on)
1083+
{
1084+
LLStringUtil::format_map_t args;
1085+
args["[AGE]"] = LLDateUtil::ageFromDate(born_on, LLDate::now());
1086+
args["[NAME]"] = av_name.getAccountName();
1087+
std::string register_date = getString("NameAgeFormat", args);
1088+
getChild<LLUICtrl>("user_name_age")->setValue(register_date);
1089+
getChild<LLUICtrl>("display_name")->setValue(av_name.getDisplayName());
11511090
}
11521091

11531092
void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep)
@@ -1620,13 +1559,15 @@ void LLPanelProfileSecondLife::onShowAgentPermissionsDialog()
16201559
LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions(parent_floater, getAvatarId());
16211560
mFloaterPermissionsHandle = perms->getHandle();
16221561
perms->openFloater();
1562+
perms->setVisibleAndFrontmost(TRUE);
16231563

16241564
parent_floater->addDependentFloater(mFloaterPermissionsHandle);
16251565
}
16261566
}
16271567
else // already open
16281568
{
1629-
floater->closeFloater();
1569+
floater->setMinimized(FALSE);
1570+
floater->setVisibleAndFrontmost(TRUE);
16301571
}
16311572
}
16321573

indra/newview/llpanelprofile.h

+9
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,16 @@ class LLPanelProfileSecondLife
136136
*/
137137
void fillAccountStatus(const LLAvatarData* avatar_data);
138138

139+
/**
140+
* Sets permissions specific icon
141+
*/
139142
void fillRightsData();
140143

144+
/**
145+
* Fills user name, display name, age.
146+
*/
147+
void fillNameAgeData(const LLAvatarName &av_name, const LLDate &born_on);
148+
141149
void onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep);
142150
static void onImageLoaded(BOOL success,
143151
LLViewerFetchedTexture *src_vi,
@@ -204,6 +212,7 @@ class LLPanelProfileSecondLife
204212
bool mWaitingForImageUpload;
205213
bool mAllowPublish;
206214
std::string mDescriptionText;
215+
LLDate mBornOn;
207216

208217
boost::signals2::connection mAvatarNameCacheConnection;
209218
};

indra/newview/skins/default/xui/en/panel_profile_secondlife.xml

+4-14
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
layout="topleft"
1111
>
1212
<string
13-
name="AgeFormat"
14-
value="[AGE]" />
13+
name="NameAgeFormat"
14+
value="[NAME] ([AGE])" />
1515
<string
1616
name="partner_text"
1717
value="Partner: [LINK]" />
@@ -99,17 +99,7 @@ Account: [ACCTTYPE]
9999
layout="topleft"/>
100100

101101
<text
102-
name="user_name"
103-
value="(loading...)"
104-
top_pad="0"
105-
left_delta="0"
106-
right="-1"
107-
height="16"
108-
follows="left|top|right"
109-
layout="topleft"/>
110-
111-
<text
112-
name="user_age"
102+
name="user_name_age"
113103
value="(loading...)"
114104
top_pad="0"
115105
left_delta="0"
@@ -171,7 +161,7 @@ Account: [ACCTTYPE]
171161
<text
172162
name="frind_text"
173163
value="You are friends"
174-
text_color="Green"
164+
text_color="ConversationFriendColor"
175165
top="0"
176166
left="0"
177167
right="-1"

0 commit comments

Comments
 (0)