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/llui/llmultifloater.h | 4 +-- indra/newview/llimconversation.cpp | 6 +++- indra/newview/llimfloatercontainer.cpp | 51 ++++++++++++++++++++++++++++++++-- indra/newview/llimfloatercontainer.h | 6 ++++ 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index f299ae5dd3..44514a6246 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -45,8 +45,8 @@ public: virtual BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void draw(); - /*virtual*/ void setVisible(BOOL visible); + virtual void draw(); + virtual void setVisible(BOOL visible); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index bbbc9fcffd..cbebf3edd3 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -106,6 +106,10 @@ BOOL LLIMConversation::postBuild() if (isChatMultiTab()) { + if (mIsNearbyChat) + { + setCanClose(FALSE); + } return LLFloater::postBuild(); } else @@ -246,7 +250,7 @@ void LLIMConversation::updateHeaderAndToolbar() mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); - mCloseBtn->setVisible(is_hosted); + mCloseBtn->setVisible(is_hosted && !mIsNearbyChat); enableDisableCallBtn(); 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) { } diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 3d1324c2fb..c6e7c6a3d9 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -97,6 +97,8 @@ public: virtual void previewItem( void ); virtual void selectItem(void); virtual void showProperties(void); + + void setVisibleIfDetached(BOOL visible); // This method should be called when a drag begins. // Returns TRUE if the drag can begin, FALSE otherwise. @@ -128,6 +130,8 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void draw(); + /*virtual*/ void setVisible(BOOL visible); void onCloseFloater(LLUUID& id); /*virtual*/ void addFloater(LLFloater* floaterp, @@ -135,6 +139,8 @@ public: LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); /*virtual*/ void removeFloater(LLFloater* floaterp); + /*virtual*/ void tabClose(); + static LLFloater* getCurrentVoiceFloater(); static LLIMFloaterContainer* findInstance(); -- cgit v1.2.3