summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-05-08 15:26:45 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2013-05-08 15:26:45 -0700
commit2d65482d7152b613409a071e0a117d38f350932a (patch)
tree08a994e835f3e1ec07dc6c2861a54bd953347ff3
parent7d6e3945204c05efe85eadf8a6635d0ca30e9186 (diff)
ACME-342 Format the PersonView so that it shows the avatar icon, SL name, FB icon, and FB name: Adjusted personview/personmodel contain a suffix which is the FB username for SL+FB users
-rw-r--r--indra/newview/llpanelpeople.cpp15
-rw-r--r--indra/newview/llpersonmodelcommon.cpp14
-rw-r--r--indra/newview/llpersonmodelcommon.h6
-rw-r--r--indra/newview/llpersontabview.cpp23
-rw-r--r--indra/newview/llpersontabview.h1
5 files changed, 49 insertions, 10 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 9956888134..07a1c46256 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -732,6 +732,7 @@ BOOL LLPanelPeople::postBuild()
folder_view_params.view_model = &mPersonFolderViewModel;
folder_view_params.root = NULL;
folder_view_params.use_ellipses = false;
+ folder_view_params.use_label_suffix = true;
folder_view_params.options_menu = "menu_conversation.xml";
folder_view_params.name = "fbcfolderview";
mPersonFolderView = LLUICtrlFactory::create<LLPersonFolderView>(folder_view_params);
@@ -1676,7 +1677,7 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends)
void LLPanelPeople::addTestParticipant()
{
std::string suffix("Aa");
- std::string prefix("Test Name");
+ std::string prefix("Second Life User Name Goes Here");
LLPersonTabModel * person_tab_model;
LLUUID agentID;
std::string name;
@@ -1717,11 +1718,15 @@ void LLPanelPeople::addParticipantToModel(LLPersonTabModel * person_folder_model
LLPersonModel* person_model = NULL;
LLAvatarName avatar_name;
- bool avatar_name_exists = LLAvatarNameCache::get(agent_id, &avatar_name);
-
- std::string aggregated_name = avatar_name_exists ? name + " (" + avatar_name.getDisplayName() + ") " : name;
+ bool has_name = LLAvatarNameCache::get(agent_id, &avatar_name);
+ std::string avatar_name_string;
+
+ if(has_name)
+ {
+ avatar_name_string = avatar_name.getDisplayName();
+ }
- person_model = new LLPersonModel(agent_id, aggregated_name, mPersonFolderViewModel);
+ person_model = new LLPersonModel(agent_id, name, avatar_name_string, mPersonFolderViewModel);
person_folder_model->addParticipant(person_model);
}
diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp
index b3424cc451..e48eddf05a 100644
--- a/indra/newview/llpersonmodelcommon.cpp
+++ b/indra/newview/llpersonmodelcommon.cpp
@@ -39,14 +39,24 @@
LLPersonModelCommon::LLPersonModelCommon(std::string display_name, LLFolderViewModelInterface& root_view_model) :
LLFolderViewModelItemCommon(root_view_model),
+ mLabelSuffix(""),
mID(LLUUID().generateNewID())
{
renameItem(display_name);
}
+LLPersonModelCommon::LLPersonModelCommon(std::string display_name, std::string suffix, LLFolderViewModelInterface& root_view_model) :
+LLFolderViewModelItemCommon(root_view_model),
+ mID(LLUUID().generateNewID())
+{
+ mLabelSuffix = suffix;
+ renameItem(display_name);
+}
+
LLPersonModelCommon::LLPersonModelCommon(LLFolderViewModelInterface& root_view_model) :
LLFolderViewModelItemCommon(root_view_model),
mName(""),
+ mLabelSuffix(""),
mSearchableName(""),
mPrevPassedAllFilters(false),
mID(LLUUID().generateNewID())
@@ -212,8 +222,8 @@ LLPersonModel* LLPersonTabModel::findParticipant(const LLUUID& person_id)
// LLPersonModel
//
-LLPersonModel::LLPersonModel(const LLUUID& agent_id, const std::string display_name, LLFolderViewModelInterface& root_view_model) :
-LLPersonModelCommon(display_name,root_view_model),
+LLPersonModel::LLPersonModel(const LLUUID& agent_id, const std::string display_name, const std::string suffix, LLFolderViewModelInterface& root_view_model) :
+LLPersonModelCommon(display_name, suffix, root_view_model),
mAgentID(agent_id)
{
}
diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h
index 5f3801874d..74598eaee0 100644
--- a/indra/newview/llpersonmodelcommon.h
+++ b/indra/newview/llpersonmodelcommon.h
@@ -40,6 +40,7 @@ class LLPersonModelCommon : public LLFolderViewModelItemCommon
public:
LLPersonModelCommon(std::string name, LLFolderViewModelInterface& root_view_model);
+ LLPersonModelCommon(std::string display_name, std::string suffix, LLFolderViewModelInterface& root_view_model);
LLPersonModelCommon(LLFolderViewModelInterface& root_view_model);
virtual ~LLPersonModelCommon();
@@ -51,7 +52,7 @@ public:
virtual LLPointer<LLUIImage> getIcon() const { return NULL; }
virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
- virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
+ virtual std::string getLabelSuffix() const { return mLabelSuffix; }
virtual BOOL isItemRenameable() const { return TRUE; }
virtual BOOL renameItem(const std::string& new_name);
virtual BOOL isItemMovable( void ) const { return FALSE; }
@@ -101,6 +102,7 @@ public:
protected:
std::string mName; // Name of the person
+ std::string mLabelSuffix;
std::string mSearchableName; // Name used in string matching for this person
bool mPrevPassedAllFilters;
LLUUID mID;
@@ -133,7 +135,7 @@ private:
class LLPersonModel : public LLPersonModelCommon
{
public:
- LLPersonModel(const LLUUID& agent_id, const std::string display_name, LLFolderViewModelInterface& root_view_model);
+ LLPersonModel(const LLUUID& agent_id, const std::string display_name, const std::string suffix, LLFolderViewModelInterface& root_view_model);
LLPersonModel(LLFolderViewModelInterface& root_view_model);
LLUUID getAgentID();
diff --git a/indra/newview/llpersontabview.cpp b/indra/newview/llpersontabview.cpp
index 6aa51febcb..16ebb6af90 100644
--- a/indra/newview/llpersontabview.cpp
+++ b/indra/newview/llpersontabview.cpp
@@ -182,6 +182,7 @@ void LLPersonView::addToFolder(LLFolderViewFolder * person_folder_view)
if(mPersonTabModel->mTabType == LLPersonTabModel::FB_SL_NON_SL_FRIEND)
{
mAvatarIcon->setVisible(TRUE);
+ mFacebookIcon->setVisible(TRUE);
}
else if(mPersonTabModel->mTabType == LLPersonTabModel::FB_ONLY_FRIEND)
{
@@ -286,7 +287,20 @@ void LLPersonView::draw()
F32 right_x = 0;
drawHighlight();
- drawLabel(font, text_left, y, color, right_x);
+ drawLabel(mLabel, font, text_left, y, color, right_x);
+
+ if(mLabelSuffix.length())
+ {
+ LLRect mFacebookIconRect = mFacebookIcon->getRect();
+ S32 new_left = right_x + 7;
+ mFacebookIconRect.set(new_left,
+ mFacebookIconRect.mTop,
+ new_left + mFacebookIconRect.getWidth(),
+ mFacebookIconRect.mBottom);
+ mFacebookIcon->setRect(mFacebookIconRect);
+ }
+
+ drawLabel(mLabelSuffix, font, mFacebookIcon->getRect().mRight + 7, y, color, right_x);
LLView::draw();
}
@@ -317,6 +331,13 @@ void LLPersonView::drawHighlight()
}
}
+void LLPersonView::drawLabel(const std::string text, const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x)
+{
+ font->renderUTF8(text, 0, x, y, color,
+ LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
+ S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, TRUE);
+}
+
void LLPersonView::initFromParams(const LLPersonView::Params & params)
{
LLIconCtrl::Params facebook_icon_params(params.facebook_icon());
diff --git a/indra/newview/llpersontabview.h b/indra/newview/llpersontabview.h
index 9839a1eaaf..6f244c2794 100644
--- a/indra/newview/llpersontabview.h
+++ b/indra/newview/llpersontabview.h
@@ -104,6 +104,7 @@ protected:
void draw();
void drawHighlight();
+ void drawLabel(const std::string text, const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x);
private: