From d9ff42ab3c24fbae2a918f8e49fc4a47637b789d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Sat, 23 Nov 2019 22:37:50 -0500 Subject: [PATCH] Add name_system attribute to NameBoxes and NameEditors Uses the main one by default. Removes old show complete names on profile setting in favor of ProfileNameSystem, which is now offered under Adv. Chat->Chat UI Forces nameui to refresh on name setting update, or should, not important though --- .../newview/app_settings/settings_ascent.xml | 22 +++++++++---------- indra/newview/ascentprefschat.cpp | 2 ++ indra/newview/ascentprefschat.h | 1 + indra/newview/ascentprefsvan.cpp | 2 -- indra/newview/ascentprefsvan.h | 1 - indra/newview/llnamebox.cpp | 9 +++++--- indra/newview/llnamebox.h | 3 ++- indra/newview/llnameeditor.cpp | 8 +++++-- indra/newview/llnameeditor.h | 3 ++- indra/newview/llnameui.cpp | 17 +++++++++----- indra/newview/llnameui.h | 11 +++++----- indra/newview/llpanelavatar.cpp | 5 +---- .../de/panel_preferences_ascent_vanity.xml | 1 - .../skins/default/xui/en-us/panel_avatar.xml | 2 +- .../en-us/panel_preferences_ascent_chat.xml | 7 ++++++ .../en-us/panel_preferences_ascent_vanity.xml | 1 - .../es/panel_preferences_ascent_vanity.xml | 1 - .../fr/panel_preferences_ascent_vanity.xml | 1 - 18 files changed, 55 insertions(+), 42 deletions(-) diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index 65398b513..b0b90b0b4 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -91,6 +91,17 @@ Value 1 + ProfileNameSystem + + Comment + For a name displayed on its profile. 0 = Old Style, 1 = Display Names and Username, 2 = Displayname only, 3 = Old Style (Display Name) + Persist + 1 + Type + S32 + Value + 1 + RadarNameSystem Comment @@ -840,17 +851,6 @@ Value /open - SinguCompleteNameProfiles - - Comment - Use the complete name "Display Name (legacy.name)" in profiles, instead of following the choice set by PhoenixNameSystem. - Persist - 1 - Type - Boolean - Value - 0 - SinguDefaultEaseIn Comment diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index 084cc448f..a32eef090 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -257,6 +257,7 @@ void LLPrefsAscentChat::refreshValues() mFriendNames = gSavedSettings.getS32("FriendNameSystem"); mGroupMembersNames = gSavedSettings.getS32("GroupMembersNameSystem"); mLandManagementNames = gSavedSettings.getS32("LandManagementNameSystem"); + mProfileNames = gSavedSettings.getS32("ProfileNameSystem"); mRadarNames = gSavedSettings.getS32("RadarNameSystem"); mSpeakerNames = gSavedSettings.getS32("SpeakerNameSystem"); @@ -454,6 +455,7 @@ void LLPrefsAscentChat::cancel() gSavedSettings.setS32("FriendNameSystem", mFriendNames); gSavedSettings.setS32("GroupMembersNameSystem", mGroupMembersNames); gSavedSettings.setS32("LandManagementNameSystem", mLandManagementNames); + gSavedSettings.setS32("ProfileNameSystem", mProfileNames); gSavedSettings.setS32("RadarNameSystem", mRadarNames); gSavedSettings.setS32("SpeakerNameSystem", mSpeakerNames); diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index 2521b2039..0f0dc9baa 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -91,6 +91,7 @@ private: S32 mFriendNames; S32 mGroupMembersNames; S32 mLandManagementNames; + S32 mProfileNames; S32 mRadarNames; S32 mSpeakerNames; diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 0c6216647..0bb200636 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -130,7 +130,6 @@ void LLPrefsAscentVan::refreshValues() mAnnounceStreamMetadata = gSavedSettings.getBOOL("AnnounceStreamMetadata"); mInactiveFloaterTransparency = gSavedSettings.getF32("InactiveFloaterTransparency"); mActiveFloaterTransparency = gSavedSettings.getF32("ActiveFloaterTransparency"); - mCompleteNameProfiles = gSavedSettings.getBOOL("SinguCompleteNameProfiles"); mScriptErrorsStealFocus = gSavedSettings.getBOOL("LiruScriptErrorsStealFocus"); mConnectToNeighbors = gSavedSettings.getBOOL("AlchemyConnectToNeighbors"); mRestartMinimized = gSavedSettings.getBOOL("LiruRegionRestartMinimized"); @@ -205,7 +204,6 @@ void LLPrefsAscentVan::cancel() gSavedSettings.setBOOL("AnnounceStreamMetadata", mAnnounceStreamMetadata); gSavedSettings.setF32("InactiveFloaterTransparency", mInactiveFloaterTransparency); gSavedSettings.setF32("ActiveFloaterTransparency", mActiveFloaterTransparency); - gSavedSettings.setBOOL("SinguCompleteNameProfiles", mCompleteNameProfiles); gSavedSettings.setBOOL("LiruScriptErrorsStealFocus", mScriptErrorsStealFocus); gSavedSettings.setBOOL("AlchemyConnectToNeighbors", mConnectToNeighbors); gSavedSettings.setBOOL("LiruRegionRestartMinimized", mRestartMinimized); diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index d8e27338e..b29f5147d 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -63,7 +63,6 @@ private: bool mAnnounceSnapshots; bool mAnnounceStreamMetadata; F32 mInactiveFloaterTransparency, mActiveFloaterTransparency; - bool mCompleteNameProfiles; bool mScriptErrorsStealFocus; bool mConnectToNeighbors; bool mRestartMinimized; diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index 399e47c88..023fcc426 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -41,8 +41,9 @@ LLNameBox::LLNameBox(const std::string& name, const LLUUID& name_id, bool is_group, const std::string& loading, - bool rlv_sensitive) -: LLNameUI(loading, rlv_sensitive, name_id, is_group) + bool rlv_sensitive, + const std::string& name_system) +: LLNameUI(loading, rlv_sensitive, name_id, is_group, name_system) , LLTextBox(name, LLRect(), LLStringUtil::null, nullptr, TRUE) { setClickedCallback(boost::bind(&LLNameUI::showProfile, this)); @@ -99,7 +100,9 @@ LLView* LLNameBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f node->getAttributeString("initial_value", loading); bool rlv_sensitive = false; node->getAttribute_bool("rlv_sensitive", rlv_sensitive); - LLNameBox* name_box = new LLNameBox("name_box", id, is_group, loading, rlv_sensitive); + std::string name_system; + node->getAttributeString("name_system", name_system); + LLNameBox* name_box = new LLNameBox("name_box", id, is_group, loading, rlv_sensitive, name_system); name_box->initFromXML(node,parent); return name_box; diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h index 2c7ea3e83..564970f26 100644 --- a/indra/newview/llnamebox.h +++ b/indra/newview/llnamebox.h @@ -55,7 +55,8 @@ public: const LLUUID& name_id = LLUUID::null, bool is_group = false, const std::string& loading = LLStringUtil::null, - bool rlv_sensitive = false); + bool rlv_sensitive = false, + const std::string& name_system = LLStringUtil::null); }; #endif diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index e69161cbe..c2706c297 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -45,10 +45,11 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, bool is_group, const std::string& loading, bool rlv_sensitive, + const std::string& name_system, bool click_for_profile, const LLFontGL* glfont, S32 max_text_length) -: LLNameUI(loading, rlv_sensitive, name_id, is_group) +: LLNameUI(loading, rlv_sensitive, name_id, is_group, name_system) , LLLineEditor(name, rect, LLStringUtil::null, glfont, max_text_length) , mClickForProfile(click_for_profile) { @@ -124,6 +125,7 @@ LLXMLNodePtr LLNameEditor::getXML(bool save_children) const node->createChild("label", TRUE)->setStringValue(mInitialValue); node->createChild("rlv_sensitive", TRUE)->setBoolValue(mRLVSensitive); node->createChild("click_for_profile", TRUE)->setBoolValue(mClickForProfile); + node->createChild("name_system", TRUE)->setStringValue(mNameSystem); return node; } @@ -145,10 +147,12 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory node->getAttribute_bool("rlv_sensitive", rlv_sensitive); bool click_for_profile = true; node->getAttribute_bool("click_for_profile", click_for_profile); + std::string name_system; + node->getAttributeString("name_system", name_system); LLNameEditor* line_editor = new LLNameEditor("name_editor", rect, - id, is_group, loading, rlv_sensitive, + id, is_group, loading, rlv_sensitive, name_system, click_for_profile, LLView::selectFont(node), max_text_length); diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index 3453906c2..65b542a7c 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -36,7 +36,7 @@ #include "lllineeditor.h" #include "llnameui.h" -class LLNameEditor +class LLNameEditor final : public LLLineEditor , public LLNameUI { @@ -47,6 +47,7 @@ public: bool is_group = false, const std::string& loading = LLStringUtil::null, bool rlv_sensitive = false, + const std::string& name_system = LLStringUtil::null, bool click_for_profile = true, const LLFontGL* glfont = nullptr, S32 max_text_length = 254); diff --git a/indra/newview/llnameui.cpp b/indra/newview/llnameui.cpp index 10e113a04..dcdf2de41 100644 --- a/indra/newview/llnameui.cpp +++ b/indra/newview/llnameui.cpp @@ -46,29 +46,34 @@ // statics std::set LLNameUI::sInstances; -LLNameUI::LLNameUI(const std::string& loading, bool rlv_sensitive, const LLUUID& id, bool is_group) +LLNameUI::LLNameUI(const std::string& loading, bool rlv_sensitive, const LLUUID& id, bool is_group, const std::string& name_system) : mNameID(id), mRLVSensitive(rlv_sensitive), mIsGroup(!is_group), mAllowInteract(false) -, mInitialValue(!loading.empty() ? loading : LLTrans::getString("LoadingData")) +, mNameSystem(name_system.empty() ? "PhoenixNameSystem" : name_system), mInitialValue(!loading.empty() ? loading : LLTrans::getString("LoadingData")) { setIsGroup(is_group); } void LLNameUI::setIsGroup(bool is_group) { + // Disconnect active connections if needed + for (auto& connection : mConnections) + connection.disconnect(); + if (mIsGroup != is_group) { if (mIsGroup = is_group) sInstances.insert(this); else + { sInstances.erase(this); + mConnections[1] = gSavedSettings.getControl(mNameSystem)->getCommitSignal()->connect(boost::bind(&LLNameUI::setNameText, this)); + } } } void LLNameUI::setNameID(const LLUUID& name_id, bool is_group) { mNameID = name_id; - mConnection.disconnect(); - setIsGroup(is_group); if (mAllowInteract = mNameID.notNull()) @@ -95,9 +100,9 @@ void LLNameUI::setNameText() { LLAvatarName av_name; if (got_name = LLAvatarNameCache::get(mNameID, &av_name)) - name = mShowCompleteName ? av_name.getCompleteName() : av_name.getNSName(); + name = mNameSystem.empty() ? av_name.getNSName() : av_name.getNSName(gSavedSettings.getS32(mNameSystem)); else - mConnection = LLAvatarNameCache::get(mNameID, boost::bind(&LLNameUI::setNameText, this)); + mConnections[0] = LLAvatarNameCache::get(mNameID, boost::bind(&LLNameUI::setNameText, this)); } if (!mIsGroup && got_name && mRLVSensitive) // Filter if needed diff --git a/indra/newview/llnameui.h b/indra/newview/llnameui.h index 15012fd08..d5854fb0a 100644 --- a/indra/newview/llnameui.h +++ b/indra/newview/llnameui.h @@ -38,13 +38,13 @@ struct LLNameUI : public LFIDBearer { - LLNameUI(const std::string& loading = LLStringUtil::null, bool rlv_sensitive = false, const LLUUID& id = LLUUID::null, bool is_group = false); + LLNameUI(const std::string& loading = LLStringUtil::null, bool rlv_sensitive = false, const LLUUID& id = LLUUID::null, bool is_group = false, const std::string& name_system = LLStringUtil::null); virtual ~LLNameUI() { if (mIsGroup) sInstances.erase(this); - else - mConnection.disconnect(); + for (auto& connection : mConnections) + connection.disconnect(); } LLUUID getStringUUIDSelectedItem() const override final { return mNameID; } @@ -56,7 +56,6 @@ struct LLNameUI : public LFIDBearer void refresh(const LLUUID& id, const std::string& full_name, bool is_group); static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group); - void setShowCompleteName(bool show) { mShowCompleteName = show; } void showProfile(); virtual void displayAsLink(bool link) = 0; // Override to make the name display as a link @@ -75,8 +74,7 @@ struct LLNameUI : public LFIDBearer private: static std::set sInstances; - boost::signals2::connection mConnection; - bool mShowCompleteName = false; + std::array mConnections; protected: LLUUID mNameID; @@ -84,4 +82,5 @@ protected: bool mIsGroup; bool mAllowInteract; std::string mInitialValue; + std::string mNameSystem; }; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 9fe61950d..c48abdf58 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -1236,13 +1236,12 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) { - auto dnname = getChild("dnname"); if (avatar_id != mAvatarID) { if (mAvatarID.notNull()) LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); mAvatarID = avatar_id; - dnname->setNameID(avatar_id, false); + getChild("dnname")->setNameID(avatar_id, false); } if (avatar_id.isNull()) return; @@ -1271,8 +1270,6 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) if (LLDropTarget* drop_target = findChild("drop_target_rect")) drop_target->setEntityID(mAvatarID); - dnname->setShowCompleteName(gSavedSettings.getBOOL("SinguCompleteNameProfiles")); - if (auto key_edit = getChildView("avatar_key")) key_edit->setValue(mAvatarID.asString()); diff --git a/indra/newview/skins/default/xui/de/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/de/panel_preferences_ascent_vanity.xml index c403b9c11..3a170dae1 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_ascent_vanity.xml @@ -11,7 +11,6 @@ - diff --git a/indra/newview/skins/default/xui/en-us/panel_avatar.xml b/indra/newview/skins/default/xui/en-us/panel_avatar.xml index 48ca5fa16..e9294626f 100644 --- a/indra/newview/skins/default/xui/en-us/panel_avatar.xml +++ b/indra/newview/skins/default/xui/en-us/panel_avatar.xml @@ -30,7 +30,7 @@ border_thickness="1" bottom="-48" enabled="false" follows="left|top" font="SansSerifSmall" height="16" is_unicode="false" left_delta="75" max_length="254" mouse_opaque="false" name="dnname" - width="181" click_for_profile="false"/> + width="181" name_system="ProfileNameSystem" click_for_profile="false"/> Display Names only Old Names (w/Display) + Profiles: + + Old Names + Display Names (w/Username) + Display Names only + Old Names (w/Display) + Radar: Old Names diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml index 6dd9e25ae..fd1df667a 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml @@ -12,7 +12,6 @@ - diff --git a/indra/newview/skins/default/xui/es/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/es/panel_preferences_ascent_vanity.xml index 23b963c4e..360841340 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_ascent_vanity.xml @@ -12,7 +12,6 @@ - diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml index e2e3fcc2d..8ee7b129a 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml @@ -12,7 +12,6 @@ -