From 25855962a86331a337c4baff2754c63850605aea Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 6 Aug 2012 18:07:56 -0700 Subject: CHUI-98 : Isolate LLConversationItem and LLConversationViewModel in their own file --- indra/newview/llconversationmodel.cpp | 106 ++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 indra/newview/llconversationmodel.cpp (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp new file mode 100644 index 0000000000..bd314588a0 --- /dev/null +++ b/indra/newview/llconversationmodel.cpp @@ -0,0 +1,106 @@ +/** + * @file llconversationmodel.cpp + * @brief Implementation of conversations list + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llconversationmodel.h" +#include "llimfloatercontainer.h" + +// Conversation items +LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) : + LLFolderViewModelItemCommon(containerp->getRootViewModel()), + mName(name), + mUUID(uuid), + mFloater(floaterp), + mContainer(containerp) +{ +} + +LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : + LLFolderViewModelItemCommon(containerp->getRootViewModel()), + mName(""), + mUUID(), + mFloater(NULL), + mContainer(NULL) +{ +} + + +// Virtual action callbacks +void LLConversationItem::selectItem(void) +{ + 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::setVisibleIfDetached(BOOL visible) +{ + // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized + // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here + if (!mFloater->getHost() && !mFloater->isMinimized()) + { + mFloater->setVisible(visible); + } +} + +void LLConversationItem::performAction(LLInventoryModel* model, std::string action) +{ +} + +void LLConversationItem::openItem( void ) +{ +} + +void LLConversationItem::closeItem( void ) +{ +} + +void LLConversationItem::previewItem( void ) +{ +} + +void LLConversationItem::showProperties(void) +{ +} + +bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const +{ + // We compare only by name for the moment + // *TODO : Implement the sorting by date + S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + return (compare < 0); +} + +// EOF -- cgit v1.2.3 From 6cf49a4a715c9f498d4b063f8d74e295be1f418c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 9 Aug 2012 16:48:33 +0300 Subject: CHUI-171 WIP (Conversation not automatically readded to conversation window listing when open) - removal of the dependence between items of the conversations list and conversation's floaters. --- indra/newview/llconversationmodel.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index bd314588a0..0c23e2654e 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,14 +28,14 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llimconversation.h" #include "llimfloatercontainer.h" // Conversation items -LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) : +LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp) : LLFolderViewModelItemCommon(containerp->getRootViewModel()), - mName(name), + mName(display_name), mUUID(uuid), - mFloater(floaterp), mContainer(containerp) { } @@ -44,7 +44,6 @@ LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : LLFolderViewModelItemCommon(containerp->getRootViewModel()), mName(""), mUUID(), - mFloater(NULL), mContainer(NULL) { } @@ -53,25 +52,30 @@ LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : // Virtual action callbacks void LLConversationItem::selectItem(void) { - LLMultiFloater* host_floater = mFloater->getHost(); + LLFloater* session_floater = LLIMConversation::getConversation(mUUID); + LLMultiFloater* host_floater = session_floater->getHost(); + +// LLIMFloater::show(mUUID); 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); + mContainer->selectFloater(session_floater); } // Set the focus on the selected floater - mFloater->setFocus(TRUE); + session_floater->setFocus(TRUE); } void LLConversationItem::setVisibleIfDetached(BOOL visible) { // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here - if (!mFloater->getHost() && !mFloater->isMinimized()) + LLFloater* session_floater = LLIMConversation::getConversation(mUUID); + + if (session_floater && !session_floater->getHost() && !session_floater->isMinimized()) { - mFloater->setVisible(visible); + session_floater->setVisible(visible); } } -- cgit v1.2.3 From 2cf5307c9211b813689f0e441b9f56bc21f63348 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 22 Aug 2012 19:29:22 -0700 Subject: CHUI-282 : WIP : Isolated llconversationview classes and suppressed the dependency of model to widgets --- indra/newview/llconversationmodel.cpp | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0c23e2654e..923bc7a3a1 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -32,41 +32,22 @@ #include "llimfloatercontainer.h" // Conversation items -LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp) : - LLFolderViewModelItemCommon(containerp->getRootViewModel()), +LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : + LLFolderViewModelItemCommon(root_view_model), mName(display_name), - mUUID(uuid), - mContainer(containerp) + mUUID(uuid) { } -LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : - LLFolderViewModelItemCommon(containerp->getRootViewModel()), +LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : + LLFolderViewModelItemCommon(root_view_model), mName(""), - mUUID(), - mContainer(NULL) + mUUID() { } // Virtual action callbacks -void LLConversationItem::selectItem(void) -{ - LLFloater* session_floater = LLIMConversation::getConversation(mUUID); - LLMultiFloater* host_floater = session_floater->getHost(); - -// LLIMFloater::show(mUUID); - 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(session_floater); - } - // Set the focus on the selected floater - session_floater->setFocus(TRUE); -} - void LLConversationItem::setVisibleIfDetached(BOOL visible) { // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized -- cgit v1.2.3 From 679d0f78f9a4a83e5eb2ec857ceb2d9b8c6f4d91 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 22 Aug 2012 23:14:01 -0700 Subject: CHUI-282 : WIP, Clean up dependencies --- indra/newview/llconversationmodel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 923bc7a3a1..42ed7603d1 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -29,7 +29,6 @@ #include "llconversationmodel.h" #include "llimconversation.h" -#include "llimfloatercontainer.h" // Conversation items LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : -- cgit v1.2.3 From 4ea73df484d22815026367771f9d728d755f6274 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 23 Aug 2012 11:32:20 -0700 Subject: CHUI-282 : WIP : Further separate view from model for llconversation items --- indra/newview/llconversationmodel.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 42ed7603d1..832dc3c3e4 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,7 +28,6 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" -#include "llimconversation.h" // Conversation items LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : @@ -45,20 +44,7 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod { } - // Virtual action callbacks -void LLConversationItem::setVisibleIfDetached(BOOL visible) -{ - // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized - // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here - LLFloater* session_floater = LLIMConversation::getConversation(mUUID); - - if (session_floater && !session_floater->getHost() && !session_floater->isMinimized()) - { - session_floater->setVisible(visible); - } -} - void LLConversationItem::performAction(LLInventoryModel* model, std::string action) { } -- cgit v1.2.3 From e537d6477dfa1eea86dc16c767b793fb530d1ebc Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 23 Aug 2012 19:44:10 -0700 Subject: CHUI-98 : Defining the various llconversation sub classes in their respective file --- indra/newview/llconversationmodel.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 832dc3c3e4..f54e6d2d48 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -29,7 +29,10 @@ #include "llconversationmodel.h" -// Conversation items +// +// Conversation items : common behaviors +// + LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(display_name), @@ -73,4 +76,32 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL return (compare < 0); } +// +// LLConversationItemSession +// + +LLConversationItemSession::LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : + LLConversationItem(display_name,uuid,root_view_model) +{ +} + +LLConversationItemSession::LLConversationItemSession(LLFolderViewModelInterface& root_view_model) : + LLConversationItem(root_view_model) +{ +} + +// +// LLConversationItemParticipant +// + +LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : + LLConversationItem(display_name,uuid,root_view_model) +{ +} + +LLConversationItemParticipant::LLConversationItemParticipant(LLFolderViewModelInterface& root_view_model) : + LLConversationItem(root_view_model) +{ +} + // EOF -- cgit v1.2.3 From fd62242dd6e5fa464db07e0b8ebf3ab54a6067a2 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 24 Aug 2012 17:31:12 -0700 Subject: CHUI-280 : Make LLParticipantList derives from LLConversationItemSession --- indra/newview/llconversationmodel.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index f54e6d2d48..a5c0244bd4 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -40,6 +40,13 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u { } +LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : + LLFolderViewModelItemCommon(root_view_model), + mName(""), + mUUID(uuid) +{ +} + LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), @@ -85,8 +92,8 @@ LLConversationItemSession::LLConversationItemSession(std::string display_name, c { } -LLConversationItemSession::LLConversationItemSession(LLFolderViewModelInterface& root_view_model) : - LLConversationItem(root_view_model) +LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : + LLConversationItem(uuid,root_view_model) { } @@ -99,8 +106,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display { } -LLConversationItemParticipant::LLConversationItemParticipant(LLFolderViewModelInterface& root_view_model) : - LLConversationItem(root_view_model) +LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : + LLConversationItem(uuid,root_view_model) { } -- cgit v1.2.3 From c4638d1dca7f3292d7ce48ddb2f5598f86282c88 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 28 Aug 2012 19:09:57 -0700 Subject: CHUI-280 : WIP : Implement update of LLConversationModel in LLParticipantList --- indra/newview/llconversationmodel.cpp | 47 +++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a5c0244bd4..9b353809db 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -88,7 +88,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL // LLConversationItemSession::LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(display_name,uuid,root_view_model) + LLConversationItem(display_name,uuid,root_view_model), + mIsLoaded(false) { } @@ -97,12 +98,54 @@ LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolde { } +void LLConversationItemSession::addParticipant(LLConversationItemParticipant* item) +{ + addChild(item); + mIsLoaded = true; +} + +void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* item) +{ + removeChild(item); +} + +void LLConversationItemSession::clearParticipants() +{ + clearChildren(); + mIsLoaded = false; +} + +LLConversationItemParticipant* LLConversationItemSession::findParticipant(const LLUUID& participant_id) +{ + // This is *not* a general tree parsing algorithm. It assumes that a session contains only + // items (LLConversationItemParticipant) that have themselve no children. + LLConversationItemParticipant* participant = NULL; + child_list_t::iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + if (participant->hasSameValue(participant_id)) + { + break; + } + } + return (iter == mChildren.end() ? NULL : participant); +} + +void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + participant->setIsMuted(is_muted); +} + // // LLConversationItemParticipant // LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(display_name,uuid,root_view_model) + LLConversationItem(display_name,uuid,root_view_model), + mIsMuted(false), + mIsModerator(false) { } -- cgit v1.2.3 From ad070b9155e2fddfc746319003253248ceb0eba3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 28 Aug 2012 23:13:10 -0700 Subject: CHUI-280 : Implement all LLConversationModel updates in LLParticipantList. Allow mAvatarList to be NULL. --- indra/newview/llconversationmodel.cpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 9b353809db..dbf5ac6e03 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -98,15 +98,24 @@ LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolde { } -void LLConversationItemSession::addParticipant(LLConversationItemParticipant* item) +void LLConversationItemSession::addParticipant(LLConversationItemParticipant* participant) { - addChild(item); + addChild(participant); mIsLoaded = true; } -void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* item) +void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { - removeChild(item); + removeChild(participant); +} + +void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + removeParticipant(participant); + } } void LLConversationItemSession::clearParticipants() @@ -135,7 +144,19 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted) { LLConversationItemParticipant* participant = findParticipant(participant_id); - participant->setIsMuted(is_muted); + if (participant) + { + participant->setIsMuted(is_muted); + } +} + +void LLConversationItemSession::setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + participant->setIsModerator(is_moderator); + } } // -- cgit v1.2.3 From ca7abc4c3be9310f4e5fec00b7d6ffadaba58ff0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 29 Aug 2012 10:07:55 -0700 Subject: CHUI-280 : Add print out debug methods --- indra/newview/llconversationmodel.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index dbf5ac6e03..d7f9093a4a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -159,6 +159,18 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +void LLConversationItemSession::dumpDebugData() +{ + llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; + LLConversationItemParticipant* participant = NULL; + child_list_t::iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + participant->dumpDebugData(); + } +} + // // LLConversationItemParticipant // @@ -175,4 +187,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, { } +void LLConversationItemParticipant::dumpDebugData() +{ + llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; +} // EOF -- cgit v1.2.3 From 8cd5d361600f34a0a7fa504a721bea3301191644 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 4 Sep 2012 22:11:28 -0700 Subject: CHUI-285 : Create participant widgets in the conversation list --- indra/newview/llconversationmodel.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index d7f9093a4a..aa21b08ec8 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -36,21 +36,24 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(display_name), - mUUID(uuid) + mUUID(uuid), + mNeedsRefresh(true) { } LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUUID(uuid) + mUUID(uuid), + mNeedsRefresh(true) { } LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUUID() + mUUID(), + mNeedsRefresh(true) { } @@ -102,11 +105,13 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa { addChild(participant); mIsLoaded = true; + mNeedsRefresh = true; } void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { removeChild(participant); + mNeedsRefresh = true; } void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) @@ -122,6 +127,7 @@ void LLConversationItemSession::clearParticipants() { clearChildren(); mIsLoaded = false; + mNeedsRefresh = true; } LLConversationItemParticipant* LLConversationItemSession::findParticipant(const LLUUID& participant_id) -- cgit v1.2.3 From ee5e689331ff6ba44cebaf9e9fb48f7bc3f590c4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 6 Sep 2012 16:32:17 -0700 Subject: CHUI-285 : Completed. Update the names of the participants. --- indra/newview/llconversationmodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index aa21b08ec8..fa49987d15 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -193,6 +193,14 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, { } +void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) +{ + mName = av_name.mDisplayName; + // *TODO : we should also store that one, to be used in the tooltip : av_name.mUsername + // *TODO : we need to request or initiate a list resort + mNeedsRefresh = true; +} + void LLConversationItemParticipant::dumpDebugData() { llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; -- cgit v1.2.3 From c26867bb6d1226c82c11f2f386f73b6d8e3ed749 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Sep 2012 19:53:38 -0700 Subject: CHUI-285 : Implement sort, alphabetical only for the moment --- indra/newview/llconversationmodel.cpp | 38 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index fa49987d15..e810bac1d9 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -78,14 +78,6 @@ void LLConversationItem::showProperties(void) { } -bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const -{ - // We compare only by name for the moment - // *TODO : Implement the sorting by date - S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); - return (compare < 0); -} - // // LLConversationItemSession // @@ -197,12 +189,38 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam { mName = av_name.mDisplayName; // *TODO : we should also store that one, to be used in the tooltip : av_name.mUsername - // *TODO : we need to request or initiate a list resort mNeedsRefresh = true; + if (mParent) + { + mParent->requestSort(); + } } void LLConversationItemParticipant::dumpDebugData() { llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; -} +} + +// +// LLConversationSort +// + +bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const +{ + // For the moment, we sort only by name + // *TODO : Implement the sorting by date as well (most recent first) + // *TODO : Check the type of item (session/participants) as order should be different for both (eventually) + S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + return (compare < 0); +} + +// +// LLConversationViewModel +// + +void LLConversationViewModel::sort(LLFolderViewFolder* folder) +{ + base_t::sort(folder); +} + // EOF -- cgit v1.2.3 From 4b52515b543546844835064dfb89e5af2bbbd948 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 13 Sep 2012 20:10:45 +0300 Subject: CHUI-282 WIP Fixed conversation list items selection. Fixed displaying session participants only when session item is open. --- indra/newview/llconversationmodel.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index fa49987d15..51a37fe856 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -101,6 +101,11 @@ LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolde { } +bool LLConversationItemSession::hasChildren() const +{ + return getChildrenCount() > 0; +} + void LLConversationItemSession::addParticipant(LLConversationItemParticipant* participant) { addChild(participant); -- cgit v1.2.3 From d22c8510b19f12e81dc68562de45c2c364036440 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 17 Sep 2012 17:53:17 -0700 Subject: CHUI-340 : WIP : Sorting implemented. Type and name work. Date and distance still need the relevant values to be computed. --- indra/newview/llconversationmodel.cpp | 70 +++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 7 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index c36c3cbc65..612744c3e9 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -37,7 +37,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u LLFolderViewModelItemCommon(root_view_model), mName(display_name), mUUID(uuid), - mNeedsRefresh(true) + mNeedsRefresh(true), + mConvType(CONV_UNKNOWN) { } @@ -45,7 +46,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte LLFolderViewModelItemCommon(root_view_model), mName(""), mUUID(uuid), - mNeedsRefresh(true) + mNeedsRefresh(true), + mConvType(CONV_UNKNOWN) { } @@ -53,7 +55,8 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod LLFolderViewModelItemCommon(root_view_model), mName(""), mUUID(), - mNeedsRefresh(true) + mNeedsRefresh(true), + mConvType(CONV_UNKNOWN) { } @@ -86,11 +89,13 @@ LLConversationItemSession::LLConversationItemSession(std::string display_name, c LLConversationItem(display_name,uuid,root_view_model), mIsLoaded(false) { + mConvType = CONV_SESSION_UNKNOWN; } LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(uuid,root_view_model) { + mConvType = CONV_SESSION_UNKNOWN; } bool LLConversationItemSession::hasChildren() const @@ -183,11 +188,13 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display mIsMuted(false), mIsModerator(false) { + mConvType = CONV_PARTICIPANT; } LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(uuid,root_view_model) { + mConvType = CONV_PARTICIPANT; } void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) @@ -212,11 +219,60 @@ void LLConversationItemParticipant::dumpDebugData() bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const { - // For the moment, we sort only by name - // *TODO : Implement the sorting by date as well (most recent first) - // *TODO : Check the type of item (session/participants) as order should be different for both (eventually) + LLConversationItem::EConversationType type_a = a->getType(); + LLConversationItem::EConversationType type_b = b->getType(); + + if ((type_a == LLConversationItem::CONV_PARTICIPANT) && (type_b == LLConversationItem::CONV_PARTICIPANT)) + { + // If both are participants + U32 sort_order = getSortOrderParticipants(); + if (sort_order == LLConversationFilter::SO_DATE) + { + F32 time_a = 0.0; + F32 time_b = 0.0; + if (a->getTime(time_a) && b->getTime(time_b)) + { + return (time_a > time_b); + } + } + else if (sort_order == LLConversationFilter::SO_DISTANCE) + { + F32 dist_a = 0.0; + F32 dist_b = 0.0; + if (a->getDistanceToAgent(dist_a) && b->getDistanceToAgent(dist_b)) + { + return (dist_a > dist_b); + } + } + } + else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT)) + { + // If both are sessions + U32 sort_order = getSortOrderSessions(); + if (sort_order == LLConversationFilter::SO_DATE) + { + F32 time_a = 0.0; + F32 time_b = 0.0; + if (a->getTime(time_a) && b->getTime(time_b)) + { + return (time_a > time_b); + } + } + else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) + { + return (type_a < type_b); + } + } + else + { + // If one is a participant and the other a session, the session is always "less" than the participant + // so we simply compare the type + // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first + return (type_a < type_b); + } + // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), sort by name S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); - return (compare < 0); + return (compare < 0); } // -- cgit v1.2.3 From 1107803a5c6da07cd5171f06afc0490f3eca7bf7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 20 Sep 2012 17:50:58 -0700 Subject: CHUI-340 : WIP : Implement time update and comparison for sessions and participants --- indra/newview/llconversationmodel.cpp | 44 +++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 612744c3e9..b39b997a55 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -167,6 +167,31 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +// The time of activity of a session is the time of the most recent participation +const bool LLConversationItemSession::getTime(F64& time) const +{ + bool has_time = false; + F64 most_recent_time = 0.0; + LLConversationItemParticipant* participant = NULL; + child_list_t::const_iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + F64 participant_time; + if (participant->getTime(participant_time)) + { + has_time = true; + most_recent_time = llmax(most_recent_time,participant_time); + } + } + if (has_time) + { + time = most_recent_time; + } + llinfos << "Merov debug : get time session, uuid = " << mUUID << ", has_time = " << has_time << ", time = " << time << llendl; + return has_time; +} + void LLConversationItemSession::dumpDebugData() { llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; @@ -186,7 +211,8 @@ void LLConversationItemSession::dumpDebugData() LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), - mIsModerator(false) + mIsModerator(false), + mLastActiveTime(0.0) { mConvType = CONV_PARTICIPANT; } @@ -228,8 +254,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL U32 sort_order = getSortOrderParticipants(); if (sort_order == LLConversationFilter::SO_DATE) { - F32 time_a = 0.0; - F32 time_b = 0.0; + F64 time_a = 0.0; + F64 time_b = 0.0; if (a->getTime(time_a) && b->getTime(time_b)) { return (time_a > time_b); @@ -251,8 +277,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL U32 sort_order = getSortOrderSessions(); if (sort_order == LLConversationFilter::SO_DATE) { - F32 time_a = 0.0; - F32 time_b = 0.0; + F64 time_a = 0.0; + F64 time_b = 0.0; if (a->getTime(time_a) && b->getTime(time_b)) { return (time_a > time_b); @@ -260,7 +286,10 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) { - return (type_a < type_b); + if (type_a != type_b) + { + return (type_a < type_b); + } } } else @@ -270,7 +299,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first return (type_a < type_b); } - // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), sort by name + // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), + // we sort by name S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); return (compare < 0); } -- cgit v1.2.3 From fc6bbee3f4ba1abba2956ee92f7ac7ba01d0f59b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 20 Sep 2012 20:48:20 -0700 Subject: CHUI-340 : WIP : Implement time update on all IM typing cases --- indra/newview/llconversationmodel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index b39b997a55..31f9ca6a32 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -167,6 +167,15 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +void LLConversationItemSession::setParticipantTimeNow(const LLUUID& participant_id) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + participant->setTimeNow(); + } +} + // The time of activity of a session is the time of the most recent participation const bool LLConversationItemSession::getTime(F64& time) const { -- cgit v1.2.3 From b5583906d0cce652f456851732db5b1c19659662 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Sep 2012 18:12:06 -0700 Subject: CHUI-340 : WIP : Fix sorting bugs on time for sessions, simplified the update time mechanism and clean up --- indra/newview/llconversationmodel.cpp | 53 ++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 13 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 31f9ca6a32..e090d1647f 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -38,7 +38,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u mName(display_name), mUUID(uuid), mNeedsRefresh(true), - mConvType(CONV_UNKNOWN) + mConvType(CONV_UNKNOWN), + mLastActiveTime(0.0) { } @@ -47,7 +48,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte mName(""), mUUID(uuid), mNeedsRefresh(true), - mConvType(CONV_UNKNOWN) + mConvType(CONV_UNKNOWN), + mLastActiveTime(0.0) { } @@ -56,7 +58,8 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod mName(""), mUUID(), mNeedsRefresh(true), - mConvType(CONV_UNKNOWN) + mConvType(CONV_UNKNOWN), + mLastActiveTime(0.0) { } @@ -167,8 +170,10 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } -void LLConversationItemSession::setParticipantTimeNow(const LLUUID& participant_id) +void LLConversationItemSession::setTimeNow(const LLUUID& participant_id) { + mLastActiveTime = LLFrameTimer::getElapsedSeconds(); + mNeedsRefresh = true; LLConversationItemParticipant* participant = findParticipant(participant_id); if (participant) { @@ -176,11 +181,11 @@ void LLConversationItemSession::setParticipantTimeNow(const LLUUID& participant_ } } -// The time of activity of a session is the time of the most recent participation +// The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { - bool has_time = false; - F64 most_recent_time = 0.0; + F64 most_recent_time = mLastActiveTime; + bool has_time = (most_recent_time > 0.1); LLConversationItemParticipant* participant = NULL; child_list_t::const_iterator iter; for (iter = mChildren.begin(); iter != mChildren.end(); iter++) @@ -197,7 +202,6 @@ const bool LLConversationItemSession::getTime(F64& time) const { time = most_recent_time; } - llinfos << "Merov debug : get time session, uuid = " << mUUID << ", has_time = " << has_time << ", time = " << time << llendl; return has_time; } @@ -220,8 +224,7 @@ void LLConversationItemSession::dumpDebugData() LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), - mIsModerator(false), - mLastActiveTime(0.0) + mIsModerator(false) { mConvType = CONV_PARTICIPANT; } @@ -265,19 +268,34 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL { F64 time_a = 0.0; F64 time_b = 0.0; - if (a->getTime(time_a) && b->getTime(time_b)) + bool has_time_a = a->getTime(time_a); + bool has_time_b = b->getTime(time_b); + if (has_time_a && has_time_b) { return (time_a > time_b); } + else if (has_time_a || has_time_b) + { + // If we have only one time updated, we consider the element with time as the "highest". + // That boils down to "has_time_a" if you think about it. + return has_time_a; + } + // If not time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_DISTANCE) { F32 dist_a = 0.0; F32 dist_b = 0.0; - if (a->getDistanceToAgent(dist_a) && b->getDistanceToAgent(dist_b)) + bool has_dist_a = a->getDistanceToAgent(dist_a); + bool has_dist_b = b->getDistanceToAgent(dist_b); + if (has_dist_a && has_dist_b) { return (dist_a > dist_b); } + else if (has_dist_a || has_dist_b) + { + return has_dist_a; + } } } else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT)) @@ -288,10 +306,19 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL { F64 time_a = 0.0; F64 time_b = 0.0; - if (a->getTime(time_a) && b->getTime(time_b)) + bool has_time_a = a->getTime(time_a); + bool has_time_b = b->getTime(time_b); + if (has_time_a && has_time_b) { return (time_a > time_b); } + else if (has_time_a || has_time_b) + { + // If we have only one time updated, we consider the element with time as the "highest". + // That boils down to "has_time_a" if you think about it. + return has_time_a; + } + // If not time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) { -- cgit v1.2.3 From 552f288a0caea45e30a231478a19f4243d69689c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Sep 2012 20:13:50 -0700 Subject: CHUI-340 : Implement distance computation and update --- indra/newview/llconversationmodel.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index e090d1647f..b0d691fa13 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -181,6 +181,16 @@ void LLConversationItemSession::setTimeNow(const LLUUID& participant_id) } } +void LLConversationItemSession::setDistance(const LLUUID& participant_id, F64 dist) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + participant->setDistance(dist); + mNeedsRefresh = true; + } +} + // The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { @@ -224,13 +234,17 @@ void LLConversationItemSession::dumpDebugData() LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), - mIsModerator(false) + mIsModerator(false), + mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; } LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(uuid,root_view_model) + LLConversationItem(uuid,root_view_model), + mIsMuted(false), + mIsModerator(false), + mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; } @@ -284,13 +298,13 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } else if (sort_order == LLConversationFilter::SO_DISTANCE) { - F32 dist_a = 0.0; - F32 dist_b = 0.0; + F64 dist_a = 0.0; + F64 dist_b = 0.0; bool has_dist_a = a->getDistanceToAgent(dist_a); bool has_dist_b = b->getDistanceToAgent(dist_b); if (has_dist_a && has_dist_b) { - return (dist_a > dist_b); + return (dist_a < dist_b); } else if (has_dist_a || has_dist_b) { -- cgit v1.2.3 From 5b0e06108b3c4373c55103dedab3306f06d392c9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Sep 2012 19:55:31 -0700 Subject: CHUI-340 : Fix dupe items in the conversation model list. Refresh when resorting. --- indra/newview/llconversationmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index b0d691fa13..a94d82bf7c 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -217,7 +217,7 @@ const bool LLConversationItemSession::getTime(F64& time) const void LLConversationItemSession::dumpDebugData() { - llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; + llinfos << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; LLConversationItemParticipant* participant = NULL; child_list_t::iterator iter; for (iter = mChildren.begin(); iter != mChildren.end(); iter++) @@ -262,7 +262,7 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam void LLConversationItemParticipant::dumpDebugData() { - llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; + llinfos << "Merov debug : participant " << this << ", uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; } // -- cgit v1.2.3 From 7ac4d71c43ec746f7bb30e5cedcfdd2c4c7940f7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Sep 2012 16:39:11 -0700 Subject: CHUI-329 : WIP : Always sort Nearby Chat to be on top of the list --- indra/newview/llconversationmodel.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a94d82bf7c..00cd8ba8f8 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -269,6 +269,7 @@ void LLConversationItemParticipant::dumpDebugData() // LLConversationSort // +// Comparison operator: returns "true" is a comes before b, "false" otherwise bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const { LLConversationItem::EConversationType type_a = a->getType(); @@ -276,7 +277,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL if ((type_a == LLConversationItem::CONV_PARTICIPANT) && (type_b == LLConversationItem::CONV_PARTICIPANT)) { - // If both are participants + // If both items are participants U32 sort_order = getSortOrderParticipants(); if (sort_order == LLConversationFilter::SO_DATE) { @@ -286,15 +287,15 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL bool has_time_b = b->getTime(time_b); if (has_time_a && has_time_b) { + // Most recent comes first return (time_a > time_b); } else if (has_time_a || has_time_b) { - // If we have only one time updated, we consider the element with time as the "highest". - // That boils down to "has_time_a" if you think about it. + // If we have only one time available, the element with time must come first return has_time_a; } - // If not time available, we'll default to sort by name at the end of this method + // If no time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_DISTANCE) { @@ -304,52 +305,63 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL bool has_dist_b = b->getDistanceToAgent(dist_b); if (has_dist_a && has_dist_b) { + // Closest comes first return (dist_a < dist_b); } else if (has_dist_a || has_dist_b) { + // If we have only one distance available, the element with it must come first return has_dist_a; } + // If no distance available, we'll default to sort by name at the end of this method } } else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT)) { // If both are sessions U32 sort_order = getSortOrderSessions(); - if (sort_order == LLConversationFilter::SO_DATE) + if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY)) + { + // If one is the nearby session, put nearby session *always* first + return (type_a == LLConversationItem::CONV_SESSION_NEARBY); + } + else if (sort_order == LLConversationFilter::SO_DATE) { + // Sort by time F64 time_a = 0.0; F64 time_b = 0.0; bool has_time_a = a->getTime(time_a); bool has_time_b = b->getTime(time_b); if (has_time_a && has_time_b) { + // Most recent comes first return (time_a > time_b); } else if (has_time_a || has_time_b) { - // If we have only one time updated, we consider the element with time as the "highest". - // That boils down to "has_time_a" if you think about it. + // If we have only one time available, the element with time must come first return has_time_a; } - // If not time available, we'll default to sort by name at the end of this method + // If no time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) { if (type_a != type_b) { + // Lowest types come first. See LLConversationItem definition of types return (type_a < type_b); } + // If types are identical, we'll default to sort by name at the end of this method } } else { - // If one is a participant and the other a session, the session is always "less" than the participant + // If one item is a participant and the other a session, the session comes before the participant // so we simply compare the type // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first - return (type_a < type_b); + return (type_a > type_b); } - // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), + // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); return (compare < 0); -- cgit v1.2.3 From 3502e783b7425ba30d92f66697bafa89ae891e60 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Sep 2012 22:02:44 -0700 Subject: CHUI-342 : Fixed : Use user name and display name correctly. Sort according to user names. --- indra/newview/llconversationmodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 00cd8ba8f8..7d0ffa0788 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -251,8 +251,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mName = av_name.mDisplayName; - // *TODO : we should also store that one, to be used in the tooltip : av_name.mUsername + mName = av_name.mUsername; + mDisplayName = av_name.mDisplayName; mNeedsRefresh = true; if (mParent) { @@ -262,7 +262,7 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam void LLConversationItemParticipant::dumpDebugData() { - llinfos << "Merov debug : participant " << this << ", uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; + llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; } // @@ -363,7 +363,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name - S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + S32 compare = LLStringUtil::compareDict(a->getName(), b->getName()); return (compare < 0); } -- cgit v1.2.3 From 0651e10afff81a6e32828c122753d87b8503a79b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Sep 2012 11:15:45 -0700 Subject: CHUI-342, CHUI-366 and CHUI-367 : WIP : Allow a NO_TOOLTIP value for tooltips, update display/user names and sort on display/user names --- indra/newview/llconversationmodel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 7d0ffa0788..176c05248d 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -36,6 +36,7 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(display_name), + mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -46,6 +47,7 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), + mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -56,6 +58,7 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), + mUseNameForSort(true), mUUID(), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -251,8 +254,9 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mName = av_name.mUsername; - mDisplayName = av_name.mDisplayName; + mUseNameForSort = !av_name.mUsername.empty(); + mName = (mUseNameForSort ? av_name.mUsername : NO_TOOLTIP_STRING); + mDisplayName = (av_name.mDisplayName.empty() ? mName : av_name.mDisplayName); mNeedsRefresh = true; if (mParent) { @@ -363,7 +367,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name - S32 compare = LLStringUtil::compareDict(a->getName(), b->getName()); + S32 compare = LLStringUtil::compareDict((a->useNameForSort() ? a->getName() : a->getDisplayName()), (b->useNameForSort() ? b->getName() : b->getDisplayName())); return (compare < 0); } -- cgit v1.2.3 From 7fc33cc47fdc080bbc7674cf118011b689ba1485 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Sep 2012 17:30:18 -0700 Subject: CHUI-367 : Completed : Show user name tooltip in all situations so to avoid the conversation name showing up --- indra/newview/llconversationmodel.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 176c05248d..9fa8758d11 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -36,7 +36,6 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(display_name), - mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -47,7 +46,6 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -58,7 +56,6 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUseNameForSort(true), mUUID(), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -254,9 +251,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mUseNameForSort = !av_name.mUsername.empty(); - mName = (mUseNameForSort ? av_name.mUsername : NO_TOOLTIP_STRING); - mDisplayName = (av_name.mDisplayName.empty() ? mName : av_name.mDisplayName); + mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); + mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; if (mParent) { @@ -367,7 +363,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name - S32 compare = LLStringUtil::compareDict((a->useNameForSort() ? a->getName() : a->getDisplayName()), (b->useNameForSort() ? b->getName() : b->getDisplayName())); + S32 compare = LLStringUtil::compareDict(a->getName(), b->getName()); return (compare < 0); } -- cgit v1.2.3 From 11a148415e810706f2a1835b6b717a0a062d458f Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 28 Sep 2012 18:22:05 -0700 Subject: CHUI-102: Now the participants and one-on-one conversations have right-click-menus. These menus are functional as well, but 'chat history' does not yet work. --- indra/newview/llconversationmodel.cpp | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 7d0ffa0788..1c4c7aefae 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llmenugl.h" // // Conversation items : common behaviors @@ -84,6 +85,24 @@ void LLConversationItem::showProperties(void) { } +void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) +{ + items.push_back(std::string("view_profile")); + items.push_back(std::string("im")); + items.push_back(std::string("offer_teleport")); + items.push_back(std::string("voice_call")); + items.push_back(std::string("chat_history")); + items.push_back(std::string("separator_chat_history")); + items.push_back(std::string("add_friend")); + items.push_back(std::string("remove_friend")); + items.push_back(std::string("invite_to_group")); + items.push_back(std::string("separator_invite_to_group")); + items.push_back(std::string("map")); + items.push_back(std::string("share")); + items.push_back(std::string("pay")); + items.push_back(std::string("block_unblock")); +} + // // LLConversationItemSession // @@ -191,6 +210,22 @@ void LLConversationItemSession::setDistance(const LLUUID& participant_id, F64 di } } +void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + lldebugs << "LLConversationItemParticipant::buildContextMenu()" << llendl; + menuentry_vec_t items; + menuentry_vec_t disabled_items; + + if(this->getType() == CONV_SESSION_1_ON_1) + { + items.push_back(std::string("close_conversation")); + items.push_back(std::string("separator_disconnect_from_voice")); + buildParticipantMenuOptions(items); + } + + hide_context_entries(menu, items, disabled_items); +} + // The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { @@ -249,6 +284,15 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, mConvType = CONV_PARTICIPANT; } +void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + menuentry_vec_t items; + menuentry_vec_t disabled_items; + + buildParticipantMenuOptions(items); + hide_context_entries(menu, items, disabled_items); +} + void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { mName = av_name.mUsername; -- cgit v1.2.3 From 8e1a9e2813da6b9d5c17795b375098fb6a386ee1 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 1 Oct 2012 13:54:53 -0700 Subject: CHUI-102: Cleaned up code after code review. --- indra/newview/llconversationmodel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 1c4c7aefae..f587ef8428 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,7 +28,6 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" -#include "llmenugl.h" // // Conversation items : common behaviors -- cgit v1.2.3 From 598f5345866c58abdd971935d80f9b53756042c9 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 1 Oct 2012 17:04:13 -0700 Subject: CHUI-102: Right clicking on a group conversation brings up the correct menu. The user can now view the group profile, activate the group and leave the group. --- indra/newview/llconversationmodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 265f77365f..3d1523c874 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -221,6 +221,14 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("separator_disconnect_from_voice")); buildParticipantMenuOptions(items); } + else if(this->getType() == CONV_SESSION_GROUP) + { + items.push_back(std::string("close_conversation")); + items.push_back(std::string("separator_disconnect_from_voice")); + items.push_back(std::string("group_profile")); + items.push_back(std::string("activate_group")); + items.push_back(std::string("leave_group")); + } hide_context_entries(menu, items, disabled_items); } -- cgit v1.2.3 From 9d989feede2dbef934cdc459b4758c024df862d6 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 15:10:12 -0700 Subject: CHUI-102: Now the user can select a conversation and use the right-click-menu to enable/disable voice. --- indra/newview/llconversationmodel.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 3d1523c874..a3ec154ac6 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llimview.h" //For LLIMModel // // Conversation items : common behaviors @@ -224,15 +225,35 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) else if(this->getType() == CONV_SESSION_GROUP) { items.push_back(std::string("close_conversation")); + addVoiceOptions(items); items.push_back(std::string("separator_disconnect_from_voice")); items.push_back(std::string("group_profile")); items.push_back(std::string("activate_group")); items.push_back(std::string("leave_group")); } + else if(this->getType() == CONV_SESSION_AD_HOC) + { + items.push_back(std::string("close_conversation")); + addVoiceOptions(items); + } hide_context_entries(menu, items, disabled_items); } +void LLConversationItemSession::addVoiceOptions(menuentry_vec_t& items) +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance() ? LLIMModel::getInstance()->getVoiceChannel(this->getUUID()) : NULL; + + if(voice_channel != LLVoiceChannel::getCurrentVoiceChannel()) + { + items.push_back(std::string("open_voice_conversation")); + } + else + { + items.push_back(std::string("disconnect_from_voice")); + } +} + // The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { -- cgit v1.2.3 From ed9ade7d50b699ac60eb69a979ea32a60eefa630 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 17:03:46 -0700 Subject: CHUI-102: Now the options menu (right-click menu) for a participant/conversation will open the 'Chat history' dialog when selected. --- indra/newview/llconversationmodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a3ec154ac6..5fc305da81 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -226,7 +226,8 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("close_conversation")); addVoiceOptions(items); - items.push_back(std::string("separator_disconnect_from_voice")); + items.push_back(std::string("chat_history")); + items.push_back(std::string("separator_chat_history")); items.push_back(std::string("group_profile")); items.push_back(std::string("activate_group")); items.push_back(std::string("leave_group")); @@ -235,6 +236,7 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("close_conversation")); addVoiceOptions(items); + items.push_back(std::string("chat_history")); } hide_context_entries(menu, items, disabled_items); -- cgit v1.2.3 From 4a25ce8b9d5d56b160d0d13c4681cd916c4ea4e0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 2 Oct 2012 22:34:44 -0700 Subject: CHUI-341 : Implement the use of LLEventStream and LLEventPump to signal conversation model changes, picked by LLIMFloaterContainer. Suppress pooling on draw(). --- indra/newview/llconversationmodel.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 9fa8758d11..1057dbaf31 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" +#include "llevents.h" #include "llconversationmodel.h" // @@ -63,6 +64,18 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod { } +void LLConversationItem::postEvent(const std::string& event_type) +{ + LLSD event; + event["pump"] = "ConversationModelEvent"; + LLSD payload; + payload["type"] = event_type; + payload["name"] = getName(); + payload["uuid"] = getUUID(); + event["payload"] = payload; + LLEventPumps::instance().obtain("ConversationsEvents").post(event); +} + // Virtual action callbacks void LLConversationItem::performAction(LLInventoryModel* model, std::string action) { @@ -111,12 +124,14 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa addChild(participant); mIsLoaded = true; mNeedsRefresh = true; + postEvent("add_participant"); } void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { removeChild(participant); mNeedsRefresh = true; + postEvent("remove_participant"); } void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) @@ -254,6 +269,7 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; + postEvent("update_participant"); if (mParent) { mParent->requestSort(); -- cgit v1.2.3 From bd64c483639ae33518609398fce7c51ddc73dae7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 3 Oct 2012 16:46:46 -0700 Subject: CHUI-358 : Fixed the removal of participants as they leave conversations. Used the event mechanism for this. --- indra/newview/llconversationmodel.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 1057dbaf31..7ddb725fb1 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -64,15 +64,13 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod { } -void LLConversationItem::postEvent(const std::string& event_type) +void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemParticipant* participant) { LLSD event; - event["pump"] = "ConversationModelEvent"; - LLSD payload; - payload["type"] = event_type; - payload["name"] = getName(); - payload["uuid"] = getUUID(); - event["payload"] = payload; + event["type"] = event_type; + event["session_uuid"] = getUUID(); + event["participant_name"] = participant->getName(); + event["participant_uuid"] = participant->getUUID(); LLEventPumps::instance().obtain("ConversationsEvents").post(event); } @@ -124,14 +122,14 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa addChild(participant); mIsLoaded = true; mNeedsRefresh = true; - postEvent("add_participant"); + postEvent("add_participant", participant); } void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { removeChild(participant); mNeedsRefresh = true; - postEvent("remove_participant"); + postEvent("remove_participant", participant); } void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) @@ -269,7 +267,7 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; - postEvent("update_participant"); + postEvent("update_participant", this); if (mParent) { mParent->requestSort(); -- cgit v1.2.3 From 5d846e141464f02a1d896ffa82d639f973f8044b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 3 Oct 2012 19:06:33 -0700 Subject: CHUI-341 : Fixed. Took Nat's review comments into account. --- indra/newview/llconversationmodel.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0f29ffe77f..3c111c919a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "llevents.h" +#include "llsdutil.h" #include "llconversationmodel.h" #include "llimview.h" //For LLIMModel @@ -67,11 +68,7 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemParticipant* participant) { - LLSD event; - event["type"] = event_type; - event["session_uuid"] = getUUID(); - event["participant_name"] = participant->getName(); - event["participant_uuid"] = participant->getUUID(); + LLSD event(LLSDMap("type", event_type)("session_uuid", getUUID())("participant_name",participant->getName())("participant_uuid",participant->getUUID())); LLEventPumps::instance().obtain("ConversationsEvents").post(event); } -- cgit v1.2.3 From f533a251553d95045ab7c1d37a149004cd1e2ef0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 4 Oct 2012 20:36:04 -0700 Subject: CHUI-381 : Implement add_participant and update_participant events handling. --- indra/newview/llconversationmodel.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 3c111c919a..b2b768bf9a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -66,9 +66,11 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod { } -void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemParticipant* participant) +void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant) { - LLSD event(LLSDMap("type", event_type)("session_uuid", getUUID())("participant_name",participant->getName())("participant_uuid",participant->getUUID())); + LLUUID session_id = (session ? session->getUUID() : LLUUID()); + LLUUID participant_id = (participant ? participant->getUUID() : LLUUID()); + LLSD event(LLSDMap("type", event_type)("session_uuid", session_id)("participant_uuid", participant_id)); LLEventPumps::instance().obtain("ConversationsEvents").post(event); } @@ -138,14 +140,14 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa addChild(participant); mIsLoaded = true; mNeedsRefresh = true; - postEvent("add_participant", participant); + postEvent("add_participant", this, participant); } void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { removeChild(participant); mNeedsRefresh = true; - postEvent("remove_participant", participant); + postEvent("remove_participant", this, participant); } void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) @@ -338,11 +340,11 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; - postEvent("update_participant", this); if (mParent) { mParent->requestSort(); } + postEvent("update_participant", dynamic_cast(mParent), this); } void LLConversationItemParticipant::dumpDebugData() -- cgit v1.2.3 From db452823e5cc615225f3f163d827954447cf9bd8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 5 Oct 2012 20:28:11 -0700 Subject: CHUI-194 : WIP : Update the ad-hoc conversation line item title, add a new update_session event. Still some clean up to do. --- indra/newview/llconversationmodel.cpp | 49 ++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index b2b768bf9a..15824704fd 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -27,6 +27,8 @@ #include "llviewerprecompiledheaders.h" +#include "llavatarnamecache.h" +#include "llavataractions.h" #include "llevents.h" #include "llsdutil.h" #include "llconversationmodel.h" @@ -140,9 +142,48 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa addChild(participant); mIsLoaded = true; mNeedsRefresh = true; + updateParticipantName(participant); postEvent("add_participant", this, participant); } +void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) +{ + // We modify the session name only in the case of an ad-hoc session, exit otherwise (nothing to do) + if (getType() != CONV_SESSION_AD_HOC) + { + return; + } + // Avoid changing the default name if no participant present yet + if (mChildren.size() == 0) + { + return; + } + // Build a string containing the participants names and check if ready for display (we don't want "(waiting)" in there) + // *TODO: Further factor out common code with LLIMFloater::onParticipantsListChanged() + bool all_names_resolved = true; + uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string + child_list_t::iterator iter = mChildren.begin(); + while (iter != mChildren.end()) + { + LLConversationItemParticipant* current_participant = dynamic_cast(*iter); + temp_uuids.push_back(current_participant->getUUID()); + LLAvatarName av_name; + if (!LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) + { + all_names_resolved = false; + break; + } + iter++; + } + if (all_names_resolved) + { + std::string new_session_name; + LLAvatarActions::buildResidentsString(temp_uuids, new_session_name); + renameItem(new_session_name); + postEvent("update_session", this, NULL); + } +} + void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { removeChild(participant); @@ -340,11 +381,13 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; - if (mParent) + LLConversationItemSession* parent_session = dynamic_cast(mParent); + if (parent_session) { - mParent->requestSort(); + parent_session->requestSort(); + parent_session->updateParticipantName(this); } - postEvent("update_participant", dynamic_cast(mParent), this); + postEvent("update_participant", parent_session, this); } void LLConversationItemParticipant::dumpDebugData() -- cgit v1.2.3 From 0d619bcdc1fbb7869a6376749b0bd46b1d40c91e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 8 Oct 2012 18:20:37 -0700 Subject: CHUI-147 : Sort the residents names when getting a resident string list --- indra/newview/llconversationmodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 15824704fd..29e7ac4e12 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -159,7 +159,6 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip return; } // Build a string containing the participants names and check if ready for display (we don't want "(waiting)" in there) - // *TODO: Further factor out common code with LLIMFloater::onParticipantsListChanged() bool all_names_resolved = true; uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string child_list_t::iterator iter = mChildren.begin(); @@ -170,6 +169,9 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip LLAvatarName av_name; if (!LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) { + // If the name is not in the cache yet, bail out + // Note: we don't bind ourselves to the LLAvatarNameCache event as we are called by + // onAvatarNameCache() which is itself attached to the same event. all_names_resolved = false; break; } -- cgit v1.2.3 From 5a22949cf509ebd1a3c7dfbd029b4bc188fee4a3 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 16 Oct 2012 15:33:12 +0300 Subject: CHUI-388 FIXED Do not add menu items to Participant Menu if own avatar is selected in participant list. Do not show Menu if all menu items are disabled. --- indra/newview/llconversationmodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 29e7ac4e12..e5232d730c 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" +#include "llagent.h" #include "llavatarnamecache.h" #include "llavataractions.h" #include "llevents.h" @@ -374,7 +375,10 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - buildParticipantMenuOptions(items); + if(gAgent.getID() != mUUID) + { + buildParticipantMenuOptions(items); + } hide_context_entries(menu, items, disabled_items); } -- cgit v1.2.3 From 1251f45e6246d81658cf4fe6f2654472c772e94b Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 17 Oct 2012 00:16:18 +0300 Subject: CHUI-394 FIXED Group moderation tools missing in right click menus --- indra/newview/llconversationmodel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index e5232d730c..f0c8658cfe 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -114,6 +114,19 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) items.push_back(std::string("share")); items.push_back(std::string("pay")); items.push_back(std::string("block_unblock")); + + if(this->getType() != CONV_SESSION_1_ON_1) + { + items.push_back(std::string("Moderator Options Separator")); + items.push_back(std::string("Moderator Options")); + items.push_back(std::string("AllowTextChat")); + items.push_back(std::string("moderate_voice_separator")); + items.push_back(std::string("ModerateVoiceMuteSelected")); + items.push_back(std::string("ModerateVoiceUnMuteSelected")); + items.push_back(std::string("ModerateVoiceMute")); + items.push_back(std::string("ModerateVoiceUnmute")); + } + } // -- cgit v1.2.3 From c0b1ae6d976a94918ea8adc0908eb7c1e3d11459 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 30 Oct 2012 17:28:39 +0200 Subject: CHUI-446 FIXED Check that parent_session is not null --- indra/newview/llconversationmodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index f0c8658cfe..67a1aed675 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -401,12 +401,13 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; LLConversationItemSession* parent_session = dynamic_cast(mParent); - if (parent_session) + if (parent_session != NULL) { parent_session->requestSort(); parent_session->updateParticipantName(this); + postEvent("update_participant", parent_session, this); } - postEvent("update_participant", parent_session, this); + } void LLConversationItemParticipant::dumpDebugData() -- cgit v1.2.3 From fb3df4790e27345a1e45f4a4675e756c1e551f21 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 30 Oct 2012 15:59:42 -0700 Subject: CHUI-459: Creating a fetchAvatarName() method for the LLConversationItemParticipant class to allow the class to query for the avatar display name directly. Also, added a field to store the avatar name cache callback connection so that we can disconnect properly on object destruction to avoid a crash with the callback attempting to access recently freed memory. --- indra/newview/llconversationmodel.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 67a1aed675..33631a027b 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -369,7 +369,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0) + mDistToAgent(-1.0), + mAvatarNameCacheConnection() { mConvType = CONV_PARTICIPANT; } @@ -378,11 +379,38 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLConversationItem(uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0) + mDistToAgent(-1.0), + mAvatarNameCacheConnection() { mConvType = CONV_PARTICIPANT; } +LLConversationItemParticipant::~LLConversationItemParticipant() +{ + // Disconnect any previous avatar name cache connection to ensure + // that the callback method is not called after destruction + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } +} + +void LLConversationItemParticipant::fetchAvatarName() +{ + // Disconnect any previous avatar name cache connection + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + // Request the avatar name from the cache + llassert(getUUID().notNull()); + if (getUUID().notNull()) + { + mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2)); + } +} + void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) { menuentry_vec_t items; -- cgit v1.2.3 From d886d89f53267d9a9a02c775fcb16e667278b904 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 1 Nov 2012 15:00:50 +0200 Subject: CHUI-446 FIXED Checkm mParent before using dynamic_cast --- indra/newview/llconversationmodel.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 33631a027b..47a82bfe17 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -428,14 +428,16 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; - LLConversationItemSession* parent_session = dynamic_cast(mParent); - if (parent_session != NULL) + if(mParent != NULL) { - parent_session->requestSort(); - parent_session->updateParticipantName(this); - postEvent("update_participant", parent_session, this); + LLConversationItemSession* parent_session = dynamic_cast(mParent); + if (parent_session != NULL) + { + parent_session->requestSort(); + parent_session->updateParticipantName(this); + postEvent("update_participant", parent_session, this); + } } - } void LLConversationItemParticipant::dumpDebugData() -- cgit v1.2.3 From 33068c6da8f079c557e4fb520b074f6e5ce40ba4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 14 Nov 2012 10:40:51 -0800 Subject: CHUI-479 : WIP : Add debug tracing into speaking indicator manager and monitors (to be deleted eventually). --- indra/newview/llconversationmodel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 47a82bfe17..8aa740e5d1 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -440,6 +440,16 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam } } +LLConversationItemSession* LLConversationItemParticipant::getParentSession() +{ + LLConversationItemSession* parent_session = NULL; + if (hasParent()) + { + parent_session = dynamic_cast(mParent); + } + return parent_session; +} + void LLConversationItemParticipant::dumpDebugData() { llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; -- cgit v1.2.3 From bd62d1d33717536e71f5fbb5ab4a477a69494c77 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 14 Nov 2012 20:00:01 -0800 Subject: CHUI-479 : WIP : More tracing --- indra/newview/llconversationmodel.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 8aa740e5d1..1c56bd672d 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -349,15 +349,21 @@ const bool LLConversationItemSession::getTime(F64& time) const return has_time; } -void LLConversationItemSession::dumpDebugData() +void LLConversationItemSession::dumpDebugData(bool dump_children) { + // Session info llinfos << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; - LLConversationItemParticipant* participant = NULL; - child_list_t::iterator iter; - for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + // Children info + if (dump_children) { - participant = dynamic_cast(*iter); - participant->dumpDebugData(); + for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + LLConversationItemParticipant* participant = dynamic_cast(*iter); + if (participant) + { + participant->dumpDebugData(); + } + } } } -- cgit v1.2.3 From a12464b9cbc40d4584d6968db2092a56fa3f4bc6 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 21 Nov 2012 11:46:38 -0800 Subject: CHUI-429, CHUI-511, CHUI-388 : Multiselection and menus in torn off dialogs --- indra/newview/llconversationmodel.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 1c56bd672d..0837a49095 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -27,7 +27,6 @@ #include "llviewerprecompiledheaders.h" -#include "llagent.h" #include "llavatarnamecache.h" #include "llavataractions.h" #include "llevents.h" @@ -422,10 +421,8 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - if(gAgent.getID() != mUUID) - { - buildParticipantMenuOptions(items); - } + buildParticipantMenuOptions(items); + hide_context_entries(menu, items, disabled_items); } -- cgit v1.2.3 From e53577c32db1a8d5e7e15cb33357c68da87acc44 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 30 Nov 2012 17:12:52 -0800 Subject: CHUI-404, CHUI-406 : Fixed : update ad-hoc conversation when participant logs off, update title of ad-hoc and P2P to be consistent with torn off and input field --- indra/newview/llconversationmodel.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0837a49095..ba92022673 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" +#include "llagent.h" #include "llavatarnamecache.h" #include "llavataractions.h" #include "llevents.h" @@ -161,8 +162,8 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) { - // We modify the session name only in the case of an ad-hoc session, exit otherwise (nothing to do) - if (getType() != CONV_SESSION_AD_HOC) + // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do) + if ((getType() != CONV_SESSION_AD_HOC) && (getType() != CONV_SESSION_1_ON_1)) { return; } @@ -171,26 +172,26 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip { return; } - // Build a string containing the participants names and check if ready for display (we don't want "(waiting)" in there) - bool all_names_resolved = true; + // Build a string containing the participants names (minus own agent) and check if ready for display (we don't want "(waiting)" in there) + // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by + // onAvatarNameCache() which is itself attached to the same event. uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string child_list_t::iterator iter = mChildren.begin(); while (iter != mChildren.end()) { LLConversationItemParticipant* current_participant = dynamic_cast(*iter); - temp_uuids.push_back(current_participant->getUUID()); - LLAvatarName av_name; - if (!LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) - { - // If the name is not in the cache yet, bail out - // Note: we don't bind ourselves to the LLAvatarNameCache event as we are called by - // onAvatarNameCache() which is itself attached to the same event. - all_names_resolved = false; - break; + // Add the avatar uuid to the list (except if it's the own agent uuid) + if (current_participant->getUUID() != gAgentID) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) + { + temp_uuids.push_back(current_participant->getUUID()); + } } iter++; } - if (all_names_resolved) + if (temp_uuids.size() != 0) { std::string new_session_name; LLAvatarActions::buildResidentsString(temp_uuids, new_session_name); @@ -203,6 +204,7 @@ void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* { removeChild(participant); mNeedsRefresh = true; + updateParticipantName(participant); postEvent("remove_participant", this, participant); } -- cgit v1.2.3 From d48357f54765f84a35b73bbf28e88b978bcb5013 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 30 Nov 2012 19:07:58 -0800 Subject: CHUI-406 : Fixed again : Update of the P2P session name when not initiating a session was wrong. Add getting the participant name from the session. --- indra/newview/llconversationmodel.cpp | 39 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index ba92022673..728b1a3f4c 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -31,6 +31,7 @@ #include "llavatarnamecache.h" #include "llavataractions.h" #include "llevents.h" +#include "llfloaterimsession.h" #include "llsdutil.h" #include "llconversationmodel.h" #include "llimview.h" //For LLIMModel @@ -162,8 +163,9 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) { + EConversationType conversation_type = getType(); // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do) - if ((getType() != CONV_SESSION_AD_HOC) && (getType() != CONV_SESSION_1_ON_1)) + if ((conversation_type != CONV_SESSION_AD_HOC) && (conversation_type != CONV_SESSION_1_ON_1)) { return; } @@ -172,24 +174,35 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip { return; } - // Build a string containing the participants names (minus own agent) and check if ready for display (we don't want "(waiting)" in there) - // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by - // onAvatarNameCache() which is itself attached to the same event. uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string - child_list_t::iterator iter = mChildren.begin(); - while (iter != mChildren.end()) + if (conversation_type == CONV_SESSION_AD_HOC) { - LLConversationItemParticipant* current_participant = dynamic_cast(*iter); - // Add the avatar uuid to the list (except if it's the own agent uuid) - if (current_participant->getUUID() != gAgentID) + // Build a string containing the participants UUIDs (minus own agent) and check if ready for display (we don't want "(waiting)" in there) + // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by + // onAvatarNameCache() which is itself attached to the same event. + child_list_t::iterator iter = mChildren.begin(); + while (iter != mChildren.end()) { - LLAvatarName av_name; - if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) + LLConversationItemParticipant* current_participant = dynamic_cast(*iter); + // Add the avatar uuid to the list (except if it's the own agent uuid) + if (current_participant->getUUID() != gAgentID) { - temp_uuids.push_back(current_participant->getUUID()); + LLAvatarName av_name; + if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) + { + temp_uuids.push_back(current_participant->getUUID()); + } } + iter++; } - iter++; + } + else if (conversation_type == CONV_SESSION_1_ON_1) + { + // In the case of a P2P conversersation, we need to grab the name of the other participant in the session instance itself + // as we do not create participants for such a session. + LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(mUUID); + LLUUID participantID = conversationFloater->getOtherParticipantUUID(); + temp_uuids.push_back(participantID); } if (temp_uuids.size() != 0) { -- cgit v1.2.3 From b43c8afc36a11c34fa76443be85430cac6c72c42 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 4 Dec 2012 14:51:33 -0800 Subject: CHUI-550, CHUI-551 : Fixed : Changed conversation sorting according to designer's desires. --- indra/newview/llconversationmodel.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 728b1a3f4c..0b7c3939df 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -528,12 +528,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL { // If both are sessions U32 sort_order = getSortOrderSessions(); - if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY)) - { - // If one is the nearby session, put nearby session *always* first - return (type_a == LLConversationItem::CONV_SESSION_NEARBY); - } - else if (sort_order == LLConversationFilter::SO_DATE) + + if (sort_order == LLConversationFilter::SO_DATE) { // Sort by time F64 time_a = 0.0; @@ -552,14 +548,22 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // If no time available, we'll default to sort by name at the end of this method } - else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) + else { - if (type_a != type_b) + if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY)) { - // Lowest types come first. See LLConversationItem definition of types - return (type_a < type_b); + // If one is the nearby session, put nearby session *always* last + return (type_b == LLConversationItem::CONV_SESSION_NEARBY); } + else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) + { + if (type_a != type_b) + { + // Lowest types come first. See LLConversationItem definition of types + return (type_a < type_b); + } // If types are identical, we'll default to sort by name at the end of this method + } } } else -- cgit v1.2.3 From e0b1b063c14081a7c53ab5620db20385e1f2bbbd Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Wed, 5 Dec 2012 20:03:15 +0200 Subject: CHUI-577 FIXED "Mute text" and "Block voice" items are added to context menu instead of "Block\unblock" --- indra/newview/llconversationmodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0b7c3939df..4328c60b1a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -115,6 +115,7 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) items.push_back(std::string("share")); items.push_back(std::string("pay")); items.push_back(std::string("block_unblock")); + items.push_back(std::string("MuteText")); if(this->getType() != CONV_SESSION_1_ON_1) { -- cgit v1.2.3 From 3a49beed0e96a797a6d663bcae5e932437ca3661 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Dec 2012 20:25:46 -0800 Subject: CHUI-580 : WIP : Change the display name cache system, deprecating the old protocol and using the cap (People API) whenever available. Still has occurence of Resident as last name to clean up. --- indra/newview/llconversationmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 728b1a3f4c..76c422f34d 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -443,8 +443,8 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); - mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); + mName = av_name.getUserName(); + mDisplayName = av_name.getDisplayName(); mNeedsRefresh = true; if(mParent != NULL) { -- cgit v1.2.3 From a6f1690128b510977cfe86071f80f81967b9d0c7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Dec 2012 18:58:52 -0800 Subject: CHUI-580, CHUI-406 : Fixed : Finished avatar name caching, also fixed the display of (waiting) when names don't come (mostly in legacy mode). --- indra/newview/llconversationmodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 1f6022decb..99dd35a9e8 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -393,6 +393,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display mDistToAgent(-1.0), mAvatarNameCacheConnection() { + mDisplayName = display_name; mConvType = CONV_PARTICIPANT; } -- cgit v1.2.3 From f49d47b3041c6b36b36a23b67eec609e95494acc Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Mon, 10 Dec 2012 17:22:56 +0200 Subject: CHUI-394 (Group moderation tools missing in right click menus) --- indra/newview/llconversationmodel.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 99dd35a9e8..d03ad92fbc 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -46,7 +46,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), - mLastActiveTime(0.0) + mLastActiveTime(0.0), + mDisplayModeratorOptions(false) { } @@ -56,7 +57,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), - mLastActiveTime(0.0) + mLastActiveTime(0.0), + mDisplayModeratorOptions(false) { } @@ -66,7 +68,8 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod mUUID(), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), - mLastActiveTime(0.0) + mLastActiveTime(0.0), + mDisplayModeratorOptions(false) { } @@ -117,14 +120,13 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) items.push_back(std::string("block_unblock")); items.push_back(std::string("MuteText")); - if(this->getType() != CONV_SESSION_1_ON_1) + if(this->getType() != CONV_SESSION_1_ON_1 && mDisplayModeratorOptions) { items.push_back(std::string("Moderator Options Separator")); items.push_back(std::string("Moderator Options")); items.push_back(std::string("AllowTextChat")); items.push_back(std::string("moderate_voice_separator")); - items.push_back(std::string("ModerateVoiceMuteSelected")); - items.push_back(std::string("ModerateVoiceUnMuteSelected")); + items.push_back(std::string("ModerateVoiceToggleMuteSelected")); items.push_back(std::string("ModerateVoiceMute")); items.push_back(std::string("ModerateVoiceUnmute")); } -- cgit v1.2.3 From 6fe7144104cd8b5bd9c7d215f76afdeafe13b7ee Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 17 Dec 2012 18:59:01 -0800 Subject: CHUI-580 : WIP : Protect callback connections passed to LLAvatarNameCache::get() where necessary --- indra/newview/llconversationmodel.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index d03ad92fbc..ef9e0e02e5 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -421,16 +421,15 @@ LLConversationItemParticipant::~LLConversationItemParticipant() void LLConversationItemParticipant::fetchAvatarName() { - // Disconnect any previous avatar name cache connection - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } - // Request the avatar name from the cache llassert(getUUID().notNull()); if (getUUID().notNull()) { + // Disconnect any previous avatar name cache connection + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2)); } } -- cgit v1.2.3 From c2d332a89cb29d54df40f1f120304d871278fb76 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 17 Dec 2012 20:16:33 -0800 Subject: CHUI-580 : WIP : Added disconnect of callbacks once they're called to prevent filling up the callback queue --- indra/newview/llconversationmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index ef9e0e02e5..b1f45d6d64 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -446,6 +446,8 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); mNeedsRefresh = true; -- cgit v1.2.3 From 090636f107a2d3ba3438a6690f36eac3ec257314 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 20 Dec 2012 18:36:01 -0800 Subject: CHUI-429 : Fixed! Add a flag to filter multi/single selection situations in menu building. Implement in conversation contextual menu. --- indra/newview/llconversationmodel.cpp | 67 ++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 29 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index d03ad92fbc..005439301a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -102,35 +102,44 @@ void LLConversationItem::showProperties(void) { } -void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) -{ - items.push_back(std::string("view_profile")); - items.push_back(std::string("im")); - items.push_back(std::string("offer_teleport")); - items.push_back(std::string("voice_call")); - items.push_back(std::string("chat_history")); - items.push_back(std::string("separator_chat_history")); - items.push_back(std::string("add_friend")); - items.push_back(std::string("remove_friend")); - items.push_back(std::string("invite_to_group")); - items.push_back(std::string("separator_invite_to_group")); - items.push_back(std::string("map")); - items.push_back(std::string("share")); - items.push_back(std::string("pay")); - items.push_back(std::string("block_unblock")); - items.push_back(std::string("MuteText")); - - if(this->getType() != CONV_SESSION_1_ON_1 && mDisplayModeratorOptions) +void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32 flags) +{ + if (flags & ITEM_IN_MULTI_SELECTION) { - items.push_back(std::string("Moderator Options Separator")); - items.push_back(std::string("Moderator Options")); - items.push_back(std::string("AllowTextChat")); - items.push_back(std::string("moderate_voice_separator")); - items.push_back(std::string("ModerateVoiceToggleMuteSelected")); - items.push_back(std::string("ModerateVoiceMute")); - items.push_back(std::string("ModerateVoiceUnmute")); + items.push_back(std::string("im")); + items.push_back(std::string("offer_teleport")); + items.push_back(std::string("voice_call")); + items.push_back(std::string("remove_friends")); + } + else + { + items.push_back(std::string("view_profile")); + items.push_back(std::string("im")); + items.push_back(std::string("offer_teleport")); + items.push_back(std::string("voice_call")); + items.push_back(std::string("chat_history")); + items.push_back(std::string("separator_chat_history")); + items.push_back(std::string("add_friend")); + items.push_back(std::string("remove_friend")); + items.push_back(std::string("invite_to_group")); + items.push_back(std::string("separator_invite_to_group")); + items.push_back(std::string("map")); + items.push_back(std::string("share")); + items.push_back(std::string("pay")); + items.push_back(std::string("block_unblock")); + items.push_back(std::string("MuteText")); + + if ((getType() != CONV_SESSION_1_ON_1) && mDisplayModeratorOptions) + { + items.push_back(std::string("Moderator Options Separator")); + items.push_back(std::string("Moderator Options")); + items.push_back(std::string("AllowTextChat")); + items.push_back(std::string("moderate_voice_separator")); + items.push_back(std::string("ModerateVoiceToggleMuteSelected")); + items.push_back(std::string("ModerateVoiceMute")); + items.push_back(std::string("ModerateVoiceUnmute")); + } } - } // @@ -306,7 +315,7 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("close_conversation")); items.push_back(std::string("separator_disconnect_from_voice")); - buildParticipantMenuOptions(items); + buildParticipantMenuOptions(items, flags); } else if(this->getType() == CONV_SESSION_GROUP) { @@ -440,7 +449,7 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - buildParticipantMenuOptions(items); + buildParticipantMenuOptions(items, flags); hide_context_entries(menu, items, disabled_items); } -- cgit v1.2.3 From 12554bffb34895533ed11013a780bfa088756a67 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 4 Jan 2013 20:23:14 -0800 Subject: CHUI-580 : Fixed : Avoid fetching names while reacting to display name checkbox change (overkill), make display name pref disabled when usePeopleAPI is off --- indra/newview/llconversationmodel.cpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index b1f45d6d64..bc5b72e029 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -434,24 +434,31 @@ void LLConversationItemParticipant::fetchAvatarName() } } -void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) +void LLConversationItemParticipant::updateAvatarName() { - menuentry_vec_t items; - menuentry_vec_t disabled_items; - - buildParticipantMenuOptions(items); - - hide_context_entries(menu, items, disabled_items); + llassert(getUUID().notNull()); + if (getUUID().notNull()) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(getUUID(),&av_name)) + { + updateAvatarName(av_name); + } + } } void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { mAvatarNameCacheConnection.disconnect(); + updateAvatarName(av_name); +} +void LLConversationItemParticipant::updateAvatarName(const LLAvatarName& av_name) +{ mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); mNeedsRefresh = true; - if(mParent != NULL) + if (mParent != NULL) { LLConversationItemSession* parent_session = dynamic_cast(mParent); if (parent_session != NULL) @@ -463,6 +470,16 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam } } +void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + menuentry_vec_t items; + menuentry_vec_t disabled_items; + + buildParticipantMenuOptions(items); + + hide_context_entries(menu, items, disabled_items); +} + LLConversationItemSession* LLConversationItemParticipant::getParentSession() { LLConversationItemSession* parent_session = NULL; -- cgit v1.2.3 From def252341a8c1675405404a6588749d06fa40791 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Tue, 8 Jan 2013 23:37:29 +0200 Subject: CHUI-612 FIXED Blank conversation names showing in conversation list --- indra/newview/llconversationmodel.cpp | 129 ++++++++++++++++++++++------------ 1 file changed, 83 insertions(+), 46 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0243fb1c97..a8da4908ce 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -47,7 +47,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } @@ -58,7 +59,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } @@ -69,10 +71,21 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } +LLConversationItem::~LLConversationItem() +{ + // Disconnect any previous avatar name cache connection to ensure + // that the callback method is not called after destruction + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } +} + void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant) { LLUUID session_id = (session ? session->getUUID() : LLUUID()); @@ -142,6 +155,37 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32 } } +// method does subscription to changes in avatar name cache for current session/participant conversation item. +void LLConversationItem::fetchAvatarName(bool isParticipant /*= true*/) +{ + LLUUID item_id = getUUID(); + + // item should not be null for participants + if (isParticipant) + { + llassert(item_id.notNull()); + } + + // disconnect any previous avatar name cache connection + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + // exclude nearby chat item + if (item_id.notNull()) + { + // for P2P session item, override it as item of called agent + if (CONV_SESSION_1_ON_1 == getType()) + { + item_id = LLIMModel::getInstance()->getOtherParticipantID(item_id); + } + + // subscribe on avatar name cache changes for participant and session items + mAvatarNameCacheConnection = LLAvatarNameCache::get(item_id, boost::bind(&LLConversationItem::onAvatarNameCache, this, _2)); + } +} + // // LLConversationItemSession // @@ -169,11 +213,11 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa addChild(participant); mIsLoaded = true; mNeedsRefresh = true; - updateParticipantName(participant); + updateName(participant); postEvent("add_participant", this, participant); } -void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) +void LLConversationItemSession::updateName(LLConversationItemParticipant* participant) { EConversationType conversation_type = getType(); // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do) @@ -181,11 +225,13 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip { return; } + // Avoid changing the default name if no participant present yet if (mChildren.size() == 0) { return; } + uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string if (conversation_type == CONV_SESSION_AD_HOC) { @@ -210,12 +256,14 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip } else if (conversation_type == CONV_SESSION_1_ON_1) { - // In the case of a P2P conversersation, we need to grab the name of the other participant in the session instance itself + // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself // as we do not create participants for such a session. - LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(mUUID); - LLUUID participantID = conversationFloater->getOtherParticipantUUID(); - temp_uuids.push_back(participantID); + if (gAgentID != participant->getUUID()) + { + temp_uuids.push_back(participant->getUUID()); + } } + if (temp_uuids.size() != 0) { std::string new_session_name; @@ -229,7 +277,7 @@ void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* { removeChild(participant); mNeedsRefresh = true; - updateParticipantName(participant); + updateName(participant); postEvent("remove_participant", this, participant); } @@ -393,6 +441,18 @@ void LLConversationItemSession::dumpDebugData(bool dump_children) } } +// should be invoked only for P2P sessions +void LLConversationItemSession::onAvatarNameCache(const LLAvatarName& av_name) +{ + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + renameItem(av_name.getDisplayName()); + postEvent("update_session", this, NULL); +} + // // LLConversationItemParticipant // @@ -401,8 +461,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0), - mAvatarNameCacheConnection() + mDistToAgent(-1.0) { mDisplayName = display_name; mConvType = CONV_PARTICIPANT; @@ -412,38 +471,12 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLConversationItem(uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0), - mAvatarNameCacheConnection() + mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; } -LLConversationItemParticipant::~LLConversationItemParticipant() -{ - // Disconnect any previous avatar name cache connection to ensure - // that the callback method is not called after destruction - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } -} - -void LLConversationItemParticipant::fetchAvatarName() -{ - // Request the avatar name from the cache - llassert(getUUID().notNull()); - if (getUUID().notNull()) - { - // Disconnect any previous avatar name cache connection - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } - mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2)); - } -} - -void LLConversationItemParticipant::updateAvatarName() +void LLConversationItemParticipant::updateName() { llassert(getUUID().notNull()); if (getUUID().notNull()) @@ -451,29 +484,33 @@ void LLConversationItemParticipant::updateAvatarName() LLAvatarName av_name; if (LLAvatarNameCache::get(getUUID(),&av_name)) { - updateAvatarName(av_name); + updateName(av_name); } } } void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mAvatarNameCacheConnection.disconnect(); - updateAvatarName(av_name); + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + updateName(av_name); } -void LLConversationItemParticipant::updateAvatarName(const LLAvatarName& av_name) +void LLConversationItemParticipant::updateName(const LLAvatarName& av_name) { mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); - mNeedsRefresh = true; + renameItem(mDisplayName); if (mParent != NULL) { LLConversationItemSession* parent_session = dynamic_cast(mParent); if (parent_session != NULL) { parent_session->requestSort(); - parent_session->updateParticipantName(this); + parent_session->updateName(this); postEvent("update_participant", parent_session, this); } } -- cgit v1.2.3 From 4a96941b73254538c27a83fe28c637065e93f2e2 Mon Sep 17 00:00:00 2001 From: mberezhnoy Date: Mon, 28 Jan 2013 18:06:27 +0200 Subject: CHUI-395 (Group moderators are not shown as Moderators in group conversation) --- indra/newview/llconversationmodel.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a8da4908ce..7184a70db5 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -35,6 +35,7 @@ #include "llsdutil.h" #include "llconversationmodel.h" #include "llimview.h" //For LLIMModel +#include "lltrans.h" // // Conversation items : common behaviors @@ -461,6 +462,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), mIsModerator(false), + mDisplayModeratorLabel(false), mDistToAgent(-1.0) { mDisplayName = display_name; @@ -471,6 +473,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLConversationItem(uuid,root_view_model), mIsMuted(false), mIsModerator(false), + mDisplayModeratorLabel(false), mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; @@ -503,6 +506,12 @@ void LLConversationItemParticipant::updateName(const LLAvatarName& av_name) { mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); + + if (mDisplayModeratorLabel) + { + mDisplayName += " " + LLTrans::getString("IM_moderator_label"); + } + renameItem(mDisplayName); if (mParent != NULL) { @@ -541,6 +550,15 @@ void LLConversationItemParticipant::dumpDebugData() llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; } +void LLConversationItemParticipant::setDisplayModeratorRole(bool displayRole) +{ + if (displayRole != mDisplayModeratorLabel) + { + mDisplayModeratorLabel = displayRole; + updateName(); + } +} + // // LLConversationSort // -- cgit v1.2.3 From d2a17e20ca889851406f22907df35b17f5030279 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Thu, 31 Jan 2013 03:16:25 +0200 Subject: CHUI-612 FIXED Blank conversation names showing in conversation list --- indra/newview/llconversationmodel.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 7184a70db5..bfc564f407 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -37,6 +37,8 @@ #include "llimview.h" //For LLIMModel #include "lltrans.h" +#include + // // Conversation items : common behaviors // @@ -234,15 +236,19 @@ void LLConversationItemSession::updateName(LLConversationItemParticipant* partic } uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string - if (conversation_type == CONV_SESSION_AD_HOC) + if (conversation_type == CONV_SESSION_AD_HOC || conversation_type == CONV_SESSION_1_ON_1) { // Build a string containing the participants UUIDs (minus own agent) and check if ready for display (we don't want "(waiting)" in there) // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by // onAvatarNameCache() which is itself attached to the same event. - child_list_t::iterator iter = mChildren.begin(); - while (iter != mChildren.end()) + + // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself + // as we do not create participants for such a session. + + LLFolderViewModelItem * itemp; + BOOST_FOREACH(itemp, mChildren) { - LLConversationItemParticipant* current_participant = dynamic_cast(*iter); + LLConversationItem* current_participant = dynamic_cast(itemp); // Add the avatar uuid to the list (except if it's the own agent uuid) if (current_participant->getUUID() != gAgentID) { @@ -250,18 +256,13 @@ void LLConversationItemSession::updateName(LLConversationItemParticipant* partic if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) { temp_uuids.push_back(current_participant->getUUID()); + + if (conversation_type == CONV_SESSION_1_ON_1) + { + break; + } } } - iter++; - } - } - else if (conversation_type == CONV_SESSION_1_ON_1) - { - // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself - // as we do not create participants for such a session. - if (gAgentID != participant->getUUID()) - { - temp_uuids.push_back(participant->getUUID()); } } -- cgit v1.2.3 From 5a92a7700666f40883b72deed8429e7e06164623 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 12 Feb 2013 01:12:47 +0000 Subject: CHUI-740 FIX Incorrect option shown in group Moderator tools "Toggle mute this participant" Reverted changes in menu_conversation.xml, llconversationmodel.cpp, and llfloaterimcontainer.cpp --- indra/newview/llconversationmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index bfc564f407..0977056b2a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -151,7 +151,8 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32 items.push_back(std::string("Moderator Options")); items.push_back(std::string("AllowTextChat")); items.push_back(std::string("moderate_voice_separator")); - items.push_back(std::string("ModerateVoiceToggleMuteSelected")); + items.push_back(std::string("ModerateVoiceMuteSelected")); + items.push_back(std::string("ModerateVoiceUnMuteSelected")); items.push_back(std::string("ModerateVoiceMute")); items.push_back(std::string("ModerateVoiceUnmute")); } -- cgit v1.2.3 From 31e5465158db171a4ac6d3aa48d44e8a62c012f9 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 27 Feb 2013 01:35:27 +0200 Subject: CHUI-788 FIXED Mute icon not shown in participant list in conversation floater --- indra/newview/llconversationmodel.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0977056b2a..009fce0a92 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -322,7 +322,7 @@ void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_ LLConversationItemParticipant* participant = findParticipant(participant_id); if (participant) { - participant->setIsMuted(is_muted); + participant->muteVoice(is_muted); } } @@ -462,7 +462,6 @@ void LLConversationItemSession::onAvatarNameCache(const LLAvatarName& av_name) LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), - mIsMuted(false), mIsModerator(false), mDisplayModeratorLabel(false), mDistToAgent(-1.0) @@ -473,7 +472,6 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(uuid,root_view_model), - mIsMuted(false), mIsModerator(false), mDisplayModeratorLabel(false), mDistToAgent(-1.0) @@ -549,7 +547,7 @@ LLConversationItemSession* LLConversationItemParticipant::getParentSession() void LLConversationItemParticipant::dumpDebugData() { - llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; + llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << isVoiceMuted() << ", moderator = " << mIsModerator << llendl; } void LLConversationItemParticipant::setDisplayModeratorRole(bool displayRole) @@ -561,6 +559,29 @@ void LLConversationItemParticipant::setDisplayModeratorRole(bool displayRole) } } +bool LLConversationItemParticipant::isVoiceMuted() +{ + return LLMuteList::getInstance()->isMuted(mUUID, LLMute::flagVoiceChat); +} + +void LLConversationItemParticipant::muteVoice(bool mute_voice) +{ + std::string name; + gCacheName->getFullName(mUUID, name); + LLMuteList * mute_listp = LLMuteList::getInstance(); + bool voice_already_muted = mute_listp->isMuted(mUUID, name); + + LLMute mute(mUUID, name, LLMute::AGENT); + if (voice_already_muted && !mute_voice) + { + mute_listp->remove(mute); + } + else if (!voice_already_muted && mute_voice) + { + mute_listp->add(mute); + } +} + // // LLConversationSort // -- cgit v1.2.3