summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-05-06 11:31:22 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2013-05-06 11:31:22 -0700
commite30c0925f517b18830b7a4d520246acd98981ab3 (patch)
tree90fa81816cd4a03892ce2646360897f601375daf
parentcca67a38d89da30d2b36690d91eb00cac04384bd (diff)
ACME-326 Populate the list with FB users who use SL but are not yet SL friends: Code cleanup
-rw-r--r--indra/newview/llpanelpeople.cpp12
-rw-r--r--indra/newview/llpersonfolderview.cpp68
-rw-r--r--indra/newview/llpersonfolderview.h7
3 files changed, 49 insertions, 38 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index f9f4d6d1b6..56523773b8 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -1664,10 +1664,10 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends)
}
//Add to folder view
- LLPersonTabModel * session_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->mPersonFolderModelMap[mPersonFolderView->mPersonTabIDs[model_index]]);
- if(session_model)
+ LLPersonTabModel * person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(model_index));
+ if(person_tab_model)
{
- addParticipantToModel(session_model, agent_id, name);
+ addParticipantToModel(person_tab_model, agent_id, name);
}
}
}
@@ -1676,7 +1676,7 @@ void LLPanelPeople::addTestParticipant()
{
std::string suffix("Aa");
std::string prefix("Test Name");
- LLPersonTabModel * person_folder_model;
+ LLPersonTabModel * person_tab_model;
LLUUID agentID;
std::string name;
S32 model_index;
@@ -1696,9 +1696,9 @@ void LLPanelPeople::addTestParticipant()
agentID = LLUUID(NULL);
}
- person_folder_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->mPersonFolderModelMap[mPersonFolderView->mPersonTabIDs[model_index]]);
+ person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(model_index));
name = prefix + " " + suffix;
- addParticipantToModel(person_folder_model, agentID, name);
+ addParticipantToModel(person_tab_model, agentID, name);
// Next suffix : Aa, Ab, Ac ... Az, Ba, Bb, Bc ... Bz, Ca, Cb ...
suffix[1]+=1;
if (suffix[1]=='{')
diff --git a/indra/newview/llpersonfolderview.cpp b/indra/newview/llpersonfolderview.cpp
index 8f468e6814..191c7d5bcd 100644
--- a/indra/newview/llpersonfolderview.cpp
+++ b/indra/newview/llpersonfolderview.cpp
@@ -47,29 +47,6 @@ LLPersonFolderView::~LLPersonFolderView()
mConversationsEventStream.stopListening("ConversationsRefresh");
}
-void LLPersonFolderView::createPersonTabs()
-{
- createPersonTab("SL residents you may want to friend");
- createPersonTab("Invite people you know to SL");
-}
-
-void LLPersonFolderView::createPersonTab(const std::string& tab_name)
-{
- //Create a person tab
- LLPersonTabModel* item = new LLPersonTabModel(tab_name, *mViewModel);
- LLPersonTabView::Params params;
- params.name = item->getDisplayName();
- params.root = this;
- params.listener = item;
- params.tool_tip = params.name;
- LLPersonTabView * widget = LLUICtrlFactory::create<LLPersonTabView>(params);
- widget->addToFolder(this);
-
- mPersonTabIDs.push_back(item->getID());
- mPersonFolderModelMap[item->getID()] = item;
- mPersonFolderViewMap[item->getID()] = widget;
-}
-
BOOL LLPersonFolderView::handleMouseDown( S32 x, S32 y, MASK mask )
{
LLFolderViewItem * item = getCurSelectedItem();
@@ -97,6 +74,29 @@ BOOL LLPersonFolderView::handleMouseDown( S32 x, S32 y, MASK mask )
return LLView::handleMouseDown( x, y, mask );
}
+void LLPersonFolderView::createPersonTabs()
+{
+ createPersonTab("SL residents you may want to friend");
+ createPersonTab("Invite people you know to SL");
+}
+
+void LLPersonFolderView::createPersonTab(const std::string& tab_name)
+{
+ //Create a person tab
+ LLPersonTabModel* item = new LLPersonTabModel(tab_name, *mViewModel);
+ LLPersonTabView::Params params;
+ params.name = item->getDisplayName();
+ params.root = this;
+ params.listener = item;
+ params.tool_tip = params.name;
+ LLPersonTabView * widget = LLUICtrlFactory::create<LLPersonTabView>(params);
+ widget->addToFolder(this);
+
+ mIndexToFolderVec.push_back(item->getID());
+ mPersonFolderModelMap[item->getID()] = item;
+ mPersonFolderViewMap[item->getID()] = widget;
+}
+
bool LLPersonFolderView::onConversationModelEvent(const LLSD &event)
{
std::string type = event.get("type").asString();
@@ -105,17 +105,17 @@ bool LLPersonFolderView::onConversationModelEvent(const LLSD &event)
if(type == "add_participant")
{
- LLPersonTabModel * person_folder_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderModelMap[folder_id]);
- LLPersonTabView * person_folder_view = dynamic_cast<LLPersonTabView *>(mPersonFolderViewMap[folder_id]);
+ LLPersonTabModel * person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderModelMap[folder_id]);
+ LLPersonTabView * person_tab_view = dynamic_cast<LLPersonTabView *>(mPersonFolderViewMap[folder_id]);
- if(person_folder_model)
+ if(person_tab_model)
{
- LLPersonModel * person_model = person_folder_model->findParticipant(person_id);
+ LLPersonModel * person_model = person_tab_model->findParticipant(person_id);
if(person_model)
{
- LLPersonView * participant_view = createConversationViewParticipant(person_model);
- participant_view->addToFolder(person_folder_view);
+ LLPersonView * person_view = createConversationViewParticipant(person_model);
+ person_view->addToFolder(person_tab_view);
}
}
}
@@ -137,3 +137,13 @@ LLPersonView * LLPersonFolderView::createConversationViewParticipant(LLPersonMod
return LLUICtrlFactory::create<LLPersonView>(params);
}
+
+LLPersonTabModel * LLPersonFolderView::getPersonTabModelByIndex(const S32 index)
+{
+ return mPersonFolderModelMap[mIndexToFolderVec[index]];
+}
+
+LLPersonTabView * LLPersonFolderView::getPersonTabViewByIndex(const S32 index)
+{
+ return mPersonFolderViewMap[mIndexToFolderVec[index]];
+}
diff --git a/indra/newview/llpersonfolderview.h b/indra/newview/llpersonfolderview.h
index 3f5f874e0f..3a15f59164 100644
--- a/indra/newview/llpersonfolderview.h
+++ b/indra/newview/llpersonfolderview.h
@@ -50,18 +50,19 @@ public:
LLPersonFolderView(const Params &p);
~LLPersonFolderView();
+ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
void createPersonTabs();
void createPersonTab(const std::string& tab_name);
-
bool onConversationModelEvent(const LLSD &event);
LLPersonView * createConversationViewParticipant(LLPersonModel * item);
- BOOL handleMouseDown( S32 x, S32 y, MASK mask );
+ LLPersonTabModel * getPersonTabModelByIndex(const S32 index);
+ LLPersonTabView * getPersonTabViewByIndex(const S32 index);
person_folder_model_map mPersonFolderModelMap;
person_folder_view_map mPersonFolderViewMap;
- std::vector<LLUUID> mPersonTabIDs;
+ std::vector<LLUUID> mIndexToFolderVec;
LLEventStream mConversationsEventStream;
};