summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-10-24 13:18:41 -0700
committerMerov Linden <merov@lindenlab.com>2012-10-24 13:18:41 -0700
commit68815045a629eeb0e4ab33c05d3773d272eafb50 (patch)
treee05ce287a9883c626cd02add7b015ec3aeb6ec3a /indra/newview
parent3f020d0be92859e1d9261261ccc9c377df700118 (diff)
CHUI-441 : WIP : Initial refactor part 2. Works but the list doesn't update in the torn off dialog.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llimconversation.cpp98
-rw-r--r--indra/newview/llimconversation.h13
-rw-r--r--indra/newview/llimfloater.cpp10
-rw-r--r--indra/newview/llimfloater.h4
-rw-r--r--indra/newview/llimfloatercontainer.cpp28
-rw-r--r--indra/newview/llimfloatercontainer.h3
-rw-r--r--indra/newview/skins/default/xui/en/floater_im_session.xml12
7 files changed, 132 insertions, 36 deletions
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index bd2a2419a8..1e268bcaf9 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -49,7 +49,7 @@ LLIMConversation::LLIMConversation(const LLSD& session_id)
, mTearOffBtn(NULL)
, mCloseBtn(NULL)
, mSessionID(session_id.asUUID())
- , mParticipantList(NULL)
+// , mParticipantList(NULL)
, mChatHistory(NULL)
, mInputEditor(NULL)
, mInputEditorTopPad(0)
@@ -73,11 +73,13 @@ LLIMConversation::LLIMConversation(const LLSD& session_id)
LLIMConversation::~LLIMConversation()
{
+ /*
if (mParticipantList)
{
delete mParticipantList;
mParticipantList = NULL;
}
+ */
delete mRefreshTimer;
}
@@ -127,11 +129,41 @@ BOOL LLIMConversation::postBuild()
mExpandCollapseBtn = getChild<LLButton>("expand_collapse_btn");
mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMConversation::onSlide, this));
- mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
-
mTearOffBtn = getChild<LLButton>("tear_off_btn");
mTearOffBtn->setCommitCallback(boost::bind(&LLIMConversation::onTearOffClicked, this));
+ mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
+
+ // Create a root view folder for all participants
+ LLConversationItem* base_item = new LLConversationItem(mConversationViewModel);
+ LLFolderView::Params p(LLUICtrlFactory::getDefaultParams<LLFolderView>());
+ //p.name = getName();
+ //p.title = getLabel();
+ p.rect = LLRect(0, 0, getRect().getWidth(), 0);
+ p.parent_panel = mParticipantListPanel;
+ //p.tool_tip = p.name;
+ p.listener = base_item;
+ p.view_model = &mConversationViewModel;
+ p.root = NULL;
+ p.use_ellipses = true;
+ //p.options_menu = "menu_conversation.xml";
+ mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
+ mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
+
+ // Add a scroller for the folder (participant) view
+ LLRect scroller_view_rect = mParticipantListPanel->getRect();
+ scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
+ LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams<LLFolderViewScrollContainer>());
+ scroller_params.rect(scroller_view_rect);
+ LLScrollContainer* scroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
+ scroller->setFollowsAll();
+ mParticipantListPanel->addChild(scroller);
+ scroller->addChild(mConversationsRoot);
+ mConversationsRoot->setScrollContainer(scroller);
+ mConversationsRoot->setFollowsAll();
+ mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
+
+
mChatHistory = getChild<LLChatHistory>("chat_history");
mInputEditor = getChild<LLChatEntry>("chat_editor");
@@ -167,15 +199,20 @@ BOOL LLIMConversation::postBuild()
return result;
}
+LLParticipantList* LLIMConversation::getParticipantList()
+{
+ return dynamic_cast<LLParticipantList*>(LLIMFloaterContainer::getInstance()->getSessionModel(mSessionID));
+}
+
void LLIMConversation::draw()
{
LLTransientDockableFloater::draw();
if (mRefreshTimer->hasExpired())
{
- if (mParticipantList)
+ if (getParticipantList())
{
- mParticipantList->update();
+ getParticipantList()->update();
}
refresh();
@@ -274,6 +311,7 @@ void LLIMConversation::appendMessage(const LLChat& chat, const LLSD &args)
void LLIMConversation::buildParticipantList()
{
+ /*
if (mIsNearbyChat)
{
LLLocalSpeakerMgr* speaker_manager = LLLocalSpeakerMgr::getInstance();
@@ -289,13 +327,57 @@ void LLIMConversation::buildParticipantList()
mParticipantList = new LLParticipantList(speaker_manager, getChild<LLAvatarList>("speakers_list"), mConversationViewModel, true, false);
}
}
- updateHeaderAndToolbar();
+ */
+
+ // Create the participants widgets now
+ // Note: inspired from LLIMFloaterContainer::addConversationListItem()
+ LLParticipantList* item = getParticipantList();
+ if (!item)
+ {
+ llinfos << "Merov debug : buildParticipantList, no list!" << llendl;
+ return;
+ }
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
+ 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(mConversationsRoot); // ! Not sure about that. TBC...
+ participant_view->setVisible(TRUE);
+ current_participant_model++;
+ }
+
+ //updateHeaderAndToolbar();
+}
+
+// Copied from LLIMFloaterContainer::createConversationViewParticipant(). Refactor opportunity!
+LLConversationViewParticipant* LLIMConversation::createConversationViewParticipant(LLConversationItem* item)
+{
+ LLConversationViewParticipant::Params params;
+ LLRect panel_rect = mParticipantListPanel->getRect();
+
+ params.name = item->getDisplayName();
+ //params.icon = bridge->getIcon();
+ //params.icon_open = bridge->getOpenIcon();
+ //params.creation_date = bridge->getCreationDate();
+ params.root = mConversationsRoot;
+ params.listener = item;
+
+ //24 is the the current hight of an item (itemHeight) loaded from conversation_view_participant.xml.
+ params.rect = LLRect (0, 24, panel_rect.getWidth(), 0);
+ params.tool_tip = params.name;
+ params.participant_id = item->getUUID();
+
+ llinfos << "Merov debug : LLIMConversation, create participant, name = " << item->getDisplayName() << llendl;
+
+ return LLUICtrlFactory::create<LLConversationViewParticipant>(params);
}
void LLIMConversation::onSortMenuItemClicked(const LLSD& userdata)
{
// TODO: Check this code when sort order menu will be added. (EM)
- if (!mParticipantList)
+ if (!getParticipantList())
{
return;
}
@@ -304,7 +386,7 @@ void LLIMConversation::onSortMenuItemClicked(const LLSD& userdata)
if (chosen_item == "sort_name")
{
- mParticipantList->setSortOrder(LLParticipantList::E_SORT_BY_NAME);
+ getParticipantList()->setSortOrder(LLParticipantList::E_SORT_BY_NAME);
}
}
diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h
index 603e0d0197..c3f885c8be 100644
--- a/indra/newview/llimconversation.h
+++ b/indra/newview/llimconversation.h
@@ -35,6 +35,7 @@
#include "lleventtimer.h"
#include "llimview.h"
#include "llconversationmodel.h"
+#include "llconversationview.h"
class LLPanelChatControlPanel;
class LLChatEntry;
@@ -114,10 +115,16 @@ protected:
LLIMModel::LLIMSession* mSession;
- LLLayoutPanel* mParticipantListPanel;
- LLParticipantList* mParticipantList;
- LLUUID mSessionID;
+ // Participants list: model and view
+ LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item);
+
+ LLUUID mSessionID;
+ LLLayoutPanel* mParticipantListPanel; // add the widgets to that see mConversationsListPanel
+ //LLParticipantList* mParticipantList; get this from the mConversationsItems for the moment
+ LLParticipantList* getParticipantList();
+ conversations_widgets_map mConversationsWidgets;
LLConversationViewModel mConversationViewModel;
+ LLFolderView* mConversationsRoot;
LLChatHistory* mChatHistory;
LLChatEntry* mInputEditor;
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 29e84e1332..9f7b3cd50b 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -582,10 +582,11 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl)
}
}
-void LLIMFloater::addToHost(const LLUUID& session_id, LLConversationItemSession* session_root_model, const bool force)
+void LLIMFloater::addToHost(const LLUUID& session_id, const bool force)
{
if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id))
{
+ llinfos << "Merov debug : addToHost, not added! multitab = " << LLIMConversation::isChatMultiTab() << ", has session = " << gIMMgr->hasSession(session_id) << llendl;
return;
}
@@ -593,12 +594,14 @@ void LLIMFloater::addToHost(const LLUUID& session_id, LLConversationItemSession*
bool exist = findInstance(session_id);
// Get the floater: this will create the instance if it didn't exist
- LLIMFloater* floater = getInstance(session_id, session_root_model);
+ LLIMFloater* floater = getInstance(session_id);
if (floater)
{
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
+ llinfos << "Merov debug : addToHost, done! exist = " << exist << llendl;
+
// Do not add again existing floaters
if (!exist)
{
@@ -672,12 +675,11 @@ LLIMFloater* LLIMFloater::findInstance(const LLUUID& session_id)
return conversation;
}
-LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id, LLConversationItemSession* session_root_model)
+LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id)
{
LLIMFloater* conversation =
LLFloaterReg::getTypedInstance<LLIMFloater>("impanel", session_id);
- conversation->setSessionRoot(session_root_model);
return conversation;
}
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index fd08612c32..26daf00afd 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -71,8 +71,8 @@ public:
// Check typing timeout timer.
static LLIMFloater* findInstance(const LLUUID& session_id);
- static LLIMFloater* getInstance(const LLUUID& session_id, LLConversationItemSession* session_root_model);
- static void addToHost(const LLUUID& session_id, LLConversationItemSession* session_root_model, const bool force = false);
+ static LLIMFloater* getInstance(const LLUUID& session_id);
+ static void addToHost(const LLUUID& session_id, const bool force = false);
// LLFloater overrides
/*virtual*/ void onClose(bool app_quitting);
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 75ccc56885..6f2b8bcf32 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -98,8 +98,10 @@ LLIMFloaterContainer::~LLIMFloaterContainer()
void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id)
{
- LLConversationItemSession* item = addConversationListItem(session_id, true);
- LLIMFloater::addToHost(session_id, item, true);
+ llinfos << "Merov debug : sessionAdded, adding LLIMFloater, id = " << session_id << llendl;
+ LLIMFloater::addToHost(session_id, true);
+ llinfos << "Merov debug : sessionAdded, adding conversation item, id = " << session_id << llendl;
+ addConversationListItem(session_id, true);
}
void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id)
@@ -109,8 +111,10 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std:
void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id)
{
- LLConversationItemSession* item = addConversationListItem(session_id, true);
- LLIMFloater::addToHost(session_id, item, true);
+ llinfos << "Merov debug : sessionVoiceOrIMStarted, adding LLIMFloater, id = " << session_id << llendl;
+ LLIMFloater::addToHost(session_id, true);
+ llinfos << "Merov debug : sessionVoiceOrIMStarted, adding conversation item, id = " << session_id << llendl;
+ addConversationListItem(session_id, true);
}
void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id)
@@ -129,6 +133,7 @@ void LLIMFloaterContainer::onCurrentChannelChanged(const LLUUID& session_id)
{
if (session_id != LLUUID::null)
{
+ llinfos << "Merov debug : onCurrentChannelChanged, LLIMFloater::show, id = " << session_id << llendl;
LLIMFloater::show(session_id);
}
}
@@ -343,6 +348,12 @@ LLIMFloaterContainer* LLIMFloaterContainer::getInstance()
return LLFloaterReg::getTypedInstance<LLIMFloaterContainer>("im_container");
}
+LLConversationItemSession* LLIMFloaterContainer::getSessionModel(const LLUUID& session_id)
+{
+ LLConversationItemSession* session_model = dynamic_cast<LLConversationItemSession*>(mConversationsItems[session_id]);
+ return session_model;
+}
+
void LLIMFloaterContainer::setMinimized(BOOL b)
{
if (isMinimized() == b) return;
@@ -813,6 +824,7 @@ void LLIMFloaterContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids)
//When a one-on-one conversation exists, retrieve the participant id from the conversation floater
else if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
{
+ llinfos << "Merov debug : getParticipantUUIDs, LLIMFloater::findInstance, id = " << conversationItem->getUUID() << llendl;
LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID());
LLUUID participantID = conversationFloater->getOtherParticipantUUID();
selected_uuids.push_back(participantID);
@@ -888,6 +900,7 @@ void LLIMFloaterContainer::doToSelectedConversation(const std::string& command,
{
//Find the conversation floater associated with the selected id
const LLConversationItem * conversationItem = getCurSelectedViewModelItem();
+ llinfos << "Merov debug : doToSelectedConversation, LLIMFloater::findInstance, id = " << conversationItem->getUUID() << llendl;
LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID());
if(conversationFloater)
@@ -1168,7 +1181,7 @@ void LLIMFloaterContainer::setNearbyDistances()
}
}
-LLConversationItemSession* LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/)
+LLConversationItem* LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/)
{
bool is_nearby_chat = uuid.isNull();
@@ -1180,7 +1193,9 @@ LLConversationItemSession* LLIMFloaterContainer::addConversationListItem(const L
conversations_items_map::iterator item_it = mConversationsItems.find(uuid);
if (item_it != mConversationsItems.end())
{
- return item_it->second;
+ llinfos << "Merov debug : addConversationListItem, item already present -> exit, id = " << uuid << llendl;
+ // HACK!!! DO NOT COMMIT!! Understand why this thing is already present...
+ //return item_it->second;
}
// Remove the conversation item that might exist already: it'll be recreated anew further down anyway
@@ -1196,6 +1211,7 @@ LLConversationItemSession* LLIMFloaterContainer::addConversationListItem(const L
}
if (!item)
{
+ llinfos << "Merov debug : Couldn't create conversation session item : " << display_name << llendl;
llwarns << "Couldn't create conversation session item : " << display_name << llendl;
return NULL;
}
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index 5823a47a8d..c5abc96162 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -92,6 +92,7 @@ public:
LLConversationViewModel& getRootViewModel() { return mConversationViewModel; }
LLUUID getSelectedSession() { return mSelectedSession; }
void setSelectedSession(LLUUID sessionID) { mSelectedSession = sessionID; }
+ LLConversationItemSession* getSessionModel(const LLUUID& session_id);
private:
typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
@@ -151,7 +152,7 @@ private:
// Conversation list implementation
public:
bool removeConversationListItem(const LLUUID& uuid, bool change_focus = true);
- LLConversationItemSession* addConversationListItem(const LLUUID& uuid, bool isWidgetSelected = false);
+ LLConversationItem* addConversationListItem(const LLUUID& uuid, bool isWidgetSelected = false);
void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
void setNearbyDistances();
diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml
index 2b542595c5..84fba0a3b3 100644
--- a/indra/newview/skins/default/xui/en/floater_im_session.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_session.xml
@@ -158,18 +158,6 @@
width="150"
height="310"
auto_resize="false">
- <avatar_list
- color="DkGray2"
- follows="all"
- height="310"
- ignore_online_status="true"
- layout="topleft"
- name="speakers_list"
- opaque="false"
- show_info_btn="true"
- show_profile_btn="false"
- show_speaking_indicator="false"
- width="150" />
</layout_panel>
<layout_panel
default_tab_group="3"