summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-05-10 18:29:00 -0700
committerMerov Linden <merov@lindenlab.com>2013-05-10 18:29:00 -0700
commitcc87c6785258cb04f11cb79ce2e9899d33f11e03 (patch)
treefcc057e96fbd8af5a5664bf4036d79ce4c6e92e0 /indra/newview
parent7c4bfc8f55ebc581ddac0c2394b07b24d240d1a6 (diff)
parentfb27eae15502cbd2a13cde018ae67f961320d0ba (diff)
Pull merge from viewer-fbc
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelpeople.cpp17
-rw-r--r--indra/newview/llpersonmodelcommon.cpp14
-rw-r--r--indra/newview/llpersonmodelcommon.h6
-rw-r--r--indra/newview/llpersontabview.cpp30
-rw-r--r--indra/newview/llpersontabview.h1
5 files changed, 57 insertions, 11 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 8648a44c55..542597f98b 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -705,7 +705,8 @@ 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";
mPersonFolderView = LLUICtrlFactory::create<LLPersonFolderView>(folder_view_params);
@@ -1654,7 +1655,7 @@ void LLPanelPeople::openFacebookWeb(std::string url)
void LLPanelPeople::addTestParticipant()
{
std::string suffix("Aa");
- std::string prefix("Test Name");
+ std::string prefix("FB Name");
LLPersonTabModel * person_tab_model;
LLUUID agentID;
std::string name;
@@ -1695,11 +1696,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 = agent_id.notNull() ? LLAvatarNameCache::get(agent_id, &avatar_name) : false;
+ 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, avatar_name_string, name, 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..34ffc6ffce 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();
@@ -182,6 +184,18 @@ void LLPersonView::addToFolder(LLFolderViewFolder * person_folder_view)
if(mPersonTabModel->mTabType == LLPersonTabModel::FB_SL_NON_SL_FRIEND)
{
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)
{
@@ -286,7 +300,14 @@ void LLPersonView::draw()
F32 right_x = 0;
drawHighlight();
- drawLabel(font, text_left, 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();
}
@@ -317,6 +338,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: