From 330ea83c3dd8f56f4cef56481f951b705d28f027 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Wed, 13 Oct 2010 15:39:16 -0700
Subject: [PATCH] making profiles look nicer when display names isn't on

---
 indra/newview/llpanelme.cpp                   | 38 +++++++++++++------
 indra/newview/llpanelprofileview.cpp          |  3 +-
 .../default/xui/en/panel_edit_profile.xml     | 36 +++++++++++++++---
 .../default/xui/en/panel_profile_view.xml     | 13 ++++++-
 4 files changed, 71 insertions(+), 19 deletions(-)

diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index a9f7b6c62c..5ea94e0611 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -212,6 +212,8 @@ void LLPanelMyProfileEdit::onOpen(const LLSD& key)
 		getChild<LLUICtrl>("display_name_label")->setVisible( true );
 		getChild<LLUICtrl>("set_name")->setVisible( true );
 		getChild<LLUICtrl>("set_name")->setEnabled( true );
+		getChild<LLUICtrl>("solo_user_name")->setVisible( false );
+		getChild<LLUICtrl>("solo_username_label")->setVisible( false );
 	}
 	else
 	{
@@ -220,6 +222,8 @@ void LLPanelMyProfileEdit::onOpen(const LLSD& key)
 		getChild<LLUICtrl>("display_name_label")->setVisible( false );
 		getChild<LLUICtrl>("set_name")->setVisible( false );
 		getChild<LLUICtrl>("set_name")->setEnabled( false );
+		getChild<LLUICtrl>("solo_user_name")->setVisible( true );
+		getChild<LLUICtrl>("solo_username_label")->setVisible( true );
 	}
 }
 
