diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-12-06 15:52:55 -0800 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-12-06 15:52:55 -0800 |
commit | 218cbebbd8bdbfadc954731ee54f6472ed847139 (patch) | |
tree | 3720ffaf8a0524e5aecf9fa6cf34d6e36dce4c07 | |
parent | ffe80818064572a19b52d4f39f0e14538f701275 (diff) |
CHUI-579: When the 'Pop up message' preference is set the conversation line item and/or FUI button flash depending on what is focused. Also when the 'Flash the toolbar button' preference is set the FUI button will flash or the line item will flash depending upon what is focused.
-rw-r--r-- | indra/newview/llimview.cpp | 65 |
1 files changed, 40 insertions, 25 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 821e62c4e6..1a2632f921 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -155,57 +155,72 @@ void on_new_message(const LLSD& msg) // execution of the action + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); + + bool sessionFloaterInActive = session_floater + && (!session_floater->isInVisibleChain()) //conversation floater not displayed + || + (session_floater->isInVisibleChain() && session_floater->hasFocus() == false); //conversation floater is displayed but doesn't have focus + if ("toast" == action) { // Skip toasting if we have open window of IM with this session id - LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(session_id); if ( - open_im_floater - && open_im_floater->isInVisibleChain() - && open_im_floater->hasFocus() - && !open_im_floater->isMinimized() - && !(open_im_floater->getHost() - && open_im_floater->getHost()->isMinimized()) + session_floater + && session_floater->isInVisibleChain() + && session_floater->hasFocus() + && !session_floater->isMinimized() + && !(session_floater->getHost() + && session_floater->getHost()->isMinimized()) ) { return; } // Skip toasting for system messages and for nearby chat - if (participant_id.isNull() || session_id.isNull()) + if (participant_id.isNull()) { return; } - //Show toast - LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + //Show IM toasts (upper right toasts) + if(session_id.notNull()) + { + LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + } + + //Session floater has focus, so don't need to show notification flashes + if(sessionFloaterInActive) + { + //Flash converstation line item anytime that conversation doesn't have focus + im_box->flashConversationItemWidget(session_id, true); + + //Only flash the 'Chat' FUI button when the conversation floater isn't focused (implies not front most floater) + if(!im_box->hasFocus()) + { + gToolBarView->flashCommand(LLCommandId("chat"), true); + } + } } else if ("flash" == action) { - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); - if (im_box) + if(sessionFloaterInActive && !im_box->hasFocus()) + { + gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat" + } + else if(sessionFloaterInActive) { im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item } - gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat" } else if("openconversations" == action) { - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); - LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); - //Don't flash and show conversation floater when conversation already active (has focus) - if(session_floater - && (!session_floater->isInVisibleChain()) //conversation floater not displayed - || - (session_floater->isInVisibleChain() && session_floater->hasFocus() == false)) //conversation floater is displayed but doesn't have focus - + if(sessionFloaterInActive) { //Flash line item - if (im_box) - { - im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item - } + im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item //Surface conversations floater LLFloaterReg::showInstance("im_container"); |