diff options
| author | Merov Linden <merov@lindenlab.com> | 2012-06-11 22:12:43 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2012-06-11 22:12:43 -0700 | 
| commit | 0e2f5c2ebad0a19e9c5e151a4ac3ae7321f2f296 (patch) | |
| tree | 7c51dcea610c462cc1a6cd96c2447c84faf64a32 /indra/newview | |
| parent | db67c21f901800d27c9dd2ea2ce6134dc3bd33f1 (diff) | |
CHUI-137 : Implemented tear off and close of conversation in the list
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 56 | ||||
| -rw-r--r-- | indra/newview/llimfloatercontainer.h | 8 | 
2 files changed, 41 insertions, 23 deletions
| 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 diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index afb65671ae..3df5a07df8 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -47,8 +47,8 @@ class LLTabContainer;  class LLConversationItem;  class LLIMFloaterContainer; -typedef std::list<LLConversationItem*> conversations_items_list_t; -typedef std::list<LLFolderViewItem*> conversations_widgets_list_t; +typedef std::map<LLUUID, LLConversationItem*> conversations_items_map; +typedef std::map<LLUUID, LLFolderViewItem*> conversations_widgets_map;  // Conversation items: we hold a list of those and create an LLFolderViewItem widget for each that we tuck   // into the mConversationsListPanel.  @@ -166,8 +166,8 @@ private:  	// CHUI-137 : Data  	LLPanel* mConversationsListPanel;	// The widget we add list item to (title of each conversation) -	conversations_items_list_t mConversationsItems; -	conversations_widgets_list_t mConversationsWidgets; +	conversations_items_map mConversationsItems; +	conversations_widgets_map mConversationsWidgets;  };  #endif // LL_LLIMFLOATERCONTAINER_H | 
