summaryrefslogtreecommitdiff
path: root/indra/newview/llimfloatercontainer.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-09-04 22:11:28 -0700
committerMerov Linden <merov@lindenlab.com>2012-09-04 22:11:28 -0700
commit8cd5d361600f34a0a7fa504a721bea3301191644 (patch)
tree722fddff8ad34e034029a6f3f89ee98f5ca00ac6 /indra/newview/llimfloatercontainer.cpp
parentab37263a5cda14227724181c771ac1d3ef55f467 (diff)
CHUI-285 : Create participant widgets in the conversation list
Diffstat (limited to 'indra/newview/llimfloatercontainer.cpp')
-rw-r--r--indra/newview/llimfloatercontainer.cpp75
1 files changed, 55 insertions, 20 deletions
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index aa85e5023d..dfe9e6491d 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -289,6 +289,59 @@ void LLIMFloaterContainer::setMinimized(BOOL b)
void LLIMFloaterContainer::draw()
{
+ // CHUI Notes
+ // Currently, the model is not responsible for creating the view which is a good thing. This means that
+ // the model could change substantially and the view could decide to echo only a portion of this model.
+ // Consequently, the participant views need to be created either by the session view or by the container panel.
+ // For the moment, we create them here (which makes for complicated code...) to conform to the pattern
+ // implemented in llinventorypanel.cpp (see LLInventoryPanel::buildNewViews()).
+ // The best however would be to have an observer on the model so that we would not pool on each draw to know
+ // if the view needs refresh. The current implementation (testing for change on draw) is less
+ // efficient perf wise than a listener/observer scheme. We will implement that shortly.
+
+ // On each session in mConversationsItems
+ for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
+ {
+ // Get the current session descriptors
+ LLConversationItem* session_model = it_session->second;
+ LLUUID session_id = it_session->first;
+ LLConversationViewSession* session_view = dynamic_cast<LLConversationViewSession*>(mConversationsWidgets[session_id]);
+ // If the session model has been changed, refresh the corresponding view
+ if (session_model->needsRefresh())
+ {
+ session_view->refresh();
+ }
+ // Iterate through each model participant child
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = session_model->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = session_model->getChildrenEnd();
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
+ LLUUID participant_id = participant_model->getUUID();
+ LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id);
+ // Is there a corresponding view? If not create it
+ if (!participant_view)
+ {
+ participant_view = createConversationViewParticipant(participant_model);
+ participant_view->addToFolder(session_view);
+ mConversationsListPanel->addChild(participant_view);
+ participant_view->setVisible(TRUE);
+ }
+ else
+ // Else, see if it needs refresh
+ {
+ if (participant_model->needsRefresh())
+ {
+ participant_view->refresh();
+ }
+ }
+ // Reset the need for refresh
+ session_model->resetRefresh();
+ // Next participant
+ current_participant_model++;
+ }
+ }
+
if (mTabContainer->getTabCount() == 0)
{
// Do not close the container when every conversation is torn off because the user
@@ -536,24 +589,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
participant_view->setVisible(TRUE);
current_participant_model++;
}
- // Debugging hack : uncomment to force the creation of a dummy participant
- // This hack is to be eventually deleted
- if (item->getChildrenCount() == 0)
- {
- llinfos << "Merov debug : create dummy participant" << llendl;
- // Create a dummy participant : we let that leak but that's just for debugging...
- std::string name("Debug Test : ");
- name += display_name;
- LLUUID test_id;
- test_id.generate(name);
- LLConversationItemParticipant* participant_model = new LLConversationItemParticipant(name, test_id, getRootViewModel());
- // Create the dummy widget
- LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model);
- participant_view->addToFolder(widget);
- mConversationsListPanel->addChild(participant_view);
- participant_view->setVisible(TRUE);
- }
- // End debugging hack
repositioningWidgets();
@@ -610,7 +645,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL
LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item)
{
- LLConversationViewSession::Params params;
+ LLConversationViewParticipant::Params params;
params.name = item->getDisplayName();
//params.icon = bridge->getIcon();
@@ -620,7 +655,7 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti
params.listener = item;
params.rect = LLRect (0, 0, 0, 0);
params.tool_tip = params.name;
- params.container = this;
+ params.participant_id = item->getUUID();
return LLUICtrlFactory::create<LLConversationViewParticipant>(params);
}