summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimsessiontab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterimsessiontab.cpp')
-rw-r--r--indra/newview/llfloaterimsessiontab.cpp72
1 files changed, 38 insertions, 34 deletions
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index 6fbc713590..22131eac49 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -52,6 +52,7 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id)
, mCloseBtn(NULL)
, mSessionID(session_id.asUUID())
, mConversationsRoot(NULL)
+ , mScroller(NULL)
, mChatHistory(NULL)
, mInputEditor(NULL)
, mInputEditorTopPad(0)
@@ -68,10 +69,6 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id)
boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemCheck, this, _2));
mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable",
boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemEnable, this, _2));
-
- // Zero expiry time is set only once to allow initial update.
- mRefreshTimer->setTimerExpirySec(0);
- mRefreshTimer->start();
}
LLFloaterIMSessionTab::~LLFloaterIMSessionTab()
@@ -195,33 +192,16 @@ BOOL LLFloaterIMSessionTab::postBuild()
mParticipantListPanel = getChild<LLLayoutPanel>("speakers_list_panel");
- // Create a root view folder for all participants
- LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel);
- LLFolderView::Params p(LLUICtrlFactory::getDefaultParams<LLFolderView>());
- p.rect = LLRect(0, 0, getRect().getWidth(), 0);
- p.parent_panel = mParticipantListPanel;
- p.listener = base_item;
- p.view_model = &mConversationViewModel;
- p.root = NULL;
- p.use_ellipses = true;
- 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();
-
- // Insert that scroller into the panel widgets hierarchy and folder view
- mParticipantListPanel->addChild(scroller);
- scroller->addChild(mConversationsRoot);
- mConversationsRoot->setScrollContainer(scroller);
- mConversationsRoot->setFollowsAll();
- mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
+ mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
+ mScroller->setFollowsAll();
+ // Insert that scroller into the panel widgets hierarchy
+ mParticipantListPanel->addChild(mScroller);
mChatHistory = getChild<LLChatHistory>("chat_history");
@@ -235,8 +215,6 @@ BOOL LLFloaterIMSessionTab::postBuild()
setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE);
- buildConversationViewParticipant();
-
mSaveRect = isTornOff();
initRectControl();
@@ -249,8 +227,14 @@ BOOL LLFloaterIMSessionTab::postBuild()
result = LLDockableFloater::postBuild();
}
+ // Now ready to build the conversation and participants list
+ buildConversationViewParticipant();
refreshConversation();
-
+
+ // Zero expiry time is set only once to allow initial update.
+ mRefreshTimer->setTimerExpirySec(0);
+ mRefreshTimer->start();
+
return result;
}
@@ -276,9 +260,8 @@ void LLFloaterIMSessionTab::draw()
{
buildConversationViewParticipant();
}
+ refreshConversation();
}
-
- refreshConversation();
// Restart the refresh timer
mRefreshTimer->setTimerExpirySec(REFRESH_INTERVAL);
@@ -390,7 +373,31 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant()
// Nothing to do if the model list is inexistent
return;
}
-
+
+ // Create or recreate the root folder: this is a dummy folder (not shown) but required by the LLFolderView architecture
+ // We need to redo this when rebuilding as the session id (mSessionID) *may* have changed
+ if (mConversationsRoot)
+ {
+ // Remove the old root if any
+ mScroller->removeChild(mConversationsRoot);
+ }
+ // Create the root using an ad-hoc base item
+ LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel);
+ LLFolderView::Params p(LLUICtrlFactory::getDefaultParams<LLFolderView>());
+ p.rect = LLRect(0, 0, getRect().getWidth(), 0);
+ p.parent_panel = mParticipantListPanel;
+ p.listener = base_item;
+ p.view_model = &mConversationViewModel;
+ p.root = NULL;
+ p.use_ellipses = true;
+ mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
+ mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
+ // Attach that root to the scroller
+ mScroller->addChild(mConversationsRoot);
+ mConversationsRoot->setScrollContainer(mScroller);
+ mConversationsRoot->setFollowsAll();
+ mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox);
+
// Create the participants widgets now
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd();
@@ -420,7 +427,6 @@ void LLFloaterIMSessionTab::addConversationViewParticipant(LLConversationItem* p
participant_view->addToFolder(mConversationsRoot);
participant_view->addToSession(mSessionID);
participant_view->setVisible(TRUE);
- refreshConversation();
}
}
@@ -432,7 +438,6 @@ void LLFloaterIMSessionTab::removeConversationViewParticipant(const LLUUID& part
mConversationsRoot->extractItem(widget);
delete widget;
mConversationsWidgets.erase(participant_id);
- refreshConversation();
}
}
@@ -443,7 +448,6 @@ void LLFloaterIMSessionTab::updateConversationViewParticipant(const LLUUID& part
{
widget->refresh();
}
- refreshConversation();
}
void LLFloaterIMSessionTab::refreshConversation()