diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llmultifloater.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 124 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 6 |
4 files changed, 91 insertions, 51 deletions
diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 540ac74aee..6f0e691f10 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -173,7 +173,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, else if (floaterp->getHost()) { // floaterp is hosted by somebody else and - // this is adding it, so remove it from it's old host + // this is adding it, so remove it from its old host floaterp->getHost()->removeFloater(floaterp); } else if (floaterp->getParent() == gFloaterView) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index dde7d248dd..882637151d 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -140,6 +140,16 @@ void LLIMFloater::onClose(bool app_quitting) // Last change: // EXT-3516 X Button should end IM session, _ button should hide gIMMgr->leaveSession(mSessionID); + + // Suppress the IM from the conversations list + if (LLIMConversation::isChatMultiTab()) + { + LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); + if (im_box) + { + im_box->removeConversationListItem(mSessionID); + } + } } /* static */ diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 8493a0e7b8..10188febab 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -128,24 +128,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<LLView>("contents_view"); @@ -183,35 +167,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 @@ -398,6 +353,69 @@ 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))); + } + + // 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; +} + LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLFolderViewItem::Params params; @@ -430,8 +448,16 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF // Virtual action callbacks void LLConversationItem::selectItem(void) { - // 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) diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index b5b60615b3..10268a5d79 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -142,7 +142,6 @@ public: void collapseMessagesPane(bool collapse); - LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); private: typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t; @@ -168,6 +167,11 @@ private: LLLayoutStack* mConversationsStack; // CHUI-137 : Temporary implementation of conversations list +public: + void removeConversationListItem(const LLUUID& session_id); +private: + void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp); + LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); // Conversation list data LLPanel* mConversationsListPanel; // This is the widget we add items to (i.e. clickable title for each conversation) conversations_items_map mConversationsItems; |