From fac210075f4c68db372ae0535e332ffe9765a5d1 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Mon, 7 May 2012 22:40:56 +0300 Subject: CHUI-105 WIP Added tear-off and return behavior for IM floater. XUI changed for Converstions multifloater and IM floater. --- indra/newview/llimfloatercontainer.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c8e48b0d42..9b5055fb98 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -56,6 +56,9 @@ BOOL LLIMFloaterContainer::postBuild() mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1)); // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button // mTabContainer will be initialized in LLMultiFloater::addChild() + + setTabContainer(getChild("im_box_tab_container")); + return TRUE; } @@ -74,6 +77,7 @@ void LLIMFloaterContainer::onOpen(const LLSD& key) */ } +// virtual void LLIMFloaterContainer::addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point) @@ -89,6 +93,12 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); + LLView* floater_contents = floaterp->getChild("contents_view"); + + // we don't show the header when the floater is hosted, + // so reshape floater contents to occupy the header space + floater_contents->setShape(floaterp->getRect()); + LLUUID session_id = floaterp->getKey(); LLIconCtrl* icon = 0; @@ -116,6 +126,20 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, mTabContainer->setTabImage(floaterp, icon); } +// virtual +void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) +{ + LLMultiFloater::removeFloater(floaterp); + + LLRect contents_rect = floaterp->getRect(); + + // reduce the floater contents height by header height + contents_rect.mTop -= floaterp->getHeaderHeight(); + + LLView* floater_contents = floaterp->getChild("contents_view"); + floater_contents->setShape(contents_rect); +} + void LLIMFloaterContainer::onCloseFloater(LLUUID& id) { mSessions.erase(id); -- cgit v1.2.3 From 7eaeb88bc37a747ff82fd37df84592f54c88cdbf Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 10 May 2012 20:40:15 +0300 Subject: CHUI-105 WIP Added expand/collapse behavior for Conversations floater messages pane. --- indra/newview/llimfloatercontainer.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9b5055fb98..c8b8cb208d 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -40,6 +40,7 @@ // LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed) + ,mMessagesPaneWidth(0) { mAutoResize = FALSE; LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); @@ -185,4 +186,29 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +void LLIMFloaterContainer::toggleMessagesPane(bool expand) +{ + LLView* messages_pane = getChild("im_box_tab_container"); + bool is_expanded = messages_pane->getVisible(); + if (is_expanded == expand) + { + return; + } + + // Store the messages pane width before collapsing it. + if (!expand) + { + LLView* conversations_pane = getChild("conversations_pane"); + S32 horizontal_pad = messages_pane->getRect().mLeft - conversations_pane->getRect().mRight; + mMessagesPaneWidth = messages_pane->getRect().getWidth() + horizontal_pad; + } + + // Show/hide the messages pane. + messages_pane->setVisible(expand); + + S32 floater_width = getRect().getWidth(); + floater_width += (expand ? mMessagesPaneWidth : -mMessagesPaneWidth); + reshape(floater_width, getRect().getHeight()); +} + // EOF -- cgit v1.2.3 From f59aa880395d4b744c89b0a375b21ee2bf429625 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 17 May 2012 02:51:18 +0300 Subject: CHUI-105 WIP Implemented collapsed/expanded state transitions for messages and conversation panes. The states and dimensions of Conversations floater panes are saved in per account settings. --- indra/newview/llimfloatercontainer.cpp | 133 +++++++++++++++++++++++++++++---- 1 file changed, 117 insertions(+), 16 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c8b8cb208d..b051440589 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -28,19 +28,23 @@ #include "llviewerprecompiledheaders.h" #include "llimfloatercontainer.h" + #include "llfloaterreg.h" -#include "llimview.h" +#include "lllayoutstack.h" + +#include "llagent.h" #include "llavatariconctrl.h" #include "llgroupiconctrl.h" -#include "llagent.h" +#include "llimview.h" #include "lltransientfloatermgr.h" +#include "llviewercontrol.h" // // LLIMFloaterContainer // LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed) - ,mMessagesPaneWidth(0) + ,mExpandCollapseBtn(NULL) { mAutoResize = FALSE; LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); @@ -50,6 +54,9 @@ LLIMFloaterContainer::~LLIMFloaterContainer() { mNewMessageConnection.disconnect(); LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); + + gSavedPerAccountSettings.setBOOL("ConversationsListPaneCollapsed", mConversationsPane->isCollapsed()); + gSavedPerAccountSettings.setBOOL("ConversationsMessagePaneCollapsed", mMessagesPane->isCollapsed()); } BOOL LLIMFloaterContainer::postBuild() @@ -60,6 +67,16 @@ BOOL LLIMFloaterContainer::postBuild() setTabContainer(getChild("im_box_tab_container")); + mConversationsStack = getChild("conversations_stack"); + mConversationsPane = getChild("conversations_layout_panel"); + mMessagesPane = getChild("messages_layout_panel"); + + mExpandCollapseBtn = getChild("expand_collapse_btn"); + mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); + + collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed")); + collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed")); + return TRUE; } @@ -146,6 +163,37 @@ void LLIMFloaterContainer::onCloseFloater(LLUUID& id) mSessions.erase(id); } +// virtual +void LLIMFloaterContainer::computeResizeLimits(S32& new_min_width, S32& new_min_height) +{ + bool is_left_pane_expanded = !mConversationsPane->isCollapsed(); + bool is_right_pane_expanded = !mMessagesPane->isCollapsed(); + + S32 conversations_pane_min_dim = mConversationsPane->getMinDim(); + + if (is_right_pane_expanded) + { + S32 conversations_pane_width = + (is_left_pane_expanded ? gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") : conversations_pane_min_dim); + + // possibly increase minimum size constraint due to children's minimums. + for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) + { + LLFloater* floaterp = dynamic_cast(mTabContainer->getPanelByIndex(tab_idx)); + if (floaterp) + { + new_min_width = llmax(new_min_width, + floaterp->getMinWidth() + conversations_pane_width + LLPANEL_BORDER_WIDTH * 2); + new_min_height = llmax(new_min_height, floaterp->getMinHeight()); + } + } + } + else + { + new_min_width = conversations_pane_min_dim; + } +} + void LLIMFloaterContainer::onNewMessageReceived(const LLSD& data) { LLUUID session_id = data["session_id"].asUUID(); @@ -160,6 +208,21 @@ void LLIMFloaterContainer::onNewMessageReceived(const LLSD& data) } } +void LLIMFloaterContainer::onExpandCollapseButtonClicked() +{ + if (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed() + && gSavedPerAccountSettings.getBOOL("ConversationsExpandMessagePaneFirst")) + { + // Expand the messages pane from ultra minimized state + // if it was collapsed last in order. + collapseMessagesPane(false); + } + else + { + collapseConversationsPane(!mConversationsPane->isCollapsed()); + } +} + LLIMFloaterContainer* LLIMFloaterContainer::findInstance() { return LLFloaterReg::findTypedInstance("im_container"); @@ -186,29 +249,67 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } -void LLIMFloaterContainer::toggleMessagesPane(bool expand) +void LLIMFloaterContainer::collapseMessagesPane(bool collapse) { - LLView* messages_pane = getChild("im_box_tab_container"); - bool is_expanded = messages_pane->getVisible(); - if (is_expanded == expand) + if (mMessagesPane->isCollapsed() == collapse) { return; } - // Store the messages pane width before collapsing it. - if (!expand) + if (collapse) { - LLView* conversations_pane = getChild("conversations_pane"); - S32 horizontal_pad = messages_pane->getRect().mLeft - conversations_pane->getRect().mRight; - mMessagesPaneWidth = messages_pane->getRect().getWidth() + horizontal_pad; + // Save the messages pane width before collapsing it. + gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", mMessagesPane->getRect().getWidth()); + + // Save the order in which the panels are closed to reverse user's last action. + gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", mConversationsPane->isCollapsed()); } // Show/hide the messages pane. - messages_pane->setVisible(expand); + mConversationsStack->collapsePanel(mMessagesPane, collapse); + + updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth")); +} + +void LLIMFloaterContainer::collapseConversationsPane(bool collapse) +{ + if (mConversationsPane->isCollapsed() == collapse) + { + return; + } + + LLView* button_panel = getChild("conversations_pane_buttons_expanded"); + button_panel->setVisible(!collapse); + mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon")); + + if (collapse) + { + // Save the conversations pane width before collapsing it. + gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", mConversationsPane->getRect().getWidth()); + + // Save the order in which the panels are closed to reverse user's last action. + gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", !mMessagesPane->isCollapsed()); + } + + mConversationsStack->collapsePanel(mConversationsPane, collapse); + + S32 collapsed_width = mConversationsPane->getMinDim(); + updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - collapsed_width); +} + +void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) +{ + LLRect floater_rect = getRect(); + floater_rect.mRight += ((collapse ? -1 : 1) * delta_width); + setShape(floater_rect); + + updateResizeLimits(); + + bool is_left_pane_expanded = !mConversationsPane->isCollapsed(); + bool is_right_pane_expanded = !mMessagesPane->isCollapsed(); - S32 floater_width = getRect().getWidth(); - floater_width += (expand ? mMessagesPaneWidth : -mMessagesPaneWidth); - reshape(floater_width, getRect().getHeight()); + setCanResize(is_left_pane_expanded || is_right_pane_expanded); + setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); } // EOF -- cgit v1.2.3 From 47ec4faeb4dc67f9614e218a75d4957ccf6f794c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 30 May 2012 19:58:20 +0300 Subject: CHUI-119 WIP Prepare the nearby chat for hosting it by the IM-container --- indra/newview/llimfloatercontainer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index b051440589..f72ddef412 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -31,6 +31,7 @@ #include "llfloaterreg.h" #include "lllayoutstack.h" +#include "llnearbychatbar.h" #include "llagent.h" #include "llavatariconctrl.h" -- cgit v1.2.3 From bba0f4f74e56d911df8fc534d83cd4a84993bc8b Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 31 May 2012 16:37:22 +0300 Subject: CHUI-119 WIP --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f72ddef412..3b6240de44 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -31,7 +31,7 @@ #include "llfloaterreg.h" #include "lllayoutstack.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llagent.h" #include "llavatariconctrl.h" -- cgit v1.2.3 From 85e553638e51994824683497bd9ccc964c7cc1fc Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 6 Jun 2012 19:37:59 -0700 Subject: CHUI-137 : Implement temporary conversations list (not working yet) --- indra/newview/llimfloatercontainer.cpp | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 3b6240de44..134d345148 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -71,6 +71,8 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsStack = getChild("conversations_stack"); mConversationsPane = getChild("conversations_layout_panel"); mMessagesPane = getChild("messages_layout_panel"); + + mConversationsListPanel = getChild("conversations_list_panel"); mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); @@ -112,6 +114,22 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); + // CHUI-137 + llinfos << "Merov debug : addFloater, title = " << floaterp->getTitle() << llendl; + // Create a conversation item + LLConversationItem item(floaterp->getTitle()); + // Add it to the list + mConversationsItems.push_back(item); + // Create a widget from it + LLFolderViewItem* widget = createConversationItemWidget(&item); + // Add it to the list of widgets + mConversationsWidgets.push_back(widget); + // Add it to the UI + widget->setVisible(TRUE); + mConversationsListPanel->addChild(widget); + // Reposition it... + // CHUI-137 : end + LLView* floater_contents = floaterp->getChild("contents_view"); // we don't show the header when the floater is hosted, @@ -150,6 +168,8 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) { LLMultiFloater::removeFloater(floaterp); + llinfos << "Merov debug : removeFloater, title = " << floaterp->getTitle() << llendl; + LLRect contents_rect = floaterp->getRect(); // reduce the floater contents height by header height @@ -313,4 +333,63 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); } +// CHUI-137 : Temp implementation of conversations list +LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) +{ + LLFolderViewItem::Params params; + + params.name = item->getDisplayName(); + //params.icon = bridge->getIcon(); + //params.icon_open = bridge->getOpenIcon(); + + //params.creation_date = bridge->getCreationDate(); + //params.root = mFolderRoot; + params.listener = item; + params.rect = LLRect (0, 0, 0, 0); + params.tool_tip = params.name; + + return LLUICtrlFactory::create(params); +} + +// Conversation items +LLConversationItem::LLConversationItem(std::string name) : + mName(name), + mUUID(LLUUID::null) +{ + if (name == "") + mName = "Nearby Chat"; +} + +// Virtual action callbacks +void LLConversationItem::performAction(LLInventoryModel* model, std::string action) +{ + llinfos << "Merov debug : performAction, title = " << mName << ", action = " << action << llendl; +} + +void LLConversationItem::openItem( void ) +{ + llinfos << "Merov debug : openItem, title = " << mName << llendl; +} + +void LLConversationItem::closeItem( void ) +{ + llinfos << "Merov debug : closeItem, title = " << mName << llendl; +} + +void LLConversationItem::previewItem( void ) +{ + llinfos << "Merov debug : previewItem, title = " << mName << llendl; +} + +void LLConversationItem::selectItem(void) +{ + llinfos << "Merov debug : selectItem, title = " << mName << llendl; +} + +void LLConversationItem::showProperties(void) +{ + llinfos << "Merov debug : showProperties, title = " << mName << llendl; +} + + // EOF -- cgit v1.2.3 From 1aba6c119ef05a4cfd91325c8455dc8c60098746 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 8 Jun 2012 17:26:13 -0700 Subject: CHUI-137 : Implement conversation list, temporary solution: add but doesn't take out items from the list --- indra/newview/llimfloatercontainer.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 134d345148..cd19105860 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -115,19 +115,22 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); // CHUI-137 - llinfos << "Merov debug : addFloater, title = " << floaterp->getTitle() << llendl; // Create a conversation item - LLConversationItem item(floaterp->getTitle()); - // Add it to the list + LLConversationItem* item = new LLConversationItem(floaterp->getTitle()); mConversationsItems.push_back(item); // Create a widget from it - LLFolderViewItem* widget = createConversationItemWidget(&item); - // Add it to the list of widgets + LLFolderViewItem* widget = createConversationItemWidget(item); mConversationsWidgets.push_back(widget); // Add it to the UI widget->setVisible(TRUE); mConversationsListPanel->addChild(widget); - // Reposition it... + LLRect panel_rect = mConversationsListPanel->getRect(); + S32 item_height = 16; + S32 index = mConversationsWidgets.size() - 1; + widget->setRect(LLRect(0, + panel_rect.getHeight() - item_height*index, + panel_rect.getWidth(), + panel_rect.getHeight() - item_height*(index+1))); // CHUI-137 : end LLView* floater_contents = floaterp->getChild("contents_view"); -- cgit v1.2.3 From db67c21f901800d27c9dd2ea2ce6134dc3bd33f1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 11 Jun 2012 17:25:17 -0700 Subject: CHUI-137 : Implemented switch conversation in the conversation list --- indra/newview/llimfloatercontainer.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index cd19105860..9c6cee6cb5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -85,6 +85,7 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { + llinfos << "Merov debug : onOpen, key = " << key.asUUID() << llendl; LLMultiFloater::onOpen(key); /* if (key.isDefined()) @@ -114,9 +115,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); + LLUUID session_id = floaterp->getKey(); + // CHUI-137 // Create a conversation item - LLConversationItem* item = new LLConversationItem(floaterp->getTitle()); + LLConversationItem* item = new LLConversationItem(floaterp->getTitle(),session_id, floaterp, this); mConversationsItems.push_back(item); // Create a widget from it LLFolderViewItem* widget = createConversationItemWidget(item); @@ -139,8 +142,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, // so reshape floater contents to occupy the header space floater_contents->setShape(floaterp->getRect()); - LLUUID session_id = floaterp->getKey(); - LLIconCtrl* icon = 0; if(gAgent.isInGroup(session_id, TRUE)) @@ -164,6 +165,8 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); } mTabContainer->setTabImage(floaterp, icon); + + llinfos << "Merov debug : addFloater, title = " << floaterp->getTitle() << ", uuid = " << session_id << llendl; } // virtual @@ -171,7 +174,7 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) { LLMultiFloater::removeFloater(floaterp); - llinfos << "Merov debug : removeFloater, title = " << floaterp->getTitle() << llendl; + llinfos << "Merov debug : removeFloater, title = " << floaterp->getTitle() << ", uuid = " << floaterp->getKey() << llendl; LLRect contents_rect = floaterp->getRect(); @@ -355,9 +358,11 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat } // Conversation items -LLConversationItem::LLConversationItem(std::string name) : +LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) : mName(name), - mUUID(LLUUID::null) + mUUID(uuid), + mFloater(floaterp), + mContainer(containerp) { if (name == "") mName = "Nearby Chat"; @@ -386,7 +391,8 @@ void LLConversationItem::previewItem( void ) void LLConversationItem::selectItem(void) { - llinfos << "Merov debug : selectItem, title = " << mName << llendl; + llinfos << "Merov debug : selectItem, title = " << mName << ", uuid = " << mUUID << llendl; + mContainer->selectFloater(mFloater); } void LLConversationItem::showProperties(void) -- cgit v1.2.3 From 0e2f5c2ebad0a19e9c5e151a4ac3ae7321f2f296 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 11 Jun 2012 22:12:43 -0700 Subject: CHUI-137 : Implemented tear off and close of conversation in the list --- indra/newview/llimfloatercontainer.cpp | 56 ++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 19 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9c6cee6cb5..9084c07cc7 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -85,7 +85,6 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { - llinfos << "Merov debug : onOpen, key = " << key.asUUID() << llendl; LLMultiFloater::onOpen(key); /* if (key.isDefined()) @@ -120,10 +119,10 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, // CHUI-137 // Create a conversation item LLConversationItem* item = new LLConversationItem(floaterp->getTitle(),session_id, floaterp, this); - mConversationsItems.push_back(item); + mConversationsItems[session_id] = item; // Create a widget from it LLFolderViewItem* widget = createConversationItemWidget(item); - mConversationsWidgets.push_back(widget); + mConversationsWidgets[session_id] = widget; // Add it to the UI widget->setVisible(TRUE); mConversationsListPanel->addChild(widget); @@ -165,8 +164,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); } mTabContainer->setTabImage(floaterp, icon); - - llinfos << "Merov debug : addFloater, title = " << floaterp->getTitle() << ", uuid = " << session_id << llendl; } // virtual @@ -174,8 +171,34 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) { LLMultiFloater::removeFloater(floaterp); - llinfos << "Merov debug : removeFloater, title = " << floaterp->getTitle() << ", uuid = " << floaterp->getKey() << llendl; - + // CHUI-137 : Clean up the conversations list + LLUUID session_id = floaterp->getKey(); + // Delete the widget and the associated conversation item + // Note : since the mConversationsItems is a listener to the widget, deleting the widget also + // delete its listener + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id); + if (widget_it != mConversationsWidgets.end()) + { + LLFolderViewItem* widget = widget_it->second; + delete widget; + } + // Suppress the conversation items and widgets from their respective maps + mConversationsItems.erase(session_id); + mConversationsWidgets.erase(session_id); + // Reposition the leftover conversation items + LLRect panel_rect = mConversationsListPanel->getRect(); + S32 item_height = 16; + int index = 0; + for (widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); ++widget_it, ++index) + { + LLFolderViewItem* widget = widget_it->second; + widget->setRect(LLRect(0, + panel_rect.getHeight() - item_height*index, + panel_rect.getWidth(), + panel_rect.getHeight() - item_height*(index+1))); + } + // CHUI-137 + LLRect contents_rect = floaterp->getRect(); // reduce the floater contents height by header height @@ -364,41 +387,36 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF mFloater(floaterp), mContainer(containerp) { + // Hack: the nearby chat has no name so we catch that and impose one if (name == "") mName = "Nearby Chat"; } // Virtual action callbacks +void LLConversationItem::selectItem(void) +{ + // Select the conversation floater that is being selected + mContainer->selectFloater(mFloater); +} + void LLConversationItem::performAction(LLInventoryModel* model, std::string action) { - llinfos << "Merov debug : performAction, title = " << mName << ", action = " << action << llendl; } void LLConversationItem::openItem( void ) { - llinfos << "Merov debug : openItem, title = " << mName << llendl; } void LLConversationItem::closeItem( void ) { - llinfos << "Merov debug : closeItem, title = " << mName << llendl; } void LLConversationItem::previewItem( void ) { - llinfos << "Merov debug : previewItem, title = " << mName << llendl; -} - -void LLConversationItem::selectItem(void) -{ - llinfos << "Merov debug : selectItem, title = " << mName << ", uuid = " << mUUID << llendl; - mContainer->selectFloater(mFloater); } void LLConversationItem::showProperties(void) { - llinfos << "Merov debug : showProperties, title = " << mName << llendl; } - // EOF -- cgit v1.2.3 From b01ab3b9b2d55a8536894a049354b87bb1d71cdb Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 13 Jun 2012 13:52:26 -0700 Subject: EXP-137 : Comments cleanup --- indra/newview/llimfloatercontainer.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9084c07cc7..77bb103bda 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -116,7 +116,7 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLUUID session_id = floaterp->getKey(); - // CHUI-137 + // CHUI-137 : Temporary implementation of conversations list // Create a conversation item LLConversationItem* item = new LLConversationItem(floaterp->getTitle(),session_id, floaterp, this); mConversationsItems[session_id] = item; @@ -171,11 +171,12 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) { LLMultiFloater::removeFloater(floaterp); - // CHUI-137 : Clean up the conversations list + // CHUI-137 : Temporary implementation of conversations list + // Clean up the conversations list LLUUID session_id = floaterp->getKey(); // Delete the widget and the associated conversation item - // Note : since the mConversationsItems is a listener to the widget, deleting the widget also - // delete its listener + // Note : since the mConversationsItems is also the listener to the widget, deleting + // the widget will also delete its listener conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id); if (widget_it != mConversationsWidgets.end()) { @@ -197,7 +198,7 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) panel_rect.getWidth(), panel_rect.getHeight() - item_height*(index+1))); } - // CHUI-137 + // CHUI-137 : end LLRect contents_rect = floaterp->getRect(); @@ -362,7 +363,7 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); } -// CHUI-137 : Temp implementation of conversations list +// CHUI-137 : Temporary implementation of conversations list LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLFolderViewItem::Params params; @@ -370,7 +371,6 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat params.name = item->getDisplayName(); //params.icon = bridge->getIcon(); //params.icon_open = bridge->getOpenIcon(); - //params.creation_date = bridge->getCreationDate(); //params.root = mFolderRoot; params.listener = item; @@ -387,7 +387,8 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF mFloater(floaterp), mContainer(containerp) { - // Hack: the nearby chat has no name so we catch that and impose one + // Hack: the nearby chat has no name so we catch that case and impose one + // Of course, we won't be doing this in the final code if (name == "") mName = "Nearby Chat"; } @@ -395,7 +396,7 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF // Virtual action callbacks void LLConversationItem::selectItem(void) { - // Select the conversation floater that is being selected + // Switch to the conversation floater that is being selected mContainer->selectFloater(mFloater); } -- cgit v1.2.3 From d34746b596bad717f7d0c10e263700738a06aa43 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 14 Jun 2012 17:37:16 +0300 Subject: CHUI-144 FIXED Residents picker added to Conversations panel + button. --- indra/newview/llimfloatercontainer.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 3b6240de44..71b69dfbc8 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -34,8 +34,10 @@ #include "llnearbychat.h" #include "llagent.h" +#include "llavataractions.h" #include "llavatariconctrl.h" #include "llgroupiconctrl.h" +#include "llfloateravatarpicker.h" #include "llimview.h" #include "lltransientfloatermgr.h" #include "llviewercontrol.h" @@ -75,6 +77,8 @@ BOOL LLIMFloaterContainer::postBuild() mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); + childSetAction("add_btn", boost::bind(&LLIMFloaterContainer::onAddButtonClicked, this)); + collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed")); collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed")); @@ -313,4 +317,26 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); } +void LLIMFloaterContainer::onAddButtonClicked() +{ + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (picker && root_floater) + { + root_floater->addDependentFloater(picker); + } +} + +void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) +{ + if (ids.size() == 1) + { + LLAvatarActions::startIM(ids.back()); + } + else + { + LLAvatarActions::startConference(ids); + } +} + // EOF -- cgit v1.2.3 From c238027dd9917b1633ff5f16911fbdbe437f9a55 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 14 Jun 2012 16:47:43 -0700 Subject: CHUI-139 : Use the Chat toolbar button to open and close the conversations multi floater. Force Nearby Conversation if floater is empty. --- indra/newview/llimfloatercontainer.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 77bb103bda..c01a167169 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" +#include "llimfloater.h" #include "llimfloatercontainer.h" #include "llfloaterreg.h" @@ -86,7 +87,15 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { LLMultiFloater::onOpen(key); -/* + if (getFloaterCount() == 0) + { + // If there's *no* conversation open so far, we force the opening of the nearby chat conversation + // *TODO: find a way to move this to XML as a default panel or something like that + LLSD name("chat_bar"); + LLSD key(""); + LLFloaterReg::toggleInstanceOrBringToFront(name,key); + } + /* if (key.isDefined()) { LLIMFloater* im_floater = LLIMFloater::findInstance(key.asUUID()); @@ -95,7 +104,7 @@ void LLIMFloaterContainer::onOpen(const LLSD& key) im_floater->openFloater(); } } -*/ + */ } // virtual -- cgit v1.2.3 From b64fc84707a0ab4c11e84cf5caec32bbc267f313 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 18 Jun 2012 08:21:42 -0700 Subject: CHUI-145 : WIP Always open the message pane when clicking on a conversation in the list --- indra/newview/llimfloatercontainer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index af5d587f20..e8eae331a1 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -431,6 +431,8 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF // Virtual action callbacks void LLConversationItem::selectItem(void) { + // Always expand the message pane in that case + mContainer->collapseMessagesPane(false); // Switch to the conversation floater that is being selected mContainer->selectFloater(mFloater); } -- cgit v1.2.3 From bc5e0eda1b1b9c289734bebe6a533565aadfd3a2 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 18 Jun 2012 21:11:56 +0300 Subject: CHUI-119 fixed bug with creating multiply instances of the nearby chat; --- indra/newview/llimfloatercontainer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index af5d587f20..8493a0e7b8 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -96,8 +96,7 @@ void LLIMFloaterContainer::onOpen(const LLSD& key) // If there's *no* conversation open so far, we force the opening of the nearby chat conversation // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("chat_bar"); - LLSD key(""); - LLFloaterReg::toggleInstanceOrBringToFront(name,key); + LLFloaterReg::toggleInstanceOrBringToFront(name); } /* if (key.isDefined()) -- cgit v1.2.3 From 06f142e974854854c91988b6a8bc5c6005a40731 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 18 Jun 2012 18:12:38 -0700 Subject: CHUI-145 : Select on list focus on relevant panel, torn off or not; torn off im stay in list; closed im suppressed from lits in all situations --- indra/newview/llimfloatercontainer.cpp | 117 +++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 51 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index e8eae331a1..bedf3315e8 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -129,24 +129,8 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLUUID session_id = floaterp->getKey(); - // CHUI-137 : Temporary implementation of conversations list - // Create a conversation item - LLConversationItem* item = new LLConversationItem(floaterp->getTitle(),session_id, floaterp, this); - mConversationsItems[session_id] = item; - // Create a widget from it - LLFolderViewItem* widget = createConversationItemWidget(item); - mConversationsWidgets[session_id] = widget; - // Add it to the UI - widget->setVisible(TRUE); - mConversationsListPanel->addChild(widget); - LLRect panel_rect = mConversationsListPanel->getRect(); - S32 item_height = 16; - S32 index = mConversationsWidgets.size() - 1; - widget->setRect(LLRect(0, - panel_rect.getHeight() - item_height*index, - panel_rect.getWidth(), - panel_rect.getHeight() - item_height*(index+1))); - // CHUI-137 : end + // Add a conversation list item in the left pane + addConversationListItem(floaterp->getTitle(), session_id, floaterp, this); LLView* floater_contents = floaterp->getChild("contents_view"); @@ -184,35 +168,6 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) { LLMultiFloater::removeFloater(floaterp); - // CHUI-137 : Temporary implementation of conversations list - // Clean up the conversations list - LLUUID session_id = floaterp->getKey(); - // Delete the widget and the associated conversation item - // Note : since the mConversationsItems is also the listener to the widget, deleting - // the widget will also delete its listener - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id); - if (widget_it != mConversationsWidgets.end()) - { - LLFolderViewItem* widget = widget_it->second; - delete widget; - } - // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(session_id); - mConversationsWidgets.erase(session_id); - // Reposition the leftover conversation items - LLRect panel_rect = mConversationsListPanel->getRect(); - S32 item_height = 16; - int index = 0; - for (widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); ++widget_it, ++index) - { - LLFolderViewItem* widget = widget_it->second; - widget->setRect(LLRect(0, - panel_rect.getHeight() - item_height*index, - panel_rect.getWidth(), - panel_rect.getHeight() - item_height*(index+1))); - } - // CHUI-137 : end - LLRect contents_rect = floaterp->getRect(); // reduce the floater contents height by header height @@ -399,6 +354,60 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) } // CHUI-137 : Temporary implementation of conversations list +void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) +{ + // Create a conversation item + LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, containerp); + mConversationsItems[uuid] = item; + + // Create a widget from it + LLFolderViewItem* widget = createConversationItemWidget(item); + mConversationsWidgets[uuid] = widget; + + // Add it to the UI + widget->setVisible(TRUE); + mConversationsListPanel->addChild(widget); + LLRect panel_rect = mConversationsListPanel->getRect(); + S32 item_height = 16; + S32 index = mConversationsWidgets.size() - 1; + widget->setRect(LLRect(0, + panel_rect.getHeight() - item_height*index, + panel_rect.getWidth(), + panel_rect.getHeight() - item_height*(index+1))); + return; +} + +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id) +{ + // Delete the widget and the associated conversation item + // Note : since the mConversationsItems is also the listener to the widget, deleting + // the widget will also delete its listener + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id); + if (widget_it != mConversationsWidgets.end()) + { + LLFolderViewItem* widget = widget_it->second; + delete widget; + } + + // Suppress the conversation items and widgets from their respective maps + mConversationsItems.erase(session_id); + mConversationsWidgets.erase(session_id); + + // Reposition the leftover conversation items + LLRect panel_rect = mConversationsListPanel->getRect(); + S32 item_height = 16; + int index = 0; + for (widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); ++widget_it, ++index) + { + LLFolderViewItem* widget = widget_it->second; + widget->setRect(LLRect(0, + panel_rect.getHeight() - item_height*index, + panel_rect.getWidth(), + panel_rect.getHeight() - item_height*(index+1))); + } + return; +} + LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLFolderViewItem::Params params; @@ -431,10 +440,16 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF // Virtual action callbacks void LLConversationItem::selectItem(void) { - // Always expand the message pane in that case - mContainer->collapseMessagesPane(false); - // Switch to the conversation floater that is being selected - mContainer->selectFloater(mFloater); + LLMultiFloater* host_floater = mFloater->getHost(); + if (host_floater == mContainer) + { + // Always expand the message pane if the panel is hosted by the container + mContainer->collapseMessagesPane(false); + // Switch to the conversation floater that is being selected + mContainer->selectFloater(mFloater); + } + // Set the focus on the selected floater + mFloater->setFocus(TRUE); } void LLConversationItem::performAction(LLInventoryModel* model, std::string action) -- cgit v1.2.3 From b882fe3b8dde9338c092922672015f975ca09587 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 18 Jun 2012 22:51:33 -0700 Subject: CHUI-146 : Refocus on the first conversation when closing another conversation, don't let focus falls out --- indra/newview/llimfloatercontainer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index bedf3315e8..04fb2f3b9a 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -405,6 +405,15 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id) panel_rect.getWidth(), panel_rect.getHeight() - item_height*(index+1))); } + + // Don't let the focus fall IW, select and refocus on the first conversation in the list + setFocus(TRUE); + conversations_items_map::iterator item_it = mConversationsItems.begin(); + if (item_it != mConversationsItems.end()) + { + LLConversationItem* item = item_it->second; + item->selectItem(); + } return; } -- cgit v1.2.3 From 49596f4b7fca83dbd7e49ee0780ac6f5574a5746 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 19 Jun 2012 16:41:08 -0700 Subject: CHUI-148 : Fix reattaching on a hidden message panel; also prevents recreation of list items (eventually lead to crashes). --- indra/newview/llimfloatercontainer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 10188febab..fb5697e2f2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -123,7 +123,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, openFloater(floaterp->getKey()); return; } + + // Make sure the message panel is open when adding a floater or it stays mysteriously hidden + collapseMessagesPane(false); + // Add the floater LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); LLUUID session_id = floaterp->getKey(); @@ -355,6 +359,14 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) // CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) { + // Check if the item is not already in the list, exit if it is (nothing to do) + // Note: this happens often, when reattaching a torn off conversation for instance + conversations_items_map::iterator item_it = mConversationsItems.find(uuid); + if (item_it != mConversationsItems.end()) + { + return; + } + // Create a conversation item LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, containerp); mConversationsItems[uuid] = item; -- cgit v1.2.3 From fd247320ceab3ab6dc6abdf17008618cf3f6a8ff Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 20 Jun 2012 17:51:56 +0300 Subject: CHUI-125 FIXED if a call is accept then open im-session's floater --- indra/newview/llimfloatercontainer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 8493a0e7b8..deeb0e9e0b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -50,6 +50,9 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed) ,mExpandCollapseBtn(NULL) { + // Firstly add our self to IMSession observers, so we catch session events + LLIMMgr::getInstance()->addSessionObserver(this); + mAutoResize = FALSE; LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); } @@ -61,8 +64,18 @@ LLIMFloaterContainer::~LLIMFloaterContainer() gSavedPerAccountSettings.setBOOL("ConversationsListPaneCollapsed", mConversationsPane->isCollapsed()); gSavedPerAccountSettings.setBOOL("ConversationsMessagePaneCollapsed", mMessagesPane->isCollapsed()); + + if (!LLSingleton::destroyed()) + { + LLIMMgr::getInstance()->removeSessionObserver(this); + } } +void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) +{ + LLIMFloater::show(session_id); +}; + BOOL LLIMFloaterContainer::postBuild() { mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1)); -- cgit v1.2.3 From 41e965c12e29136d2b81a9b67d6b6c9af4fb2092 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 25 Jun 2012 15:20:52 -0700 Subject: CHUI-139 : Hide torn off floaters when hiding conversation list; make nearby chat always present; leave conversation list around when all torn off --- indra/newview/llimfloatercontainer.cpp | 51 ++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index a2a54bf02c..33b96b20f3 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -103,14 +103,14 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { - LLMultiFloater::onOpen(key); if (getFloaterCount() == 0) { - // If there's *no* conversation open so far, we force the opening of the nearby chat conversation + // We always force the opening of the nearby chat conversation when we open for the first time // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("chat_bar"); LLFloaterReg::toggleInstanceOrBringToFront(name); } + LLMultiFloater::onOpen(key); /* if (key.isDefined()) { @@ -284,6 +284,44 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +void LLIMFloaterContainer::draw() +{ + if (mTabContainer->getTabCount() == 0) + { + // Do not close the container when every conversation is torn off because the user + // still needs the conversation list. Simply collapse the message pane in that case. + collapseMessagesPane(true); + } + LLFloater::draw(); +} + +void LLIMFloaterContainer::tabClose() +{ + if (mTabContainer->getTabCount() == 0) + { + // Do not close the container when every conversation is torn off because the user + // still needs the conversation list. Simply collapse the message pane in that case. + collapseMessagesPane(true); + } +} + +void LLIMFloaterContainer::setVisible(BOOL visible) +{ + // We need to show/hide all the associated conversations that have been torn off + // (and therefore, are not longer managed by the multifloater), + // so that they show/hide with the conversations manager. + conversations_items_map::iterator item_it = mConversationsItems.begin(); + for (;item_it != mConversationsItems.end(); ++item_it) + { + LLConversationItem* item = item_it->second; + item->setVisibleIfDetached(visible); + } + + // Now, do the normal multifloater show/hide + LLMultiFloater::setVisible(visible); + +} + void LLIMFloaterContainer::collapseMessagesPane(bool collapse) { if (mMessagesPane->isCollapsed() == collapse) @@ -485,6 +523,15 @@ void LLConversationItem::selectItem(void) mFloater->setFocus(TRUE); } +void LLConversationItem::setVisibleIfDetached(BOOL visible) +{ + // Do this only if the conversation floater has been torn off (i.e. no multi floater host) + if (!mFloater->getHost()) + { + mFloater->setVisible(visible); + } +} + void LLConversationItem::performAction(LLInventoryModel* model, std::string action) { } -- cgit v1.2.3 From c233f0c9494d7dddbd8baab0f87b0ad54f42b0f9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 26 Jun 2012 17:05:16 -0700 Subject: CHUI-164 : Fix crash when closing ad-hoc conversations; insure consistency of the conversation list when adding and removing items from it --- indra/newview/llimfloatercontainer.cpp | 56 +++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 33b96b20f3..f6bcf8bbe9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -146,7 +146,7 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLUUID session_id = floaterp->getKey(); // Add a conversation list item in the left pane - addConversationListItem(floaterp->getTitle(), session_id, floaterp, this); + addConversationListItem(floaterp->getTitle(), session_id, floaterp); LLView* floater_contents = floaterp->getChild("contents_view"); @@ -408,18 +408,33 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) } // CHUI-137 : Temporary implementation of conversations list -void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) +void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) { - // Check if the item is not already in the list, exit if it is (nothing to do) + // Check if the item is not already in the list, exit if it is and has the same name and points to the same floater (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance conversations_items_map::iterator item_it = mConversationsItems.find(uuid); if (item_it != mConversationsItems.end()) { - return; + LLConversationItem* item = item_it->second; + // Check if the item has changed + if (item->hasSameValues(name,floaterp)) + { + // If it hasn't, nothing to do -> exit + return; + } + // If it has, remove it: it'll be recreated anew further down + removeConversationListItem(uuid,false); + } + + // Reverse find and clean up: we need to make sure that no other uuid is pointing to that same floater + LLUUID found_id = LLUUID::null; + if (findConversationItem(floaterp,found_id)) + { + removeConversationListItem(found_id,false); } // Create a conversation item - LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, containerp); + LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); mConversationsItems[uuid] = item; // Create a widget from it @@ -439,7 +454,7 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id) +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, bool change_focus) { // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting @@ -469,16 +484,35 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id) } // Don't let the focus fall IW, select and refocus on the first conversation in the list - setFocus(TRUE); - conversations_items_map::iterator item_it = mConversationsItems.begin(); - if (item_it != mConversationsItems.end()) + if (change_focus) { - LLConversationItem* item = item_it->second; - item->selectItem(); + setFocus(TRUE); + conversations_items_map::iterator item_it = mConversationsItems.begin(); + if (item_it != mConversationsItems.end()) + { + LLConversationItem* item = item_it->second; + item->selectItem(); + } } return; } +bool LLIMFloaterContainer::findConversationItem(LLFloater* floaterp, LLUUID& uuid) +{ + bool found = false; + for (conversations_items_map::iterator item_it = mConversationsItems.begin(); item_it != mConversationsItems.end(); ++item_it) + { + LLConversationItem* item = item_it->second; + uuid = item_it->first; + if (item->hasSameValue(floaterp)) + { + found = true; + break; + } + } + return found; +} + LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLFolderViewItem::Params params; -- cgit v1.2.3 From 1eb6b4509d9ae79f8313e1e68351028794093a53 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 14:03:16 -0700 Subject: CHUI-139 : Make sure the Nearby Chat shows up in the conversations floater in every situation --- indra/newview/llimfloatercontainer.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f6bcf8bbe9..52bacf15e4 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -103,24 +103,7 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { - if (getFloaterCount() == 0) - { - // We always force the opening of the nearby chat conversation when we open for the first time - // *TODO: find a way to move this to XML as a default panel or something like that - LLSD name("chat_bar"); - LLFloaterReg::toggleInstanceOrBringToFront(name); - } LLMultiFloater::onOpen(key); - /* - if (key.isDefined()) - { - LLIMFloater* im_floater = LLIMFloater::findInstance(key.asUUID()); - if (im_floater) - { - im_floater->openFloater(); - } - } - */ } // virtual @@ -307,6 +290,20 @@ void LLIMFloaterContainer::tabClose() void LLIMFloaterContainer::setVisible(BOOL visible) { + if (visible) + { + // Make sure we have the Nearby Chat present when showing the conversation container + LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is null + conversations_items_map::iterator item_it = mConversationsItems.find(nearbychat_uuid); + if (item_it == mConversationsItems.end()) + { + // If not found, force the creation of the nearby chat conversation panel + // *TODO: find a way to move this to XML as a default panel or something like that + LLSD name("chat_bar"); + LLFloaterReg::toggleInstanceOrBringToFront(name); + } + } + // We need to show/hide all the associated conversations that have been torn off // (and therefore, are not longer managed by the multifloater), // so that they show/hide with the conversations manager. -- cgit v1.2.3 From d470632799dfdea723d15d91aa5783bdd1700257 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 15:32:08 -0700 Subject: CHUI-130 : Leave minimized torn off IM untouched when showing hiding the whole set of conversations --- indra/newview/llimfloatercontainer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 52bacf15e4..34a9758c52 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -556,8 +556,9 @@ void LLConversationItem::selectItem(void) void LLConversationItem::setVisibleIfDetached(BOOL visible) { - // Do this only if the conversation floater has been torn off (i.e. no multi floater host) - if (!mFloater->getHost()) + // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized + // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here + if (!mFloater->getHost() && !mFloater->isMinimized()) { mFloater->setVisible(visible); } -- cgit v1.2.3 From 71deb6d500238900bf7bf62cf957a68c063ade56 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 29 Jun 2012 11:59:14 -0700 Subject: CHUI-164 : Fix crash when removing ad-hoc conversation. Turns out that sessions uuids are not constant so I shouldn't use them as index in the conversation list. More complete fix to follow. --- indra/newview/llimfloatercontainer.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 34a9758c52..85cc8cf38b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -416,19 +416,14 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI // Check if the item has changed if (item->hasSameValues(name,floaterp)) { - // If it hasn't, nothing to do -> exit + // If it hasn't changed, nothing to do -> exit return; } - // If it has, remove it: it'll be recreated anew further down - removeConversationListItem(uuid,false); } - // Reverse find and clean up: we need to make sure that no other uuid is pointing to that same floater - LLUUID found_id = LLUUID::null; - if (findConversationItem(floaterp,found_id)) - { - removeConversationListItem(found_id,false); - } + // Remove the conversation item that might exist already: it'll be recreated anew further down anyway + // and nothing wrong will happen removing it if it doesn't exist + removeConversationListItem(uuid,floaterp,false); // Create a conversation item LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); @@ -451,21 +446,32 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, bool change_focus) +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus) { + // Reverse find : we need to find the item that point to that floater + // Note : the session UUID actually might change so we cannot really use it here + // *TODO : Change the structure so that we use the floaterp and not the uuid as a map index + LLUUID found_id = LLUUID::null; + if (!findConversationItem(floaterp,found_id)) + { + // If the floater wasn't found, we trust the passed id + // Note: in most cases, the id doesn't correspond to any conversation either + found_id = session_id; + } + // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id); + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(found_id); if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; delete widget; } - + // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(session_id); - mConversationsWidgets.erase(session_id); + mConversationsItems.erase(found_id); + mConversationsWidgets.erase(found_id); // Reposition the leftover conversation items LLRect panel_rect = mConversationsListPanel->getRect(); -- cgit v1.2.3 From 5eab95955fec4d3dcb8b2f98c6c084d227e70b8c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 29 Jun 2012 14:29:56 -0700 Subject: CHUI-164 : Fix conversation list index using handle to floater rather than uuid. Simplify the code accordingly (suppress hacks). --- indra/newview/llimfloatercontainer.cpp | 48 +++++++++++++--------------------- 1 file changed, 18 insertions(+), 30 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 85cc8cf38b..261b5f33a2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -293,9 +293,9 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is null - conversations_items_map::iterator item_it = mConversationsItems.find(nearbychat_uuid); - if (item_it == mConversationsItems.end()) + LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is always null + LLFloater* floaterp = findConversationItem(nearbychat_uuid); + if (floaterp == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that @@ -407,14 +407,14 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) // CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) { - // Check if the item is not already in the list, exit if it is and has the same name and points to the same floater (nothing to do) + // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance - conversations_items_map::iterator item_it = mConversationsItems.find(uuid); + conversations_items_map::iterator item_it = mConversationsItems.find(floaterp); if (item_it != mConversationsItems.end()) { LLConversationItem* item = item_it->second; // Check if the item has changed - if (item->hasSameValues(name,floaterp)) + if (item->hasSameValues(name,uuid)) { // If it hasn't changed, nothing to do -> exit return; @@ -423,15 +423,15 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI // Remove the conversation item that might exist already: it'll be recreated anew further down anyway // and nothing wrong will happen removing it if it doesn't exist - removeConversationListItem(uuid,floaterp,false); + removeConversationListItem(floaterp,false); // Create a conversation item LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); - mConversationsItems[uuid] = item; + mConversationsItems[floaterp] = item; // Create a widget from it LLFolderViewItem* widget = createConversationItemWidget(item); - mConversationsWidgets[uuid] = widget; + mConversationsWidgets[floaterp] = widget; // Add it to the UI widget->setVisible(TRUE); @@ -446,23 +446,12 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus) +void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool change_focus) { - // Reverse find : we need to find the item that point to that floater - // Note : the session UUID actually might change so we cannot really use it here - // *TODO : Change the structure so that we use the floaterp and not the uuid as a map index - LLUUID found_id = LLUUID::null; - if (!findConversationItem(floaterp,found_id)) - { - // If the floater wasn't found, we trust the passed id - // Note: in most cases, the id doesn't correspond to any conversation either - found_id = session_id; - } - // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(found_id); + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(floaterp); if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; @@ -470,8 +459,8 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, } // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(found_id); - mConversationsWidgets.erase(found_id); + mConversationsItems.erase(floaterp); + mConversationsWidgets.erase(floaterp); // Reposition the leftover conversation items LLRect panel_rect = mConversationsListPanel->getRect(); @@ -500,20 +489,19 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, return; } -bool LLIMFloaterContainer::findConversationItem(LLFloater* floaterp, LLUUID& uuid) +LLFloater* LLIMFloaterContainer::findConversationItem(LLUUID& uuid) { - bool found = false; + LLFloater* floaterp = NULL; for (conversations_items_map::iterator item_it = mConversationsItems.begin(); item_it != mConversationsItems.end(); ++item_it) { LLConversationItem* item = item_it->second; - uuid = item_it->first; - if (item->hasSameValue(floaterp)) + if (item->hasSameValue(uuid)) { - found = true; + floaterp = item_it->first; break; } } - return found; + return floaterp; } LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) -- cgit v1.2.3 From cea3c37dcb09eb30cb986ecac4d29a4ff1cc0898 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 3 Jul 2012 19:58:49 -0700 Subject: CHUI-164 : Fix crash when closing conversations using the conversation widget. Populated the sessionRemoved() method with code to close the floater and clean up the list. --- indra/newview/llimfloatercontainer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 261b5f33a2..08ace601a3 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -73,8 +73,15 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::show(session_id); -}; + LLIMFloater::show(session_id); +} + +void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) +{ + LLIMFloater* floaterp = LLIMFloater::findInstance(session_id); + LLFloater::onClickClose(floaterp); + removeConversationListItem(floaterp); +} BOOL LLIMFloaterContainer::postBuild() { -- cgit v1.2.3 From d3edb1c466f42e2c46c77e43b26d700c6298b8d6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 4 Jul 2012 00:30:00 -0700 Subject: CHUI-101 WIP Make LLFolderview general purpose partial fix for crash on startup --- indra/newview/llimfloatercontainer.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 261b5f33a2..2b943df48f 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -47,8 +47,9 @@ // LLIMFloaterContainer // LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) -: LLMultiFloater(seed) - ,mExpandCollapseBtn(NULL) +: LLMultiFloater(seed), + mExpandCollapseBtn(NULL), + mFolders(NULL) { // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -90,6 +91,16 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); + LLFolderView::Params p; + //TODO RN: define view model for conversations + //p.view_model = ?; + p.parent_panel = mConversationsListPanel; + p.rect = mConversationsListPanel->getLocalRect(); + p.follows.flags = FOLLOWS_ALL; + + mFolders = LLUICtrlFactory::create(p); + mConversationsListPanel->addChild(mFolders); + mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); @@ -512,7 +523,7 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat //params.icon = bridge->getIcon(); //params.icon_open = bridge->getOpenIcon(); //params.creation_date = bridge->getCreationDate(); - //params.root = mFolderRoot; + params.root = mFolders; params.listener = item; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; -- cgit v1.2.3 From ff448aed525b8c1d2f05b6a5816ba6855707e4b8 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 5 Jul 2012 19:23:34 +0300 Subject: CHUI-200 FIXED Show correct and localized name of the nearby chat In the conversations list --- indra/newview/llimfloatercontainer.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 08ace601a3..134623722c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -534,10 +534,6 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF mFloater(floaterp), mContainer(containerp) { - // Hack: the nearby chat has no name so we catch that case and impose one - // Of course, we won't be doing this in the final code - if (name == "") - mName = "Nearby Chat"; } // Virtual action callbacks -- cgit v1.2.3 From 89d8a49f28dac5d99ec05a5201203ec57f72be02 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 5 Jul 2012 14:14:35 +0300 Subject: CHUI-197 FIXED Conversation names updating when checked corresponding preference --- indra/newview/llimfloatercontainer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 134623722c..30a77bef98 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -104,6 +104,8 @@ BOOL LLIMFloaterContainer::postBuild() collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed")); collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed")); + LLAvatarNameCache::addUseDisplayNamesCallback( + boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); return TRUE; } -- cgit v1.2.3 From 73ad740443e615467f7e14fe4fb3f04d8abe2f9c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 4 Jul 2012 16:45:02 +0300 Subject: CHUI-170 FIXED Save Torn off state of Nearby Chat between sessions --- indra/newview/llimfloatercontainer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 30a77bef98..546eccbd04 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -302,9 +302,8 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is always null - LLFloater* floaterp = findConversationItem(nearbychat_uuid); - if (floaterp == NULL) + LLFloater* nearby_chat = LLFloaterReg::findInstance("chat_bar"); + if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that -- cgit v1.2.3 From ec15ff6350c0997421cf2884e40aa9feaa070d4d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 5 Jul 2012 16:42:20 -0700 Subject: CHUI-98 : WIP, use the refactored folder view for conversation view list --- indra/newview/llimfloatercontainer.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 2b943df48f..be38eddbaf 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -91,12 +91,14 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); + mRoot = new LLConversationItem(); LLFolderView::Params p; - //TODO RN: define view model for conversations - //p.view_model = ?; + // CHUI-98 : View Model for conversations + p.view_model = &mConversationViewModel; p.parent_panel = mConversationsListPanel; p.rect = mConversationsListPanel->getLocalRect(); p.follows.flags = FOLLOWS_ALL; + p.listener = mRoot; mFolders = LLUICtrlFactory::create(p); mConversationsListPanel->addChild(mFolders); @@ -544,6 +546,15 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF mName = "Nearby Chat"; } +LLConversationItem::LLConversationItem() : + mName(""), + mUUID(), + mFloater(NULL), + mContainer(NULL) +{ +} + + // Virtual action callbacks void LLConversationItem::selectItem(void) { @@ -589,4 +600,12 @@ void LLConversationItem::showProperties(void) { } +bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const +{ + // We compare only by name for the moment + // *TODO : Implement the sorting by date + S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + return (compare < 0); +} + // EOF -- cgit v1.2.3 From c3e048a2f14b08ec4428ea9f5a10f17de154e1fc Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 6 Jul 2012 13:30:05 +0300 Subject: build fix --- indra/newview/llimfloatercontainer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 546eccbd04..f3b97776fc 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -37,6 +37,7 @@ #include "llagent.h" #include "llavataractions.h" #include "llavatariconctrl.h" +#include "llavatarnamecache.h" #include "llgroupiconctrl.h" #include "llfloateravatarpicker.h" #include "llimview.h" -- cgit v1.2.3 From b490266226ac79cc7570ff7ee921506e941cce16 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 9 Jul 2012 11:49:43 -0700 Subject: CHUI-98 : WIP. Clean up conversation list data structure and comments --- indra/newview/llimfloatercontainer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index be38eddbaf..d343c8be24 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -49,7 +49,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed), mExpandCollapseBtn(NULL), - mFolders(NULL) + mConversationsRoot(NULL) { // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -91,17 +91,17 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); - mRoot = new LLConversationItem(); - LLFolderView::Params p; // CHUI-98 : View Model for conversations + LLConversationItem* base_item = new LLConversationItem(); + LLFolderView::Params p; p.view_model = &mConversationViewModel; p.parent_panel = mConversationsListPanel; p.rect = mConversationsListPanel->getLocalRect(); p.follows.flags = FOLLOWS_ALL; - p.listener = mRoot; + p.listener = base_item; - mFolders = LLUICtrlFactory::create(p); - mConversationsListPanel->addChild(mFolders); + mConversationsRoot = LLUICtrlFactory::create(p); + mConversationsListPanel->addChild(mConversationsRoot); mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); @@ -525,7 +525,7 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat //params.icon = bridge->getIcon(); //params.icon_open = bridge->getOpenIcon(); //params.creation_date = bridge->getCreationDate(); - params.root = mFolders; + params.root = mConversationsRoot; params.listener = item; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; -- cgit v1.2.3 From aafbf0d21301ccaf2e447a556d08e6686f519d4d Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 11 Jul 2012 17:19:22 +0300 Subject: CHUI-203 FIXED Conversations floater resizing when it is opened with FUI Chat button. --- indra/newview/llimfloatercontainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index e9144a4969..f54b3672e5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -393,7 +393,9 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) { LLRect floater_rect = getRect(); floater_rect.mRight += ((collapse ? -1 : 1) * delta_width); - setShape(floater_rect); + + // Set by_user = true so that reshaped rect is saved in user_settings. + setShape(floater_rect, true); updateResizeLimits(); -- cgit v1.2.3 From 6dff1477d5898c54ea0a08aa72bd099b628433e7 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 12 Jul 2012 16:36:01 +0300 Subject: CHUI-199 FIXED Save positioning of conversations between sessions --- indra/newview/llimfloatercontainer.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f54b3672e5..bf0fc2f6c0 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -154,12 +154,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, // Add a conversation list item in the left pane addConversationListItem(floaterp->getTitle(), session_id, floaterp); - LLView* floater_contents = floaterp->getChild("contents_view"); - - // we don't show the header when the floater is hosted, - // so reshape floater contents to occupy the header space - floater_contents->setShape(floaterp->getRect()); - LLIconCtrl* icon = 0; if(gAgent.isInGroup(session_id, TRUE)) @@ -185,19 +179,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, mTabContainer->setTabImage(floaterp, icon); } -// virtual -void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) -{ - LLMultiFloater::removeFloater(floaterp); - - LLRect contents_rect = floaterp->getRect(); - - // reduce the floater contents height by header height - contents_rect.mTop -= floaterp->getHeaderHeight(); - - LLView* floater_contents = floaterp->getChild("contents_view"); - floater_contents->setShape(contents_rect); -} void LLIMFloaterContainer::onCloseFloater(LLUUID& id) { -- cgit v1.2.3 From 7f7a9b7cbae153b00b8a77d3d662257bf6152912 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 13 Jul 2012 20:06:35 +0300 Subject: CHUI-205 FIXED conversations selection in the conversations list. Each conversation item is added to the folder view which lists all conversations. --- indra/newview/llimfloatercontainer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index bf0fc2f6c0..4f626cb5d2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -438,6 +438,9 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI LLFolderViewItem* widget = createConversationItemWidget(item); mConversationsWidgets[floaterp] = widget; + // Add a new conversation widget to the root folder of a folder view. + mConversationsRoot->addItem(widget); + // Add it to the UI widget->setVisible(TRUE); mConversationsListPanel->addChild(widget); @@ -460,7 +463,7 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; - delete widget; + widget->destroyView(); } // Suppress the conversation items and widgets from their respective maps -- cgit v1.2.3 From 7c9be0e3de6821478c71e4646f07fb112e0e572c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 19 Jul 2012 15:11:56 +0300 Subject: CHUI-229 [FIXED] Nearby chat conversation does not appear initially in conversation list if no other conversations are present --- indra/newview/llimfloatercontainer.cpp | 48 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4f626cb5d2..005794444b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -150,9 +150,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); LLUUID session_id = floaterp->getKey(); - - // Add a conversation list item in the left pane - addConversationListItem(floaterp->getTitle(), session_id, floaterp); LLIconCtrl* icon = 0; @@ -280,6 +277,8 @@ void LLIMFloaterContainer::draw() collapseMessagesPane(true); } LLFloater::draw(); + + repositioningWidgets(); } void LLIMFloaterContainer::tabClose() @@ -306,7 +305,7 @@ void LLIMFloaterContainer::setVisible(BOOL visible) LLFloaterReg::toggleInstanceOrBringToFront(name); } } - + // We need to show/hide all the associated conversations that have been torn off // (and therefore, are not longer managed by the multifloater), // so that they show/hide with the conversations manager. @@ -409,6 +408,23 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) } } +void LLIMFloaterContainer::repositioningWidgets() +{ + LLRect panel_rect = mConversationsListPanel->getRect(); + S32 item_height = 16; + int index = 0; + for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); + widget_it != mConversationsWidgets.end(); + widget_it++, ++index) + { + LLFolderViewItem* widget = widget_it->second; + widget->setRect(LLRect(0, + panel_rect.getHeight() - item_height*index, + panel_rect.getWidth(), + panel_rect.getHeight() - item_height*(index+1))); + } +} + // CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) { @@ -443,14 +459,11 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI // Add it to the UI widget->setVisible(TRUE); + + repositioningWidgets(); + mConversationsListPanel->addChild(widget); - LLRect panel_rect = mConversationsListPanel->getRect(); - S32 item_height = 16; - S32 index = mConversationsWidgets.size() - 1; - widget->setRect(LLRect(0, - panel_rect.getHeight() - item_height*index, - panel_rect.getWidth(), - panel_rect.getHeight() - item_height*(index+1))); + return; } @@ -470,18 +483,7 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool mConversationsItems.erase(floaterp); mConversationsWidgets.erase(floaterp); - // Reposition the leftover conversation items - LLRect panel_rect = mConversationsListPanel->getRect(); - S32 item_height = 16; - int index = 0; - for (widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); ++widget_it, ++index) - { - LLFolderViewItem* widget = widget_it->second; - widget->setRect(LLRect(0, - panel_rect.getHeight() - item_height*index, - panel_rect.getWidth(), - panel_rect.getHeight() - item_height*(index+1))); - } + repositioningWidgets(); // Don't let the focus fall IW, select and refocus on the first conversation in the list if (change_focus) -- cgit v1.2.3 From e9f640a26fd6c9219ba28336231621e2ad2558fc Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 27 Jul 2012 17:36:41 +0300 Subject: CHUI-198 FIXED (Hitting minimize option on conversations floater closes floater, not minimize) - Removed code which was hiding floater on minimizing floater. --- indra/newview/llimfloatercontainer.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 005794444b..c19683b1c2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -257,8 +257,6 @@ void LLIMFloaterContainer::setMinimized(BOOL b) if (isMinimized() == b) return; LLMultiFloater::setMinimized(b); - // Hide minimized floater (see EXT-5315) - setVisible(!b); if (isMinimized()) return; -- cgit v1.2.3 From 3ba619053de562fc623263704af2bc2f415e8389 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 27 Jul 2012 14:10:29 -0700 Subject: CHUI-256 FIX Invalid param warnings in llfolderview when adding and deleting items from object inventory --- indra/newview/llimfloatercontainer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c19683b1c2..74f089811e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -107,6 +107,7 @@ BOOL LLIMFloaterContainer::postBuild() p.rect = mConversationsListPanel->getLocalRect(); p.follows.flags = FOLLOWS_ALL; p.listener = base_item; + p.root = NULL; mConversationsRoot = LLUICtrlFactory::create(p); mConversationsListPanel->addChild(mConversationsRoot); -- cgit v1.2.3 From c8bc6a9d663c3abcaeec270eb443e30a9108afc4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 30 Jul 2012 19:47:02 -0700 Subject: CHUI-229 : Fix disappearance of nearby chat list item by forcing all list widgets to be visible. --- indra/newview/llimfloatercontainer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index adcd840dfc..405a2b3255 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -418,6 +418,7 @@ void LLIMFloaterContainer::repositioningWidgets() widget_it++, ++index) { LLFolderViewItem* widget = widget_it->second; + widget->setVisible(TRUE); widget->setRect(LLRect(0, panel_rect.getHeight() - item_height*index, panel_rect.getWidth(), @@ -461,7 +462,7 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI widget->setVisible(TRUE); repositioningWidgets(); - + mConversationsListPanel->addChild(widget); return; -- cgit v1.2.3 From 4256b54ee78a89dc5e790cc13556451e1a7c43fa Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 1 Aug 2012 10:45:11 -0700 Subject: build fix --- indra/newview/llimfloatercontainer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 405a2b3255..cc094fcaa1 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -100,7 +100,7 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); // CHUI-98 : View Model for conversations - LLConversationItem* base_item = new LLConversationItem(); + LLConversationItem* base_item = new LLConversationItem(this); LLFolderView::Params p; p.view_model = &mConversationViewModel; p.parent_panel = mConversationsListPanel; @@ -456,7 +456,7 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI mConversationsWidgets[floaterp] = widget; // Add a new conversation widget to the root folder of a folder view. - mConversationsRoot->addItem(widget); + widget->addToFolder(mConversationsRoot); // Add it to the UI widget->setVisible(TRUE); @@ -533,6 +533,7 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat // Conversation items LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) : + LLFolderViewModelItemCommon(containerp->getRootViewModel()), mName(name), mUUID(uuid), mFloater(floaterp), @@ -540,7 +541,8 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF { } -LLConversationItem::LLConversationItem() : +LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : + LLFolderViewModelItemCommon(containerp->getRootViewModel()), mName(""), mUUID(), mFloater(NULL), -- cgit v1.2.3 From 0fa1e2b9ae41bb06e5c7db90900d4f469f44b8d3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 2 Aug 2012 18:43:44 +0300 Subject: CHUI-230, CHUI-232, CHUI-261 Forced resize of a conversation's floater in the IM-container; support of the rectControls for IM-conversations; fixed LLFloater and LLMultiFloater for the correct hosting of floaters with mSaveRect --- indra/newview/llimfloatercontainer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index cc094fcaa1..d618e7491a 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -174,6 +174,11 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, mSessions[session_id] = floaterp; floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); } + + // forced resize of the floater + LLRect wrapper_rect = this->mTabContainer->getLocalRect(); + floaterp->setRect(wrapper_rect); + mTabContainer->setTabImage(floaterp, icon); } -- cgit v1.2.3 From 25855962a86331a337c4baff2754c63850605aea Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 6 Aug 2012 18:07:56 -0700 Subject: CHUI-98 : Isolate LLConversationItem and LLConversationViewModel in their own file --- indra/newview/llimfloatercontainer.cpp | 73 ---------------------------------- 1 file changed, 73 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index d618e7491a..c2c0ddddea 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -536,77 +536,4 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat return LLUICtrlFactory::create(params); } -// Conversation items -LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) : - LLFolderViewModelItemCommon(containerp->getRootViewModel()), - mName(name), - mUUID(uuid), - mFloater(floaterp), - mContainer(containerp) -{ -} - -LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : - LLFolderViewModelItemCommon(containerp->getRootViewModel()), - mName(""), - mUUID(), - mFloater(NULL), - mContainer(NULL) -{ -} - - -// Virtual action callbacks -void LLConversationItem::selectItem(void) -{ - LLMultiFloater* host_floater = mFloater->getHost(); - if (host_floater == mContainer) - { - // Always expand the message pane if the panel is hosted by the container - mContainer->collapseMessagesPane(false); - // Switch to the conversation floater that is being selected - mContainer->selectFloater(mFloater); - } - // Set the focus on the selected floater - mFloater->setFocus(TRUE); -} - -void LLConversationItem::setVisibleIfDetached(BOOL visible) -{ - // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized - // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here - if (!mFloater->getHost() && !mFloater->isMinimized()) - { - mFloater->setVisible(visible); - } -} - -void LLConversationItem::performAction(LLInventoryModel* model, std::string action) -{ -} - -void LLConversationItem::openItem( void ) -{ -} - -void LLConversationItem::closeItem( void ) -{ -} - -void LLConversationItem::previewItem( void ) -{ -} - -void LLConversationItem::showProperties(void) -{ -} - -bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const -{ - // We compare only by name for the moment - // *TODO : Implement the sorting by date - S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); - return (compare < 0); -} - // EOF -- cgit v1.2.3 From 6cf49a4a715c9f498d4b063f8d74e295be1f418c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 9 Aug 2012 16:48:33 +0300 Subject: CHUI-171 WIP (Conversation not automatically readded to conversation window listing when open) - removal of the dependence between items of the conversations list and conversation's floaters. --- indra/newview/llimfloatercontainer.cpp | 64 +++++++++++++++------------------- 1 file changed, 28 insertions(+), 36 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c2c0ddddea..1896ed65f3 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -76,13 +76,20 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { LLIMFloater::show(session_id); + addConversationListItem(session_id); +} + +void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) +{ + removeConversationListItem(old_session_id); + addConversationListItem(new_session_id); } void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) { LLIMFloater* floaterp = LLIMFloater::findInstance(session_id); LLFloater::onClickClose(floaterp); - removeConversationListItem(floaterp); + removeConversationListItem(session_id); } BOOL LLIMFloaterContainer::postBuild() @@ -112,6 +119,10 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsRoot = LLUICtrlFactory::create(p); mConversationsListPanel->addChild(mConversationsRoot); + addConversationListItem(LLUUID()); // manually add nearby chat + + addConversationListItem(LLUUID()); // manually add nearby chat + mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); @@ -301,13 +312,13 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLFloater* nearby_chat = LLFloaterReg::findInstance("chat_bar"); + LLIMConversation* nearby_chat = LLIMConversation::getConversation(LLUUID::null); if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("chat_bar"); - LLFloaterReg::toggleInstanceOrBringToFront(name); + LLFloaterReg::toggleInstanceOrBringToFront(name, LLSD(LLUUID::null)); } } @@ -432,33 +443,29 @@ void LLIMFloaterContainer::repositioningWidgets() } // CHUI-137 : Temporary implementation of conversations list -void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) +void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { + std::string display_name = uuid.isNull()? LLTrans::getString("NearbyChatTitle") : LLIMModel::instance().getName(uuid); + // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance - conversations_items_map::iterator item_it = mConversationsItems.find(floaterp); + conversations_items_map::iterator item_it = mConversationsItems.find(uuid); if (item_it != mConversationsItems.end()) { - LLConversationItem* item = item_it->second; - // Check if the item has changed - if (item->hasSameValues(name,uuid)) - { - // If it hasn't changed, nothing to do -> exit - return; - } + return; } - + // Remove the conversation item that might exist already: it'll be recreated anew further down anyway // and nothing wrong will happen removing it if it doesn't exist - removeConversationListItem(floaterp,false); + removeConversationListItem(uuid,false); // Create a conversation item - LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); - mConversationsItems[floaterp] = item; + LLConversationItem* item = new LLConversationItem(display_name, uuid, this); + mConversationsItems[uuid] = item; // Create a widget from it LLFolderViewItem* widget = createConversationItemWidget(item); - mConversationsWidgets[floaterp] = widget; + mConversationsWidgets[uuid] = widget; // Add a new conversation widget to the root folder of a folder view. widget->addToFolder(mConversationsRoot); @@ -473,12 +480,12 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool change_focus) +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) { // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(floaterp); + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(uuid); if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; @@ -486,8 +493,8 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool } // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(floaterp); - mConversationsWidgets.erase(floaterp); + mConversationsItems.erase(uuid); + mConversationsWidgets.erase(uuid); repositioningWidgets(); @@ -505,21 +512,6 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool return; } -LLFloater* LLIMFloaterContainer::findConversationItem(LLUUID& uuid) -{ - LLFloater* floaterp = NULL; - for (conversations_items_map::iterator item_it = mConversationsItems.begin(); item_it != mConversationsItems.end(); ++item_it) - { - LLConversationItem* item = item_it->second; - if (item->hasSameValue(uuid)) - { - floaterp = item_it->first; - break; - } - } - return floaterp; -} - LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLFolderViewItem::Params params; -- cgit v1.2.3 From f4c4df4cdd3dae7ce90efb8fbea8af1ba66410ff Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 10 Aug 2012 17:39:46 +0300 Subject: fix incorrect merge --- indra/newview/llimfloatercontainer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 1896ed65f3..ad3b0279e5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -73,6 +73,11 @@ LLIMFloaterContainer::~LLIMFloaterContainer() } } +void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + addConversationListItem(session_id); +} + void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { LLIMFloater::show(session_id); -- cgit v1.2.3 From 09c890db98bb0996058e9faf1f867650707e3e31 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 10 Aug 2012 19:03:37 +0300 Subject: fixed merge issue. Done. --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index ad3b0279e5..38b5768a60 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -317,7 +317,7 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLIMConversation* nearby_chat = LLIMConversation::getConversation(LLUUID::null); + LLIMConversation* nearby_chat = LLIMConversation::findConversation(LLUUID::null); if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel -- cgit v1.2.3 From c01254daf16adb3d91ad8990ba5c66d2b51eae45 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 14 Aug 2012 16:05:47 +0300 Subject: CHUI-171, CHUI-272 conversation is added as docked in conversation floater when session started (without click on an conv. list's item) --- indra/newview/llimfloatercontainer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 38b5768a60..fe47e03beb 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -75,6 +75,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { + LLIMFloater::show(session_id); addConversationListItem(session_id); } -- cgit v1.2.3 From 3a21eb59f1cf0b7672e2beb671e1dbc717e28b3f Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 15 Aug 2012 20:10:00 +0300 Subject: CHUI-286 (Conversations floater opened by default when a new IM session is started (no IM toast shown): now floater silently adds itself to the container --- indra/newview/llimfloatercontainer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index fe47e03beb..bcad7adcce 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -75,13 +75,13 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - LLIMFloater::show(session_id); + LLIMFloater::addToIMContainer(session_id); addConversationListItem(session_id); } void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::show(session_id); + LLIMFloater::addToIMContainer(session_id); addConversationListItem(session_id); } @@ -93,8 +93,6 @@ void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) { - LLIMFloater* floaterp = LLIMFloater::findInstance(session_id); - LLFloater::onClickClose(floaterp); removeConversationListItem(session_id); } -- cgit v1.2.3 From d2b813fd79e4cf60d1670472c5a5f09ee9a2eed7 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 17 Aug 2012 20:08:01 +0300 Subject: Remove typo --- indra/newview/llimfloatercontainer.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index bcad7adcce..450717e624 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -125,8 +125,6 @@ BOOL LLIMFloaterContainer::postBuild() addConversationListItem(LLUUID()); // manually add nearby chat - addConversationListItem(LLUUID()); // manually add nearby chat - mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); -- cgit v1.2.3 From 2097e61dcb6865ad4c5b6667c9032f2cef658bd6 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 20 Aug 2012 17:54:33 +0300 Subject: CHUI-302 FIXED (User can resize conversation list too small with message panel collapsed) set floater's resize limits from a left panel's limits --- indra/newview/llimfloatercontainer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 450717e624..6b7912205e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -402,6 +402,14 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) setCanResize(is_left_pane_expanded || is_right_pane_expanded); setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); + + // restore floater's resize limits (prevent collapse when left panel is expanded) + if (is_left_pane_expanded && !is_right_pane_expanded) + { + S32 expanded_min_size = mConversationsPane->getExpandedMinDim(); + setResizeLimits(expanded_min_size, expanded_min_size); + } + } void LLIMFloaterContainer::onAddButtonClicked() -- cgit v1.2.3 From 9a49dbcc456e1313750d5f8b127f29945f8d7ba9 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 16 Aug 2012 13:47:46 +0300 Subject: CHUI-299 (User can start IM session with themselves) FIXED: agent was excluded from the search results --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 6b7912205e..1e136b721c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -414,7 +414,7 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) void LLIMFloaterContainer::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE); LLFloater* root_floater = gFloaterView->getParentFloater(this); if (picker && root_floater) { -- cgit v1.2.3 From 76827f03d429e3ce80def7a49c2657a1cb1179d4 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 22 Aug 2012 13:25:06 +0300 Subject: CHUI-289 FIXED (Newly added conversation is not selected in conversation list): added the "reverse" selecting - list item is selected when the corresponding floter gets focus. --- indra/newview/llimfloatercontainer.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 54a40627fb..81dddfaa70 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -183,9 +183,9 @@ void LLIMFloaterContainer::onOpen(const LLSD& key) } // virtual -void LLIMFloaterContainer::addFloater(LLFloater* floaterp, - BOOL select_added_floater, - LLTabContainer::eInsertionPoint insertion_point) +void LLIMFloaterContainer::addFloater(LLFloater* floaterp, + BOOL select_added_floater, + LLTabContainer::eInsertionPoint insertion_point) { if(!floaterp) return; @@ -427,7 +427,10 @@ void LLIMFloaterContainer::setVisible(BOOL visible) for (;widget_it != mConversationsWidgets.end(); ++widget_it) { LLConversationViewSession* widget = dynamic_cast(widget_it->second); - widget->setVisibleIfDetached(visible); + if (widget) + { + widget->setVisibleIfDetached(visible); + } } // Now, do the normal multifloater show/hide @@ -608,6 +611,16 @@ void LLIMFloaterContainer::repositioningWidgets() } } +void LLIMFloaterContainer::setConvItemSelect(LLUUID& session_id) +{ + LLFolderViewItem* widget = mConversationsWidgets[session_id]; + if (widget && mSelectedSession != session_id) + { + mSelectedSession = session_id; + (widget->getRoot())->setSelection(widget, FALSE, FALSE); + } +} + void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { bool is_nearby_chat = uuid.isNull(); @@ -675,7 +688,10 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; - widget->destroyView(); + if (widget) + { + widget->destroyView(); + } } // Suppress the conversation items and widgets from their respective maps -- cgit v1.2.3 From b2f2a8b21610ae6863b773333c60b18b818c047f Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 22 Aug 2012 14:48:44 +0300 Subject: code style fix --- indra/newview/llimfloatercontainer.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 1e136b721c..6127a9a19b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -519,7 +519,6 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c item->selectItem(); } } - return; } LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) -- cgit v1.2.3 From 14708a3ace184b0654ca7923732be6e06962d583 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 22 Aug 2012 18:27:29 +0300 Subject: CHUI_310 make NearbyChat a singletone --- indra/newview/llimfloatercontainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4d0bd623f8..a3f5e357c9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -315,13 +315,13 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLIMConversation* nearby_chat = LLIMConversation::findConversation(LLUUID::null); + LLIMConversation* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that - LLSD name("chat_bar"); - LLFloaterReg::toggleInstanceOrBringToFront(name, LLSD(LLUUID::null)); + LLSD name("nearby_chat"); + LLFloaterReg::toggleInstanceOrBringToFront(name); } } -- cgit v1.2.3 From 2cf5307c9211b813689f0e441b9f56bc21f63348 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 22 Aug 2012 19:29:22 -0700 Subject: CHUI-282 : WIP : Isolated llconversationview classes and suppressed the dependency of model to widgets --- indra/newview/llimfloatercontainer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 1e136b721c..29878cfc9e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -43,6 +43,7 @@ #include "llimview.h" #include "lltransientfloatermgr.h" #include "llviewercontrol.h" +#include "llconversationview.h" // // LLIMFloaterContainer @@ -111,7 +112,7 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); // CHUI-98 : View Model for conversations - LLConversationItem* base_item = new LLConversationItem(this); + LLConversationItem* base_item = new LLConversationItem(getRootViewModel()); LLFolderView::Params p; p.view_model = &mConversationViewModel; p.parent_panel = mConversationsListPanel; @@ -470,7 +471,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) removeConversationListItem(uuid,false); // Create a conversation item - LLConversationItem* item = new LLConversationItem(display_name, uuid, this); + LLConversationItem* item = new LLConversationItem(display_name, uuid, getRootViewModel()); mConversationsItems[uuid] = item; // Create a widget from it @@ -524,7 +525,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { - LLFolderViewItem::Params params; + LLConversationViewSession::Params params; params.name = item->getDisplayName(); //params.icon = bridge->getIcon(); @@ -534,8 +535,9 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat params.listener = item; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; + params.container = this; - return LLUICtrlFactory::create(params); + return LLUICtrlFactory::create(params); } // EOF -- cgit v1.2.3 From 4ea73df484d22815026367771f9d728d755f6274 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 23 Aug 2012 11:32:20 -0700 Subject: CHUI-282 : WIP : Further separate view from model for llconversation items --- indra/newview/llimfloatercontainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 29878cfc9e..38ac3eb9e4 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -328,10 +328,10 @@ void LLIMFloaterContainer::setVisible(BOOL visible) // We need to show/hide all the associated conversations that have been torn off // (and therefore, are not longer managed by the multifloater), // so that they show/hide with the conversations manager. - conversations_items_map::iterator item_it = mConversationsItems.begin(); - for (;item_it != mConversationsItems.end(); ++item_it) + conversations_widgets_map::iterator item_it = mConversationsWidgets.begin(); + for (;item_it != mConversationsWidgets.end(); ++item_it) { - LLConversationItem* item = item_it->second; + LLConversationViewSession* item = dynamic_cast(item_it->second); item->setVisibleIfDetached(visible); } -- cgit v1.2.3 From 15d957616ebac22a9f4633b6d806f8519423593b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 23 Aug 2012 16:11:08 -0700 Subject: CHUI-282 : Use views for UI manipulation, not models --- indra/newview/llimfloatercontainer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 35b9f404c3..32ef292763 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -328,11 +328,11 @@ void LLIMFloaterContainer::setVisible(BOOL visible) // We need to show/hide all the associated conversations that have been torn off // (and therefore, are not longer managed by the multifloater), // so that they show/hide with the conversations manager. - conversations_widgets_map::iterator item_it = mConversationsWidgets.begin(); - for (;item_it != mConversationsWidgets.end(); ++item_it) + conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); + for (;widget_it != mConversationsWidgets.end(); ++widget_it) { - LLConversationViewSession* item = dynamic_cast(item_it->second); - item->setVisibleIfDetached(visible); + LLConversationViewSession* widget = dynamic_cast(widget_it->second); + widget->setVisibleIfDetached(visible); } // Now, do the normal multifloater show/hide @@ -513,11 +513,11 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c if (change_focus) { setFocus(TRUE); - conversations_items_map::iterator item_it = mConversationsItems.begin(); - if (item_it != mConversationsItems.end()) + conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); + if (widget_it != mConversationsWidgets.end()) { - LLConversationItem* item = item_it->second; - item->selectItem(); + LLFolderViewItem* widget = widget_it->second; + widget->selectItem(); } } } -- cgit v1.2.3 From e537d6477dfa1eea86dc16c767b793fb530d1ebc Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 23 Aug 2012 19:44:10 -0700 Subject: CHUI-98 : Defining the various llconversation sub classes in their respective file --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 32ef292763..4d0bd623f8 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -471,7 +471,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) removeConversationListItem(uuid,false); // Create a conversation item - LLConversationItem* item = new LLConversationItem(display_name, uuid, getRootViewModel()); + LLConversationItem* item = new LLConversationItemSession(display_name, uuid, getRootViewModel()); mConversationsItems[uuid] = item; // Create a widget from it -- cgit v1.2.3 From 9ff67f4a040fae53f28aa981309bce2356df1445 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 29 Aug 2012 18:27:21 -0700 Subject: CHUI-285 : WIP : Get the conversation floater to use the same LLParticipantList as the IM and call dialog --- indra/newview/llimfloatercontainer.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index a3f5e357c9..55cbf0b266 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -456,7 +456,9 @@ void LLIMFloaterContainer::repositioningWidgets() // CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { - std::string display_name = uuid.isNull()? LLTrans::getString("NearbyChatTitle") : LLIMModel::instance().getName(uuid); + bool is_nearby_chat = uuid.isNull(); + + std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatTitle") : LLIMModel::instance().getName(uuid); // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance @@ -470,8 +472,21 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) // and nothing wrong will happen removing it if it doesn't exist removeConversationListItem(uuid,false); - // Create a conversation item - LLConversationItem* item = new LLConversationItemSession(display_name, uuid, getRootViewModel()); + // Create a conversation session model + LLConversationItem* item = NULL; + LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid)); + if (speaker_manager) + { + item = new LLParticipantList(speaker_manager, NULL, getRootViewModel(), true, false); + } + if (!item) + { + llinfos << "Merov debug : Couldn't create conversation session item : " << display_name << llendl; + return; + } + // *TODO: Should we flag LLConversationItemSession with a mIsNearbyChat? + item->renameItem(display_name); + mConversationsItems[uuid] = item; // Create a widget from it -- cgit v1.2.3 From be61b5be2f4089e12ca25ca1ece13bd0fdaea543 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 29 Aug 2012 19:18:25 -0700 Subject: CHUI-305: Problem: The 'resident picker' had multiple parents and due to the design of the resident picker it can have only one parent. Having multiple parents caused both parents to fight for depth ordering...which caused the flickering. Resolution: Now multiple 'resident pickers' can exist and they are coupled to the floater that spawned then. Meaning that when the parent floater closes, the 'resident picker' floater will also close. In addition, a shadow frustum eminates from the button that opened the 'resident picker'. --- indra/newview/llimfloatercontainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4d0bd623f8..bfe4afe80b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -415,8 +415,10 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) void LLIMFloaterContainer::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE); + LLView * button = getChildView("conversations_pane_buttons_expanded")->getChildView("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE, root_floater->getName(), button); + if (picker && root_floater) { root_floater->addDependentFloater(picker); -- cgit v1.2.3 From d67c295d8bb6cfd58655bf961dcf835157abb3e7 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 30 Aug 2012 16:20:27 -0700 Subject: CHUI-305: Minor changes after code review. Using templated findChild() instead of getChildView(). Also using settings.xml to store common custom variables. --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index fe00f70a28..d382b61921 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -415,7 +415,7 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) void LLIMFloaterContainer::onAddButtonClicked() { - LLView * button = getChildView("conversations_pane_buttons_expanded")->getChildView("add_btn"); + LLView * button = findChild("conversations_pane_buttons_expanded")->findChild("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE, root_floater->getName(), button); -- cgit v1.2.3 From ab37263a5cda14227724181c771ac1d3ef55f467 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 30 Aug 2012 21:34:48 -0700 Subject: CHUI-285 : LLIMFloaterContainer is now using LLParticipantList fully --- indra/newview/llimfloatercontainer.cpp | 85 +++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 7 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') 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(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(*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(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(params); +} + // EOF -- cgit v1.2.3 From c2bb1a189c5f4c2367ee38e03371b28948e3ea81 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 31 Aug 2012 12:05:36 +0300 Subject: CHUI-154 FIXED (Add link to chat preferences from Conversation floater) - Added link to chat preferences from Conversation floater --- indra/newview/llimfloatercontainer.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index aa85e5023d..f85b60cb36 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -40,6 +40,7 @@ #include "llavatarnamecache.h" #include "llgroupiconctrl.h" #include "llfloateravatarpicker.h" +#include "llfloaterpreference.h" #include "llimview.h" #include "lltransientfloatermgr.h" #include "llviewercontrol.h" @@ -53,6 +54,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mExpandCollapseBtn(NULL), mConversationsRoot(NULL) { + mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); + // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -435,6 +438,25 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) } } +void LLIMFloaterContainer::onCustomAction(const LLSD& userdata) +{ + std::string command = userdata.asString(); + + if ("chat_preferences" == command) + { + LLFloaterPreference* floater_prefs = LLFloaterReg::showTypedInstance("preferences"); + if (floater_prefs) + { + LLTabContainer* tab_container = floater_prefs->getChild("pref core"); + LLPanel* chat_panel = tab_container->getPanelByName("chat"); + if (tab_container && chat_panel) + { + tab_container->selectTabPanel(chat_panel); + } + } + } +} + void LLIMFloaterContainer::repositioningWidgets() { LLRect panel_rect = mConversationsListPanel->getRect(); -- cgit v1.2.3 From 681406427fab95167cb87b54e8315600176bf218 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 4 Sep 2012 20:39:49 +0300 Subject: CHUI-311 FIXED (Make conversation list panel size persist between sessions): save current width in the setting_per_account.xml --- indra/newview/llimfloatercontainer.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 56648d09b5..480f964939 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -52,7 +52,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed), mExpandCollapseBtn(NULL), - mConversationsRoot(NULL) + mConversationsRoot(NULL), + mInitialized(false) { mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); @@ -139,6 +140,16 @@ BOOL LLIMFloaterContainer::postBuild() LLAvatarNameCache::addUseDisplayNamesCallback( boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); + if (! mMessagesPane->isCollapsed()) + { + S32 list_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth"); + LLRect list_size = mConversationsPane->getRect(); + S32 left_pad = mConversationsListPanel->getRect().mLeft; + list_size.mRight = list_size.mLeft + list_width - left_pad; + + mConversationsPane->handleReshape(list_size, TRUE); + } + mInitialized = true; return TRUE; } @@ -514,6 +525,16 @@ void LLIMFloaterContainer::onCustomAction(const LLSD& userdata) void LLIMFloaterContainer::repositioningWidgets() { + if (!mInitialized) + { + return; + } + + if (!mConversationsPane->isCollapsed()) + { + S32 list_width = (mConversationsPane->getRect()).getWidth(); + gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", list_width); + } LLRect panel_rect = mConversationsListPanel->getRect(); S32 item_height = 16; int index = 0; -- cgit v1.2.3 From 8cd5d361600f34a0a7fa504a721bea3301191644 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 4 Sep 2012 22:11:28 -0700 Subject: CHUI-285 : Create participant widgets in the conversation list --- indra/newview/llimfloatercontainer.cpp | 75 +++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 20 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') 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(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(*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(params); } -- cgit v1.2.3 From 1229f42ade088f69164b59742305119bacc8f4de Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Sep 2012 18:55:07 -0700 Subject: CHUI-285 : Clear the needs refresh flag when refreshing, comment clean up. --- indra/newview/llimfloatercontainer.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 1be0c5f075..56648d09b5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -552,7 +552,6 @@ void LLIMFloaterContainer::repositioningWidgets() } } -// CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { bool is_nearby_chat = uuid.isNull(); -- cgit v1.2.3 From c26867bb6d1226c82c11f2f386f73b6d8e3ed749 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Sep 2012 19:53:38 -0700 Subject: CHUI-285 : Implement sort, alphabetical only for the moment --- indra/newview/llimfloatercontainer.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 56648d09b5..fa0750c39c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -45,6 +45,7 @@ #include "lltransientfloatermgr.h" #include "llviewercontrol.h" #include "llconversationview.h" +#include "llcallbacklist.h" // // LLIMFloaterContainer @@ -65,6 +66,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) LLIMFloaterContainer::~LLIMFloaterContainer() { + gIdleCallbacks.deleteFunction(idle, this); + mNewMessageConnection.disconnect(); LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); @@ -139,6 +142,9 @@ BOOL LLIMFloaterContainer::postBuild() LLAvatarNameCache::addUseDisplayNamesCallback( boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); + // Add callback: we'll take care of view updates on idle + gIdleCallbacks.addFunction(idle, this); + return TRUE; } @@ -290,6 +296,13 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +//static +void LLIMFloaterContainer::idle(void* user_data) +{ + LLIMFloaterContainer* panel = (LLIMFloaterContainer*)user_data; + panel->mConversationsRoot->update(); +} + void LLIMFloaterContainer::draw() { // CHUI Notes @@ -579,7 +592,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) } 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; } // *TODO: Should we flag LLConversationItemSession with a mIsNearbyChat? @@ -602,7 +615,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) // 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(*current_participant_model); -- cgit v1.2.3 From 6df8c2b42066efad4d46a601ecaabbc9bf1dcd91 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 9 Sep 2012 14:48:06 -0700 Subject: CHUI-285 : Complete. Fix participants repositioning. --- indra/newview/llimfloatercontainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index fa0750c39c..978b91b598 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -358,6 +358,8 @@ void LLIMFloaterContainer::draw() } } + repositioningWidgets(); + if (mTabContainer->getTabCount() == 0) { // Do not close the container when every conversation is torn off because the user @@ -365,8 +367,6 @@ void LLIMFloaterContainer::draw() collapseMessagesPane(true); } LLFloater::draw(); - - repositioningWidgets(); } void LLIMFloaterContainer::tabClose() -- cgit v1.2.3 From 5dc8738076d158aa74a93f7f3630a17d9102fdc4 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 10 Sep 2012 07:40:13 -0700 Subject: CHUI-283: Basic Implementation, just have hard coded avatar icon appearing and profile/info buttons visible. profile/info buttons do not have proper positioning or mouseclick events. --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/llimfloatercontainer.cpp (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp old mode 100644 new mode 100755 index 5261d30cd9..9758f5a93e --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -634,7 +634,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item) { - LLConversationViewSession::Params params; + LLConversationViewParticipant::Params params; params.name = item->getDisplayName(); //params.icon = bridge->getIcon(); -- cgit v1.2.3 From be06bebffcc1a08c3018ab3712048599455e025b Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Mon, 10 Sep 2012 20:12:27 +0300 Subject: CHUI-282 WIP Modified conversation view item and IM floater container so that the folder view handles the positioning of items in conversations list. --- indra/newview/llimfloatercontainer.cpp | 60 +++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 15 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 480f964939..9157d16aea 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -38,6 +38,7 @@ #include "llavataractions.h" #include "llavatariconctrl.h" #include "llavatarnamecache.h" +#include "llcallbacklist.h" #include "llgroupiconctrl.h" #include "llfloateravatarpicker.h" #include "llfloaterpreference.h" @@ -76,6 +77,8 @@ LLIMFloaterContainer::~LLIMFloaterContainer() { LLIMMgr::getInstance()->removeSessionObserver(this); } + + gIdleCallbacks.deleteFunction(idle, (void*)this); } void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -117,16 +120,31 @@ BOOL LLIMFloaterContainer::postBuild() // CHUI-98 : View Model for conversations LLConversationItem* base_item = new LLConversationItem(getRootViewModel()); - LLFolderView::Params p; - p.view_model = &mConversationViewModel; - p.parent_panel = mConversationsListPanel; - p.rect = mConversationsListPanel->getLocalRect(); - p.follows.flags = FOLLOWS_ALL; - p.listener = base_item; - p.root = NULL; + LLFolderView::Params p(LLUICtrlFactory::getDefaultParams()); + p.name = getName(); + p.title = getLabel(); + p.rect = LLRect(0, 0, getRect().getWidth(), 0); + p.parent_panel = mConversationsListPanel; + p.tool_tip = p.name; + p.listener = base_item; + p.view_model = &mConversationViewModel; + p.root = NULL; mConversationsRoot = LLUICtrlFactory::create(p); - mConversationsListPanel->addChild(mConversationsRoot); + + // Scroller + LLRect scroller_view_rect = mConversationsListPanel->getRect(); + scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); + LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams()); + scroller_params.rect(scroller_view_rect); + + LLScrollContainer* scroller = LLUICtrlFactory::create(scroller_params); + scroller->setFollowsAll(); + mConversationsListPanel->addChild(scroller); + scroller->addChild(mConversationsRoot); + mConversationsRoot->setScrollContainer(scroller); + mConversationsRoot->setFollowsAll(); + mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox); addConversationListItem(LLUUID()); // manually add nearby chat @@ -149,6 +167,9 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsPane->handleReshape(list_size, TRUE); } + + gIdleCallbacks.addFunction(idle, (void*)this); + mInitialized = true; return TRUE; } @@ -301,6 +322,13 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +// static +void LLIMFloaterContainer::idle(void* user_data) +{ + LLIMFloaterContainer* self = static_cast(user_data); + self->mConversationsRoot->update(); +} + void LLIMFloaterContainer::draw() { // CHUI Notes @@ -338,7 +366,6 @@ void LLIMFloaterContainer::draw() { participant_view = createConversationViewParticipant(participant_model); participant_view->addToFolder(session_view); - mConversationsListPanel->addChild(participant_view); participant_view->setVisible(TRUE); } else @@ -363,8 +390,6 @@ void LLIMFloaterContainer::draw() collapseMessagesPane(true); } LLFloater::draw(); - - repositioningWidgets(); } void LLIMFloaterContainer::tabClose() @@ -616,7 +641,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) widget->addToFolder(mConversationsRoot); // Add it to the UI - mConversationsListPanel->addChild(widget); +// mConversationsListPanel->addChild(widget); widget->setVisible(TRUE); // Create the participants widgets now @@ -629,12 +654,16 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) LLConversationItem* participant_model = dynamic_cast(*current_participant_model); LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); participant_view->addToFolder(widget); - mConversationsListPanel->addChild(participant_view); - participant_view->setVisible(TRUE); +// mConversationsListPanel->addChild(participant_view); +// participant_view->setVisible(TRUE); current_participant_model++; } - repositioningWidgets(); + S32 width = 0; + S32 height = 0; + mConversationsRoot->arrange(&width, &height); + +// repositioningWidgets(); return; } @@ -678,6 +707,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL //params.icon = bridge->getIcon(); //params.icon_open = bridge->getOpenIcon(); //params.creation_date = bridge->getCreationDate(); + params.item_height = 24; params.root = mConversationsRoot; params.listener = item; params.rect = LLRect (0, 0, 0, 0); -- cgit v1.2.3 From 5cad4b5768cccc8301da5e15dd09a0a4e68d4112 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 12 Sep 2012 23:18:52 -0700 Subject: CHUI-308 : Temp fix while waiting for a scroll container to be implemented --- indra/newview/llimfloatercontainer.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index faca92e662..b70305a4e9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -118,7 +118,7 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); - // CHUI-98 : View Model for conversations + // Create the root model and view for all conversation sessions LLConversationItem* base_item = new LLConversationItem(getRootViewModel()); LLFolderView::Params p; p.view_model = &mConversationViewModel; @@ -129,6 +129,8 @@ BOOL LLIMFloaterContainer::postBuild() p.root = NULL; mConversationsRoot = LLUICtrlFactory::create(p); + mConversationsRoot->setVisible(TRUE); + mConversationsListPanel->addChild(mConversationsRoot); addConversationListItem(LLUUID()); // manually add nearby chat @@ -370,8 +372,13 @@ void LLIMFloaterContainer::draw() } } - repositioningWidgets(); - + // CHUI-308 : Hack! We shouldn't have to do that but we have too as long as + // we don't have a scroll container. + // *TODO: Take those 3 lines out once we implement the scroll container. + repositioningWidgets(); + mConversationsRoot->setRect(mConversationsListPanel->getLocalRect()); + mConversationsRoot->setFollowsAll(); + if (mTabContainer->getTabCount() == 0) { // Do not close the container when every conversation is torn off because the user @@ -630,7 +637,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) widget->addToFolder(mConversationsRoot); // Add it to the UI - mConversationsListPanel->addChild(widget); widget->setVisible(TRUE); // Create the participants widgets now -- cgit v1.2.3 From 7da24ddaa3813f7b409b51ed5d330c7609b4f8a9 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 13 Sep 2012 17:00:26 +0300 Subject: CHUI-332 [Overlap of icons in chrome when collapsing and expanding conversation list]: force header resizing after show/hide minimize button --- indra/newview/llimfloatercontainer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index b70305a4e9..a1bd623ac5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -492,6 +492,13 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) setCanResize(is_left_pane_expanded || is_right_pane_expanded); setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); + // force set correct size for the title after show/hide minimize button + LLRect cur_rect = getRect(); + LLRect force_rect = cur_rect; + force_rect.mRight = cur_rect.mRight + 1; + setRect(force_rect); + setRect(cur_rect); + // restore floater's resize limits (prevent collapse when left panel is expanded) if (is_left_pane_expanded && !is_right_pane_expanded) { -- cgit v1.2.3 From 4b52515b543546844835064dfb89e5af2bbbd948 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 13 Sep 2012 20:10:45 +0300 Subject: CHUI-282 WIP Fixed conversation list items selection. Fixed displaying session participants only when session item is open. --- indra/newview/llimfloatercontainer.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9157d16aea..79009942bf 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -132,7 +132,7 @@ BOOL LLIMFloaterContainer::postBuild() p.root = NULL; mConversationsRoot = LLUICtrlFactory::create(p); - // Scroller + // a scroller for folder view LLRect scroller_view_rect = mConversationsListPanel->getRect(); scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams()); @@ -639,10 +639,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) // 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); + widget->requestArrange(); // Create the participants widgets now // Note: usually, we do not get an updated avatar list at that point @@ -654,16 +651,8 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) LLConversationItem* participant_model = dynamic_cast(*current_participant_model); LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); participant_view->addToFolder(widget); -// mConversationsListPanel->addChild(participant_view); -// participant_view->setVisible(TRUE); current_participant_model++; } - - S32 width = 0; - S32 height = 0; - mConversationsRoot->arrange(&width, &height); - -// repositioningWidgets(); return; } @@ -683,8 +672,6 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c // Suppress the conversation items and widgets from their respective maps mConversationsItems.erase(uuid); mConversationsWidgets.erase(uuid); - - repositioningWidgets(); // Don't let the focus fall IW, select and refocus on the first conversation in the list if (change_focus) @@ -704,13 +691,8 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL LLConversationViewSession::Params params; params.name = item->getDisplayName(); - //params.icon = bridge->getIcon(); - //params.icon_open = bridge->getOpenIcon(); - //params.creation_date = bridge->getCreationDate(); - params.item_height = 24; params.root = mConversationsRoot; params.listener = item; - params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; params.container = this; -- cgit v1.2.3 From 2084d33c1ec827b4e8d975a3bf1232e971f704e2 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 13 Sep 2012 11:22:41 -0700 Subject: CHUI-283: Now the information icon only appears upon mousehover. Also the information/speaker icon are right justified. --- indra/newview/llimfloatercontainer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index faca92e662..3243fd48de 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -703,6 +703,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item) { LLConversationViewParticipant::Params params; + LLRect panel_rect = mConversationsListPanel->getRect(); params.name = item->getDisplayName(); //params.icon = bridge->getIcon(); @@ -710,7 +711,7 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti //params.creation_date = bridge->getCreationDate(); params.root = mConversationsRoot; params.listener = item; - params.rect = LLRect (0, 0, 0, 0); + params.rect = LLRect (0, 16, panel_rect.getWidth(), 0); params.tool_tip = params.name; params.participant_id = item->getUUID(); -- cgit v1.2.3 From 386c50d414e6357975cb18814b6bfb048b46b3da Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 14 Sep 2012 00:29:50 +0300 Subject: CHUI-282 WIP Removed the hack added for CHUI-308 to resize the folder view in conversation list. Fixed some glitches after automated merge. --- indra/newview/llimfloatercontainer.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 6aa7a2e054..58b788d231 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -80,8 +80,6 @@ LLIMFloaterContainer::~LLIMFloaterContainer() { LLIMMgr::getInstance()->removeSessionObserver(this); } - - gIdleCallbacks.deleteFunction(idle, (void*)this); } void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -171,8 +169,6 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsPane->handleReshape(list_size, TRUE); } - gIdleCallbacks.addFunction(idle, (void*)this); - mInitialized = true; // Add callback: we'll take care of view updates on idle @@ -390,13 +386,6 @@ void LLIMFloaterContainer::draw() } } - // CHUI-308 : Hack! We shouldn't have to do that but we have too as long as - // we don't have a scroll container. - // *TODO: Take those 3 lines out once we implement the scroll container. - repositioningWidgets(); - mConversationsRoot->setRect(mConversationsListPanel->getLocalRect()); - mConversationsRoot->setFollowsAll(); - if (mTabContainer->getTabCount() == 0) { // Do not close the container when every conversation is torn off because the user -- cgit v1.2.3 From c6863d18d7c981756c57bbcd52baa06af00d1551 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 13 Sep 2012 19:10:28 -0700 Subject: CHUI-283: Now upon the information icon and speaker icon do not overlap the username text. Instead the username text will be truncated with an ellipse to prevent the overlap. Also did a code cleanup. --- indra/newview/llimfloatercontainer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9320117eb5..299d38298e 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -724,6 +724,8 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti //params.creation_date = bridge->getCreationDate(); params.root = mConversationsRoot; params.listener = item; + + //16 and panel_rect.getWidth() are used since that is currently the values used in repositioningWidgets() params.rect = LLRect (0, 16, panel_rect.getWidth(), 0); params.tool_tip = params.name; params.participant_id = item->getUUID(); -- cgit v1.2.3 From 399ba09c08d8ccaf9b34daa8b743f837639b2f35 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 14 Sep 2012 18:47:39 -0700 Subject: CHUI-283: Now the info/speaker icon are better positioned within the participant item. Also the participant item now matches the height of the session (conversation) item. --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 54a40627fb..e039702683 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -721,7 +721,7 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti params.listener = item; //16 and panel_rect.getWidth() are used since that is currently the values used in repositioningWidgets() - params.rect = LLRect (0, 16, panel_rect.getWidth(), 0); + params.rect = LLRect (0, 24, panel_rect.getWidth(), 0); params.tool_tip = params.name; params.participant_id = item->getUUID(); -- cgit v1.2.3 From 9b0d627a06a817fc11edc4c6c718f1114aa7cfcf Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 14 Sep 2012 19:47:52 -0700 Subject: CHUI-192 : Implement menus and settings for sorting. The sort itself is not performed though. Wait for CHUI-340 for this. --- indra/newview/llimfloatercontainer.cpp | 89 ++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 81dddfaa70..ab4b64471b 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -58,6 +58,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mInitialized(false) { mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); + mEnableCallbackRegistrar.add("IMFloaterContainer.Check", boost::bind(&LLIMFloaterContainer::isActionChecked, this, _2)); // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -169,6 +170,9 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsPane->handleReshape(list_size, TRUE); } + // Init the sort order now that the root had been created + setSortOrder(LLConversationSort(gSavedSettings.getU32("ConversationSortOrder"))); + mInitialized = true; // Add callback: we'll take care of view updates on idle @@ -546,6 +550,30 @@ void LLIMFloaterContainer::onCustomAction(const LLSD& userdata) { std::string command = userdata.asString(); + if ("sort_sessions_by_type" == command) + { + setSortOrderSessions(LLConversationFilter::SO_SESSION_TYPE); + } + if ("sort_sessions_by_name" == command) + { + setSortOrderSessions(LLConversationFilter::SO_NAME); + } + if ("sort_sessions_by_recent" == command) + { + setSortOrderSessions(LLConversationFilter::SO_DATE); + } + if ("sort_participants_by_name" == command) + { + setSortOrderParticipants(LLConversationFilter::SO_NAME); + } + if ("sort_participants_by_recent" == command) + { + setSortOrderParticipants(LLConversationFilter::SO_DATE); + } + if ("sort_participants_by_distance" == command) + { + setSortOrderParticipants(LLConversationFilter::SO_DISTANCE); + } if ("chat_preferences" == command) { LLFloaterPreference* floater_prefs = LLFloaterReg::showTypedInstance("preferences"); @@ -561,6 +589,67 @@ void LLIMFloaterContainer::onCustomAction(const LLSD& userdata) } } +BOOL LLIMFloaterContainer::isActionChecked(const LLSD& userdata) +{ + LLConversationSort order = mConversationViewModel.getSorter(); + std::string command = userdata.asString(); + if ("sort_sessions_by_type" == command) + { + return (order.getSortOrderSessions() == LLConversationFilter::SO_SESSION_TYPE); + } + if ("sort_sessions_by_name" == command) + { + return (order.getSortOrderSessions() == LLConversationFilter::SO_NAME); + } + if ("sort_sessions_by_recent" == command) + { + return (order.getSortOrderSessions() == LLConversationFilter::SO_DATE); + } + if ("sort_participants_by_name" == command) + { + return (order.getSortOrderParticipants() == LLConversationFilter::SO_NAME); + } + if ("sort_participants_by_recent" == command) + { + return (order.getSortOrderParticipants() == LLConversationFilter::SO_DATE); + } + if ("sort_participants_by_distance" == command) + { + return (order.getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE); + } + + return FALSE; +} + +void LLIMFloaterContainer::setSortOrderSessions(const LLConversationFilter::ESortOrderType order) +{ + LLConversationSort old_order = mConversationViewModel.getSorter(); + if (order != old_order.getSortOrderSessions()) + { + old_order.setSortOrderSessions(order); + setSortOrder(old_order); + } +} + +void LLIMFloaterContainer::setSortOrderParticipants(const LLConversationFilter::ESortOrderType order) +{ + LLConversationSort old_order = mConversationViewModel.getSorter(); + if (order != old_order.getSortOrderParticipants()) + { + old_order.setSortOrderParticipants(order); + setSortOrder(old_order); + } +} + +void LLIMFloaterContainer::setSortOrder(const LLConversationSort& order) +{ + mConversationViewModel.setSorter(order); + mConversationsRoot->arrangeAll(); + // try to keep selection onscreen, even if it wasn't to start with + mConversationsRoot->scrollToShowSelection(); + gSavedSettings.setU32("ConversationSortOrder", (U32)order); +} + void LLIMFloaterContainer::repositioningWidgets() { if (!mInitialized) -- cgit v1.2.3 From d22c8510b19f12e81dc68562de45c2c364036440 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 17 Sep 2012 17:53:17 -0700 Subject: CHUI-340 : WIP : Sorting implemented. Type and name work. Date and distance still need the relevant values to be computed. --- indra/newview/llimfloatercontainer.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index ab4b64471b..76bd6b14b9 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -740,7 +740,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) llwarns << "Couldn't create conversation session item : " << display_name << llendl; return; } - // *TODO: Should we flag LLConversationItemSession with a mIsNearbyChat? item->renameItem(display_name); mConversationsItems[uuid] = item; -- cgit v1.2.3 From 073065d6520a3b438fce3c5c27ee51c6d86ee742 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 21 Sep 2012 17:52:03 +0300 Subject: CHUI-289 ADD. FIX (Newly added conversation is not selected in conversation list): Select item which was added from avatar picker --- indra/newview/llimfloatercontainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4e0fba9502..de1fd58661 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -700,7 +700,7 @@ void LLIMFloaterContainer::repositioningWidgets() } } -void LLIMFloaterContainer::setConvItemSelect(LLUUID& session_id) +void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) { LLFolderViewItem* widget = mConversationsWidgets[session_id]; if (widget && mSelectedSession != session_id) @@ -763,6 +763,8 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) participant_view->addToFolder(widget); current_participant_model++; } + + setConvItemSelect(uuid); return; } -- cgit v1.2.3 From b5583906d0cce652f456851732db5b1c19659662 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Sep 2012 18:12:06 -0700 Subject: CHUI-340 : WIP : Fix sorting bugs on time for sessions, simplified the update time mechanism and clean up --- indra/newview/llimfloatercontainer.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4e0fba9502..f84da25baa 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -710,6 +710,21 @@ void LLIMFloaterContainer::setConvItemSelect(LLUUID& session_id) } } +void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) +{ + conversations_items_map::iterator item_it = mConversationsItems.find(session_id); + if (item_it != mConversationsItems.end()) + { + LLConversationItemSession* item = dynamic_cast(item_it->second); + if (item) + { + item->setTimeNow(participant_id); + mConversationViewModel.requestSortAll(); + mConversationsRoot->arrangeAll(); + } + } +} + void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { bool is_nearby_chat = uuid.isNull(); -- cgit v1.2.3 From 552f288a0caea45e30a231478a19f4243d69689c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Sep 2012 20:13:50 -0700 Subject: CHUI-340 : Implement distance computation and update --- indra/newview/llimfloatercontainer.cpp | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 3c21794d28..cd56ea6081 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -47,6 +47,7 @@ #include "llviewercontrol.h" #include "llconversationview.h" #include "llcallbacklist.h" +#include "llworld.h" // // LLIMFloaterContainer @@ -333,6 +334,14 @@ void LLIMFloaterContainer::setMinimized(BOOL b) void LLIMFloaterContainer::idle(void* user_data) { LLIMFloaterContainer* self = static_cast(user_data); + + // Update the distance to agent in the nearby chat session if required + // Note: it makes no sense of course to update the distance in other session + if (self->mConversationViewModel.getSorter().getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE) + { + self->setNearbyDistances(); + } + self->mConversationsRoot->update(); } @@ -725,6 +734,37 @@ void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& pa } } +void LLIMFloaterContainer::setNearbyDistances() +{ + // Get the nearby chat session: that's the one with uuid nul in mConversationsItems + conversations_items_map::iterator item_it = mConversationsItems.find(LLUUID()); + if (item_it != mConversationsItems.end()) + { + LLConversationItemSession* item = dynamic_cast(item_it->second); + if (item) + { + // Get the positions of the nearby avatars and their ids + std::vector positions; + uuid_vec_t avatar_ids; + LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); + // Get the position of the agent + const LLVector3d& me_pos = gAgent.getPositionGlobal(); + // For each nearby avatar, compute and update the distance + int avatar_count = positions.size(); + for (int i = 0; i < avatar_count; i++) + { + F64 dist = dist_vec_squared(positions[i], me_pos); + item->setDistance(avatar_ids[i],dist); + } + // Also does it for the agent itself + item->setDistance(gAgent.getID(),0.0f); + // Request resort + mConversationViewModel.requestSortAll(); + mConversationsRoot->arrangeAll(); + } + } +} + void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { bool is_nearby_chat = uuid.isNull(); -- cgit v1.2.3 From 5b0e06108b3c4373c55103dedab3306f06d392c9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Sep 2012 19:55:31 -0700 Subject: CHUI-340 : Fix dupe items in the conversation model list. Refresh when resorting. --- indra/newview/llimfloatercontainer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index cd56ea6081..14d40d4685 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -394,6 +394,8 @@ void LLIMFloaterContainer::draw() } // Reset the need for refresh session_model->resetRefresh(); + mConversationViewModel.requestSortAll(); + mConversationsRoot->arrangeAll(); // Next participant current_participant_model++; } -- cgit v1.2.3 From 9e1ea5a1652528dead811dee8904ae8a6833d163 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 26 Sep 2012 12:05:27 -0700 Subject: CHUI-364 : WIP : Suppress unused code --- indra/newview/llimfloatercontainer.cpp | 50 ---------------------------------- 1 file changed, 50 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 14d40d4685..e64247cd60 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -661,56 +661,6 @@ void LLIMFloaterContainer::setSortOrder(const LLConversationSort& order) gSavedSettings.setU32("ConversationSortOrder", (U32)order); } -void LLIMFloaterContainer::repositioningWidgets() -{ - if (!mInitialized) - { - return; - } - - if (!mConversationsPane->isCollapsed()) - { - S32 list_width = (mConversationsPane->getRect()).getWidth(); - gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", list_width); - } - LLRect panel_rect = mConversationsListPanel->getRect(); - S32 item_height = 16; - int index = 0; - for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); - widget_it != mConversationsWidgets.end(); - widget_it++) - { - LLFolderViewFolder* widget = dynamic_cast(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); - } - } -} - void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) { LLFolderViewItem* widget = mConversationsWidgets[session_id]; -- cgit v1.2.3 From 8b2ed2e2050fcb8836be120902f44417613adb13 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 28 Sep 2012 18:22:00 +0300 Subject: CHUI-370, CHUI-372 ADDITIONAL FIX (Viewer crash when voice calling another user from people panel then opening conversation floater or when starting a IM chat when conversation floater has not been previously opened): fixed nearby chat positioning --- indra/newview/llimfloatercontainer.cpp | 1 + 1 file changed, 1 insertion(+) mode change 100755 => 100644 indra/newview/llimfloatercontainer.cpp (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp old mode 100755 new mode 100644 index e64247cd60..a74ebdae7a --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -432,6 +432,7 @@ void LLIMFloaterContainer::setVisible(BOOL visible) // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("nearby_chat"); LLFloaterReg::toggleInstanceOrBringToFront(name); + LLFloaterReg::getTypedInstance("nearby_chat")->addToHost(); } } -- cgit v1.2.3 From 0651e10afff81a6e32828c122753d87b8503a79b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Sep 2012 11:15:45 -0700 Subject: CHUI-342, CHUI-366 and CHUI-367 : WIP : Allow a NO_TOOLTIP value for tooltips, update display/user names and sort on display/user names --- indra/newview/llimfloatercontainer.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index e64247cd60..26b4e6c903 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -158,8 +158,7 @@ BOOL LLIMFloaterContainer::postBuild() collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed")); collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed")); - LLAvatarNameCache::addUseDisplayNamesCallback( - boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); + LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); if (! mMessagesPane->isCollapsed()) { @@ -176,8 +175,11 @@ BOOL LLIMFloaterContainer::postBuild() mInitialized = true; - // Add callback: we'll take care of view updates on idle + // Add callbacks: + // We'll take care of view updates on idle gIdleCallbacks.addFunction(idle, this); + // When display name option change, we need to reload all participant names + LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLIMFloaterContainer::processParticipantsStyleUpdate, this)); return TRUE; } @@ -330,6 +332,31 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +// Update all participants in the conversation lists +void LLIMFloaterContainer::processParticipantsStyleUpdate() +{ + // 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; + // 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) + { + LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); + // Get the avatar name for this participant id from the cache and update the model + LLUUID participant_id = participant_model->getUUID(); + LLAvatarName av_name; + LLAvatarNameCache::get(participant_id,&av_name); + participant_model->onAvatarNameCache(av_name); + // Next participant + current_participant_model++; + } + } +} + // static void LLIMFloaterContainer::idle(void* user_data) { -- cgit v1.2.3 From 166ff2b1b8dc21ad1a88c715a480ce1d2c5c2e07 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Sep 2012 15:08:56 -0700 Subject: CHUI-366 : Completed : Update participants names when the display name pref is toggled on and off. --- indra/newview/llimfloatercontainer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 26b4e6c903..45d63ce4f9 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -350,7 +350,13 @@ void LLIMFloaterContainer::processParticipantsStyleUpdate() LLUUID participant_id = participant_model->getUUID(); LLAvatarName av_name; LLAvatarNameCache::get(participant_id,&av_name); - participant_model->onAvatarNameCache(av_name); + // Avoid updating the model though if the cache is still waiting for its first update + if (!av_name.mDisplayName.empty()) + { + participant_model->onAvatarNameCache(av_name); + } + // Bind update to the next cache name signal + LLAvatarNameCache::get(participant_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant_model, _2)); // Next participant current_participant_model++; } @@ -368,7 +374,6 @@ void LLIMFloaterContainer::idle(void* user_data) { self->setNearbyDistances(); } - self->mConversationsRoot->update(); } -- cgit v1.2.3 From 507b66aeb1614a1293890ffacbab53ccecc25e20 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 28 Sep 2012 19:40:17 +0300 Subject: CHUI-349 (Crash when clicking on nearby chat toast): removed a faulty method LLIMFloater::addToIMContainer; replaced it's calls to calls of its correct twin - LLIMFloater::addToHost --- indra/newview/llimfloatercontainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index ffbdae305b..ca77f05545 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -86,13 +86,13 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - LLIMFloater::addToIMContainer(session_id); + LLIMFloater::addToHost(session_id, true); addConversationListItem(session_id); } void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::addToIMContainer(session_id); + LLIMFloater::addToHost(session_id, true); addConversationListItem(session_id); } -- cgit v1.2.3 From 14307b099bdb0e7c5b56d052a55e010ecd69b5c3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 28 Sep 2012 19:06:36 +0300 Subject: CHUI-361 FIXED (Viewer crash when selecting to start IM with user from right click menu in people floater ): prevent destruction of im_container; suppress warning for the nearby_chat --- indra/newview/llimfloatercontainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index ca77f05545..c6f0607b35 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -223,8 +223,8 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); } else - { - LLUUID avatar_id = LLIMModel::getInstance()->getOtherParticipantID(session_id); + { LLUUID avatar_id = session_id.notNull()? + LLIMModel::getInstance()->getOtherParticipantID(session_id) : LLUUID(); LLAvatarIconCtrl::Params icon_params; icon_params.avatar_id = avatar_id; -- cgit v1.2.3 From d54eded93ba270402349f5f337bbe12339255ece Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 28 Sep 2012 20:48:24 +0300 Subject: CHUI-357 FIXED moved conversation icon to prevent it being obscured when conversations list is minimized. Added minimized mode for LLConversationViewSession: this mode is used to move the conversation icon within the item when the conversations panel is minimized. --- indra/newview/llimfloatercontainer.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c6f0607b35..6f7eb7822a 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -133,6 +133,7 @@ BOOL LLIMFloaterContainer::postBuild() p.listener = base_item; p.view_model = &mConversationViewModel; p.root = NULL; + p.use_ellipses = true; mConversationsRoot = LLUICtrlFactory::create(p); // a scroller for folder view @@ -532,6 +533,22 @@ void LLIMFloaterContainer::collapseConversationsPane(bool collapse) S32 collapsed_width = mConversationsPane->getMinDim(); updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - collapsed_width); + + for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); + widget_it != mConversationsWidgets.end(); ++widget_it) + { + LLConversationViewSession* widget = dynamic_cast(widget_it->second); + if (widget) + { + widget->toggleMinimizedMode(collapse); + + // force closing all open conversations when collapsing to minimized state + if (collapse) + { + widget->setOpen(false); + } + } + } } void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) @@ -806,6 +823,9 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) setConvItemSelect(uuid); + // set the widget to minimized mode if conversations pane is collapsed + widget->toggleMinimizedMode(mConversationsPane->isCollapsed()); + return; } -- cgit v1.2.3 From 11a148415e810706f2a1835b6b717a0a062d458f Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 28 Sep 2012 18:22:05 -0700 Subject: CHUI-102: Now the participants and one-on-one conversations have right-click-menus. These menus are functional as well, but 'chat history' does not yet work. --- indra/newview/llimfloatercontainer.cpp | 192 ++++++++++++++++++++++++++++++++- 1 file changed, 190 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 14d40d4685..b4802c71f9 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -58,8 +58,12 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mConversationsRoot(NULL), mInitialized(false) { + mEnableCallbackRegistrar.add("IMFloaterContainer.Check", boost::bind(&LLIMFloaterContainer::isActionChecked, this, _2)); mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); - mEnableCallbackRegistrar.add("IMFloaterContainer.Check", boost::bind(&LLIMFloaterContainer::isActionChecked, this, _2)); + + mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLIMFloaterContainer::checkContextMenuItem, this, _2)); + mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLIMFloaterContainer::enableContextMenuItem, this, _2)); + mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelected, this, _2)); // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -133,7 +137,9 @@ BOOL LLIMFloaterContainer::postBuild() p.listener = base_item; p.view_model = &mConversationViewModel; p.root = NULL; + p.options_menu = "menu_conversation.xml"; mConversationsRoot = LLUICtrlFactory::create(p); + mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); // a scroller for folder view LLRect scroller_view_rect = mConversationsListPanel->getRect(); @@ -341,7 +347,7 @@ void LLIMFloaterContainer::idle(void* user_data) { self->setNearbyDistances(); } - + self->mConversationsRoot->update(); } @@ -661,6 +667,188 @@ void LLIMFloaterContainer::setSortOrder(const LLConversationSort& order) gSavedSettings.setU32("ConversationSortOrder", (U32)order); } +void LLIMFloaterContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids) +{ + const std::set selectedItems = mConversationsRoot->getSelectionList(); + + std::set::const_iterator it = selectedItems.begin(); + const std::set::const_iterator it_end = selectedItems.end(); + LLConversationItem * conversationItem; + + for (; it != it_end; ++it) + { + conversationItem = static_cast((*it)->getViewModelItem()); + selected_uuids.push_back(conversationItem->getUUID()); + } +} +void LLIMFloaterContainer::doToSelected(const LLSD& userdata) +{ + std::string command = userdata.asString(); + uuid_vec_t selected_uuids; + LLUUID currentSelectedUUID; + LLIMFloater * conversation; + + getSelectedUUIDs(selected_uuids); + conversation = LLIMFloater::findInstance(selected_uuids.front()); + + if(conversation && + static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + { + currentSelectedUUID = conversation->getOtherParticipantUUID(); + } + else + { + currentSelectedUUID = selected_uuids.front(); + } + + //Close the selected conversation + if(conversation && "close_conversation" == command) + { + LLFloater::onClickClose(conversation); + } + else if ("view_profile" == command) + { + LLAvatarActions::showProfile(currentSelectedUUID); + } + else if("im" == command) + { + LLAvatarActions::startIM(currentSelectedUUID); + } + else if("offer_teleport" == command) + { + LLAvatarActions::offerTeleport(selected_uuids); + } + else if("voice_call" == command) + { + LLAvatarActions::startCall(currentSelectedUUID); + } + else if("add_friend" == command) + { + LLAvatarActions::requestFriendshipDialog(currentSelectedUUID); + } + else if("remove_friend" == command) + { + LLAvatarActions::removeFriendDialog(currentSelectedUUID); + } + else if("invite_to_group" == command) + { + LLAvatarActions::inviteToGroup(currentSelectedUUID); + } + else if("map" == command) + { + LLAvatarActions::showOnMap(currentSelectedUUID); + } + else if("share" == command) + { + LLAvatarActions::share(currentSelectedUUID); + } + else if("pay" == command) + { + LLAvatarActions::pay(currentSelectedUUID); + } + else if("block_unblock" == command) + { + LLAvatarActions::toggleBlock(currentSelectedUUID); + } +} + +bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) +{ + std::string item = userdata.asString(); + uuid_vec_t mUUIDs; + getSelectedUUIDs(mUUIDs); + + // Note: can_block and can_delete is used only for one person selected menu + // so we don't need to go over all uuids. + + if (item == std::string("can_block")) + { + const LLUUID& id = mUUIDs.front(); + return LLAvatarActions::canBlock(id); + } + else if (item == std::string("can_add")) + { + // We can add friends if: + // - there are selected people + // - and there are no friends among selection yet. + + //EXT-7389 - disable for more than 1 + if(mUUIDs.size() > 1) + { + return false; + } + + bool result = (mUUIDs.size() > 0); + + uuid_vec_t::const_iterator + id = mUUIDs.begin(), + uuids_end = mUUIDs.end(); + + for (;id != uuids_end; ++id) + { + if ( LLAvatarActions::isFriend(*id) ) + { + result = false; + break; + } + } + + return result; + } + else if (item == std::string("can_delete")) + { + // We can remove friends if: + // - there are selected people + // - and there are only friends among selection. + + bool result = (mUUIDs.size() > 0); + + uuid_vec_t::const_iterator + id = mUUIDs.begin(), + uuids_end = mUUIDs.end(); + + for (;id != uuids_end; ++id) + { + if ( !LLAvatarActions::isFriend(*id) ) + { + result = false; + break; + } + } + + return result; + } + else if (item == std::string("can_call")) + { + return LLAvatarActions::canCall(); + } + else if (item == std::string("can_show_on_map")) + { + const LLUUID& id = mUUIDs.front(); + + return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) + || gAgent.isGodlike(); + } + else if(item == std::string("can_offer_teleport")) + { + return LLAvatarActions::canOfferTeleport(mUUIDs); + } + return false; +} + +bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) +{ + std::string item = userdata.asString(); + const LLUUID& id = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getUUID(); + + if (item == std::string("is_blocked")) + { + return LLAvatarActions::isBlocked(id); + } + + return false; +} + void LLIMFloaterContainer::repositioningWidgets() { if (!mInitialized) -- cgit v1.2.3 From 8e1a9e2813da6b9d5c17795b375098fb6a386ee1 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 1 Oct 2012 13:54:53 -0700 Subject: CHUI-102: Cleaned up code after code review. --- indra/newview/llimfloatercontainer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index b4802c71f9..58d2020801 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -689,13 +689,20 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata) LLIMFloater * conversation; getSelectedUUIDs(selected_uuids); + //Find the conversation floater associated with the selected id conversation = LLIMFloater::findInstance(selected_uuids.front()); - + + //When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c + //selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with. if(conversation && + mConversationsRoot && + mConversationsRoot->getCurSelectedItem() && + mConversationsRoot->getCurSelectedItem()->getViewModelItem() && static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getType() == LLConversationItem::CONV_SESSION_1_ON_1) { currentSelectedUUID = conversation->getOtherParticipantUUID(); } + //Otherwise can get the UUID directly from selected_uuids else { currentSelectedUUID = selected_uuids.front(); -- cgit v1.2.3 From 598f5345866c58abdd971935d80f9b53756042c9 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 1 Oct 2012 17:04:13 -0700 Subject: CHUI-102: Right clicking on a group conversation brings up the correct menu. The user can now view the group profile, activate the group and leave the group. --- indra/newview/llimfloatercontainer.cpp | 48 ++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index d25a195f33..b7f83e3c23 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -39,6 +39,7 @@ #include "llavatariconctrl.h" #include "llavatarnamecache.h" #include "llcallbacklist.h" +#include "llgroupactions.h" #include "llgroupiconctrl.h" #include "llfloateravatarpicker.h" #include "llfloaterpreference.h" @@ -63,7 +64,9 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLIMFloaterContainer::checkContextMenuItem, this, _2)); mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLIMFloaterContainer::enableContextMenuItem, this, _2)); - mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelected, this, _2)); + mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedAvatar, this, _2)); + + mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedGroup, this, _2)); // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -731,7 +734,20 @@ void LLIMFloaterContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids) selected_uuids.push_back(conversationItem->getUUID()); } } -void LLIMFloaterContainer::doToSelected(const LLSD& userdata) + +const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() +{ + if(mConversationsRoot && + mConversationsRoot->getCurSelectedItem() && + mConversationsRoot->getCurSelectedItem()->getViewModelItem()) + { + return static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); + } + + return NULL; +} + +void LLIMFloaterContainer::doToSelectedAvatar(const LLSD& userdata) { std::string command = userdata.asString(); uuid_vec_t selected_uuids; @@ -741,14 +757,11 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata) getSelectedUUIDs(selected_uuids); //Find the conversation floater associated with the selected id conversation = LLIMFloater::findInstance(selected_uuids.front()); + const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); //When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c //selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with. - if(conversation && - mConversationsRoot && - mConversationsRoot->getCurSelectedItem() && - mConversationsRoot->getCurSelectedItem()->getViewModelItem() && - static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + if(conversation && conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) { currentSelectedUUID = conversation->getOtherParticipantUUID(); } @@ -809,6 +822,25 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata) } } +void LLIMFloaterContainer::doToSelectedGroup(const LLSD& userdata) +{ + std::string action = userdata.asString(); + LLUUID selected_group = getCurSelectedViewModelItem()->getUUID(); + + if (action == "group_profile") + { + LLGroupActions::show(selected_group); + } + else if (action == "activate_group") + { + LLGroupActions::activate(selected_group); + } + else if (action == "leave_group") + { + LLGroupActions::leave(selected_group); + } +} + bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); @@ -896,7 +928,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); - const LLUUID& id = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getUUID(); + const LLUUID& id = getCurSelectedViewModelItem()->getUUID(); if (item == std::string("is_blocked")) { -- cgit v1.2.3 From 1ed2915796f610ced2387f5c76b6d10cc508962f Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 11:09:58 -0700 Subject: CHUI-102: Code cleanup, decoupling code and made specific methods for handling menu events for conversations or participants. --- indra/newview/llimfloatercontainer.cpp | 113 +++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 41 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index b7f83e3c23..ad77a7510c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -64,7 +64,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLIMFloaterContainer::checkContextMenuItem, this, _2)); mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLIMFloaterContainer::enableContextMenuItem, this, _2)); - mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedAvatar, this, _2)); + mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelected, this, _2)); mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedGroup, this, _2)); @@ -747,78 +747,109 @@ const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() return NULL; } -void LLIMFloaterContainer::doToSelectedAvatar(const LLSD& userdata) -{ - std::string command = userdata.asString(); - uuid_vec_t selected_uuids; - LLUUID currentSelectedUUID; - LLIMFloater * conversation; - - getSelectedUUIDs(selected_uuids); - //Find the conversation floater associated with the selected id - conversation = LLIMFloater::findInstance(selected_uuids.front()); - const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); - - //When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c - //selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with. - if(conversation && conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) - { - currentSelectedUUID = conversation->getOtherParticipantUUID(); - } - //Otherwise can get the UUID directly from selected_uuids - else - { - currentSelectedUUID = selected_uuids.front(); - } +void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t selectedIDS) +{dd + LLUUID userID; + userID = selectedIDS.front(); - //Close the selected conversation - if(conversation && "close_conversation" == command) - { - LLFloater::onClickClose(conversation); - } - else if ("view_profile" == command) + if ("view_profile" == command) { - LLAvatarActions::showProfile(currentSelectedUUID); + LLAvatarActions::showProfile(userID); } else if("im" == command) { - LLAvatarActions::startIM(currentSelectedUUID); + LLAvatarActions::startIM(userID); } else if("offer_teleport" == command) { - LLAvatarActions::offerTeleport(selected_uuids); + LLAvatarActions::offerTeleport(selectedIDS); } else if("voice_call" == command) { - LLAvatarActions::startCall(currentSelectedUUID); + LLAvatarActions::startCall(userID); } else if("add_friend" == command) { - LLAvatarActions::requestFriendshipDialog(currentSelectedUUID); + LLAvatarActions::requestFriendshipDialog(userID); } else if("remove_friend" == command) { - LLAvatarActions::removeFriendDialog(currentSelectedUUID); + LLAvatarActions::removeFriendDialog(userID); } else if("invite_to_group" == command) { - LLAvatarActions::inviteToGroup(currentSelectedUUID); + LLAvatarActions::inviteToGroup(userID); } else if("map" == command) { - LLAvatarActions::showOnMap(currentSelectedUUID); + LLAvatarActions::showOnMap(userID); } else if("share" == command) { - LLAvatarActions::share(currentSelectedUUID); + LLAvatarActions::share(userID); } else if("pay" == command) { - LLAvatarActions::pay(currentSelectedUUID); + LLAvatarActions::pay(userID); } else if("block_unblock" == command) { - LLAvatarActions::toggleBlock(currentSelectedUUID); + LLAvatarActions::toggleBlock(userID); + } +} + +void LLIMFloaterContainer::doToSelectedParticipant(const std::string& command) +{ + uuid_vec_t selected_uuids; + getSelectedUUIDs(selected_uuids); + + doToUsers(command, selected_uuids); +} + +void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) +{ + LLUUID participantID; + + //Find the conversation floater associated with the selected id + const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); + + if(conversationFloater) + { + //When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c + //selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with. + if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + { + participantID = conversationFloater->getOtherParticipantUUID(); + } + + //Close the selected conversation + if("close_conversation" == command) + { + LLFloater::onClickClose(conversationFloater); + } + else + { + uuid_vec_t selected_uuids; + selected_uuids.push_back(participantID); + doToUsers(command, selected_uuids); + } + } +} + +void LLIMFloaterContainer::doToSelected(const LLSD& userdata) +{ + std::string command = userdata.asString(); + const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + + if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1 || + conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP) + { + doToSelectedConversation(command); + } + else + { + doToSelectedParticipant(command); } } -- cgit v1.2.3 From 9d989feede2dbef934cdc459b4758c024df862d6 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 15:10:12 -0700 Subject: CHUI-102: Now the user can select a conversation and use the right-click-menu to enable/disable voice. --- indra/newview/llimfloatercontainer.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index ad77a7510c..7130926212 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -748,7 +748,7 @@ const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() } void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t selectedIDS) -{dd +{ LLUUID userID; userID = selectedIDS.front(); @@ -828,6 +828,14 @@ void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) { LLFloater::onClickClose(conversationFloater); } + else if("open_voice_conversation" == command) + { + gIMMgr->startCall(conversationItem->getUUID()); + } + else if("disconnect_from_voice" == command) + { + gIMMgr->endCall(conversationItem->getUUID()); + } else { uuid_vec_t selected_uuids; @@ -843,7 +851,8 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata) const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1 || - conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP) + conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP || + conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC) { doToSelectedConversation(command); } -- cgit v1.2.3 From ed9ade7d50b699ac60eb69a979ea32a60eefa630 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 17:03:46 -0700 Subject: CHUI-102: Now the options menu (right-click menu) for a participant/conversation will open the 'Chat history' dialog when selected. --- indra/newview/llimfloatercontainer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 7130926212..11aecde6e2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -768,6 +768,10 @@ void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t sele { LLAvatarActions::startCall(userID); } + else if("chat_history" == command) + { + LLAvatarActions::viewChatHistory(userID); + } else if("add_friend" == command) { LLAvatarActions::requestFriendshipDialog(userID); @@ -836,6 +840,10 @@ void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) { gIMMgr->endCall(conversationItem->getUUID()); } + else if("chat_history" == command) + { + LLAvatarActions::viewChatHistory(conversationItem->getUUID()); + } else { uuid_vec_t selected_uuids; -- cgit v1.2.3 From 7e1fbd1a897e3238a101f1db2d155f0493beaac5 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 17:56:01 -0700 Subject: CHUI-102: Code review, just changed function getCurSelectedViewModelItem() to have a single return statement. --- indra/newview/llimfloatercontainer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 11aecde6e2..a33fc2c57e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -737,14 +737,16 @@ void LLIMFloaterContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids) const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() { + LLConversationItem * conversationItem = NULL; + if(mConversationsRoot && mConversationsRoot->getCurSelectedItem() && mConversationsRoot->getCurSelectedItem()->getViewModelItem()) { - return static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); + conversationItem = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); } - return NULL; + return conversationItem; } void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t selectedIDS) -- cgit v1.2.3 From a8159facdeb478abf094d8ba8ad229c0e282f9f6 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 2 Oct 2012 19:36:46 +0300 Subject: CHUI-374 FIXED (Nearby chat is torn off and cannot be docked if nearby chat is received while conversation floater is closed) Nearby_chat is created only after the creation of the im_container --- indra/newview/llimfloatercontainer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index a33fc2c57e..237748179c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -463,21 +463,26 @@ void LLIMFloaterContainer::tabClose() } void LLIMFloaterContainer::setVisible(BOOL visible) -{ +{ LLNearbyChat* nearby_chat; if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLIMConversation* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); + nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("nearby_chat"); LLFloaterReg::toggleInstanceOrBringToFront(name); - LLFloaterReg::getTypedInstance("nearby_chat")->addToHost(); } } + nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); + if (nearby_chat && !nearby_chat->isHostSet()) + { + nearby_chat->addToHost(); + } + // We need to show/hide all the associated conversations that have been torn off // (and therefore, are not longer managed by the multifloater), // so that they show/hide with the conversations manager. -- cgit v1.2.3 From 4a25ce8b9d5d56b160d0d13c4681cd916c4ea4e0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 2 Oct 2012 22:34:44 -0700 Subject: CHUI-341 : Implement the use of LLEventStream and LLEventPump to signal conversation model changes, picked by LLIMFloaterContainer. Suppress pooling on draw(). --- indra/newview/llimfloatercontainer.cpp | 41 +++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 6f7eb7822a..8642eaf5e1 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -49,6 +49,7 @@ #include "llcallbacklist.h" #include "llworld.h" +#include "llsdserialize.h" // // LLIMFloaterContainer // @@ -56,6 +57,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed), mExpandCollapseBtn(NULL), mConversationsRoot(NULL), + mStream("ConversationsEvents"), mInitialized(false) { mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); @@ -136,6 +138,9 @@ BOOL LLIMFloaterContainer::postBuild() p.use_ellipses = true; mConversationsRoot = LLUICtrlFactory::create(p); + // Add listener to conversation model events + mStream.listen("ConversationsRefresh", boost::bind(&LLIMFloaterContainer::onConversationModelEvent, this, _1)); + // a scroller for folder view LLRect scroller_view_rect = mConversationsListPanel->getRect(); scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); @@ -378,18 +383,29 @@ void LLIMFloaterContainer::idle(void* user_data) self->mConversationsRoot->update(); } -void LLIMFloaterContainer::draw() +bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) { - // CHUI Notes - // Currently, the model is not responsible for creating the view which is a good thing. This means that + // For debug only + //std::ostringstream llsd_value; + //llsd_value << LLSDOStreamer(event) << std::endl; + //llinfos << "Merov debug : onConversationModelEvent, event = " << llsd_value.str() << llendl; + // end debug + + // Note: In conversations, 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. - + // For the moment, we create them here to conform to the pattern implemented in llinventorypanel.cpp + // (see LLInventoryPanel::buildNewViews()). + + // Note: For the moment, we're not very smart about the event paramter and we just refresh the whole set of views/widgets + // according to the current state of the whole model. + // We should at least analyze the event payload and do things differently for a handful of useful cases: + // - add session or participant + // - remove session or participant + // - update session or participant (e.g. rename, change sort order, etc...) + // see LLConversationItem::postEvent() for the payload formatting. + // *TODO: Add handling for various event signatures (add, remove, update, resort) + // On each session in mConversationsItems for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) { @@ -418,7 +434,7 @@ void LLIMFloaterContainer::draw() participant_view->setVisible(TRUE); } else - // Else, see if it needs refresh + // Else, see if it needs refresh { if (participant_model->needsRefresh()) { @@ -434,6 +450,11 @@ void LLIMFloaterContainer::draw() } } + return false; +} + +void LLIMFloaterContainer::draw() +{ if (mTabContainer->getTabCount() == 0) { // Do not close the container when every conversation is torn off because the user -- cgit v1.2.3 From 7f3f5cc408d7b36478c7dd707e32f921c1e1b720 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 3 Oct 2012 16:56:27 +0300 Subject: CHUI-378 FIXED (Conversation floater is not opened if call initiated and accepted with conversation floater closed - goes to voice settings floater): added open conversation floater on the voice channel's changing --- indra/newview/llimfloatercontainer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 237748179c..5a323583b8 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -114,6 +114,16 @@ void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) removeConversationListItem(session_id); } +// static +void LLIMFloaterContainer::onCurrentChannelChanged(const LLUUID& session_id) +{ + if (session_id != LLUUID::null) + { + LLIMFloater::show(session_id); + } +} + + BOOL LLIMFloaterContainer::postBuild() { mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1)); -- cgit v1.2.3 From 9c3bbd378332a3dca8c58d0e3e351fd038e3f61b Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 3 Oct 2012 14:31:13 -0700 Subject: CHUI-102: Now the options enabled in the one-on-one conversation menu are the same as the participants menu. In prior commits the one-on-one conversations menu was not enabling/disabling the proper menu options. --- indra/newview/llimfloatercontainer.cpp | 75 +++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 32 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 5a323583b8..4af170b3db 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -764,10 +764,29 @@ const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() return conversationItem; } -void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t selectedIDS) +void LLIMFloaterContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids) { - LLUUID userID; - userID = selectedIDS.front(); + //Find the conversation floater associated with the selected id + const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + + if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) + { + getSelectedUUIDs(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) + { + LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); + LLUUID participantID = conversationFloater->getOtherParticipantUUID(); + selected_uuids.push_back(participantID); + } +} + +void LLIMFloaterContainer::doToParticipants(const std::string& command, uuid_vec_t& selectedIDS) +{ + if(selectedIDS.size() > 0) +{ + const LLUUID userID = selectedIDS.front(); if ("view_profile" == command) { @@ -818,32 +837,16 @@ void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t sele LLAvatarActions::toggleBlock(userID); } } - -void LLIMFloaterContainer::doToSelectedParticipant(const std::string& command) -{ - uuid_vec_t selected_uuids; - getSelectedUUIDs(selected_uuids); - - doToUsers(command, selected_uuids); } -void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) +void LLIMFloaterContainer::doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS) { - LLUUID participantID; - //Find the conversation floater associated with the selected id const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); if(conversationFloater) { - //When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c - //selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with. - if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) - { - participantID = conversationFloater->getOtherParticipantUUID(); - } - //Close the selected conversation if("close_conversation" == command) { @@ -863,9 +866,7 @@ void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) } else { - uuid_vec_t selected_uuids; - selected_uuids.push_back(participantID); - doToUsers(command, selected_uuids); + doToParticipants(command, selectedIDS); } } } @@ -874,16 +875,17 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata) { std::string command = userdata.asString(); const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + uuid_vec_t selected_uuids; + + getParticipantUUIDs(selected_uuids); - if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1 || - conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP || - conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC) + if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) { - doToSelectedConversation(command); + doToParticipants(command, selected_uuids); } else { - doToSelectedParticipant(command); + doToSelectedConversation(command, selected_uuids); } } @@ -910,7 +912,12 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); uuid_vec_t mUUIDs; - getSelectedUUIDs(mUUIDs); + getParticipantUUIDs(mUUIDs); + + if(mUUIDs.size() <= 0) + { + return false; + } // Note: can_block and can_delete is used only for one person selected menu // so we don't need to go over all uuids. @@ -932,7 +939,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) return false; } - bool result = (mUUIDs.size() > 0); + bool result = true; uuid_vec_t::const_iterator id = mUUIDs.begin(), @@ -993,11 +1000,15 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); - const LLUUID& id = getCurSelectedViewModelItem()->getUUID(); + uuid_vec_t mUUIDs; + getParticipantUUIDs(mUUIDs); + if(mUUIDs.size() > 0 ) + { if (item == std::string("is_blocked")) { - return LLAvatarActions::isBlocked(id); + return LLAvatarActions::isBlocked(mUUIDs.front()); + } } return false; -- cgit v1.2.3 From bd64c483639ae33518609398fce7c51ddc73dae7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 3 Oct 2012 16:46:46 -0700 Subject: CHUI-358 : Fixed the removal of participants as they leave conversations. Used the event mechanism for this. --- indra/newview/llimfloatercontainer.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 8642eaf5e1..e58154b2a2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -391,21 +391,39 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) //llinfos << "Merov debug : onConversationModelEvent, event = " << llsd_value.str() << llendl; // end debug - // Note: In conversations, 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. + // Note: In conversations, 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 echo only a portion of this model (though currently the + // conversation view does echo the conversation model 1 to 1). // 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 to conform to the pattern implemented in llinventorypanel.cpp + // For the moment, we create them here, at the container level, to conform to the pattern implemented in llinventorypanel.cpp // (see LLInventoryPanel::buildNewViews()). - // Note: For the moment, we're not very smart about the event paramter and we just refresh the whole set of views/widgets + // Note: For the moment, we're not very smart about the event parameter and we just refresh the whole set of views/widgets // according to the current state of the whole model. - // We should at least analyze the event payload and do things differently for a handful of useful cases: + // We should at least analyze the event payload and do things differently for a handful of cases: // - add session or participant // - remove session or participant // - update session or participant (e.g. rename, change sort order, etc...) - // see LLConversationItem::postEvent() for the payload formatting. + // Please see LLConversationItem::postEvent() for the payload formatting. // *TODO: Add handling for various event signatures (add, remove, update, resort) + std::string type = event.get("type").asString(); + if (type == "remove_participant") + { + LLUUID session_id = event.get("session_uuid").asUUID(); + LLConversationViewSession* session_view = dynamic_cast(mConversationsWidgets[session_id]); + LLUUID participant_id = event.get("participant_uuid").asUUID(); + LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); + if (participant_view) + { + session_view->extractItem(participant_view); + delete participant_view; + session_view->refresh(); + mConversationsRoot->arrangeAll(); + } + } + else + { // On each session in mConversationsItems for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) { @@ -449,6 +467,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) current_participant_model++; } } + } return false; } -- cgit v1.2.3 From 5d846e141464f02a1d896ffa82d639f973f8044b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 3 Oct 2012 19:06:33 -0700 Subject: CHUI-341 : Fixed. Took Nat's review comments into account. --- indra/newview/llimfloatercontainer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 36c39f5717..78bd90fb96 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -79,6 +79,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) LLIMFloaterContainer::~LLIMFloaterContainer() { + mStream.stopListening("ConversationsRefresh"); + gIdleCallbacks.deleteFunction(idle, this); mNewMessageConnection.disconnect(); -- cgit v1.2.3 From f533a251553d95045ab7c1d37a149004cd1e2ef0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 4 Oct 2012 20:36:04 -0700 Subject: CHUI-381 : Implement add_participant and update_participant events handling. --- indra/newview/llimfloatercontainer.cpp | 86 +++++++++++++--------------------- 1 file changed, 33 insertions(+), 53 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 78bd90fb96..4022ebdf5b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -58,7 +58,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed), mExpandCollapseBtn(NULL), mConversationsRoot(NULL), - mStream("ConversationsEvents"), + mConversationsEventStream("ConversationsEvents"), mInitialized(false) { mEnableCallbackRegistrar.add("IMFloaterContainer.Check", boost::bind(&LLIMFloaterContainer::isActionChecked, this, _2)); @@ -79,7 +79,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) LLIMFloaterContainer::~LLIMFloaterContainer() { - mStream.stopListening("ConversationsRefresh"); + mConversationsEventStream.stopListening("ConversationsRefresh"); gIdleCallbacks.deleteFunction(idle, this); @@ -160,7 +160,7 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); // Add listener to conversation model events - mStream.listen("ConversationsRefresh", boost::bind(&LLIMFloaterContainer::onConversationModelEvent, this, _1)); + mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLIMFloaterContainer::onConversationModelEvent, this, _1)); // a scroller for folder view LLRect scroller_view_rect = mConversationsListPanel->getRect(); @@ -419,22 +419,20 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) // For the moment, we create them here, at the container level, to conform to the pattern implemented in llinventorypanel.cpp // (see LLInventoryPanel::buildNewViews()). - // Note: For the moment, we're not very smart about the event parameter and we just refresh the whole set of views/widgets - // according to the current state of the whole model. - // We should at least analyze the event payload and do things differently for a handful of cases: - // - add session or participant - // - remove session or participant - // - update session or participant (e.g. rename, change sort order, etc...) - // Please see LLConversationItem::postEvent() for the payload formatting. - // *TODO: Add handling for various event signatures (add, remove, update, resort) - std::string type = event.get("type").asString(); + LLUUID session_id = event.get("session_uuid").asUUID(); + LLUUID participant_id = event.get("participant_uuid").asUUID(); + + LLConversationViewSession* session_view = dynamic_cast(mConversationsWidgets[session_id]); + if (!session_view) + { + // We skip events that are not associated to a session + return false; + } + LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); + if (type == "remove_participant") { - LLUUID session_id = event.get("session_uuid").asUUID(); - LLConversationViewSession* session_view = dynamic_cast(mConversationsWidgets[session_id]); - LLUUID participant_id = event.get("participant_uuid").asUUID(); - LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); if (participant_view) { session_view->extractItem(participant_view); @@ -443,52 +441,34 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) mConversationsRoot->arrangeAll(); } } - else - { - // On each session in mConversationsItems - for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) + else if (type == "add_participant") { - // Get the current session descriptors - LLConversationItem* session_model = it_session->second; - LLUUID session_id = it_session->first; - LLConversationViewSession* session_view = dynamic_cast(mConversationsWidgets[session_id]); - // If the session model has been changed, refresh the corresponding view - if (session_model->needsRefresh()) + if (!participant_view) { - 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(*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); - participant_view->setVisible(TRUE); - } - else - // Else, see if it needs refresh + LLConversationItemSession* session_model = dynamic_cast(mConversationsItems[session_id]); + if (session_model) { - if (participant_model->needsRefresh()) + LLConversationItemParticipant* participant_model = session_model->findParticipant(participant_id); + if (participant_model) { - participant_view->refresh(); + participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(session_view); + participant_view->setVisible(TRUE); } } - // Reset the need for refresh - session_model->resetRefresh(); - mConversationViewModel.requestSortAll(); - mConversationsRoot->arrangeAll(); - // Next participant - current_participant_model++; + } } + else if (type == "update_participant") + { + if (participant_view) + { + participant_view->refresh(); + } } + + mConversationViewModel.requestSortAll(); + mConversationsRoot->arrangeAll(); return false; } -- cgit v1.2.3 From db452823e5cc615225f3f163d827954447cf9bd8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 5 Oct 2012 20:28:11 -0700 Subject: CHUI-194 : WIP : Update the ad-hoc conversation line item title, add a new update_session event. Still some clean up to do. --- indra/newview/llimfloatercontainer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4022ebdf5b..7c5aaa7d0f 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -466,7 +466,11 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) participant_view->refresh(); } } - + else if (type == "update_session") + { + session_view->refresh(); + } + mConversationViewModel.requestSortAll(); mConversationsRoot->arrangeAll(); @@ -1111,7 +1115,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) removeConversationListItem(uuid,false); // Create a conversation session model - LLConversationItem* item = NULL; + LLConversationItemSession* item = NULL; LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid)); if (speaker_manager) { @@ -1123,6 +1127,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) return; } item->renameItem(display_name); + item->updateParticipantName(NULL); mConversationsItems[uuid] = item; -- cgit v1.2.3 From 698cfc2811a6ce976a153a1a0d87d31c56dd52ec Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Mon, 8 Oct 2012 15:19:00 +0300 Subject: CHUI-390 FIXED Selecting Chat History option from right click menu on a conversation name does not open chat history viewer --- indra/newview/llimfloatercontainer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 7c5aaa7d0f..94e7f1000b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -888,7 +888,13 @@ void LLIMFloaterContainer::doToSelectedConversation(const std::string& command, } else if("chat_history" == command) { - LLAvatarActions::viewChatHistory(conversationItem->getUUID()); + const LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(conversationItem->getUUID()); + + if (NULL != session) + { + const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgouigAdHocHash() : session->mSessionID; + LLFloaterReg::showInstance("preview_conversation", session_id, true); + } } else { -- cgit v1.2.3 From 93e36340ec895a44d0b0bc73157fe23279883863 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Mon, 8 Oct 2012 22:20:58 +0300 Subject: CHUI-331 (Resizing conversation list when message panel is collapsed does not resize list) fixed --- indra/newview/llimfloatercontainer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 94e7f1000b..5f111b39d4 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -553,12 +553,25 @@ void LLIMFloaterContainer::collapseMessagesPane(bool collapse) gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", mConversationsPane->isCollapsed()); } + // Save left pane rectangle before collapsing/expanding right pane. + LLRect prevRect = mConversationsPane->getRect(); + // Show/hide the messages pane. mConversationsStack->collapsePanel(mMessagesPane, collapse); + if (!collapse) + { + // Make sure layout is updated before resizing conversation pane. + mConversationsStack->updateLayout(); + } + updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth")); + if (!collapse) + { + // Restore conversation's pane previous width after expanding messages pane. + mConversationsPane->setTargetDim(prevRect.getWidth()); + } } - void LLIMFloaterContainer::collapseConversationsPane(bool collapse) { if (mConversationsPane->isCollapsed() == collapse) -- cgit v1.2.3 From 9aa03f0bf284bbfa3f50883351c6e39f7ffa41c5 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Fri, 12 Oct 2012 14:29:44 +0300 Subject: CHUI-402 (Double-click on conversation participant should begin IM session) --- indra/newview/llimfloatercontainer.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 5f111b39d4..0f44d42780 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -142,6 +142,9 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); + // Open IM session with selected participant on double click event + mConversationsListPanel->setDoubleClickCallback(boost::bind(&LLIMFloaterContainer::doToSelected, this, LLSD("im"))); + // Create the root model and view for all conversation sessions LLConversationItem* base_item = new LLConversationItem(getRootViewModel()); -- cgit v1.2.3 From 19c5b35a86dbe641fe397baf9a8194d78e440af8 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Fri, 12 Oct 2012 20:10:13 +0300 Subject: CHUI-385 FIXED All user's do not receive ad hoc messages after adding a user to a conversation --- indra/newview/llimfloatercontainer.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 0f44d42780..2248699e5e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -109,8 +109,7 @@ void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) { - removeConversationListItem(old_session_id); - addConversationListItem(new_session_id); + addConversationListItem(new_session_id, removeConversationListItem(old_session_id)); } void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) @@ -1118,7 +1117,7 @@ void LLIMFloaterContainer::setNearbyDistances() } } -void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) +void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/) { bool is_nearby_chat = uuid.isNull(); @@ -1173,7 +1172,10 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) current_participant_model++; } - setConvItemSelect(uuid); + if (isWidgetSelected) + { + setConvItemSelect(uuid); + } // set the widget to minimized mode if conversations pane is collapsed widget->toggleMinimizedMode(mConversationsPane->isCollapsed()); @@ -1181,17 +1183,19 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) return; } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) +bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) { // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener + bool isWidgetSelected = false; conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(uuid); if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; if (widget) { + isWidgetSelected = widget->isSelected(); widget->destroyView(); } } @@ -1211,6 +1215,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c widget->selectItem(); } } + return isWidgetSelected; } LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) -- cgit v1.2.3 From d7d0416547958792517a9b739b370e51c717fb23 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 12 Oct 2012 20:15:57 -0700 Subject: CHUI-380: (In progress) Refactoring needed to fix focusing issues when selecting an existing conversation item. This commit resolves re-introducing bug CHUI-289. Will code review and cleanup code in next commit. --- indra/newview/llimfloatercontainer.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 5f111b39d4..0250854f36 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -101,6 +101,11 @@ void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::str addConversationListItem(session_id); } +void LLIMFloaterContainer::sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + doSomething(session_id); +} + void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { LLIMFloater::addToHost(session_id, true); @@ -1069,6 +1074,19 @@ void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) } } +void LLIMFloaterContainer::doSomething(const LLUUID& session_id) +{ + LLConversationItem* vmi = static_cast(mConversationsRoot->getCurSelectedItem()->getParentFolder()->getViewModelItem()); + + if(session_id != vmi->getUUID()) + { + mSelectedSession = session_id; + LLFolderViewItem* widget = mConversationsWidgets[session_id]; + (widget->getRoot())->setSelection(widget, FALSE, FALSE); + } +} + + void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) { conversations_items_map::iterator item_it = mConversationsItems.find(session_id); @@ -1204,6 +1222,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); if (widget_it != mConversationsWidgets.end()) { + mSelectedSession = widget_it->first; LLFolderViewItem* widget = widget_it->second; widget->selectItem(); } -- cgit v1.2.3 From f609f4cca3a91c8d6ea7c55b61d0b2cfd29be6b7 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 15 Oct 2012 13:55:12 +0300 Subject: CHUI-400 FIXED Disable "Activate Group" menu item if selected group is the active group --- indra/newview/llimfloatercontainer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 2248699e5e..16751a6ea1 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -961,6 +961,12 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) uuid_vec_t mUUIDs; getParticipantUUIDs(mUUIDs); + if(item == std::string("can_activate_group")) + { + LLUUID selected_group_id = getCurSelectedViewModelItem()->getUUID(); + return gAgent.getGroupID() != selected_group_id; + } + if(mUUIDs.size() <= 0) { return false; -- cgit v1.2.3 From 5a5df259ffc23a6289d25deac906047a7356fb42 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 15 Oct 2012 13:58:21 -0700 Subject: CHUI-380: Final commit for this issue. After code review changed some method names to be more accurate. Also using dynamic_cast instead of static_cast for safety. --- indra/newview/llimfloatercontainer.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 0250854f36..c8897c1f92 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -101,9 +101,9 @@ void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::str addConversationListItem(session_id); } -void LLIMFloaterContainer::sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - doSomething(session_id); + setItemSelect(session_id); } void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) @@ -1064,6 +1064,7 @@ bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) return false; } +//Will select only the conversation item void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) { LLFolderViewItem* widget = mConversationsWidgets[session_id]; @@ -1074,15 +1075,22 @@ void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) } } -void LLIMFloaterContainer::doSomething(const LLUUID& session_id) +//Will select the conversation/participant item +void LLIMFloaterContainer::setItemSelect(const LLUUID& session_id) { - LLConversationItem* vmi = static_cast(mConversationsRoot->getCurSelectedItem()->getParentFolder()->getViewModelItem()); - if(session_id != vmi->getUUID()) + if(mConversationsRoot->getCurSelectedItem() && mConversationsRoot->getCurSelectedItem()->getParentFolder()) { - mSelectedSession = session_id; - LLFolderViewItem* widget = mConversationsWidgets[session_id]; - (widget->getRoot())->setSelection(widget, FALSE, FALSE); + //Retreive the conversation id. When a participant is selected, then have to to get the converation id from the parent. + LLConversationItem* vmi = dynamic_cast(mConversationsRoot->getCurSelectedItem()->getParentFolder()->getViewModelItem()); + + //Will allow selection/highlighting of the conversation/participant + if(session_id != vmi->getUUID()) + { + mSelectedSession = session_id; + LLFolderViewItem* widget = mConversationsWidgets[session_id]; + (widget->getRoot())->setSelection(widget, FALSE, FALSE); + } } } -- cgit v1.2.3 From 699e0a1e0b89e4d3c2d1342c821496c5699b8c52 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 15 Oct 2012 14:28:07 -0700 Subject: CHUI-380: Merge fix, the addConverationListItem API was changedso that it does not by default select the new conversation item. Adjusted sessionAdded and sessionVoiceOrImStarted functions to specify that the first item should be selected when calling addConversationListItem(). --- indra/newview/llimfloatercontainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 8a30b5cd68..5c1105531e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,7 +98,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { LLIMFloater::addToHost(session_id, true); - addConversationListItem(session_id); + addConversationListItem(session_id, true); } void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -109,7 +109,7 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { LLIMFloater::addToHost(session_id, true); - addConversationListItem(session_id); + addConversationListItem(session_id, true); } void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) -- cgit v1.2.3 From 1251f45e6246d81658cf4fe6f2654472c772e94b Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 17 Oct 2012 00:16:18 +0300 Subject: CHUI-394 FIXED Group moderation tools missing in right click menus --- indra/newview/llimfloatercontainer.cpp | 344 ++++++++++++++++++++++++++------- 1 file changed, 276 insertions(+), 68 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 5c1105531e..c9c7e94af9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -44,6 +44,7 @@ #include "llfloateravatarpicker.h" #include "llfloaterpreference.h" #include "llimview.h" +#include "llnotificationsutil.h" #include "lltransientfloatermgr.h" #include "llviewercontrol.h" #include "llconversationview.h" @@ -830,59 +831,67 @@ void LLIMFloaterContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids) void LLIMFloaterContainer::doToParticipants(const std::string& command, uuid_vec_t& selectedIDS) { - if(selectedIDS.size() > 0) -{ - const LLUUID userID = selectedIDS.front(); + if(selectedIDS.size() > 0) + { + const LLUUID& userID = selectedIDS.front(); - if ("view_profile" == command) - { - LLAvatarActions::showProfile(userID); - } - else if("im" == command) - { - LLAvatarActions::startIM(userID); - } - else if("offer_teleport" == command) - { - LLAvatarActions::offerTeleport(selectedIDS); - } - else if("voice_call" == command) - { - LLAvatarActions::startCall(userID); - } - else if("chat_history" == command) - { - LLAvatarActions::viewChatHistory(userID); - } - else if("add_friend" == command) - { - LLAvatarActions::requestFriendshipDialog(userID); - } - else if("remove_friend" == command) - { - LLAvatarActions::removeFriendDialog(userID); - } - else if("invite_to_group" == command) - { - LLAvatarActions::inviteToGroup(userID); - } - else if("map" == command) - { - LLAvatarActions::showOnMap(userID); - } - else if("share" == command) - { - LLAvatarActions::share(userID); - } - else if("pay" == command) - { - LLAvatarActions::pay(userID); - } - else if("block_unblock" == command) - { - LLAvatarActions::toggleBlock(userID); - } -} + if ("view_profile" == command) + { + LLAvatarActions::showProfile(userID); + } + else if("im" == command) + { + LLAvatarActions::startIM(userID); + } + else if("offer_teleport" == command) + { + LLAvatarActions::offerTeleport(selectedIDS); + } + else if("voice_call" == command) + { + LLAvatarActions::startCall(userID); + } + else if("chat_history" == command) + { + LLAvatarActions::viewChatHistory(userID); + } + else if("add_friend" == command) + { + LLAvatarActions::requestFriendshipDialog(userID); + } + else if("remove_friend" == command) + { + LLAvatarActions::removeFriendDialog(userID); + } + else if("invite_to_group" == command) + { + LLAvatarActions::inviteToGroup(userID); + } + else if("map" == command) + { + LLAvatarActions::showOnMap(userID); + } + else if("share" == command) + { + LLAvatarActions::share(userID); + } + else if("pay" == command) + { + LLAvatarActions::pay(userID); + } + else if("block_unblock" == command) + { + LLAvatarActions::toggleBlock(userID); + } + else if("selected" == command || "mute_all" == command || "unmute_all" == command) + { + moderateVoice(command, userID); + } + else if ("toggle_allow_text_chat" == command) + { + toggleAllowTextChat(userID); + } + } } void LLIMFloaterContainer::doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS) @@ -963,8 +972,8 @@ void LLIMFloaterContainer::doToSelectedGroup(const LLSD& userdata) bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); - uuid_vec_t mUUIDs; - getParticipantUUIDs(mUUIDs); + uuid_vec_t uuids; + getParticipantUUIDs(uuids); if(item == std::string("can_activate_group")) { @@ -972,7 +981,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) return gAgent.getGroupID() != selected_group_id; } - if(mUUIDs.size() <= 0) + if(uuids.size() <= 0) { return false; } @@ -982,7 +991,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) if (item == std::string("can_block")) { - const LLUUID& id = mUUIDs.front(); + const LLUUID& id = uuids.front(); return LLAvatarActions::canBlock(id); } else if (item == std::string("can_add")) @@ -992,7 +1001,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) // - and there are no friends among selection yet. //EXT-7389 - disable for more than 1 - if(mUUIDs.size() > 1) + if(uuids.size() > 1) { return false; } @@ -1000,8 +1009,8 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) bool result = true; uuid_vec_t::const_iterator - id = mUUIDs.begin(), - uuids_end = mUUIDs.end(); + id = uuids.begin(), + uuids_end = uuids.end(); for (;id != uuids_end; ++id) { @@ -1020,11 +1029,11 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) // - there are selected people // - and there are only friends among selection. - bool result = (mUUIDs.size() > 0); + bool result = (uuids.size() > 0); uuid_vec_t::const_iterator - id = mUUIDs.begin(), - uuids_end = mUUIDs.end(); + id = uuids.begin(), + uuids_end = uuids.end(); for (;id != uuids_end; ++id) { @@ -1043,15 +1052,20 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) } else if (item == std::string("can_show_on_map")) { - const LLUUID& id = mUUIDs.front(); + const LLUUID& id = uuids.front(); return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) || gAgent.isGodlike(); } else if(item == std::string("can_offer_teleport")) { - return LLAvatarActions::canOfferTeleport(mUUIDs); + return LLAvatarActions::canOfferTeleport(uuids); } + else if("can_moderate_voice" == item || "can_allow_text_chat" == item || "can_mute" == item || "can_unmute" == item) + { + return enableModerateContextMenuItem(item); + } + return false; } @@ -1063,10 +1077,19 @@ bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) if(mUUIDs.size() > 0 ) { - if (item == std::string("is_blocked")) - { - return LLAvatarActions::isBlocked(mUUIDs.front()); - } + if ("is_blocked" == item) + { + return LLAvatarActions::isBlocked(mUUIDs.front()); + } + else if ("is_allowed_text_chat" == item) + { + const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant()); + + if (NULL != speakerp) + { + return !speakerp->mModeratorMutedText; + } + } } return false; @@ -1284,4 +1307,189 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti return LLUICtrlFactory::create(params); } +bool LLIMFloaterContainer::enableModerateContextMenuItem(const std::string& userdata) +{ + // only group moderators can perform actions related to this "enable callback" + if (!isGroupModerator()) + { + return false; + } + + LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant()); + if (NULL == speakerp) + { + return false; + } + + bool voice_channel = speakerp->isInVoiceChannel(); + + if ("can_moderate_voice" == userdata) + { + return voice_channel; + } + else if ("can_mute" == userdata) + { + return voice_channel && !isMuted(getCurSelectedViewModelItem()->getUUID()); + } + else if ("can_unmute" == userdata) + { + return voice_channel && isMuted(getCurSelectedViewModelItem()->getUUID()); + } + + // The last invoke is used to check whether the "can_allow_text_chat" will enabled + return LLVoiceClient::getInstance()->isParticipantAvatar(getCurSelectedViewModelItem()->getUUID()); +} + +bool LLIMFloaterContainer::isGroupModerator() +{ + LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant(); + if (NULL == speaker_manager) + { + llwarns << "Speaker manager is missing" << llendl; + return false; + } + + // Is session a group call/chat? + if(gAgent.isInGroup(speaker_manager->getSessionID())) + { + LLSpeaker * speaker = speaker_manager->findSpeaker(gAgentID).get(); + + // Is agent a moderator? + return speaker && speaker->mIsModerator; + } + + return false; +} + +void LLIMFloaterContainer::moderateVoice(const std::string& command, const LLUUID& userID) +{ + if (!gAgent.getRegion()) return; + + if (command.compare("selected")) + { + moderateVoiceAllParticipants(command.compare("mute_all")); + } + else + { + moderateVoiceParticipant(userID, isMuted(userID)); + } +} + +bool LLIMFloaterContainer::isMuted(const LLUUID& avatar_id) +{ + const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant()); + return NULL == speakerp ? true : speakerp->mStatus == LLSpeaker::STATUS_MUTED; +} + +void LLIMFloaterContainer::moderateVoiceAllParticipants(bool unmute) +{ + LLIMSpeakerMgr * speaker_managerp = dynamic_cast(getSpeakerMgrForSelectedParticipant()); + + if (NULL != speaker_managerp) + { + if (!unmute) + { + LLSD payload; + payload["session_id"] = speaker_managerp->getSessionID(); + LLNotificationsUtil::add("ConfirmMuteAll", LLSD(), payload, confirmMuteAllCallback); + return; + } + + speaker_managerp->moderateVoiceAllParticipants(unmute); + } +} + +// static +void LLIMFloaterContainer::confirmMuteAllCallback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + // if Cancel pressed + if (option == 1) + { + return; + } + + const LLSD& payload = notification["payload"]; + const LLUUID& session_id = payload["session_id"]; + + LLIMSpeakerMgr * speaker_manager = dynamic_cast ( + LLIMModel::getInstance()->getSpeakerManager(session_id)); + if (speaker_manager) + { + speaker_manager->moderateVoiceAllParticipants(false); + } + + return; +} + +void LLIMFloaterContainer::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) +{ + LLIMSpeakerMgr * speaker_managerp = dynamic_cast(getSpeakerMgrForSelectedParticipant()); + + if (NULL != speaker_managerp) + { + speaker_managerp->moderateVoiceParticipant(avatar_id, unmute); + } +} + +LLSpeakerMgr * LLIMFloaterContainer::getSpeakerMgrForSelectedParticipant() +{ + LLFolderViewItem * selected_folder_itemp = mConversationsRoot->getCurSelectedItem(); + if (NULL == selected_folder_itemp) + { + llwarns << "Current selected item is null" << llendl; + return NULL; + } + + LLFolderViewFolder * conversation_itemp = selected_folder_itemp->getParentFolder(); + + conversations_widgets_map::const_iterator iter = mConversationsWidgets.begin(); + conversations_widgets_map::const_iterator end = mConversationsWidgets.end(); + const LLUUID * conversation_uuidp = NULL; + while(iter != end) + { + if (iter->second == conversation_itemp) + { + conversation_uuidp = &iter->first; + break; + } + ++iter; + } + if (NULL == conversation_uuidp) + { + llwarns << "Cannot find conversation item widget" << llendl; + return NULL; + } + + return conversation_uuidp->isNull() ? (LLSpeakerMgr *)LLLocalSpeakerMgr::getInstance() + : LLIMModel::getInstance()->getSpeakerManager(*conversation_uuidp); +} + +LLSpeaker * LLIMFloaterContainer::getSpeakerOfSelectedParticipant(LLSpeakerMgr * speaker_managerp) +{ + if (NULL == speaker_managerp) + { + llwarns << "Speaker manager is missing" << llendl; + return NULL; + } + + const LLConversationItem * participant_itemp = getCurSelectedViewModelItem(); + if (NULL == participant_itemp) + { + llwarns << "Cannot evaluate current selected view model item" << llendl; + return NULL; + } + + return speaker_managerp->findSpeaker(participant_itemp->getUUID()); +} + +void LLIMFloaterContainer::toggleAllowTextChat(const LLUUID& participant_uuid) +{ + LLIMSpeakerMgr * speaker_managerp = dynamic_cast(getSpeakerMgrForSelectedParticipant()); + if (NULL != speaker_managerp) + { + speaker_managerp->toggleAllowTextChat(participant_uuid); + } +} + // EOF -- cgit v1.2.3 From c0b60841ce14a1c449ede17284d2aa6939322be3 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Thu, 18 Oct 2012 16:50:40 +0300 Subject: CHUI-412 (User restricted in resizing conversation floater width) fixed --- indra/newview/llimfloatercontainer.cpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c9c7e94af9..8a6659667d 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -286,32 +286,21 @@ void LLIMFloaterContainer::onCloseFloater(LLUUID& id) // virtual void LLIMFloaterContainer::computeResizeLimits(S32& new_min_width, S32& new_min_height) { - bool is_left_pane_expanded = !mConversationsPane->isCollapsed(); - bool is_right_pane_expanded = !mMessagesPane->isCollapsed(); - - S32 conversations_pane_min_dim = mConversationsPane->getMinDim(); - - if (is_right_pane_expanded) + // possibly increase floater's minimum height according to children's minimums + for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) { - S32 conversations_pane_width = - (is_left_pane_expanded ? gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") : conversations_pane_min_dim); - - // possibly increase minimum size constraint due to children's minimums. - for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) + LLFloater* floaterp = dynamic_cast(mTabContainer->getPanelByIndex(tab_idx)); + if (floaterp) { - LLFloater* floaterp = dynamic_cast(mTabContainer->getPanelByIndex(tab_idx)); - if (floaterp) - { - new_min_width = llmax(new_min_width, - floaterp->getMinWidth() + conversations_pane_width + LLPANEL_BORDER_WIDTH * 2); - new_min_height = llmax(new_min_height, floaterp->getMinHeight()); - } + new_min_height = llmax(new_min_height, floaterp->getMinHeight()); } } - else - { - new_min_width = conversations_pane_min_dim; - } + + S32 conversations_pane_min_dim = mConversationsPane->getRelevantMinDim(); + S32 messages_pane_min_dim = mMessagesPane->getRelevantMinDim(); + + // set floater's minimum width according to relevant minimal children's dimensionals + new_min_width = conversations_pane_min_dim + messages_pane_min_dim + LLPANEL_BORDER_WIDTH*2; } void LLIMFloaterContainer::onNewMessageReceived(const LLSD& data) -- cgit v1.2.3 From 36ea92678e028abb54e02c603b657dfa10c91da1 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 18 Oct 2012 11:44:52 -0700 Subject: CHUI-329: The text is now gray due to CHUI 410. The only change in this commit is that parenthesis surround the nearby chat text (Nearby chat). --- indra/newview/llimfloatercontainer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c9c7e94af9..6edda76ad2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1175,8 +1175,18 @@ void LLIMFloaterContainer::setNearbyDistances() void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/) { bool is_nearby_chat = uuid.isNull(); - - std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatTitle") : LLIMModel::instance().getName(uuid); + std::string display_name; + + //Stores the display name for the conversation line item + if(is_nearby_chat) + { + //Adds parenthesis in code since these are independent of the translated string + display_name = "(" + LLTrans::getString("NearbyChatTitle") + ")"; + } + else + { + display_name = LLIMModel::instance().getName(uuid); + } // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance -- cgit v1.2.3 From 2301c7cff60eca879f605a3ee3f26b960597d8c3 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 18 Oct 2012 13:16:00 -0700 Subject: CHUI-329: Post code review commit, instead of hard coded the parenthesis, created a custom string in string.xml. The reasoning for this is because some languages may not use the parenthesis or perhaps even use brackets if needed...basically allows for flexibility. --- indra/newview/llimfloatercontainer.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 6edda76ad2..5d328bb283 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1175,18 +1175,9 @@ void LLIMFloaterContainer::setNearbyDistances() void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/) { bool is_nearby_chat = uuid.isNull(); - std::string display_name; //Stores the display name for the conversation line item - if(is_nearby_chat) - { - //Adds parenthesis in code since these are independent of the translated string - display_name = "(" + LLTrans::getString("NearbyChatTitle") + ")"; - } - else - { - display_name = LLIMModel::instance().getName(uuid); - } + std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatLabel") : LLIMModel::instance().getName(uuid); // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance -- cgit v1.2.3 From 155cb976cb807771772b6bab62709709348c918b Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 19 Oct 2012 19:10:35 +0300 Subject: CHUI-416 FIXED Check if conversationItem is not NULL before calling getType(). --- indra/newview/llimfloatercontainer.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c4eeccecbe..14ed0b3c3e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -927,15 +927,18 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata) const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); uuid_vec_t selected_uuids; - getParticipantUUIDs(selected_uuids); - - if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) - { - doToParticipants(command, selected_uuids); - } - else + if(conversationItem != NULL) { - doToSelectedConversation(command, selected_uuids); + getParticipantUUIDs(selected_uuids); + + if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) + { + doToParticipants(command, selected_uuids); + } + else + { + doToSelectedConversation(command, selected_uuids); + } } } -- cgit v1.2.3 From 364e8118670f7ea80a1fa7187b23cc46ad2fc2f7 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Mon, 22 Oct 2012 04:35:31 +0300 Subject: CHUI-428 (Scroll conversation list to the newly created conversation) fixed --- indra/newview/llimfloatercontainer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 14ed0b3c3e..cf4d054dd5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1113,6 +1113,9 @@ void LLIMFloaterContainer::setItemSelect(const LLUUID& session_id) mSelectedSession = session_id; LLFolderViewItem* widget = mConversationsWidgets[session_id]; (widget->getRoot())->setSelection(widget, FALSE, FALSE); + + // Scroll to selected item + mConversationsRoot->scrollToShowSelection(); } } } @@ -1228,6 +1231,9 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWi // set the widget to minimized mode if conversations pane is collapsed widget->toggleMinimizedMode(mConversationsPane->isCollapsed()); + // scroll to newly added item + mConversationsRoot->scrollToShowSelection(); + return; } -- cgit v1.2.3 From 3f020d0be92859e1d9261261ccc9c377df700118 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 22 Oct 2012 19:26:18 -0700 Subject: CHUI-441 : WIP : Initial changes to LLIMFloater to use the same model as LLIMFloaterContainer --- indra/newview/llimfloatercontainer.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index cf4d054dd5..75ccc56885 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,8 +98,8 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - LLIMFloater::addToHost(session_id, true); - addConversationListItem(session_id, true); + LLConversationItemSession* item = addConversationListItem(session_id, true); + LLIMFloater::addToHost(session_id, item, true); } void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -109,12 +109,13 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::addToHost(session_id, true); - addConversationListItem(session_id, true); + LLConversationItemSession* item = addConversationListItem(session_id, true); + LLIMFloater::addToHost(session_id, item, true); } void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) { + // CHUI-441 : We should do this *without* delete and recreate addConversationListItem(new_session_id, removeConversationListItem(old_session_id)); } @@ -1167,11 +1168,11 @@ void LLIMFloaterContainer::setNearbyDistances() } } -void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/) +LLConversationItemSession* LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/) { bool is_nearby_chat = uuid.isNull(); - //Stores the display name for the conversation line item + // Stores the display name for the conversation line item std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatLabel") : LLIMModel::instance().getName(uuid); // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) @@ -1179,7 +1180,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWi conversations_items_map::iterator item_it = mConversationsItems.find(uuid); if (item_it != mConversationsItems.end()) { - return; + return item_it->second; } // Remove the conversation item that might exist already: it'll be recreated anew further down anyway @@ -1196,7 +1197,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWi if (!item) { llwarns << "Couldn't create conversation session item : " << display_name << llendl; - return; + return NULL; } item->renameItem(display_name); item->updateParticipantName(NULL); @@ -1234,7 +1235,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWi // scroll to newly added item mConversationsRoot->scrollToShowSelection(); - return; + return item; } bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) -- cgit v1.2.3 From 06978c99d12a1261f3834fa2ebc19e24c54fd1d4 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 24 Oct 2012 13:06:30 +0300 Subject: CHUI-430 FIXED Open Nearby chat if is is the only conversation in the list. --- indra/newview/llimfloatercontainer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index cf4d054dd5..7821f2ee0d 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -222,6 +222,7 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { LLMultiFloater::onOpen(key); + openNearbyChat(); } // virtual @@ -508,6 +509,7 @@ void LLIMFloaterContainer::setVisible(BOOL visible) LLSD name("nearby_chat"); LLFloaterReg::toggleInstanceOrBringToFront(name); } + openNearbyChat(); } nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); @@ -1491,4 +1493,18 @@ void LLIMFloaterContainer::toggleAllowTextChat(const LLUUID& participant_uuid) } } +void LLIMFloaterContainer::openNearbyChat() +{ + // If there's only one conversation in the container and that conversation is the nearby chat + //(which it should be...), open it so to make the list of participants visible. This happens to be the most common case when opening the Chat floater. + if(mConversationsItems.size() == 1) + { + LLConversationViewSession* nearby_chat = dynamic_cast(mConversationsWidgets[LLUUID()]); + if (nearby_chat) + { + nearby_chat->setOpen(TRUE); + } + } +} + // EOF -- cgit v1.2.3 From 68815045a629eeb0e4ab33c05d3773d272eafb50 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 24 Oct 2012 13:18:41 -0700 Subject: CHUI-441 : WIP : Initial refactor part 2. Works but the list doesn't update in the torn off dialog. --- indra/newview/llimfloatercontainer.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') 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("im_container"); } +LLConversationItemSession* LLIMFloaterContainer::getSessionModel(const LLUUID& session_id) +{ + LLConversationItemSession* session_model = dynamic_cast(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; } -- cgit v1.2.3 From b77e2f17aa9755120032ee977d34e9e923cba0be Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 24 Oct 2012 16:02:58 -0700 Subject: CHUI-449: Problem: When a toast was clicked, the conversation floater was displayed without selecting the conversation line item. Resolution: Added a function that will show the conversation floater container and then trigger selecting the conversation line item. When the conversation line item is selecting this implicitly will cause the correct conversation floater to be displayed. --- indra/newview/llimfloatercontainer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 7821f2ee0d..0538a286ce 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1089,6 +1089,12 @@ bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) return false; } +void LLIMFloaterContainer::showConversation(const LLUUID& session_id) +{ + setVisibleAndFrontmost(false); + setConvItemSelect(session_id); +} + //Will select only the conversation item void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) { -- cgit v1.2.3 From e6e2b0dda2b1c3cb8d96a885a569a645d97e0756 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 24 Oct 2012 16:37:08 -0700 Subject: CHUI-441 : WIP : Fixed the creation of empty model records in the list model --- indra/newview/llimfloatercontainer.cpp | 70 +++++++++++++++------------------- 1 file changed, 30 insertions(+), 40 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 6f2b8bcf32..60cc5c6d7e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -348,10 +348,10 @@ LLIMFloaterContainer* LLIMFloaterContainer::getInstance() return LLFloaterReg::getTypedInstance("im_container"); } +// Returns a pointer to the session model if found, NULL otherwise. LLConversationItemSession* LLIMFloaterContainer::getSessionModel(const LLUUID& session_id) { - LLConversationItemSession* session_model = dynamic_cast(mConversationsItems[session_id]); - return session_model; + return (mConversationsItems.find(session_id) != mConversationsItems.end() ? dynamic_cast(mConversationsItems[session_id]) : NULL); } void LLIMFloaterContainer::setMinimized(BOOL b) @@ -454,7 +454,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) { if (!participant_view) { - LLConversationItemSession* session_model = dynamic_cast(mConversationsItems[session_id]); + LLConversationItemSession* session_model = getSessionModel(session_id); if (session_model) { LLConversationItemParticipant* participant_model = session_model->findParticipant(participant_id); @@ -1137,47 +1137,39 @@ void LLIMFloaterContainer::setItemSelect(const LLUUID& session_id) void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) { - conversations_items_map::iterator item_it = mConversationsItems.find(session_id); - if (item_it != mConversationsItems.end()) + LLConversationItemSession* item = getSessionModel(session_id); + if (item) { - LLConversationItemSession* item = dynamic_cast(item_it->second); - if (item) - { - item->setTimeNow(participant_id); - mConversationViewModel.requestSortAll(); - mConversationsRoot->arrangeAll(); - } + item->setTimeNow(participant_id); + mConversationViewModel.requestSortAll(); + mConversationsRoot->arrangeAll(); } } void LLIMFloaterContainer::setNearbyDistances() { - // Get the nearby chat session: that's the one with uuid nul in mConversationsItems - conversations_items_map::iterator item_it = mConversationsItems.find(LLUUID()); - if (item_it != mConversationsItems.end()) - { - LLConversationItemSession* item = dynamic_cast(item_it->second); - if (item) + // Get the nearby chat session: that's the one with uuid nul + LLConversationItemSession* item = getSessionModel(LLUUID()); + if (item) + { + // Get the positions of the nearby avatars and their ids + std::vector positions; + uuid_vec_t avatar_ids; + LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); + // Get the position of the agent + const LLVector3d& me_pos = gAgent.getPositionGlobal(); + // For each nearby avatar, compute and update the distance + int avatar_count = positions.size(); + for (int i = 0; i < avatar_count; i++) { - // Get the positions of the nearby avatars and their ids - std::vector positions; - uuid_vec_t avatar_ids; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); - // Get the position of the agent - const LLVector3d& me_pos = gAgent.getPositionGlobal(); - // For each nearby avatar, compute and update the distance - int avatar_count = positions.size(); - for (int i = 0; i < avatar_count; i++) - { - F64 dist = dist_vec_squared(positions[i], me_pos); - item->setDistance(avatar_ids[i],dist); - } - // Also does it for the agent itself - item->setDistance(gAgent.getID(),0.0f); - // Request resort - mConversationViewModel.requestSortAll(); - mConversationsRoot->arrangeAll(); + F64 dist = dist_vec_squared(positions[i], me_pos); + item->setDistance(avatar_ids[i],dist); } + // Also does it for the agent itself + item->setDistance(gAgent.getID(),0.0f); + // Request resort + mConversationViewModel.requestSortAll(); + mConversationsRoot->arrangeAll(); } } @@ -1188,14 +1180,12 @@ LLConversationItem* LLIMFloaterContainer::addConversationListItem(const LLUUID& // Stores the display name for the conversation line item std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatLabel") : LLIMModel::instance().getName(uuid); - // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) + // Check if the item is not already in the list, exit (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance conversations_items_map::iterator item_it = mConversationsItems.find(uuid); if (item_it != mConversationsItems.end()) { - 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; + return item_it->second; } // Remove the conversation item that might exist already: it'll be recreated anew further down anyway -- cgit v1.2.3 From 853826efccfea704eb22276dd63c9155a3f77ac1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 24 Oct 2012 18:12:27 -0700 Subject: CHUI-441 : WIP : More map clean up and better use of get_ptr_in_map() --- indra/newview/llimfloatercontainer.cpp | 36 ++++++++++++---------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 60cc5c6d7e..9d9d49f497 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -348,12 +348,6 @@ LLIMFloaterContainer* LLIMFloaterContainer::getInstance() return LLFloaterReg::getTypedInstance("im_container"); } -// Returns a pointer to the session model if found, NULL otherwise. -LLConversationItemSession* LLIMFloaterContainer::getSessionModel(const LLUUID& session_id) -{ - return (mConversationsItems.find(session_id) != mConversationsItems.end() ? dynamic_cast(mConversationsItems[session_id]) : NULL); -} - void LLIMFloaterContainer::setMinimized(BOOL b) { if (isMinimized() == b) return; @@ -432,7 +426,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) LLUUID session_id = event.get("session_uuid").asUUID(); LLUUID participant_id = event.get("participant_uuid").asUUID(); - LLConversationViewSession* session_view = dynamic_cast(mConversationsWidgets[session_id]); + LLConversationViewSession* session_view = dynamic_cast(get_ptr_in_map(mConversationsWidgets,session_id)); if (!session_view) { // We skip events that are not associated to a session @@ -454,7 +448,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) { if (!participant_view) { - LLConversationItemSession* session_model = getSessionModel(session_id); + LLConversationItemSession* session_model = dynamic_cast(get_ptr_in_map(mConversationsItems,session_id)); if (session_model) { LLConversationItemParticipant* participant_model = session_model->findParticipant(participant_id); @@ -1101,18 +1095,18 @@ bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) return false; } -//Will select only the conversation item +// Will select only the conversation item void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) { - LLFolderViewItem* widget = mConversationsWidgets[session_id]; - if (widget && mSelectedSession != session_id) + LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); + if (widget && (mSelectedSession != session_id)) { mSelectedSession = session_id; (widget->getRoot())->setSelection(widget, FALSE, FALSE); } } -//Will select the conversation/participant item +// Will select the conversation/participant item void LLIMFloaterContainer::setItemSelect(const LLUUID& session_id) { @@ -1125,7 +1119,7 @@ void LLIMFloaterContainer::setItemSelect(const LLUUID& session_id) if(session_id != vmi->getUUID()) { mSelectedSession = session_id; - LLFolderViewItem* widget = mConversationsWidgets[session_id]; + LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); (widget->getRoot())->setSelection(widget, FALSE, FALSE); // Scroll to selected item @@ -1137,7 +1131,7 @@ void LLIMFloaterContainer::setItemSelect(const LLUUID& session_id) void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) { - LLConversationItemSession* item = getSessionModel(session_id); + LLConversationItemSession* item = dynamic_cast(get_ptr_in_map(mConversationsItems,session_id)); if (item) { item->setTimeNow(participant_id); @@ -1149,7 +1143,7 @@ void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& pa void LLIMFloaterContainer::setNearbyDistances() { // Get the nearby chat session: that's the one with uuid nul - LLConversationItemSession* item = getSessionModel(LLUUID()); + LLConversationItemSession* item = dynamic_cast(get_ptr_in_map(mConversationsItems,LLUUID())); if (item) { // Get the positions of the nearby avatars and their ids @@ -1250,15 +1244,11 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener bool isWidgetSelected = false; - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(uuid); - if (widget_it != mConversationsWidgets.end()) + LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid); + if (widget) { - LLFolderViewItem* widget = widget_it->second; - if (widget) - { - isWidgetSelected = widget->isSelected(); - widget->destroyView(); - } + isWidgetSelected = widget->isSelected(); + widget->destroyView(); } // Suppress the conversation items and widgets from their respective maps -- cgit v1.2.3 From b5d76c2b55666083279580f383e5a7b139517504 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 24 Oct 2012 20:08:36 -0700 Subject: CHUI-441 : WIP : Fix the initial attach code so to allow creation of the conversation item before the dialog --- indra/newview/llimfloatercontainer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 9d9d49f497..11d8b29884 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,10 +98,10 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - 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); + llinfos << "Merov debug : sessionAdded, adding LLIMFloater, id = " << session_id << llendl; + LLIMFloater::addToHost(session_id, true); } void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -111,10 +111,10 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - 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); + llinfos << "Merov debug : sessionVoiceOrIMStarted, adding LLIMFloater, id = " << session_id << llendl; + LLIMFloater::addToHost(session_id, true); } void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) @@ -1195,7 +1195,6 @@ LLConversationItem* LLIMFloaterContainer::addConversationListItem(const LLUUID& } 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; } -- cgit v1.2.3 From 63548b973e6de392f2bf209b3405b1dde78bda03 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 25 Oct 2012 11:43:18 -0700 Subject: CHUI-449: Got rid of a function called setItemSelect(), I wrote this code and it doesn't have a purpose anymore since I can use setConvItemSelect() instead. Also now torn off, minimized conversations are selected when clicking a toast for that conversation. Resolution: Adjusted setConvItemSelect() to be less strict when trying to select an item, now as long as the function is called it will attempt to select the conversation line item. --- indra/newview/llimfloatercontainer.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 0538a286ce..ebb732b995 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -104,7 +104,7 @@ void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::str void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - setItemSelect(session_id); + setConvItemSelect(session_id); } void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) @@ -1099,35 +1099,12 @@ void LLIMFloaterContainer::showConversation(const LLUUID& session_id) void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) { LLFolderViewItem* widget = mConversationsWidgets[session_id]; - if (widget && mSelectedSession != session_id) + if (widget) { - mSelectedSession = session_id; (widget->getRoot())->setSelection(widget, FALSE, FALSE); } } -//Will select the conversation/participant item -void LLIMFloaterContainer::setItemSelect(const LLUUID& session_id) -{ - - if(mConversationsRoot->getCurSelectedItem() && mConversationsRoot->getCurSelectedItem()->getParentFolder()) - { - //Retreive the conversation id. When a participant is selected, then have to to get the converation id from the parent. - LLConversationItem* vmi = dynamic_cast(mConversationsRoot->getCurSelectedItem()->getParentFolder()->getViewModelItem()); - - //Will allow selection/highlighting of the conversation/participant - if(session_id != vmi->getUUID()) - { - mSelectedSession = session_id; - LLFolderViewItem* widget = mConversationsWidgets[session_id]; - (widget->getRoot())->setSelection(widget, FALSE, FALSE); - - // Scroll to selected item - mConversationsRoot->scrollToShowSelection(); - } - } -} - void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) { -- cgit v1.2.3 From 7127ea071922ee703cab56439a379f475cd5e4e7 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 25 Oct 2012 14:17:10 -0700 Subject: CHUI-449: Post code review with Merov, adjusted setConvItemSelect() fuction to be called selectConversation(). --- indra/newview/llimfloatercontainer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index ebb732b995..bd7d570154 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -104,7 +104,7 @@ void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::str void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - setConvItemSelect(session_id); + selectConversation(session_id); } void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) @@ -1092,11 +1092,11 @@ bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) void LLIMFloaterContainer::showConversation(const LLUUID& session_id) { setVisibleAndFrontmost(false); - setConvItemSelect(session_id); + selectConversation(session_id); } //Will select only the conversation item -void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) +void LLIMFloaterContainer::selectConversation(const LLUUID& session_id) { LLFolderViewItem* widget = mConversationsWidgets[session_id]; if (widget) @@ -1210,7 +1210,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWi if (isWidgetSelected) { - setConvItemSelect(uuid); + selectConversation(uuid); } // set the widget to minimized mode if conversations pane is collapsed -- cgit v1.2.3 From d49de3a66a5476f4541f15dc61c68e0e509c4c70 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 25 Oct 2012 18:16:56 -0700 Subject: CHUI-441 : WIP : Fix crashes when spawning torn off floaters, added widgets creation in the torn off floater for participants. --- indra/newview/llimfloatercontainer.cpp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 11d8b29884..0d62630b31 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,9 +98,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - llinfos << "Merov debug : sessionAdded, adding conversation item, id = " << session_id << llendl; addConversationListItem(session_id, true); - llinfos << "Merov debug : sessionAdded, adding LLIMFloater, id = " << session_id << llendl; LLIMFloater::addToHost(session_id, true); } @@ -111,9 +109,7 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - llinfos << "Merov debug : sessionVoiceOrIMStarted, adding conversation item, id = " << session_id << llendl; addConversationListItem(session_id, true); - llinfos << "Merov debug : sessionVoiceOrIMStarted, adding LLIMFloater, id = " << session_id << llendl; LLIMFloater::addToHost(session_id, true); } @@ -433,6 +429,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) return false; } LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); + LLIMFloater *conversation_floater = LLIMFloater::findInstance(session_id); if (type == "remove_participant") { @@ -446,20 +443,18 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) } else if (type == "add_participant") { - if (!participant_view) + LLConversationItemSession* session_model = dynamic_cast(get_ptr_in_map(mConversationsItems,session_id)); + LLConversationItemParticipant* participant_model = (session_model ? session_model->findParticipant(participant_id) : NULL); + if (!participant_view && session_model && participant_model) { - LLConversationItemSession* session_model = dynamic_cast(get_ptr_in_map(mConversationsItems,session_id)); - if (session_model) - { - LLConversationItemParticipant* participant_model = session_model->findParticipant(participant_id); - if (participant_model) - { - participant_view = createConversationViewParticipant(participant_model); - participant_view->addToFolder(session_view); - participant_view->setVisible(TRUE); - } - } - + participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(session_view); + participant_view->setVisible(TRUE); + } + // CHUI-441 : + if (conversation_floater && participant_model) + { + conversation_floater->addConversationViewParticipant(participant_model); } } else if (type == "update_participant") -- cgit v1.2.3 From 8f1049b2f8659b039752ee23017c1f30fa6d2725 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 26 Oct 2012 15:22:31 +0300 Subject: CHUI-457 FIXED Check that selected participant is not self before performing actions. --- indra/newview/llimfloatercontainer.cpp | 112 +++++++++++++++++---------------- 1 file changed, 57 insertions(+), 55 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index bd7d570154..b98558c47b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -825,62 +825,64 @@ void LLIMFloaterContainer::doToParticipants(const std::string& command, uuid_vec if(selectedIDS.size() > 0) { const LLUUID& userID = selectedIDS.front(); - - if ("view_profile" == command) - { - LLAvatarActions::showProfile(userID); - } - else if("im" == command) - { - LLAvatarActions::startIM(userID); - } - else if("offer_teleport" == command) - { - LLAvatarActions::offerTeleport(selectedIDS); - } - else if("voice_call" == command) - { - LLAvatarActions::startCall(userID); - } - else if("chat_history" == command) - { - LLAvatarActions::viewChatHistory(userID); - } - else if("add_friend" == command) - { - LLAvatarActions::requestFriendshipDialog(userID); - } - else if("remove_friend" == command) - { - LLAvatarActions::removeFriendDialog(userID); - } - else if("invite_to_group" == command) - { - LLAvatarActions::inviteToGroup(userID); - } - else if("map" == command) - { - LLAvatarActions::showOnMap(userID); - } - else if("share" == command) - { - LLAvatarActions::share(userID); - } - else if("pay" == command) + if(gAgent.getID() != userID) { - LLAvatarActions::pay(userID); - } - else if("block_unblock" == command) - { - LLAvatarActions::toggleBlock(userID); - } - else if("selected" == command || "mute_all" == command || "unmute_all" == command) - { - moderateVoice(command, userID); - } - else if ("toggle_allow_text_chat" == command) - { - toggleAllowTextChat(userID); + if ("view_profile" == command) + { + LLAvatarActions::showProfile(userID); + } + else if("im" == command) + { + LLAvatarActions::startIM(userID); + } + else if("offer_teleport" == command) + { + LLAvatarActions::offerTeleport(selectedIDS); + } + else if("voice_call" == command) + { + LLAvatarActions::startCall(userID); + } + else if("chat_history" == command) + { + LLAvatarActions::viewChatHistory(userID); + } + else if("add_friend" == command) + { + LLAvatarActions::requestFriendshipDialog(userID); + } + else if("remove_friend" == command) + { + LLAvatarActions::removeFriendDialog(userID); + } + else if("invite_to_group" == command) + { + LLAvatarActions::inviteToGroup(userID); + } + else if("map" == command) + { + LLAvatarActions::showOnMap(userID); + } + else if("share" == command) + { + LLAvatarActions::share(userID); + } + else if("pay" == command) + { + LLAvatarActions::pay(userID); + } + else if("block_unblock" == command) + { + LLAvatarActions::toggleBlock(userID); + } + else if("selected" == command || "mute_all" == command || "unmute_all" == command) + { + moderateVoice(command, userID); + } + else if ("toggle_allow_text_chat" == command) + { + toggleAllowTextChat(userID); + } } } } -- cgit v1.2.3 From 83562e059fdcf9f732bc8effba99d1e95d39cd36 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 26 Oct 2012 11:36:14 -0700 Subject: CHUI-383: Now a new conversation will not take focus. Instead a toast will appear. Problem: Each time a conversation was added, code would execute to add the conversation floater AND select the conversation. Resolution: This is no longer the expected behavior so adjusted LLIMFloater::addToHost() to only add a floater and not select/show the floater. If selection and/or showing is needed it seems to make sense that this is done outside LLIMFloater:addToHost(). --- indra/newview/llimfloatercontainer.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index bd7d570154..71487eb382 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,8 +98,8 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - LLIMFloater::addToHost(session_id, true); - addConversationListItem(session_id, true); + LLIMFloater::addToHost(session_id); + addConversationListItem(session_id); } void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -109,8 +109,8 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::addToHost(session_id, true); - addConversationListItem(session_id, true); + LLIMFloater::addToHost(session_id); + addConversationListItem(session_id); } void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) @@ -1208,16 +1208,15 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWi current_participant_model++; } - if (isWidgetSelected) - { - selectConversation(uuid); - } - // set the widget to minimized mode if conversations pane is collapsed widget->toggleMinimizedMode(mConversationsPane->isCollapsed()); - // scroll to newly added item - mConversationsRoot->scrollToShowSelection(); + if (isWidgetSelected) + { + selectConversation(uuid); + // scroll to newly added item + mConversationsRoot->scrollToShowSelection(); + } return; } -- cgit v1.2.3 From 1a1a0b91c0c4400ec3febac183124314f9226127 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 26 Oct 2012 16:49:22 -0700 Subject: CHUI-383: Realized that prior changes for this bug caused a regress. The regress was using the people panel or a notecard to start a im/call with a user. When doing this the conversation line item would not be focused. Resolution: Changed all calls to LLIMFloater::show() to LLIMFloaterContainer::showConversation(), which will first select the conversation line item and then show the corresponding conversation floater. --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 6377ffeecf..4d2201ebb9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -128,7 +128,7 @@ void LLIMFloaterContainer::onCurrentChannelChanged(const LLUUID& session_id) { if (session_id != LLUUID::null) { - LLIMFloater::show(session_id); + LLIMFloaterContainer::getInstance()->showConversation(session_id); } } -- cgit v1.2.3 From 36b1b4c4b6bbae641271b6b1668e1fea4629d899 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 26 Oct 2012 17:04:17 -0700 Subject: CHUI-465 : Add event handling for LLIMConversation participant list --- indra/newview/llimfloatercontainer.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 0d62630b31..7159b13c8c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -408,7 +408,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) // For debug only //std::ostringstream llsd_value; //llsd_value << LLSDOStreamer(event) << std::endl; - //llinfos << "Merov debug : onConversationModelEvent, event = " << llsd_value.str() << llendl; + //llinfos << "LLIMFloaterContainer::onConversationModelEvent, event = " << llsd_value.str() << llendl; // end debug // Note: In conversations, the model is not responsible for creating the view, which is a good thing. This means that @@ -425,7 +425,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) LLConversationViewSession* session_view = dynamic_cast(get_ptr_in_map(mConversationsWidgets,session_id)); if (!session_view) { - // We skip events that are not associated to a session + // We skip events that are not associated with a session return false; } LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); @@ -433,6 +433,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) if (type == "remove_participant") { + // Remove a participant view from the hierarchical conversation list if (participant_view) { session_view->extractItem(participant_view); @@ -440,18 +441,24 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) session_view->refresh(); mConversationsRoot->arrangeAll(); } + // Remove a participant view from the conversation floater + if (conversation_floater) + { + conversation_floater->removeConversationViewParticipant(participant_id); + } } else if (type == "add_participant") { LLConversationItemSession* session_model = dynamic_cast(get_ptr_in_map(mConversationsItems,session_id)); LLConversationItemParticipant* participant_model = (session_model ? session_model->findParticipant(participant_id) : NULL); + // Add a participant view to the hierarchical conversation list if (!participant_view && session_model && participant_model) { participant_view = createConversationViewParticipant(participant_model); participant_view->addToFolder(session_view); participant_view->setVisible(TRUE); } - // CHUI-441 : + // Add a participant view to the conversation floater if (conversation_floater && participant_model) { conversation_floater->addConversationViewParticipant(participant_model); @@ -459,14 +466,24 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) } else if (type == "update_participant") { + // Update the participant view in the hierarchical conversation list if (participant_view) { participant_view->refresh(); } + // Update the participant view in the conversation floater + if (conversation_floater) + { + conversation_floater->updateConversationViewParticipant(participant_id); + } } else if (type == "update_session") { session_view->refresh(); + if (conversation_floater) + { + conversation_floater->refreshConversation(); + } } mConversationViewModel.requestSortAll(); -- cgit v1.2.3 From 09282019ef4d068fe95a94931bf341d8e84f29ea Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 26 Oct 2012 19:12:19 -0700 Subject: CHUI-469 : WIP : Add participants to the nearby chat torn off panel --- indra/newview/llimfloatercontainer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 7159b13c8c..89dfd2e149 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -429,7 +429,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) return false; } LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); - LLIMFloater *conversation_floater = LLIMFloater::findInstance(session_id); + LLIMConversation *conversation_floater = (session_id.isNull() ? (LLIMConversation*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLIMConversation*)(LLIMFloater::findInstance(session_id))); if (type == "remove_participant") { @@ -830,7 +830,6 @@ 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); @@ -906,7 +905,6 @@ 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) @@ -1234,6 +1232,12 @@ LLConversationItem* LLIMFloaterContainer::addConversationListItem(const LLUUID& participant_view->addToFolder(widget); current_participant_model++; } + // Do that too for the conversation dialog + LLIMConversation *conversation_floater = (uuid.isNull() ? (LLIMConversation*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLIMConversation*)(LLIMFloater::findInstance(uuid))); + if (conversation_floater) + { + conversation_floater->buildConversationViewParticipant(); + } if (isWidgetSelected) { -- cgit v1.2.3 From 480c3a1acb32e98d0d64aaf7bb70e4d61e6882f6 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 29 Oct 2012 16:59:53 -0700 Subject: CHUI-469 : Fixed. Add the widget to its map, init the widget map consistently and correctly. --- indra/newview/llimfloatercontainer.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 89dfd2e149..297db96c83 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -129,7 +129,6 @@ 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); } } -- cgit v1.2.3 From d2087bdd8a6591cafc6c8d8de7582a9dda6ea352 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Tue, 30 Oct 2012 18:16:56 +0200 Subject: CHUI-437 (Conversation floater shows as transparent after being minimized and unminimized) --- indra/newview/llimfloatercontainer.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index b98558c47b..83233cdd13 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -343,20 +343,6 @@ LLIMFloaterContainer* LLIMFloaterContainer::getInstance() return LLFloaterReg::getTypedInstance("im_container"); } -void LLIMFloaterContainer::setMinimized(BOOL b) -{ - if (isMinimized() == b) return; - - LLMultiFloater::setMinimized(b); - - if (isMinimized()) return; - - if (getActiveFloater()) - { - getActiveFloater()->setVisible(TRUE); - } -} - // Update all participants in the conversation lists void LLIMFloaterContainer::processParticipantsStyleUpdate() { -- cgit v1.2.3 From fb3df4790e27345a1e45f4a4675e756c1e551f21 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 30 Oct 2012 15:59:42 -0700 Subject: CHUI-459: Creating a fetchAvatarName() method for the LLConversationItemParticipant class to allow the class to query for the avatar display name directly. Also, added a field to store the avatar name cache callback connection so that we can disconnect properly on object destruction to avoid a crash with the callback attempting to access recently freed memory. --- indra/newview/llimfloatercontainer.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f46ecd905a..00ae0b8fd8 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -358,16 +358,7 @@ void LLIMFloaterContainer::processParticipantsStyleUpdate() { LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); // Get the avatar name for this participant id from the cache and update the model - LLUUID participant_id = participant_model->getUUID(); - LLAvatarName av_name; - LLAvatarNameCache::get(participant_id,&av_name); - // Avoid updating the model though if the cache is still waiting for its first update - if (!av_name.mDisplayName.empty()) - { - participant_model->onAvatarNameCache(av_name); - } - // Bind update to the next cache name signal - LLAvatarNameCache::get(participant_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant_model, _2)); + participant_model->fetchAvatarName(); // Next participant current_participant_model++; } -- cgit v1.2.3 From 9d9853082361b35987a70574b422c40e8ee04d93 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 30 Oct 2012 18:20:28 -0700 Subject: CHUI-471: Adjusted conversationview so that indentation of the avatar icon is dependent upon getIndentation() instead of modifying avatar icon's left value. --- indra/newview/llimfloatercontainer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 01456fee3b..298a6055bf 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1289,9 +1289,6 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti LLRect panel_rect = mConversationsListPanel->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; @@ -1299,7 +1296,8 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti params.rect = LLRect (0, 24, panel_rect.getWidth(), 0); params.tool_tip = params.name; params.participant_id = item->getUUID(); - + params.folder_indentation = 42; + return LLUICtrlFactory::create(params); } -- cgit v1.2.3 From a8ca9dc5a98d0bd99581d17be45a36c602ce87fd Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 31 Oct 2012 17:51:55 +0200 Subject: CHUI-374 ADD. FIX, CHUI-442 FIXED (Nearby chat is torn off and cannot be docked if nearby chat is received while conversation floater is closed) - implement. lazy creating of container --- indra/newview/llimfloatercontainer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 00ae0b8fd8..65dc024aea 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,7 +98,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); addConversationListItem(session_id); } @@ -109,7 +109,7 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); addConversationListItem(session_id); } @@ -490,9 +490,9 @@ void LLIMFloaterContainer::setVisible(BOOL visible) } nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); - if (nearby_chat && !nearby_chat->isHostSet()) + if (nearby_chat) { - nearby_chat->addToHost(); + LLIMConversation::addToHost(LLUUID()); } // We need to show/hide all the associated conversations that have been torn off -- cgit v1.2.3 From 424a80155ac755bc0191ddd44ef125bdbda39fa5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 1 Nov 2012 16:58:55 +0200 Subject: CHUI-445 FIXED Select the next conversation in the list when current conversation is deleted --- indra/newview/llimfloatercontainer.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 65dc024aea..f85aa9a353 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1206,6 +1206,7 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener bool isWidgetSelected = false; + LLFolderViewItem* new_selection = NULL; conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(uuid); if (widget_it != mConversationsWidgets.end()) { @@ -1213,6 +1214,11 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c if (widget) { isWidgetSelected = widget->isSelected(); + new_selection = mConversationsRoot->getNextFromChild(widget); + if(new_selection == NULL) + { + new_selection = mConversationsRoot->getPreviousFromChild(widget); + } widget->destroyView(); } } @@ -1225,12 +1231,13 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c if (change_focus) { setFocus(TRUE); - conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); - if (widget_it != mConversationsWidgets.end()) + if(new_selection != NULL) { - mSelectedSession = widget_it->first; - LLFolderViewItem* widget = widget_it->second; - widget->selectItem(); + LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); + if(vmi != NULL) + { + selectConversation(vmi->getUUID()); + } } } return isWidgetSelected; -- cgit v1.2.3 From 622a697788e3cabb9e803226de72856e9189911f Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 6 Nov 2012 14:47:01 +0200 Subject: CHUI-460 FIXED Reselect current conversation on clicking expand/collapse button --- indra/newview/llimfloatercontainer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f85aa9a353..52deae445b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -331,6 +331,7 @@ void LLIMFloaterContainer::onExpandCollapseButtonClicked() { collapseConversationsPane(!mConversationsPane->isCollapsed()); } + selectConversation(mSelectedSession); } LLIMFloaterContainer* LLIMFloaterContainer::findInstance() -- cgit v1.2.3 From 2d9d44e31643214c80bde5ffee03f9b6af6af9d0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 5 Nov 2012 18:33:39 -0800 Subject: CHUI-468 : WIP : Taking LLAvatarList and related out of LLParticipantList --- indra/newview/llimfloatercontainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 72e0f90f8c..e6657260e6 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -115,7 +115,7 @@ void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) { - // CHUI-441 : We should do this *without* delete and recreate + // *TODO: We should do this *without* delete and recreate addConversationListItem(new_session_id, removeConversationListItem(old_session_id)); } @@ -1164,7 +1164,7 @@ LLConversationItem* LLIMFloaterContainer::addConversationListItem(const LLUUID& LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid)); if (speaker_manager) { - item = new LLParticipantList(speaker_manager, NULL, getRootViewModel(), true, false); + item = new LLParticipantList(speaker_manager, getRootViewModel(), true, false); } if (!item) { -- cgit v1.2.3 From 8828eb21e2a8960bbcfd4edb2d113dbada7d4a5d Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Tue, 6 Nov 2012 22:02:09 +0200 Subject: CHUI-448 FIXED p2p IM chat conversations show a participant list with a carat --- indra/newview/llimfloatercontainer.cpp | 41 +++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 52deae445b..af43b1ac38 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -424,15 +424,21 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) LLConversationItemSession* session_model = dynamic_cast(mConversationsItems[session_id]); if (session_model) { - LLConversationItemParticipant* participant_model = session_model->findParticipant(participant_id); - if (participant_model) + const LLUUID& uuid = session_model->getUUID(); + + LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(uuid); + + if (uuid.isNull() || im_sessionp && !im_sessionp->isP2PSessionType()) { - participant_view = createConversationViewParticipant(participant_model); - participant_view->addToFolder(session_view); - participant_view->setVisible(TRUE); + LLConversationItemParticipant* participant_model = session_model->findParticipant(participant_id); + if (participant_model) + { + participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(session_view); + participant_view->setVisible(TRUE); + } } } - } } else if (type == "update_participant") @@ -1175,17 +1181,22 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWi // Add a new conversation widget to the root folder of the folder view widget->addToFolder(mConversationsRoot); widget->requestArrange(); - + + LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(uuid); + // 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(); - while (current_participant_model != end_participant_model) - { - LLConversationItem* participant_model = dynamic_cast(*current_participant_model); - LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); - participant_view->addToFolder(widget); - current_participant_model++; + if (uuid.isNull() || im_sessionp && !im_sessionp->isP2PSessionType()) + { + 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(*current_participant_model); + LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(widget); + current_participant_model++; + } } // set the widget to minimized mode if conversations pane is collapsed -- cgit v1.2.3 From 990a8c6085b43cb0290a631b664b3160938b0536 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Tue, 6 Nov 2012 22:44:22 +0200 Subject: CHUI-462 (Torn-off Nearby Chat can't be closed) --- indra/newview/llimfloatercontainer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f85aa9a353..c9cd013317 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1475,4 +1475,11 @@ void LLIMFloaterContainer::openNearbyChat() } } +void LLIMFloaterContainer::onNearbyChatClosed() +{ + // If nearby chat is the only remaining conversation and it is closed, close whole conversation floater as well + if (mConversationsItems.size() == 1) + closeFloater(); +} + // EOF -- cgit v1.2.3 From 8c64fbf1b76e46fa3f5a8f8c6baba30d4583b7ec Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 6 Nov 2012 18:32:45 -0800 Subject: CHUI-468 : WIP : More cleanup and fix of the participants sorting in LLIMConversation --- indra/newview/llimfloatercontainer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index e6657260e6..4b992a2e0f 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -764,6 +764,19 @@ void LLIMFloaterContainer::setSortOrder(const LLConversationSort& order) mConversationsRoot->arrangeAll(); // try to keep selection onscreen, even if it wasn't to start with mConversationsRoot->scrollToShowSelection(); + + // Notify all conversation (torn off or not) of the change to the sort order + // Note: For the moment, the sort order is *unique* across all conversations. That might change in the future. + for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) + { + LLUUID session_id = it_session->first; + LLIMConversation *conversation_floater = (session_id.isNull() ? (LLIMConversation*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLIMConversation*)(LLIMFloater::findInstance(session_id))); + if (conversation_floater) + { + conversation_floater->setSortOrder(order); + } + } + gSavedSettings.setU32("ConversationSortOrder", (U32)order); } -- cgit v1.2.3 From d1f45654d91762af4e614de2156304d7acad6619 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 7 Nov 2012 18:45:02 +0200 Subject: CHUI-473, CHUI-482 FIXED (Clicking on nearby chat toast to open Conversation floater does not show Nearby Chat conversation selected in list; Nearby chat conversation is not selected in list by default when it is the only conversation ): implement. new logic in LLIMFloaterContainer for the syncronous select the conv. list's item and corresponding convers. floater; removed floater selecting from conv. items; fixed bug with item select --- indra/newview/llimfloatercontainer.cpp | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index af43b1ac38..c2ad94c423 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1091,6 +1091,47 @@ void LLIMFloaterContainer::selectConversation(const LLUUID& session_id) } } +// Synchronous select the conversation item and the conversation floater +BOOL LLIMFloaterContainer::selectConversationPair(const LLUUID& session_id, bool select_widget) +{ + BOOL handled = TRUE; + + /* widget processing */ + if (select_widget) + { + LLFolderViewItem* widget = mConversationsWidgets[session_id]; + if (widget && widget->getParentFolder()) + { + widget->getParentFolder()->setSelection(widget, FALSE, FALSE); + } + } + + /* floater processing */ + + if (session_id != getSelectedSession()) + { + // Store the active session + setSelectedSession(session_id); + + LLIMConversation* session_floater = LLIMConversation::getConversation(session_id); + + if (session_floater->getHost()) + { + // Always expand the message pane if the panel is hosted by the container + collapseMessagesPane(false); + // Switch to the conversation floater that is being selected + selectFloater(session_floater); + } + + // Set the focus on the selected floater + if (!session_floater->hasFocus()) + { + session_floater->setFocus(TRUE); + } + } + + return handled; +} void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) { -- cgit v1.2.3 From 626d07daa1219e6834bf371547cc8c4852840fb9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 7 Nov 2012 15:36:16 -0800 Subject: CHUI-468 : WIP : Clean up LLAvatarList and all sorting code left over in LLParticipantList --- indra/newview/llimfloatercontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4b992a2e0f..c0465c6956 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1177,7 +1177,7 @@ LLConversationItem* LLIMFloaterContainer::addConversationListItem(const LLUUID& LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid)); if (speaker_manager) { - item = new LLParticipantList(speaker_manager, getRootViewModel(), true, false); + item = new LLParticipantList(speaker_manager, getRootViewModel()); } if (!item) { -- cgit v1.2.3 From 486bdf32845e248ec4923224f1f4ea5d239ac0f3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 9 Nov 2012 12:45:36 +0200 Subject: CHUI-337 FIXED: To avoid confusion with a classes "...conversation..." and in accordance with the naming convention in the project, some classes and corresponding files should be renamed: LLIMConversation -> LLFloaterIMSessionTab LLIMFloater -> LLFloaterIMSession LLNearbyChat -> LLFloaterIMNearbyChat LLIMFloaterContainer -> LLFloaterIMContainer LLNearbyChatBarListener -> LLFloaterIMNearbyChatListener LLNearbyChatHandler -> LLFloaterIMNearbyChatHandler --- indra/newview/llimfloatercontainer.cpp | 1557 -------------------------------- 1 file changed, 1557 deletions(-) delete mode 100644 indra/newview/llimfloatercontainer.cpp (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp deleted file mode 100644 index 9c1f5d7593..0000000000 --- a/indra/newview/llimfloatercontainer.cpp +++ /dev/null @@ -1,1557 +0,0 @@ -/** - * @file llimfloatercontainer.cpp - * @brief Multifloater containing active IM sessions in separate tab container tabs - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - -#include "llviewerprecompiledheaders.h" - -#include "llimfloater.h" -#include "llimfloatercontainer.h" - -#include "llfloaterreg.h" -#include "lllayoutstack.h" -#include "llnearbychat.h" - -#include "llagent.h" -#include "llavataractions.h" -#include "llavatariconctrl.h" -#include "llavatarnamecache.h" -#include "llcallbacklist.h" -#include "llgroupactions.h" -#include "llgroupiconctrl.h" -#include "llfloateravatarpicker.h" -#include "llfloaterpreference.h" -#include "llimview.h" -#include "llnotificationsutil.h" -#include "lltransientfloatermgr.h" -#include "llviewercontrol.h" -#include "llconversationview.h" -#include "llcallbacklist.h" -#include "llworld.h" - -#include "llsdserialize.h" -// -// LLIMFloaterContainer -// -LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) -: LLMultiFloater(seed), - mExpandCollapseBtn(NULL), - mConversationsRoot(NULL), - mConversationsEventStream("ConversationsEvents"), - mInitialized(false) -{ - mEnableCallbackRegistrar.add("IMFloaterContainer.Check", boost::bind(&LLIMFloaterContainer::isActionChecked, this, _2)); - mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); - - mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLIMFloaterContainer::checkContextMenuItem, this, _2)); - mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLIMFloaterContainer::enableContextMenuItem, this, _2)); - mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelected, this, _2)); - - mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedGroup, this, _2)); - - // Firstly add our self to IMSession observers, so we catch session events - LLIMMgr::getInstance()->addSessionObserver(this); - - mAutoResize = FALSE; - LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); -} - -LLIMFloaterContainer::~LLIMFloaterContainer() -{ - mConversationsEventStream.stopListening("ConversationsRefresh"); - - gIdleCallbacks.deleteFunction(idle, this); - - mNewMessageConnection.disconnect(); - LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); - - gSavedPerAccountSettings.setBOOL("ConversationsListPaneCollapsed", mConversationsPane->isCollapsed()); - gSavedPerAccountSettings.setBOOL("ConversationsMessagePaneCollapsed", mMessagesPane->isCollapsed()); - - if (!LLSingleton::destroyed()) - { - LLIMMgr::getInstance()->removeSessionObserver(this); - } -} - -void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) -{ - addConversationListItem(session_id); - LLIMConversation::addToHost(session_id); -} - -void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) -{ - selectConversation(session_id); -} - -void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) -{ - addConversationListItem(session_id); - LLIMConversation::addToHost(session_id); -} - -void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) -{ - // *TODO: We should do this *without* delete and recreate - addConversationListItem(new_session_id, removeConversationListItem(old_session_id)); -} - -void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) -{ - removeConversationListItem(session_id); -} - -// static -void LLIMFloaterContainer::onCurrentChannelChanged(const LLUUID& session_id) -{ - if (session_id != LLUUID::null) - { - LLIMFloaterContainer::getInstance()->showConversation(session_id); - } -} - - -BOOL LLIMFloaterContainer::postBuild() -{ - mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1)); - // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button - // mTabContainer will be initialized in LLMultiFloater::addChild() - - setTabContainer(getChild("im_box_tab_container")); - - mConversationsStack = getChild("conversations_stack"); - mConversationsPane = getChild("conversations_layout_panel"); - mMessagesPane = getChild("messages_layout_panel"); - - mConversationsListPanel = getChild("conversations_list_panel"); - - // Open IM session with selected participant on double click event - mConversationsListPanel->setDoubleClickCallback(boost::bind(&LLIMFloaterContainer::doToSelected, this, LLSD("im"))); - - // Create the root model and view for all conversation sessions - LLConversationItem* base_item = new LLConversationItem(getRootViewModel()); - - LLFolderView::Params p(LLUICtrlFactory::getDefaultParams()); - p.name = getName(); - p.title = getLabel(); - p.rect = LLRect(0, 0, getRect().getWidth(), 0); - p.parent_panel = mConversationsListPanel; - 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(p); - mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); - - // Add listener to conversation model events - mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLIMFloaterContainer::onConversationModelEvent, this, _1)); - - // a scroller for folder view - LLRect scroller_view_rect = mConversationsListPanel->getRect(); - scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); - LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams()); - scroller_params.rect(scroller_view_rect); - - LLScrollContainer* scroller = LLUICtrlFactory::create(scroller_params); - scroller->setFollowsAll(); - mConversationsListPanel->addChild(scroller); - scroller->addChild(mConversationsRoot); - mConversationsRoot->setScrollContainer(scroller); - mConversationsRoot->setFollowsAll(); - mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox); - - addConversationListItem(LLUUID()); // manually add nearby chat - - mExpandCollapseBtn = getChild("expand_collapse_btn"); - mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); - - childSetAction("add_btn", boost::bind(&LLIMFloaterContainer::onAddButtonClicked, this)); - - collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed")); - collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed")); - LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); - - if (! mMessagesPane->isCollapsed()) - { - S32 list_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth"); - LLRect list_size = mConversationsPane->getRect(); - S32 left_pad = mConversationsListPanel->getRect().mLeft; - list_size.mRight = list_size.mLeft + list_width - left_pad; - - mConversationsPane->handleReshape(list_size, TRUE); - } - - // Init the sort order now that the root had been created - setSortOrder(LLConversationSort(gSavedSettings.getU32("ConversationSortOrder"))); - - mInitialized = true; - - // Add callbacks: - // We'll take care of view updates on idle - gIdleCallbacks.addFunction(idle, this); - // When display name option change, we need to reload all participant names - LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLIMFloaterContainer::processParticipantsStyleUpdate, this)); - - return TRUE; -} - -void LLIMFloaterContainer::onOpen(const LLSD& key) -{ - LLMultiFloater::onOpen(key); - openNearbyChat(); -} - -// virtual -void LLIMFloaterContainer::addFloater(LLFloater* floaterp, - BOOL select_added_floater, - LLTabContainer::eInsertionPoint insertion_point) -{ - if(!floaterp) return; - - // already here - if (floaterp->getHost() == this) - { - openFloater(floaterp->getKey()); - return; - } - - // Make sure the message panel is open when adding a floater or it stays mysteriously hidden - collapseMessagesPane(false); - - // Add the floater - LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); - - LLUUID session_id = floaterp->getKey(); - - LLIconCtrl* icon = 0; - - if(gAgent.isInGroup(session_id, TRUE)) - { - LLGroupIconCtrl::Params icon_params; - icon_params.group_id = session_id; - icon = LLUICtrlFactory::instance().create(icon_params); - - mSessions[session_id] = floaterp; - floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); - } - else - { LLUUID avatar_id = session_id.notNull()? - LLIMModel::getInstance()->getOtherParticipantID(session_id) : LLUUID(); - - LLAvatarIconCtrl::Params icon_params; - icon_params.avatar_id = avatar_id; - icon = LLUICtrlFactory::instance().create(icon_params); - - mSessions[session_id] = floaterp; - floaterp->mCloseSignal.connect(boost::bind(&LLIMFloaterContainer::onCloseFloater, this, session_id)); - } - - // forced resize of the floater - LLRect wrapper_rect = this->mTabContainer->getLocalRect(); - floaterp->setRect(wrapper_rect); - - mTabContainer->setTabImage(floaterp, icon); -} - - -void LLIMFloaterContainer::onCloseFloater(LLUUID& id) -{ - mSessions.erase(id); - setFocus(TRUE); -} - -// virtual -void LLIMFloaterContainer::computeResizeLimits(S32& new_min_width, S32& new_min_height) -{ - // possibly increase floater's minimum height according to children's minimums - for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) - { - LLFloater* floaterp = dynamic_cast(mTabContainer->getPanelByIndex(tab_idx)); - if (floaterp) - { - new_min_height = llmax(new_min_height, floaterp->getMinHeight()); - } - } - - S32 conversations_pane_min_dim = mConversationsPane->getRelevantMinDim(); - S32 messages_pane_min_dim = mMessagesPane->getRelevantMinDim(); - - // set floater's minimum width according to relevant minimal children's dimensionals - new_min_width = conversations_pane_min_dim + messages_pane_min_dim + LLPANEL_BORDER_WIDTH*2; -} - -void LLIMFloaterContainer::onNewMessageReceived(const LLSD& data) -{ - LLUUID session_id = data["session_id"].asUUID(); - LLFloater* floaterp = get_ptr_in_map(mSessions, session_id); - LLFloater* current_floater = LLMultiFloater::getActiveFloater(); - - if(floaterp && current_floater && floaterp != current_floater) - { - if(LLMultiFloater::isFloaterFlashing(floaterp)) - LLMultiFloater::setFloaterFlashing(floaterp, FALSE); - LLMultiFloater::setFloaterFlashing(floaterp, TRUE); - } -} - -void LLIMFloaterContainer::onExpandCollapseButtonClicked() -{ - if (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed() - && gSavedPerAccountSettings.getBOOL("ConversationsExpandMessagePaneFirst")) - { - // Expand the messages pane from ultra minimized state - // if it was collapsed last in order. - collapseMessagesPane(false); - } - else - { - collapseConversationsPane(!mConversationsPane->isCollapsed()); - } - selectConversation(mSelectedSession); -} - -LLIMFloaterContainer* LLIMFloaterContainer::findInstance() -{ - return LLFloaterReg::findTypedInstance("im_container"); -} - -LLIMFloaterContainer* LLIMFloaterContainer::getInstance() -{ - return LLFloaterReg::getTypedInstance("im_container"); -} - -// Update all participants in the conversation lists -void LLIMFloaterContainer::processParticipantsStyleUpdate() -{ - // 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; - // 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) - { - LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); - // Get the avatar name for this participant id from the cache and update the model - participant_model->fetchAvatarName(); - // Next participant - current_participant_model++; - } - } -} - -// static -void LLIMFloaterContainer::idle(void* user_data) -{ - LLIMFloaterContainer* self = static_cast(user_data); - - // Update the distance to agent in the nearby chat session if required - // Note: it makes no sense of course to update the distance in other session - if (self->mConversationViewModel.getSorter().getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE) - { - self->setNearbyDistances(); - } - self->mConversationsRoot->update(); -} - -bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) -{ - // For debug only - //std::ostringstream llsd_value; - //llsd_value << LLSDOStreamer(event) << std::endl; - //llinfos << "LLIMFloaterContainer::onConversationModelEvent, event = " << llsd_value.str() << llendl; - // end debug - - // Note: In conversations, 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 echo only a portion of this model (though currently the - // conversation view does echo the conversation model 1 to 1). - // 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, at the container level, to conform to the pattern implemented in llinventorypanel.cpp - // (see LLInventoryPanel::buildNewViews()). - - std::string type = event.get("type").asString(); - LLUUID session_id = event.get("session_uuid").asUUID(); - LLUUID participant_id = event.get("participant_uuid").asUUID(); - - LLConversationViewSession* session_view = dynamic_cast(get_ptr_in_map(mConversationsWidgets,session_id)); - if (!session_view) - { - // We skip events that are not associated with a session - return false; - } - LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); - LLIMConversation *conversation_floater = (session_id.isNull() ? (LLIMConversation*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLIMConversation*)(LLIMFloater::findInstance(session_id))); - - if (type == "remove_participant") - { - // Remove a participant view from the hierarchical conversation list - if (participant_view) - { - session_view->extractItem(participant_view); - delete participant_view; - session_view->refresh(); - mConversationsRoot->arrangeAll(); - } - // Remove a participant view from the conversation floater - if (conversation_floater) - { - conversation_floater->removeConversationViewParticipant(participant_id); - } - } - else if (type == "add_participant") - { - LLConversationItemSession* session_model = dynamic_cast(mConversationsItems[session_id]); - LLConversationItemParticipant* participant_model = (session_model ? session_model->findParticipant(participant_id) : NULL); - if (!participant_view && session_model && participant_model) - { - LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(session_id); - if (session_id.isNull() || (im_sessionp && !im_sessionp->isP2PSessionType())) - { - participant_view = createConversationViewParticipant(participant_model); - participant_view->addToFolder(session_view); - participant_view->setVisible(TRUE); - } - } - // Add a participant view to the conversation floater - if (conversation_floater && participant_model) - { - conversation_floater->addConversationViewParticipant(participant_model); - } - } - else if (type == "update_participant") - { - // Update the participant view in the hierarchical conversation list - if (participant_view) - { - participant_view->refresh(); - } - // Update the participant view in the conversation floater - if (conversation_floater) - { - conversation_floater->updateConversationViewParticipant(participant_id); - } - } - else if (type == "update_session") - { - session_view->refresh(); - if (conversation_floater) - { - conversation_floater->refreshConversation(); - } - } - - mConversationViewModel.requestSortAll(); - mConversationsRoot->arrangeAll(); - - return false; -} - -void LLIMFloaterContainer::draw() -{ - if (mTabContainer->getTabCount() == 0) - { - // Do not close the container when every conversation is torn off because the user - // still needs the conversation list. Simply collapse the message pane in that case. - collapseMessagesPane(true); - } - LLFloater::draw(); -} - -void LLIMFloaterContainer::tabClose() -{ - if (mTabContainer->getTabCount() == 0) - { - // Do not close the container when every conversation is torn off because the user - // still needs the conversation list. Simply collapse the message pane in that case. - collapseMessagesPane(true); - } -} - -void LLIMFloaterContainer::setVisible(BOOL visible) -{ LLNearbyChat* nearby_chat; - if (visible) - { - // Make sure we have the Nearby Chat present when showing the conversation container - nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); - if (nearby_chat == NULL) - { - // If not found, force the creation of the nearby chat conversation panel - // *TODO: find a way to move this to XML as a default panel or something like that - LLSD name("nearby_chat"); - LLFloaterReg::toggleInstanceOrBringToFront(name); - } - openNearbyChat(); - } - - nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); - if (nearby_chat) - { - LLIMConversation::addToHost(LLUUID()); - } - - // We need to show/hide all the associated conversations that have been torn off - // (and therefore, are not longer managed by the multifloater), - // so that they show/hide with the conversations manager. - conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); - for (;widget_it != mConversationsWidgets.end(); ++widget_it) - { - LLConversationViewSession* widget = dynamic_cast(widget_it->second); - if (widget) - { - widget->setVisibleIfDetached(visible); - } - } - - // Now, do the normal multifloater show/hide - LLMultiFloater::setVisible(visible); - -} - -void LLIMFloaterContainer::collapseMessagesPane(bool collapse) -{ - if (mMessagesPane->isCollapsed() == collapse) - { - return; - } - - if (collapse) - { - // Save the messages pane width before collapsing it. - gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", mMessagesPane->getRect().getWidth()); - - // Save the order in which the panels are closed to reverse user's last action. - gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", mConversationsPane->isCollapsed()); - } - - // Save left pane rectangle before collapsing/expanding right pane. - LLRect prevRect = mConversationsPane->getRect(); - - // Show/hide the messages pane. - mConversationsStack->collapsePanel(mMessagesPane, collapse); - - if (!collapse) - { - // Make sure layout is updated before resizing conversation pane. - mConversationsStack->updateLayout(); - } - - updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth")); - if (!collapse) - { - // Restore conversation's pane previous width after expanding messages pane. - mConversationsPane->setTargetDim(prevRect.getWidth()); - } -} -void LLIMFloaterContainer::collapseConversationsPane(bool collapse) -{ - if (mConversationsPane->isCollapsed() == collapse) - { - return; - } - - LLView* button_panel = getChild("conversations_pane_buttons_expanded"); - button_panel->setVisible(!collapse); - mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon")); - - if (collapse) - { - // Save the conversations pane width before collapsing it. - gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", mConversationsPane->getRect().getWidth()); - - // Save the order in which the panels are closed to reverse user's last action. - gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", !mMessagesPane->isCollapsed()); - } - - mConversationsStack->collapsePanel(mConversationsPane, collapse); - - S32 collapsed_width = mConversationsPane->getMinDim(); - updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - collapsed_width); - - for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); - widget_it != mConversationsWidgets.end(); ++widget_it) - { - LLConversationViewSession* widget = dynamic_cast(widget_it->second); - if (widget) - { - widget->toggleMinimizedMode(collapse); - - // force closing all open conversations when collapsing to minimized state - if (collapse) - { - widget->setOpen(false); - } -} - } -} - -void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) -{ - LLRect floater_rect = getRect(); - floater_rect.mRight += ((collapse ? -1 : 1) * delta_width); - - // Set by_user = true so that reshaped rect is saved in user_settings. - setShape(floater_rect, true); - - updateResizeLimits(); - - bool is_left_pane_expanded = !mConversationsPane->isCollapsed(); - bool is_right_pane_expanded = !mMessagesPane->isCollapsed(); - - setCanResize(is_left_pane_expanded || is_right_pane_expanded); - setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); - - // force set correct size for the title after show/hide minimize button - LLRect cur_rect = getRect(); - LLRect force_rect = cur_rect; - force_rect.mRight = cur_rect.mRight + 1; - setRect(force_rect); - setRect(cur_rect); - - // restore floater's resize limits (prevent collapse when left panel is expanded) - if (is_left_pane_expanded && !is_right_pane_expanded) - { - S32 expanded_min_size = mConversationsPane->getExpandedMinDim(); - setResizeLimits(expanded_min_size, expanded_min_size); - } - -} - -void LLIMFloaterContainer::onAddButtonClicked() -{ - LLView * button = findChild("conversations_pane_buttons_expanded")->findChild("add_btn"); - LLFloater* root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE, root_floater->getName(), button); - - if (picker && root_floater) - { - root_floater->addDependentFloater(picker); - } -} - -void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) -{ - if (ids.size() == 1) - { - LLAvatarActions::startIM(ids.back()); - } - else - { - LLAvatarActions::startConference(ids); - } -} - -void LLIMFloaterContainer::onCustomAction(const LLSD& userdata) -{ - std::string command = userdata.asString(); - - if ("sort_sessions_by_type" == command) - { - setSortOrderSessions(LLConversationFilter::SO_SESSION_TYPE); - } - if ("sort_sessions_by_name" == command) - { - setSortOrderSessions(LLConversationFilter::SO_NAME); - } - if ("sort_sessions_by_recent" == command) - { - setSortOrderSessions(LLConversationFilter::SO_DATE); - } - if ("sort_participants_by_name" == command) - { - setSortOrderParticipants(LLConversationFilter::SO_NAME); - } - if ("sort_participants_by_recent" == command) - { - setSortOrderParticipants(LLConversationFilter::SO_DATE); - } - if ("sort_participants_by_distance" == command) - { - setSortOrderParticipants(LLConversationFilter::SO_DISTANCE); - } - if ("chat_preferences" == command) - { - LLFloaterPreference* floater_prefs = LLFloaterReg::showTypedInstance("preferences"); - if (floater_prefs) - { - LLTabContainer* tab_container = floater_prefs->getChild("pref core"); - LLPanel* chat_panel = tab_container->getPanelByName("chat"); - if (tab_container && chat_panel) - { - tab_container->selectTabPanel(chat_panel); - } - } - } -} - -BOOL LLIMFloaterContainer::isActionChecked(const LLSD& userdata) -{ - LLConversationSort order = mConversationViewModel.getSorter(); - std::string command = userdata.asString(); - if ("sort_sessions_by_type" == command) - { - return (order.getSortOrderSessions() == LLConversationFilter::SO_SESSION_TYPE); - } - if ("sort_sessions_by_name" == command) - { - return (order.getSortOrderSessions() == LLConversationFilter::SO_NAME); - } - if ("sort_sessions_by_recent" == command) - { - return (order.getSortOrderSessions() == LLConversationFilter::SO_DATE); - } - if ("sort_participants_by_name" == command) - { - return (order.getSortOrderParticipants() == LLConversationFilter::SO_NAME); - } - if ("sort_participants_by_recent" == command) - { - return (order.getSortOrderParticipants() == LLConversationFilter::SO_DATE); - } - if ("sort_participants_by_distance" == command) - { - return (order.getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE); - } - - return FALSE; -} - -void LLIMFloaterContainer::setSortOrderSessions(const LLConversationFilter::ESortOrderType order) -{ - LLConversationSort old_order = mConversationViewModel.getSorter(); - if (order != old_order.getSortOrderSessions()) - { - old_order.setSortOrderSessions(order); - setSortOrder(old_order); - } -} - -void LLIMFloaterContainer::setSortOrderParticipants(const LLConversationFilter::ESortOrderType order) -{ - LLConversationSort old_order = mConversationViewModel.getSorter(); - if (order != old_order.getSortOrderParticipants()) - { - old_order.setSortOrderParticipants(order); - setSortOrder(old_order); - } -} - -void LLIMFloaterContainer::setSortOrder(const LLConversationSort& order) -{ - mConversationViewModel.setSorter(order); - mConversationsRoot->arrangeAll(); - // try to keep selection onscreen, even if it wasn't to start with - mConversationsRoot->scrollToShowSelection(); - - // Notify all conversation (torn off or not) of the change to the sort order - // Note: For the moment, the sort order is *unique* across all conversations. That might change in the future. - for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) - { - LLUUID session_id = it_session->first; - LLIMConversation *conversation_floater = (session_id.isNull() ? (LLIMConversation*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLIMConversation*)(LLIMFloater::findInstance(session_id))); - if (conversation_floater) - { - conversation_floater->setSortOrder(order); - } - } - - gSavedSettings.setU32("ConversationSortOrder", (U32)order); -} - -void LLIMFloaterContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids) -{ - const std::set selectedItems = mConversationsRoot->getSelectionList(); - - std::set::const_iterator it = selectedItems.begin(); - const std::set::const_iterator it_end = selectedItems.end(); - LLConversationItem * conversationItem; - - for (; it != it_end; ++it) - { - conversationItem = static_cast((*it)->getViewModelItem()); - selected_uuids.push_back(conversationItem->getUUID()); - } -} - -const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() -{ - LLConversationItem * conversationItem = NULL; - - if(mConversationsRoot && - mConversationsRoot->getCurSelectedItem() && - mConversationsRoot->getCurSelectedItem()->getViewModelItem()) - { - conversationItem = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); - } - - return conversationItem; -} - -void LLIMFloaterContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids) -{ - //Find the conversation floater associated with the selected id - const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); - - if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) - { - getSelectedUUIDs(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) - { - LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); - LLUUID participantID = conversationFloater->getOtherParticipantUUID(); - selected_uuids.push_back(participantID); - } -} - -void LLIMFloaterContainer::doToParticipants(const std::string& command, uuid_vec_t& selectedIDS) -{ - if(selectedIDS.size() > 0) - { - const LLUUID& userID = selectedIDS.front(); - if(gAgent.getID() != userID) - { - if ("view_profile" == command) - { - LLAvatarActions::showProfile(userID); - } - else if("im" == command) - { - LLAvatarActions::startIM(userID); - } - else if("offer_teleport" == command) - { - LLAvatarActions::offerTeleport(selectedIDS); - } - else if("voice_call" == command) - { - LLAvatarActions::startCall(userID); - } - else if("chat_history" == command) - { - LLAvatarActions::viewChatHistory(userID); - } - else if("add_friend" == command) - { - LLAvatarActions::requestFriendshipDialog(userID); - } - else if("remove_friend" == command) - { - LLAvatarActions::removeFriendDialog(userID); - } - else if("invite_to_group" == command) - { - LLAvatarActions::inviteToGroup(userID); - } - else if("map" == command) - { - LLAvatarActions::showOnMap(userID); - } - else if("share" == command) - { - LLAvatarActions::share(userID); - } - else if("pay" == command) - { - LLAvatarActions::pay(userID); - } - else if("block_unblock" == command) - { - LLAvatarActions::toggleBlock(userID); - } - else if("selected" == command || "mute_all" == command || "unmute_all" == command) - { - moderateVoice(command, userID); - } - else if ("toggle_allow_text_chat" == command) - { - toggleAllowTextChat(userID); - } - } - } -} - -void LLIMFloaterContainer::doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS) -{ - //Find the conversation floater associated with the selected id - const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); - LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); - - if(conversationFloater) - { - //Close the selected conversation - if("close_conversation" == command) - { - LLFloater::onClickClose(conversationFloater); - } - else if("open_voice_conversation" == command) - { - gIMMgr->startCall(conversationItem->getUUID()); - } - else if("disconnect_from_voice" == command) - { - gIMMgr->endCall(conversationItem->getUUID()); - } - else if("chat_history" == command) - { - const LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(conversationItem->getUUID()); - - if (NULL != session) - { - const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgouigAdHocHash() : session->mSessionID; - LLFloaterReg::showInstance("preview_conversation", session_id, true); - } - } - else - { - doToParticipants(command, selectedIDS); - } - } -} - -void LLIMFloaterContainer::doToSelected(const LLSD& userdata) -{ - std::string command = userdata.asString(); - const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); - uuid_vec_t selected_uuids; - - if(conversationItem != NULL) - { - getParticipantUUIDs(selected_uuids); - - if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) - { - doToParticipants(command, selected_uuids); - } - else - { - doToSelectedConversation(command, selected_uuids); - } - } -} - -void LLIMFloaterContainer::doToSelectedGroup(const LLSD& userdata) -{ - std::string action = userdata.asString(); - LLUUID selected_group = getCurSelectedViewModelItem()->getUUID(); - - if (action == "group_profile") - { - LLGroupActions::show(selected_group); - } - else if (action == "activate_group") - { - LLGroupActions::activate(selected_group); - } - else if (action == "leave_group") - { - LLGroupActions::leave(selected_group); - } -} - -bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) -{ - std::string item = userdata.asString(); - uuid_vec_t uuids; - getParticipantUUIDs(uuids); - - if(item == std::string("can_activate_group")) - { - LLUUID selected_group_id = getCurSelectedViewModelItem()->getUUID(); - return gAgent.getGroupID() != selected_group_id; - } - - if(uuids.size() <= 0) - { - return false; - } - - // Note: can_block and can_delete is used only for one person selected menu - // so we don't need to go over all uuids. - - if (item == std::string("can_block")) - { - const LLUUID& id = uuids.front(); - return LLAvatarActions::canBlock(id); - } - else if (item == std::string("can_add")) - { - // We can add friends if: - // - there are selected people - // - and there are no friends among selection yet. - - //EXT-7389 - disable for more than 1 - if(uuids.size() > 1) - { - return false; - } - - bool result = true; - - uuid_vec_t::const_iterator - id = uuids.begin(), - uuids_end = uuids.end(); - - for (;id != uuids_end; ++id) - { - if ( LLAvatarActions::isFriend(*id) ) - { - result = false; - break; - } - } - - return result; - } - else if (item == std::string("can_delete")) - { - // We can remove friends if: - // - there are selected people - // - and there are only friends among selection. - - bool result = (uuids.size() > 0); - - uuid_vec_t::const_iterator - id = uuids.begin(), - uuids_end = uuids.end(); - - for (;id != uuids_end; ++id) - { - if ( !LLAvatarActions::isFriend(*id) ) - { - result = false; - break; - } - } - - return result; - } - else if (item == std::string("can_call")) - { - return LLAvatarActions::canCall(); - } - else if (item == std::string("can_show_on_map")) - { - const LLUUID& id = uuids.front(); - - return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) - || gAgent.isGodlike(); - } - else if(item == std::string("can_offer_teleport")) - { - return LLAvatarActions::canOfferTeleport(uuids); - } - else if("can_moderate_voice" == item || "can_allow_text_chat" == item || "can_mute" == item || "can_unmute" == item) - { - return enableModerateContextMenuItem(item); - } - - return false; -} - -bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) -{ - std::string item = userdata.asString(); - uuid_vec_t mUUIDs; - getParticipantUUIDs(mUUIDs); - - if(mUUIDs.size() > 0 ) - { - if ("is_blocked" == item) - { - return LLAvatarActions::isBlocked(mUUIDs.front()); - } - else if ("is_allowed_text_chat" == item) - { - const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant()); - - if (NULL != speakerp) - { - return !speakerp->mModeratorMutedText; - } - } - } - - return false; -} - -void LLIMFloaterContainer::showConversation(const LLUUID& session_id) -{ - setVisibleAndFrontmost(false); - selectConversation(session_id); -} - -// Will select only the conversation item -void LLIMFloaterContainer::selectConversation(const LLUUID& session_id) -{ - LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); - if (widget) - { - (widget->getRoot())->setSelection(widget, FALSE, FALSE); - } -} - -// Synchronous select the conversation item and the conversation floater -BOOL LLIMFloaterContainer::selectConversationPair(const LLUUID& session_id, bool select_widget) -{ - BOOL handled = TRUE; - - /* widget processing */ - if (select_widget) - { - LLFolderViewItem* widget = mConversationsWidgets[session_id]; - if (widget && widget->getParentFolder()) - { - widget->getParentFolder()->setSelection(widget, FALSE, FALSE); - } - } - - /* floater processing */ - - if (session_id != getSelectedSession()) - { - // Store the active session - setSelectedSession(session_id); - - LLIMConversation* session_floater = LLIMConversation::getConversation(session_id); - - if (session_floater->getHost()) - { - // Always expand the message pane if the panel is hosted by the container - collapseMessagesPane(false); - // Switch to the conversation floater that is being selected - selectFloater(session_floater); - } - - // Set the focus on the selected floater - if (!session_floater->hasFocus()) - { - session_floater->setFocus(TRUE); - } - } - - return handled; -} - -void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) -{ - LLConversationItemSession* item = dynamic_cast(get_ptr_in_map(mConversationsItems,session_id)); - if (item) - { - item->setTimeNow(participant_id); - mConversationViewModel.requestSortAll(); - mConversationsRoot->arrangeAll(); - } -} - -void LLIMFloaterContainer::setNearbyDistances() -{ - // Get the nearby chat session: that's the one with uuid nul - LLConversationItemSession* item = dynamic_cast(get_ptr_in_map(mConversationsItems,LLUUID())); - if (item) - { - // Get the positions of the nearby avatars and their ids - std::vector positions; - uuid_vec_t avatar_ids; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); - // Get the position of the agent - const LLVector3d& me_pos = gAgent.getPositionGlobal(); - // For each nearby avatar, compute and update the distance - int avatar_count = positions.size(); - for (int i = 0; i < avatar_count; i++) - { - F64 dist = dist_vec_squared(positions[i], me_pos); - item->setDistance(avatar_ids[i],dist); - } - // Also does it for the agent itself - item->setDistance(gAgent.getID(),0.0f); - // Request resort - mConversationViewModel.requestSortAll(); - mConversationsRoot->arrangeAll(); - } -} - -LLConversationItem* LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid, bool isWidgetSelected /*= false*/) -{ - bool is_nearby_chat = uuid.isNull(); - - // Stores the display name for the conversation line item - std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatLabel") : LLIMModel::instance().getName(uuid); - - // Check if the item is not already in the list, exit (nothing to do) - // Note: this happens often, when reattaching a torn off conversation for instance - conversations_items_map::iterator item_it = mConversationsItems.find(uuid); - if (item_it != mConversationsItems.end()) - { - return item_it->second; - } - - // Remove the conversation item that might exist already: it'll be recreated anew further down anyway - // and nothing wrong will happen removing it if it doesn't exist - removeConversationListItem(uuid,false); - - // Create a conversation session model - LLConversationItemSession* item = NULL; - LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid)); - if (speaker_manager) - { - item = new LLParticipantList(speaker_manager, getRootViewModel()); - } - if (!item) - { - llwarns << "Couldn't create conversation session item : " << display_name << llendl; - return NULL; - } - item->renameItem(display_name); - item->updateParticipantName(NULL); - - mConversationsItems[uuid] = item; - - // Create a widget from it - LLConversationViewSession* widget = createConversationItemWidget(item); - mConversationsWidgets[uuid] = widget; - - // Add a new conversation widget to the root folder of the folder view - widget->addToFolder(mConversationsRoot); - widget->requestArrange(); - - LLIMModel::LLIMSession * im_sessionp = LLIMModel::getInstance()->findIMSession(uuid); - - // Create the participants widgets now - // Note: usually, we do not get an updated avatar list at that point - if (uuid.isNull() || im_sessionp && !im_sessionp->isP2PSessionType()) - { - 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(*current_participant_model); - LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); - participant_view->addToFolder(widget); - current_participant_model++; - } - } - // Do that too for the conversation dialog - LLIMConversation *conversation_floater = (uuid.isNull() ? (LLIMConversation*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLIMConversation*)(LLIMFloater::findInstance(uuid))); - if (conversation_floater) - { - conversation_floater->buildConversationViewParticipant(); - } - - // set the widget to minimized mode if conversations pane is collapsed - widget->toggleMinimizedMode(mConversationsPane->isCollapsed()); - - if (isWidgetSelected) - { - selectConversation(uuid); - // scroll to newly added item - mConversationsRoot->scrollToShowSelection(); - } - - return item; -} - -bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) -{ - // Delete the widget and the associated conversation item - // Note : since the mConversationsItems is also the listener to the widget, deleting - // the widget will also delete its listener - bool isWidgetSelected = false; - LLFolderViewItem* new_selection = NULL; - LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid); - if (widget) - { - isWidgetSelected = widget->isSelected(); - new_selection = mConversationsRoot->getNextFromChild(widget); - if(new_selection == NULL) - { - new_selection = mConversationsRoot->getPreviousFromChild(widget); - } - widget->destroyView(); - } - - // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(uuid); - mConversationsWidgets.erase(uuid); - - // Don't let the focus fall IW, select and refocus on the first conversation in the list - if (change_focus) - { - setFocus(TRUE); - if(new_selection != NULL) - { - LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); - if(vmi != NULL) - { - selectConversation(vmi->getUUID()); - } - } - } - return isWidgetSelected; -} - -LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) -{ - LLConversationViewSession::Params params; - - params.name = item->getDisplayName(); - params.root = mConversationsRoot; - params.listener = item; - params.tool_tip = params.name; - params.container = this; - - return LLUICtrlFactory::create(params); -} - -LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item) -{ - LLConversationViewParticipant::Params params; - LLRect panel_rect = mConversationsListPanel->getRect(); - - params.name = item->getDisplayName(); - 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(); - params.folder_indentation = 42; - - return LLUICtrlFactory::create(params); -} - -bool LLIMFloaterContainer::enableModerateContextMenuItem(const std::string& userdata) -{ - // only group moderators can perform actions related to this "enable callback" - if (!isGroupModerator()) - { - return false; - } - - LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant()); - if (NULL == speakerp) - { - return false; - } - - bool voice_channel = speakerp->isInVoiceChannel(); - - if ("can_moderate_voice" == userdata) - { - return voice_channel; - } - else if ("can_mute" == userdata) - { - return voice_channel && !isMuted(getCurSelectedViewModelItem()->getUUID()); - } - else if ("can_unmute" == userdata) - { - return voice_channel && isMuted(getCurSelectedViewModelItem()->getUUID()); - } - - // The last invoke is used to check whether the "can_allow_text_chat" will enabled - return LLVoiceClient::getInstance()->isParticipantAvatar(getCurSelectedViewModelItem()->getUUID()); -} - -bool LLIMFloaterContainer::isGroupModerator() -{ - LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant(); - if (NULL == speaker_manager) - { - llwarns << "Speaker manager is missing" << llendl; - return false; - } - - // Is session a group call/chat? - if(gAgent.isInGroup(speaker_manager->getSessionID())) - { - LLSpeaker * speaker = speaker_manager->findSpeaker(gAgentID).get(); - - // Is agent a moderator? - return speaker && speaker->mIsModerator; - } - - return false; -} - -void LLIMFloaterContainer::moderateVoice(const std::string& command, const LLUUID& userID) -{ - if (!gAgent.getRegion()) return; - - if (command.compare("selected")) - { - moderateVoiceAllParticipants(command.compare("mute_all")); - } - else - { - moderateVoiceParticipant(userID, isMuted(userID)); - } -} - -bool LLIMFloaterContainer::isMuted(const LLUUID& avatar_id) -{ - const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant()); - return NULL == speakerp ? true : speakerp->mStatus == LLSpeaker::STATUS_MUTED; -} - -void LLIMFloaterContainer::moderateVoiceAllParticipants(bool unmute) -{ - LLIMSpeakerMgr * speaker_managerp = dynamic_cast(getSpeakerMgrForSelectedParticipant()); - - if (NULL != speaker_managerp) - { - if (!unmute) - { - LLSD payload; - payload["session_id"] = speaker_managerp->getSessionID(); - LLNotificationsUtil::add("ConfirmMuteAll", LLSD(), payload, confirmMuteAllCallback); - return; - } - - speaker_managerp->moderateVoiceAllParticipants(unmute); - } -} - -// static -void LLIMFloaterContainer::confirmMuteAllCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - // if Cancel pressed - if (option == 1) - { - return; - } - - const LLSD& payload = notification["payload"]; - const LLUUID& session_id = payload["session_id"]; - - LLIMSpeakerMgr * speaker_manager = dynamic_cast ( - LLIMModel::getInstance()->getSpeakerManager(session_id)); - if (speaker_manager) - { - speaker_manager->moderateVoiceAllParticipants(false); - } - - return; -} - -void LLIMFloaterContainer::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) -{ - LLIMSpeakerMgr * speaker_managerp = dynamic_cast(getSpeakerMgrForSelectedParticipant()); - - if (NULL != speaker_managerp) - { - speaker_managerp->moderateVoiceParticipant(avatar_id, unmute); - } -} - -LLSpeakerMgr * LLIMFloaterContainer::getSpeakerMgrForSelectedParticipant() -{ - LLFolderViewItem * selected_folder_itemp = mConversationsRoot->getCurSelectedItem(); - if (NULL == selected_folder_itemp) - { - llwarns << "Current selected item is null" << llendl; - return NULL; - } - - LLFolderViewFolder * conversation_itemp = selected_folder_itemp->getParentFolder(); - - conversations_widgets_map::const_iterator iter = mConversationsWidgets.begin(); - conversations_widgets_map::const_iterator end = mConversationsWidgets.end(); - const LLUUID * conversation_uuidp = NULL; - while(iter != end) - { - if (iter->second == conversation_itemp) - { - conversation_uuidp = &iter->first; - break; - } - ++iter; - } - if (NULL == conversation_uuidp) - { - llwarns << "Cannot find conversation item widget" << llendl; - return NULL; - } - - return conversation_uuidp->isNull() ? (LLSpeakerMgr *)LLLocalSpeakerMgr::getInstance() - : LLIMModel::getInstance()->getSpeakerManager(*conversation_uuidp); -} - -LLSpeaker * LLIMFloaterContainer::getSpeakerOfSelectedParticipant(LLSpeakerMgr * speaker_managerp) -{ - if (NULL == speaker_managerp) - { - llwarns << "Speaker manager is missing" << llendl; - return NULL; - } - - const LLConversationItem * participant_itemp = getCurSelectedViewModelItem(); - if (NULL == participant_itemp) - { - llwarns << "Cannot evaluate current selected view model item" << llendl; - return NULL; - } - - return speaker_managerp->findSpeaker(participant_itemp->getUUID()); -} - -void LLIMFloaterContainer::toggleAllowTextChat(const LLUUID& participant_uuid) -{ - LLIMSpeakerMgr * speaker_managerp = dynamic_cast(getSpeakerMgrForSelectedParticipant()); - if (NULL != speaker_managerp) - { - speaker_managerp->toggleAllowTextChat(participant_uuid); - } -} - -void LLIMFloaterContainer::openNearbyChat() -{ - // If there's only one conversation in the container and that conversation is the nearby chat - //(which it should be...), open it so to make the list of participants visible. This happens to be the most common case when opening the Chat floater. - if(mConversationsItems.size() == 1) - { - LLConversationViewSession* nearby_chat = dynamic_cast(mConversationsWidgets[LLUUID()]); - if (nearby_chat) - { - nearby_chat->setOpen(TRUE); - } - } -} - -void LLIMFloaterContainer::onNearbyChatClosed() -{ - // If nearby chat is the only remaining conversation and it is closed, close whole conversation floater as well - if (mConversationsItems.size() == 1) - closeFloater(); -} - -// EOF -- cgit v1.2.3