@@ -270,18 +274,8 @@ void LLPanelMyProfileEdit::onNameCache(const LLUUID& agent_id, const LLAvatarNam
 	getChild<LLUICtrl>("user_name")->setValue( av_name.mDisplayName );
 	getChild<LLUICtrl>("user_slid")->setValue( av_name.mUsername );
 	getChild<LLUICtrl>("user_name_small")->setValue( av_name.mDisplayName );
+	getChild<LLUICtrl>("solo_user_name")->setValue( av_name.mDisplayName );
 
-	// show smaller display name if too long to display in regular size
-	if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
-	{
-		getChild<LLUICtrl>("user_name_small")->setVisible( true );
-		getChild<LLUICtrl>("user_name")->setVisible( false );
-	}
-	else
-	{
-		getChild<LLUICtrl>("user_name_small")->setVisible( false );
-		getChild<LLUICtrl>("user_name")->setVisible( true );
-	}
 
 	if (LLAvatarNameCache::useDisplayNames())
 	{
@@ -290,6 +284,21 @@ void LLPanelMyProfileEdit::onNameCache(const LLUUID& agent_id, const LLAvatarNam
 		getChild<LLUICtrl>("display_name_label")->setVisible( true );
 		getChild<LLUICtrl>("set_name")->setVisible( true );
 		getChild<LLUICtrl>("set_name")->setEnabled( true );
+
+		getChild<LLUICtrl>("solo_user_name")->setVisible( false );
+		getChild<LLUICtrl>("solo_username_label")->setVisible( false );
+
+		// show smaller display name if too long to display in regular size
+		if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
+		{
+			getChild<LLUICtrl>("user_name_small")->setVisible( true );
+			getChild<LLUICtrl>("user_name")->setVisible( false );
+		}
+		else
+		{
+			getChild<LLUICtrl>("user_name_small")->setVisible( false );
+			getChild<LLUICtrl>("user_name")->setVisible( true );
+		}
 	}
 	else
 	{
@@ -298,6 +307,11 @@ void LLPanelMyProfileEdit::onNameCache(const LLUUID& agent_id, const LLAvatarNam
 		getChild<LLUICtrl>("display_name_label")->setVisible( false );
 		getChild<LLUICtrl>("set_name")->setVisible( false );
 		getChild<LLUICtrl>("set_name")->setEnabled( false );
+		
+		getChild<LLUICtrl>("solo_user_name")->setVisible( true );
+		getChild<LLUICtrl>("user_name_small")->setVisible( false );
+		getChild<LLUICtrl>("user_name")->setVisible( false );
+		getChild<LLUICtrl>("solo_username_label")->setVisible( true );
 	}
 }
 
@@ -351,6 +365,8 @@ void LLPanelMyProfileEdit::resetData()
 	//childSetTextArg("name_text", "[LAST]", LLStringUtil::null);
 	getChild<LLUICtrl>("user_name")->setValue( LLSD() );
 	getChild<LLUICtrl>("user_slid")->setValue( LLSD() );
+	getChild<LLUICtrl>("solo_user_name")->setValue( LLSD() );
+	getChild<LLUICtrl>("user_name_small")->setValue( LLSD() );
 }
 
 void LLPanelMyProfileEdit::onTexturePickerMouseEnter(LLUICtrl* ctrl)
diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp
index 9011583a60..7635aedf58 100644
--- a/indra/newview/llpanelprofileview.cpp
+++ b/indra/newview/llpanelprofileview.cpp
@@ -222,7 +222,6 @@ void LLPanelProfileView::onAvatarNameCache(const LLUUID& agent_id,
 	{
 		getChild<LLUICtrl>("user_name_small")->setVisible( false );
 		getChild<LLUICtrl>("user_name")->setVisible( true );
-
 	}
 
 	if (LLAvatarNameCache::useDisplayNames())
@@ -232,6 +231,7 @@ void LLPanelProfileView::onAvatarNameCache(const LLUUID& agent_id,
 		getChild<LLUICtrl>("display_name_label")->setVisible( true );
 		getChild<LLUICtrl>("copy_to_clipboard")->setVisible( true );
 		getChild<LLUICtrl>("copy_to_clipboard")->setEnabled( true );
+		getChild<LLUICtrl>("solo_username_label")->setVisible( false );
 	}
 	else
 	{
@@ -240,6 +240,7 @@ void LLPanelProfileView::onAvatarNameCache(const LLUUID& agent_id,
 		getChild<LLUICtrl>("display_name_label")->setVisible( false );
 		getChild<LLUICtrl>("copy_to_clipboard")->setVisible( false );
 		getChild<LLUICtrl>("copy_to_clipboard")->setEnabled( false );
+		getChild<LLUICtrl>("solo_username_label")->setVisible( true );
 	}
 }
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_profile.xml b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
index 70c7bae662..90dbddaff7 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
@@ -96,6 +96,17 @@
      name="display_name_label"
      text_color="LtGray"
      value="Display Name:"
+     width="80" />
+      <text
+     top="5"
+     follows="top|left"
+     height="13"
+     layout="topleft"
+     left="10"
+     name="solo_username_label"
+     text_color="LtGray"
+     value="Username:"
+     visible="false" 
      width="80" />
       <button
          name="set_name"
@@ -112,13 +123,26 @@
        font="SansSerifBigBold"
        height="20"
        layout="topleft"
-       left_pad="10"
-       name="user_name"
+       left="10"
+       name="solo_user_name"
        text_color="white"
        top_delta="3"
        value="Hamilton Hitchings"
-       use_ellipses="true" 
-       visible="true" 
+       use_ellipses="true"
+       visible="false"
+       width="275" />
+      <text
+       follows="top|left"
+       font="SansSerifBigBold"
+       height="20"
+       layout="topleft"
+       left="43"
+       name="user_name"
+       text_color="white"
+       top_delta="0"
+       value="Hamilton Hitchings"
+       use_ellipses="true"
+       visible="true"
        width="250" />
       <text
        follows="top|left"
@@ -131,7 +155,7 @@
        top_delta="-4"
        value="Hamilton Hitchings"
        use_ellipses="true"
-       visible="false" 
+       visible="false"
        wrap="true"
        width="245" />
       <text
@@ -141,7 +165,7 @@
     left="10"
     name="user_label"
     text_color="LtGray"
-    top_pad="8" 
+    top_pad="8"
     value="Username:"
     width="70" />
       <text
diff --git a/indra/newview/skins/default/xui/en/panel_profile_view.xml b/indra/newview/skins/default/xui/en/panel_profile_view.xml
index dc5173867b..97229c413c 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_view.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_view.xml
@@ -38,6 +38,17 @@
    text_color="LtGray"
    value="Display Name:"
    width="80" />
+  <text
+   top_delta="0"
+   follows="top|left"
+   height="13"
+   layout="topleft"
+   left="45"
+   name="solo_username_label"
+   text_color="LtGray"
+   value="Username:"
+   visible="false" 
+   width="80" />
   <text
    follows="top|right"
    halign="right"
@@ -108,7 +119,7 @@
    top_delta="-2"
    use_ellipses="true"
    value="jack.linden"
-   width="205" 
+   width="195" 
    wrap="true "/>
   <tab_container
    follows="all"
-- 
GitLab