summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-05-31 22:41:21 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-05-31 23:31:14 +0300
commitab3d986ac82e6c54804e8216d8ba2f72f8e8dfc8 (patch)
tree7ed2b8b58e459cf4455c1cf356fab8a41a2a29b2 /indra/newview
parent4ffc6c3fde17de5e18370139274bbd44b1b61a23 (diff)
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)
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelprofile.cpp207
-rw-r--r--indra/newview/llpanelprofile.h9
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_secondlife.xml18
3 files changed, 87 insertions, 147 deletions
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 41d8a3e51c..85f443635d 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -468,123 +468,8 @@ public:
};
LLProfileHandler gProfileHandler;
-
-//////////////////////////////////////////////////////////////////////////
-// LLAgentHandler
-
-class LLAgentHandler : public LLCommandHandler
-{
-public:
- // requires trusted browser to trigger
- LLAgentHandler() : LLCommandHandler("agent", UNTRUSTED_THROTTLE) { }
-
- bool handle(const LLSD& params, const LLSD& query_map,
- LLMediaCtrl* web)
- {
- if (params.size() < 2) return false;
- LLUUID avatar_id;
- if (!avatar_id.set(params[0], FALSE))
- {
- return false;
- }
-
- const std::string verb = params[1].asString();
- if (verb == "about")
- {
- LLAvatarActions::showProfile(avatar_id);
- return true;
- }
-
- if (verb == "inspect")
- {
- LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
- return true;
- }
-
- if (verb == "im")
- {
- LLAvatarActions::startIM(avatar_id);
- return true;
- }
-
- if (verb == "pay")
- {
- if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarPay"))
- {
- LLNotificationsUtil::add("NoAvatarPay", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
- return true;
- }
-
- LLAvatarActions::pay(avatar_id);
- return true;
- }
-
- if (verb == "offerteleport")
- {
- LLAvatarActions::offerTeleport(avatar_id);
- return true;
- }
-
- if (verb == "requestfriend")
- {
- LLAvatarActions::requestFriendshipDialog(avatar_id);
- return true;
- }
-
- if (verb == "removefriend")
- {
- LLAvatarActions::removeFriendDialog(avatar_id);
- return true;
- }
-
- if (verb == "mute")
- {
- if (! LLAvatarActions::isBlocked(avatar_id))
- {
- LLAvatarActions::toggleBlock(avatar_id);
- }
- return true;
- }
-
- if (verb == "unmute")
- {
- if (LLAvatarActions::isBlocked(avatar_id))
- {
- LLAvatarActions::toggleBlock(avatar_id);
- }
- return true;
- }
-
- if (verb == "block")
- {
- if (params.size() > 2)
- {
- const std::string object_name = LLURI::unescape(params[2].asString());
- LLMute mute(avatar_id, object_name, LLMute::OBJECT);
- LLMuteList::getInstance()->add(mute);
- LLPanelBlockedList::showPanelAndSelect(mute.mID);
- }
- return true;
- }
-
- if (verb == "unblock")
- {
- if (params.size() > 2)
- {
- const std::string object_name = params[2].asString();
- LLMute mute(avatar_id, object_name, LLMute::OBJECT);
- LLMuteList::getInstance()->remove(mute);
- }
- return true;
- }
- return false;
- }
-};
-LLAgentHandler gAgentHandler;
-
-
///----------------------------------------------------------------------------
-/// LLFloaterInventoryFinder
+/// LLFloaterProfilePermissions
///----------------------------------------------------------------------------
class LLFloaterProfilePermissions
@@ -605,7 +490,8 @@ private:
void fillRightsData();
void rightsConfirmationCallback(const LLSD& notification, const LLSD& response);
void confirmModifyRights(bool grant);
- void onCommitRights();
+ void onCommitSeeOnlineRights();
+ void onCommitEditRights();
void onApplyRights();
void onCancel();
@@ -651,7 +537,8 @@ BOOL LLFloaterProfilePermissions::postBuild()
mOkBtn = getChild<LLButton>("perms_btn_ok");
mCancelBtn = getChild<LLButton>("perms_btn_cancel");
- mEditObjectRights->setCommitCallback([this](LLUICtrl*, void*) { onCommitRights(); }, nullptr);
+ mOnlineStatus->setCommitCallback([this](LLUICtrl*, void*) { onCommitSeeOnlineRights(); }, nullptr);
+ mEditObjectRights->setCommitCallback([this](LLUICtrl*, void*) { onCommitEditRights(); }, nullptr);
mOkBtn->setCommitCallback([this](LLUICtrl*, void*) { onApplyRights(); }, nullptr);
mCancelBtn->setCommitCallback([this](LLUICtrl*, void*) { onCancel(); }, nullptr);
@@ -704,7 +591,9 @@ void LLFloaterProfilePermissions::fillRightsData()
{
S32 rights = relation->getRightsGrantedTo();
- mOnlineStatus->setValue(LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE);
+ BOOL see_online = LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE;
+ mOnlineStatus->setValue(see_online);
+ mMapRights->setEnabled(see_online);
mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE);
mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE);
}
@@ -733,13 +622,38 @@ void LLFloaterProfilePermissions::confirmModifyRights(bool grant)
boost::bind(&LLFloaterProfilePermissions::rightsConfirmationCallback, this, _1, _2));
}
-void LLFloaterProfilePermissions::onCommitRights()
+void LLFloaterProfilePermissions::onCommitSeeOnlineRights()
+{
+ bool see_online = mOnlineStatus->getValue().asBoolean();
+ mMapRights->setEnabled(see_online);
+ if (see_online)
+ {
+ const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(mAvatarID);
+ if (relation)
+ {
+ S32 rights = relation->getRightsGrantedTo();
+ mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE);
+ }
+ else
+ {
+ closeFloater();
+ LL_INFOS("ProfilePermissions") << "Floater closing since agent is no longer a friend" << LL_ENDL;
+ }
+ }
+ else
+ {
+ mMapRights->setValue(FALSE);
+ }
+}
+
+void LLFloaterProfilePermissions::onCommitEditRights()
{
const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(mAvatarID);
if (!buddy_relationship)
{
- LL_WARNS("ProfilePermissions") << "Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL;
+ LL_WARNS("ProfilePermissions") << "Trying to modify rights for non-friend avatar. Closing floater." << LL_ENDL;
+ closeFloater();
return;
}
@@ -844,6 +758,13 @@ BOOL LLPanelProfileSecondLife::postBuild()
getChild<LLButton>("open_notes")->setCommitCallback([this](LLUICtrl*, void*) { onOpenNotes(); }, nullptr);
+ mCanSeeOnlineIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
+ mCantSeeOnlineIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
+ mCanSeeOnMapIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
+ mCantSeeOnMapIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
+ mCanEditObjectsIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
+ mCantEditObjectsIcon->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onShowAgentPermissionsDialog(); });
+
return TRUE;
}
@@ -995,9 +916,10 @@ void LLPanelProfileSecondLife::openGroupProfile()
void LLPanelProfileSecondLife::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
{
mAvatarNameCacheConnection.disconnect();
- // Should be possible to get this from AgentProfile capability
- getChild<LLUICtrl>("display_name")->setValue( av_name.getDisplayName() );
- getChild<LLUICtrl>("user_name")->setValue(av_name.getAccountName());
+ if (getIsLoaded())
+ {
+ fillNameAgeData(av_name, mBornOn);
+ }
}
void LLPanelProfileSecondLife::setNotesSnippet(std::string &notes)
@@ -1049,10 +971,21 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data)
// and to make sure icons in text will be up to date
LLAvatarIconIDCache::getInstance()->add(avatar_data->avatar_id, avatar_data->image_id);
- LLStringUtil::format_map_t args;
- args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now());
- std::string register_date = getString("AgeFormat", args);
- getChild<LLUICtrl>("user_age")->setValue(register_date);
+ mBornOn = avatar_data->born_on;
+
+ // Should be possible to get user and display names from AgentProfile capability
+ // but at the moment contraining this to limits of LLAvatarData
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(avatar_data->avatar_id, &av_name))
+ {
+ fillNameAgeData(av_name, mBornOn);
+ }
+ else if (!mAvatarNameCacheConnection.connected())
+ {
+ // shouldn't happen, but just in case
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCache, this, _1, _2));
+ }
+
setDescriptionText(avatar_data->about_text);
if (avatar_data->image_id.notNull())
@@ -1144,10 +1077,16 @@ 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::fillNameAgeData(const LLAvatarName &av_name, const LLDate &born_on)
+{
+ LLStringUtil::format_map_t args;
+ args["[AGE]"] = LLDateUtil::ageFromDate(born_on, LLDate::now());
+ args["[NAME]"] = av_name.getAccountName();
+ std::string register_date = getString("NameAgeFormat", args);
+ getChild<LLUICtrl>("user_name_age")->setValue(register_date);
+ getChild<LLUICtrl>("display_name")->setValue(av_name.getDisplayName());
}
void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep)
@@ -1620,13 +1559,15 @@ void LLPanelProfileSecondLife::onShowAgentPermissionsDialog()
LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions(parent_floater, getAvatarId());
mFloaterPermissionsHandle = perms->getHandle();
perms->openFloater();
+ perms->setVisibleAndFrontmost(TRUE);
parent_floater->addDependentFloater(mFloaterPermissionsHandle);
}
}
else // already open
{
- floater->closeFloater();
+ floater->setMinimized(FALSE);
+ floater->setVisibleAndFrontmost(TRUE);
}
}
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 2f2437ed0a..4985ec0015 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -136,8 +136,16 @@ protected:
*/
void fillAccountStatus(const LLAvatarData* avatar_data);
+ /**
+ * Sets permissions specific icon
+ */
void fillRightsData();
+ /**
+ * Fills user name, display name, age.
+ */
+ void fillNameAgeData(const LLAvatarName &av_name, const LLDate &born_on);
+
void onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep);
static void onImageLoaded(BOOL success,
LLViewerFetchedTexture *src_vi,
@@ -204,6 +212,7 @@ private:
bool mWaitingForImageUpload;
bool mAllowPublish;
std::string mDescriptionText;
+ LLDate mBornOn;
boost::signals2::connection mAvatarNameCacheConnection;
};
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 853e782de1..7dd16de0ed 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
@@ -10,8 +10,8 @@
layout="topleft"
>
<string
- name="AgeFormat"
- value="[AGE]" />
+ name="NameAgeFormat"
+ value="[NAME] ([AGE])" />
<string
name="partner_text"
value="Partner: [LINK]" />
@@ -99,17 +99,7 @@ Account: [ACCTTYPE]
layout="topleft"/>
<text
- name="user_name"
- value="(loading...)"
- top_pad="0"
- left_delta="0"
- right="-1"
- height="16"
- follows="left|top|right"
- layout="topleft"/>
-
- <text
- name="user_age"
+ name="user_name_age"
value="(loading...)"
top_pad="0"
left_delta="0"
@@ -171,7 +161,7 @@ Account: [ACCTTYPE]
<text
name="frind_text"
value="You are friends"
- text_color="Green"
+ text_color="ConversationFriendColor"
top="0"
left="0"
right="-1"