summaryrefslogtreecommitdiff
path: root/indra/newview/llimfloatercontainer.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-08-30 21:34:48 -0700
committerMerov Linden <merov@lindenlab.com>2012-08-30 21:34:48 -0700
commitab37263a5cda14227724181c771ac1d3ef55f467 (patch)
tree76e17dafc83a8a8ded92c9ad5494d31dda56ce73 /indra/newview/llimfloatercontainer.cpp
parent9ff67f4a040fae53f28aa981309bce2356df1445 (diff)
CHUI-285 : LLIMFloaterContainer is now using LLParticipantList fully
Diffstat (limited to 'indra/newview/llimfloatercontainer.cpp')
-rw-r--r--indra/newview/llimfloatercontainer.cpp85
1 files changed, 78 insertions, 7 deletions
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 55cbf0b266..aa85e5023d 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -442,14 +442,36 @@ void LLIMFloaterContainer::repositioningWidgets()
int index = 0;
for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
widget_it != mConversationsWidgets.end();
- widget_it++, ++index)
+ widget_it++)
{
- LLFolderViewItem* widget = widget_it->second;
+ LLFolderViewFolder* widget = dynamic_cast<LLFolderViewFolder*>(widget_it->second);
widget->setVisible(TRUE);
widget->setRect(LLRect(0,
panel_rect.getHeight() - item_height*index,
panel_rect.getWidth(),
panel_rect.getHeight() - item_height*(index+1)));
+ index++;
+ // Reposition the children as well
+ // Merov : This is highly suspiscious but gets the debug hack to work. This needs to be revised though.
+ if (widget->getItemsCount() != 0)
+ {
+ BOOL is_open = widget->isOpen();
+ widget->setOpen(TRUE);
+ LLFolderViewFolder::items_t::const_iterator current = widget->getItemsBegin();
+ LLFolderViewFolder::items_t::const_iterator end = widget->getItemsEnd();
+ while (current != end)
+ {
+ LLFolderViewItem* item = (*current);
+ item->setVisible(TRUE);
+ item->setRect(LLRect(0,
+ panel_rect.getHeight() - item_height*index,
+ panel_rect.getWidth(),
+ panel_rect.getHeight() - item_height*(index+1)));
+ index++;
+ current++;
+ }
+ widget->setOpen(is_open);
+ }
}
}
@@ -490,19 +512,51 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
mConversationsItems[uuid] = item;
// Create a widget from it
- LLFolderViewItem* widget = createConversationItemWidget(item);
+ LLConversationViewSession* widget = createConversationItemWidget(item);
mConversationsWidgets[uuid] = widget;
- // Add a new conversation widget to the root folder of a folder view.
+ // Add a new conversation widget to the root folder of the folder view
widget->addToFolder(mConversationsRoot);
// Add it to the UI
+ mConversationsListPanel->addChild(widget);
widget->setVisible(TRUE);
+
+ // Create the participants widgets now
+ // Note: usually, we do not get an updated avatar list at that point
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
+ llinfos << "Merov debug : create participant, children size = " << item->getChildrenCount() << llendl;
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model);
+ LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model);
+ participant_view->addToFolder(widget);
+ mConversationsListPanel->addChild(participant_view);
+ 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();
- mConversationsListPanel->addChild(widget);
-
return;
}
@@ -537,7 +591,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c
}
}
-LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item)
+LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item)
{
LLConversationViewSession::Params params;
@@ -554,4 +608,21 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat
return LLUICtrlFactory::create<LLConversationViewSession>(params);
}
+LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item)
+{
+ LLConversationViewSession::Params params;
+
+ params.name = item->getDisplayName();
+ //params.icon = bridge->getIcon();
+ //params.icon_open = bridge->getOpenIcon();
+ //params.creation_date = bridge->getCreationDate();
+ params.root = mConversationsRoot;
+ params.listener = item;
+ params.rect = LLRect (0, 0, 0, 0);
+ params.tool_tip = params.name;
+ params.container = this;
+
+ return LLUICtrlFactory::create<LLConversationViewParticipant>(params);
+}
+
// EOF