From 2d65482d7152b613409a071e0a117d38f350932a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 8 May 2013 15:26:45 -0700 Subject: 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 --- indra/newview/llpanelpeople.cpp | 15 ++++++++++----- indra/newview/llpersonmodelcommon.cpp | 14 ++++++++++++-- indra/newview/llpersonmodelcommon.h | 6 ++++-- indra/newview/llpersontabview.cpp | 23 ++++++++++++++++++++++- indra/newview/llpersontabview.h | 1 + 5 files changed, 49 insertions(+), 10 deletions(-) (limited to 'indra/newview') 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(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 getIcon() const { return NULL; } virtual LLPointer 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: -- cgit v1.2.3 From 359c3d520eaf8de818081db32812387416add26a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 9 May 2013 16:02:03 -0700 Subject: ACME-342 Format the PersonView so that it shows the avatar icon, SL name, FB icon, and FB name: Rendering now matches the UX spec. --- indra/newview/llpanelpeople.cpp | 6 +++--- indra/newview/llpersontabview.cpp | 25 +++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 07a1c46256..420225f260 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -731,7 +731,7 @@ BOOL LLPanelPeople::postBuild() folder_view_params.listener = base_item; folder_view_params.view_model = &mPersonFolderViewModel; folder_view_params.root = NULL; - folder_view_params.use_ellipses = false; + folder_view_params.use_ellipses = true; folder_view_params.use_label_suffix = true; folder_view_params.options_menu = "menu_conversation.xml"; folder_view_params.name = "fbcfolderview"; @@ -1677,7 +1677,7 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends) void LLPanelPeople::addTestParticipant() { std::string suffix("Aa"); - std::string prefix("Second Life User Name Goes Here"); + std::string prefix("Facebook User Name"); LLPersonTabModel * person_tab_model; LLUUID agentID; std::string name; @@ -1726,7 +1726,7 @@ void LLPanelPeople::addParticipantToModel(LLPersonTabModel * person_folder_model avatar_name_string = avatar_name.getDisplayName(); } - person_model = new LLPersonModel(agent_id, name, avatar_name_string, mPersonFolderViewModel); + person_model = new LLPersonModel(agent_id, avatar_name_string, name, mPersonFolderViewModel); person_folder_model->addParticipant(person_model); } diff --git a/indra/newview/llpersontabview.cpp b/indra/newview/llpersontabview.cpp index 16ebb6af90..d4c73cd53f 100644 --- a/indra/newview/llpersontabview.cpp +++ b/indra/newview/llpersontabview.cpp @@ -173,6 +173,8 @@ S32 LLPersonView::getLabelXPos() void LLPersonView::addToFolder(LLFolderViewFolder * person_folder_view) { + const LLFontGL * font = LLFontGL::getFontSansSerifSmall(); + LLFolderViewItem::addToFolder(person_folder_view); //Added item to folder could change folder's mHasVisibleChildren flag so call arrange person_folder_view->requestArrange(); @@ -183,6 +185,17 @@ void LLPersonView::addToFolder(LLFolderViewFolder * person_folder_view) { mAvatarIcon->setVisible(TRUE); mFacebookIcon->setVisible(TRUE); + + S32 label_width = font->getWidth(mLabel); + F32 text_left = (F32)getLabelXPos(); + + LLRect mFacebookIconRect = mFacebookIcon->getRect(); + S32 new_left = text_left + label_width + 7; + mFacebookIconRect.set(new_left, + mFacebookIconRect.mTop, + new_left + mFacebookIconRect.getWidth(), + mFacebookIconRect.mBottom); + mFacebookIcon->setRect(mFacebookIconRect); } else if(mPersonTabModel->mTabType == LLPersonTabModel::FB_ONLY_FRIEND) { @@ -288,18 +301,6 @@ void LLPersonView::draw() drawHighlight(); 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(); -- cgit v1.2.3 From fb27eae15502cbd2a13cde018ae67f961320d0ba Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 9 May 2013 17:36:04 -0700 Subject: ACME-342 Format the PersonView so that it shows the avatar icon, SL name, FB icon, and FB name: Found a couple bugs that were causing the positioning of text to be incorrect in the 'Peope you may want to friend' tab. --- indra/newview/llpanelpeople.cpp | 4 ++-- indra/newview/llpersontabview.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 420225f260..2bdfdf6687 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1677,7 +1677,7 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends) void LLPanelPeople::addTestParticipant() { std::string suffix("Aa"); - std::string prefix("Facebook User Name"); + std::string prefix("FB Name"); LLPersonTabModel * person_tab_model; LLUUID agentID; std::string name; @@ -1718,7 +1718,7 @@ void LLPanelPeople::addParticipantToModel(LLPersonTabModel * person_folder_model LLPersonModel* person_model = NULL; LLAvatarName avatar_name; - bool has_name = LLAvatarNameCache::get(agent_id, &avatar_name); + bool has_name = agent_id.notNull() ? LLAvatarNameCache::get(agent_id, &avatar_name) : false; std::string avatar_name_string; if(has_name) diff --git a/indra/newview/llpersontabview.cpp b/indra/newview/llpersontabview.cpp index d4c73cd53f..34ffc6ffce 100644 --- a/indra/newview/llpersontabview.cpp +++ b/indra/newview/llpersontabview.cpp @@ -300,8 +300,14 @@ void LLPersonView::draw() F32 right_x = 0; drawHighlight(); - drawLabel(mLabel, font, text_left, y, color, right_x); - drawLabel(mLabelSuffix, font, mFacebookIcon->getRect().mRight + 7, y, color, right_x); + if(mLabel.length()) + { + drawLabel(mLabel, font, text_left, y, color, right_x); + } + if(mLabelSuffix.length()) + { + drawLabel(mLabelSuffix, font, mFacebookIcon->getRect().mRight + 7, y, color, right_x); + } LLView::draw(); } -- cgit v1.2.3