From 2d9285cddb4a48fb766b21fac2705c8873e15f93 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 16 Nov 2012 18:53:05 -0800 Subject: CHUI-529: Now the conversations floater will appear when the chat preference is set for friend, non-friend, conference, group and nearby chat. --- indra/newview/llfloaterimnearbychathandler.cpp | 50 ++++++---- indra/newview/llimview.cpp | 104 +++++++++++++-------- .../default/xui/en/panel_preferences_chat.xml | 20 ++++ 3 files changed, 116 insertions(+), 58 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index ab81b85d04..2d8a6d46fe 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -41,6 +41,7 @@ #include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance #include "llviewerwindow.h"//for screen channel position #include "llfloaterimnearbychat.h" +#include "llfloaterimcontainer.h" #include "llrootview.h" #include "lllayoutstack.h" @@ -283,12 +284,6 @@ bool LLFloaterIMNearbyChatScreenChannel::createPoolToast() void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { - //Ignore Nearby Toasts - if(gSavedSettings.getString("NotificationNearbyChatOptions") != "toast") - { - return; - } - //look in pool. if there is any message if(mStopProcessing) return; @@ -606,19 +601,36 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, toast_msg = chat_msg.mText; } - // Add a nearby chat toast. - LLUUID id; - id.generate(); - chat["id"] = id; - std::string r_color_name = "White"; - F32 r_color_alpha = 1.0f; - LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); - - chat["text_color"] = r_color_name; - chat["color_alpha"] = r_color_alpha; - chat["font_size"] = (S32)LLViewerChat::getChatFontSize() ; - chat["message"] = toast_msg; - channel->addChat(chat); + + //Will show toast when chat preference is set + if(gSavedSettings.getString("NotificationNearbyChatOptions") == "toast") + { + // Add a nearby chat toast. + LLUUID id; + id.generate(); + chat["id"] = id; + std::string r_color_name = "White"; + F32 r_color_alpha = 1.0f; + LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); + + chat["text_color"] = r_color_name; + chat["color_alpha"] = r_color_alpha; + chat["font_size"] = (S32)LLViewerChat::getChatFontSize() ; + chat["message"] = toast_msg; + channel->addChat(chat); + } + //Will show Conversations floater when chat preference is set + else if(gSavedSettings.getString("NotificationNearbyChatOptions") == "openconversations") + { + LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); + + if(floaterIMContainer) + { + floaterIMContainer->setVisible(TRUE); + floaterIMContainer->setFrontmost(TRUE); + } + } + } } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 818de4eaf4..106811b7e0 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -112,6 +112,55 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id, LLNotificationsUtil::add("IMToast", args, LLSD(), boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID())); } +//Will return true if the preference is allowed (user configures these preferences via 'Chat Preference' Dialog +bool ignoreNotification(const LLSD& msg, const char * preferenceString) +{ + //Get the session so we can find out the type of session + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + msg["session_id"]); + + const LLRelationship * relationship; + + // Skip system messages + if (msg["from_id"].asUUID() == LLUUID::null) + { + return true; + } + + //Ignore P2P Friend/Non-Friend Notification + if(session->isP2PSessionType()) + { + relationship = LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]); + + //Ignores non-friends + if(relationship == NULL + && (gSavedSettings.getString("NotificationNonFriendIMOptions") != preferenceString)) + { + return true; + } + //Ignores friends + else if(relationship + && gSavedSettings.getString("NotificationFriendIMOptions") != preferenceString) + { + return true; + } + } + //Ignore Ad Hoc Notification + else if(session->isAdHocSessionType() + && (gSavedSettings.getString("NotificationConferenceIMOptions") != preferenceString)) + { + return true; + } + //Ignore Group Notification + else if(session->isGroupSessionType() + && (gSavedSettings.getString("NotificationGroupChatOptions") != preferenceString)) + { + return true; + } + + return false; +} + void toast_callback(const LLSD& msg){ // do not show toast in do not disturb mode or it goes from agent if (gAgent.isDoNotDisturb() || gAgent.getID() == msg["from_id"]) @@ -133,55 +182,32 @@ void toast_callback(const LLSD& msg){ return; } - // Skip toasting for system messages - if (msg["from_id"].asUUID() == LLUUID::null) - { - return; - } - - // *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - msg["session_id"]); - - - //Ignore P2P Friend/Non-Friend toasts - if(session->isP2PSessionType()) - { - //Ignores non-friends - if((LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL) - && (gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast")) - { - return; - } - //Ignores friends - else if(gSavedSettings.getString("NotificationFriendIMOptions") != "toast") - { - return; - } - } - //Ignore Ad Hoc Toasts - else if(session->isAdHocSessionType() - && (gSavedSettings.getString("NotificationConferenceIMOptions") != "toast")) + //Show toast + if(ignoreNotification(msg, "toast") == false) { - return; + LLAvatarNameCache::get(msg["from_id"].asUUID(), + boost::bind(&on_avatar_name_cache_toast, + _1, _2, msg)); } - //Ignore Group Toasts - else if(session->isGroupSessionType() - && (gSavedSettings.getString("NotificationGroupChatOptions") != "toast")) +} + +void open_conversations_callback(const LLSD& msg) +{ + LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); + + if(floaterIMContainer + && ignoreNotification(msg, "openconversations") == false) { - return; + floaterIMContainer->setVisible(TRUE); + floaterIMContainer->setFrontmost(TRUE); } - - //Show toast - LLAvatarNameCache::get(msg["from_id"].asUUID(), - boost::bind(&on_avatar_name_cache_toast, - _1, _2, msg)); } LLIMModel::LLIMModel() { addNewMsgCallback(boost::bind(&LLFloaterIMSession::newIMCallback, _1)); addNewMsgCallback(boost::bind(&toast_callback, _1)); + addNewMsgCallback(boost::bind(&open_conversations_callback, _1)); } LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 712e8bff7f..0c94b6b223 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -134,6 +134,10 @@ top_delta="-6" name="FriendIMOptions" width="223"> + + + + + Date: Mon, 26 Nov 2012 12:24:11 +0200 Subject: CHUI-542 (Torn off message in conversation panel is not cleared when torn off conversation is closed) --- indra/newview/llfloaterimcontainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 304fb78260..d4b552deae 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1353,10 +1353,12 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c setFocus(TRUE); if(new_selection != NULL) { + if (mConversationsWidgets.size() == 1) + new_selection = new_selection->getParentFolder(); LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); if(vmi != NULL) { - selectConversation(vmi->getUUID()); + selectConversationPair(vmi->getUUID(), true); } } } -- cgit v1.2.3 From 4105ae946707947e469793364e07adde7993cffe Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 26 Nov 2012 19:12:04 -0800 Subject: CHUI-529: Post code review changes. When showing a floater using LLFloater::showInstance() instead of setVisibleAndFrontmost(). Also made setVisibleAndFrontmost() public since both setVisible and setFrontmost are public functions. --- indra/newview/llfloaterimnearbychathandler.cpp | 8 +------- indra/newview/llimview.cpp | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 2d8a6d46fe..d9c461e836 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -622,13 +622,7 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, //Will show Conversations floater when chat preference is set else if(gSavedSettings.getString("NotificationNearbyChatOptions") == "openconversations") { - LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); - - if(floaterIMContainer) - { - floaterIMContainer->setVisible(TRUE); - floaterIMContainer->setFrontmost(TRUE); - } + LLFloaterReg::showInstance("im_container"); } } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index fc6be2cd97..581043a3d0 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -191,13 +191,7 @@ void on_new_message(const LLSD& msg) } else if("openconversations" == action) { - LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); - - if(floaterIMContainer) - { - floaterIMContainer->setVisible(TRUE); - floaterIMContainer->setFrontmost(TRUE); - } + LLFloaterReg::showInstance("im_container"); } } -- cgit v1.2.3 From d9ad20055330e0911a553af284359a5cf5711b7b Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Tue, 27 Nov 2012 17:55:50 +0200 Subject: CHUI-544 (Legacy name shows in conversation list for user that answers a voice call) --- indra/newview/llavataractions.cpp | 2 +- indra/newview/llvoicevivox.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index f5d8998ce5..1969a0bc5f 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -215,7 +215,7 @@ void LLAvatarActions::endIM(const LLUUID& id) static void on_avatar_name_cache_start_call(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string name = av_name.getCompleteName(); + std::string name = av_name.mDisplayName; LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true); if (session_id != LLUUID::null) { diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 3a26f14772..37491e5b58 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6200,10 +6200,8 @@ void LLVivoxVoiceClient::lookupName(const LLUUID &id) void LLVivoxVoiceClient::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - // For Vivox, we use the legacy name because I'm uncertain whether or - // not their service can tolerate switching to Username or Display Name - std::string legacy_name = av_name.getLegacyName(); - avatarNameResolved(agent_id, legacy_name); + std::string display_name = av_name.mDisplayName; + avatarNameResolved(agent_id, display_name); } void LLVivoxVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name) -- cgit v1.2.3 From 80f8a465eb2885246b0a1daca66077ecd1dcc61d Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 28 Nov 2012 11:35:59 -0800 Subject: CHUI-548: Now a p2p conversation is aligned with the nearby chat arrow. Just had to check for a p2p conversation type and then adjust then decrease the indentation. Also made LLFolderViewItem::drawOpenFolderArrow() a non-virtual function and adjusted code accordingly. --- indra/newview/llconversationview.cpp | 27 ++++++++++++--------------- indra/newview/llconversationview.h | 3 +-- indra/newview/llfloaterimcontainer.cpp | 6 ++++++ 3 files changed, 19 insertions(+), 17 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index e40d57c318..3aadc2986f 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -80,7 +80,8 @@ LLConversationViewSession::LLConversationViewSession(const LLConversationViewSes mSessionTitle(NULL), mSpeakingIndicator(NULL), mVoiceClientObserver(NULL), - mMinimizedMode(false) + mMinimizedMode(false), + mHasArrow(true) { mFlashTimer = new LLFlashTimer(); } @@ -135,6 +136,7 @@ BOOL LLConversationViewSession::postBuild() icon->setVisible(true); icon->setValue(session->mOtherParticipantID); mSpeakingIndicator->setSpeakerId(gAgentID, session->mSessionID, true); + mHasArrow = false; } break; } @@ -183,11 +185,10 @@ void LLConversationViewSession::draw() const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); // we don't draw the open folder arrow in minimized mode - if (!mMinimizedMode) + if (mHasArrow && !mMinimizedMode) { // update the rotation angle of open folder arrow updateLabelRotation(); - drawOpenFolderArrow(default_params, sFgColor); } @@ -227,14 +228,18 @@ BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask ) // virtual S32 LLConversationViewSession::arrange(S32* width, S32* height) { - S32 h_pad = getIndentation() + mArrowSize; + //LLFolderViewFolder::arrange computes value for getIndentation() function below + S32 arranged = LLFolderViewFolder::arrange(width, height); + + S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation(); + LLRect rect(mMinimizedMode ? getLocalRect().mLeft : h_pad, getLocalRect().mTop, getLocalRect().mRight, getLocalRect().mTop - getItemHeight()); mItemPanel->setShape(rect); - return LLFolderViewFolder::arrange(width, height); + return arranged; } // virtual @@ -262,7 +267,8 @@ void LLConversationViewSession::toggleMinimizedMode(bool is_minimized) // except for the icon which we display in minimized mode getChild("conversation_item_stack")->setVisible(!mMinimizedMode); - S32 h_pad = getIndentation() + mArrowSize; + S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation(); + mItemPanel->translate(mMinimizedMode ? -h_pad : h_pad, 0); } @@ -340,15 +346,6 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi } } -void LLConversationViewSession::drawOpenFolderArrow(const LLFolderViewItem::Params& default_params, const LLUIColor& fg_color) -{ - LLConversationItem * itemp = dynamic_cast(getViewModelItem()); - if (itemp && itemp->getType() != LLConversationItem::CONV_SESSION_1_ON_1) - { - LLFolderViewFolder::drawOpenFolderArrow(default_params, fg_color); - } -} - // // Implementation of conversations list participant (avatar) widgets // diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index acd7128b7d..c6cb502355 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -74,8 +74,6 @@ public: /*virtual*/ bool isMinimized() { return mMinimizedMode; } - /*virtual*/ void drawOpenFolderArrow(const LLFolderViewItem::Params& default_params, const LLUIColor& fg_color); - void toggleMinimizedMode(bool is_minimized); void setVisibleIfDetached(BOOL visible); @@ -98,6 +96,7 @@ private: LLFlashTimer* mFlashTimer; bool mMinimizedMode; + bool mHasArrow; LLVoiceClientStatusObserver* mVoiceClientObserver; diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 016a7723b6..5fbbfd1283 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1383,6 +1383,12 @@ LLConversationViewSession* LLFloaterIMContainer::createConversationItemWidget(LL params.tool_tip = params.name; params.container = this; + //Indentation for aligning the p2p converstation image with the nearby chat arrow + if(item->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + { + params.folder_indentation = 3; + } + return LLUICtrlFactory::create(params); } -- cgit v1.2.3 From 45e8926f138a2b42c5054149d3a9f6f39df29247 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 28 Nov 2012 13:48:55 -0800 Subject: code cleanup: variables and functions were using the word 'minimized' to refer 'collapsed'. Renamed variables and functions to use the word 'collapsed' instead of 'minimized'. --- indra/newview/llconversationview.cpp | 16 ++++++++-------- indra/newview/llconversationview.h | 6 +++--- indra/newview/llfloaterimcontainer.cpp | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 3aadc2986f..1b1d61e6d6 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -80,7 +80,7 @@ LLConversationViewSession::LLConversationViewSession(const LLConversationViewSes mSessionTitle(NULL), mSpeakingIndicator(NULL), mVoiceClientObserver(NULL), - mMinimizedMode(false), + mCollapsedMode(false), mHasArrow(true) { mFlashTimer = new LLFlashTimer(); @@ -185,7 +185,7 @@ void LLConversationViewSession::draw() const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); // we don't draw the open folder arrow in minimized mode - if (mHasArrow && !mMinimizedMode) + if (mHasArrow && !mCollapsedMode) { // update the rotation angle of open folder arrow updateLabelRotation(); @@ -233,7 +233,7 @@ S32 LLConversationViewSession::arrange(S32* width, S32* height) S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation(); - LLRect rect(mMinimizedMode ? getLocalRect().mLeft : h_pad, + LLRect rect(mCollapsedMode ? getLocalRect().mLeft : h_pad, getLocalRect().mTop, getLocalRect().mRight, getLocalRect().mTop - getItemHeight()); @@ -246,7 +246,7 @@ S32 LLConversationViewSession::arrange(S32* width, S32* height) void LLConversationViewSession::toggleOpen() { // conversations should not be opened while in minimized mode - if (!mMinimizedMode) + if (!mCollapsedMode) { LLFolderViewFolder::toggleOpen(); @@ -259,17 +259,17 @@ void LLConversationViewSession::toggleOpen() } } -void LLConversationViewSession::toggleMinimizedMode(bool is_minimized) +void LLConversationViewSession::toggleCollapsedMode(bool is_collapsed) { - mMinimizedMode = is_minimized; + mCollapsedMode = is_collapsed; // hide the layout stack which contains all item's child widgets // except for the icon which we display in minimized mode - getChild("conversation_item_stack")->setVisible(!mMinimizedMode); + getChild("conversation_item_stack")->setVisible(!mCollapsedMode); S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation(); - mItemPanel->translate(mMinimizedMode ? -h_pad : h_pad, 0); + mItemPanel->translate(mCollapsedMode ? -h_pad : h_pad, 0); } void LLConversationViewSession::setVisibleIfDetached(BOOL visible) diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index c6cb502355..a6f408403b 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -72,9 +72,9 @@ public: /*virtual*/ void toggleOpen(); - /*virtual*/ bool isMinimized() { return mMinimizedMode; } + /*virtual*/ bool isCollapsed() { return mCollapsedMode; } - void toggleMinimizedMode(bool is_minimized); + void toggleCollapsedMode(bool is_collapsed); void setVisibleIfDetached(BOOL visible); LLConversationViewParticipant* findParticipant(const LLUUID& participant_id); @@ -95,7 +95,7 @@ private: LLOutputMonitorCtrl* mSpeakingIndicator; LLFlashTimer* mFlashTimer; - bool mMinimizedMode; + bool mCollapsedMode; bool mHasArrow; LLVoiceClientStatusObserver* mVoiceClientObserver; diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 5fbbfd1283..a04b8d79d6 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -640,7 +640,7 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse) LLConversationViewSession* widget = dynamic_cast(widget_it->second); if (widget) { - widget->toggleMinimizedMode(collapse); + widget->toggleCollapsedMode(collapse); // force closing all open conversations when collapsing to minimized state if (collapse) @@ -1320,7 +1320,7 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& } // set the widget to minimized mode if conversations pane is collapsed - widget->toggleMinimizedMode(mConversationsPane->isCollapsed()); + widget->toggleCollapsedMode(mConversationsPane->isCollapsed()); if (isWidgetSelected) { -- cgit v1.2.3