summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfolderviewmodel.h11
-rw-r--r--indra/newview/llimfloatercontainer.cpp85
-rw-r--r--indra/newview/llimfloatercontainer.h4
-rw-r--r--indra/newview/llparticipantlist.cpp13
4 files changed, 99 insertions, 14 deletions
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 16d9c86fd7..22bfc4dfb4 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -209,6 +209,7 @@ protected:
};
+
class LLFolderViewModelItemCommon : public LLFolderViewModelItem
{
public:
@@ -249,6 +250,8 @@ public:
std::string::size_type getFilterStringOffset();
std::string::size_type getFilterStringSize();
+ typedef std::list<LLFolderViewModelItem*> child_list_t;
+
virtual void addChild(LLFolderViewModelItem* child)
{
mChildren.push_back(child);
@@ -271,7 +274,11 @@ public:
mChildren.clear();
dirtyFilter();
}
-
+
+ child_list_t::const_iterator getChildrenBegin() const { return mChildren.begin(); }
+ child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); }
+ child_list_t::size_type getChildrenCount() const { return mChildren.size(); }
+
void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0)
{
mPassedFilter = passed;
@@ -325,8 +332,6 @@ protected:
S32 mLastFolderFilterGeneration;
S32 mMostFilteredDescendantGeneration;
-
- typedef std::list<LLFolderViewModelItem*> child_list_t;
child_list_t mChildren;
LLFolderViewModelItem* mParent;
LLFolderViewModelInterface& mRootViewModel;
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
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index d6dda8ea2d..300a820a26 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -37,6 +37,7 @@
#include "llgroupmgr.h"
#include "lltrans.h"
#include "llconversationmodel.h"
+#include "llconversationview.h"
class LLButton;
class LLLayoutPanel;
@@ -113,7 +114,8 @@ public:
void addConversationListItem(const LLUUID& uuid);
private:
- LLFolderViewItem* createConversationItemWidget(LLConversationItem* item);
+ LLConversationViewSession* createConversationItemWidget(LLConversationItem* item);
+ LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item);
// Conversation list data
LLPanel* mConversationsListPanel; // This is the main widget we add conversation widget to
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 35c1a34a26..fa3432fc89 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -648,10 +648,10 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
if (is_avatar)
{
- // Create a participant view model instance and add it to the linked list
+ // Create a participant view model instance
LLAvatarName avatar_name;
bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name);
- participant = new LLConversationItemParticipant(!has_name ? "Avatar" : avatar_name.mDisplayName , avatar_id, mRootViewModel);
+ participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.mDisplayName , avatar_id, mRootViewModel);
if (mAvatarList)
{
mAvatarList->getIDs().push_back(avatar_id);
@@ -661,7 +661,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
else
{
std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id);
- // Create a participant view model instance and add it to the linked list
+ // Create a participant view model instance
participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel);
if (mAvatarList)
{
@@ -672,6 +672,13 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
// *TODO : Merov : need to declare and bind a name update callback on that "participant" instance. See LLAvatarListItem::updateAvatarName() for pattern.
// For the moment, we'll get the correct name only if it's already in the name cache (see call to LLAvatarNameCache::get() here above)
+
+ // *TODO : Merov : need to update the online/offline status of the participant.
+ // Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id))
+
+ llinfos << "Merov debug : added participant, name = " << participant->getName() << llendl;
+
+ // Add the participant model to the session's children list
addParticipant(participant);
adjustParticipant(avatar_id);