From 8c64fbf1b76e46fa3f5a8f8c6baba30d4583b7ec Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 6 Nov 2012 18:32:45 -0800 Subject: CHUI-468 : WIP : More cleanup and fix of the participants sorting in LLIMConversation --- indra/newview/llimconversation.cpp | 22 ++++++---------------- indra/newview/llimconversation.h | 5 ++--- indra/newview/llimfloatercontainer.cpp | 13 +++++++++++++ indra/newview/llimfloatercontainer.h | 1 + indra/newview/llparticipantlist.cpp | 9 --------- indra/newview/llparticipantlist.h | 1 - 6 files changed, 22 insertions(+), 29 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index f91c25ef8c..fb247b4604 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -166,7 +166,8 @@ void LLIMConversation::addToHost(const LLUUID& session_id) conversp->setHost(floater_container); conversp->setHost(NULL); } - + // Added floaters share some state (like sort order) with their host + conversp->setSortOrder(floater_container->getSortOrder()); } } } @@ -483,22 +484,11 @@ LLConversationViewParticipant* LLIMConversation::createConversationViewParticipa return LLUICtrlFactory::create(params); } -void LLIMConversation::onSortMenuItemClicked(const LLSD& userdata) +void LLIMConversation::setSortOrder(const LLConversationSort& order) { - // *TODO: Check this code when sort order menu will be added. (EM) - /* - if (!getParticipantList()) - { - return; - } - - std::string chosen_item = userdata.asString(); - - if (chosen_item == "sort_name") - { - getParticipantList()->setSortOrder(LLParticipantList::E_SORT_BY_NAME); - } - */ + mConversationViewModel.setSorter(order); + mConversationsRoot->arrangeAll(); + refreshConversation(); } void LLIMConversation::onIMSessionMenuItemClicked(const LLSD& userdata) diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index ff248d97ff..edcae5e45d 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -89,7 +89,8 @@ public: void refreshConversation(); void buildConversationViewParticipant(); - + void setSortOrder(const LLConversationSort& order); + protected: // callback for click on any items of the visual states menu @@ -107,8 +108,6 @@ protected: // refresh a visual state of the Call button void updateCallBtnState(bool callIsActive); - void onSortMenuItemClicked(const LLSD& userdata); - void hideOrShowTitle(); // toggle the floater's drag handle void hideAllStandardButtons(); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index e6657260e6..4b992a2e0f 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -764,6 +764,19 @@ void LLIMFloaterContainer::setSortOrder(const LLConversationSort& order) mConversationsRoot->arrangeAll(); // try to keep selection onscreen, even if it wasn't to start with mConversationsRoot->scrollToShowSelection(); + + // Notify all conversation (torn off or not) of the change to the sort order + // Note: For the moment, the sort order is *unique* across all conversations. That might change in the future. + for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) + { + LLUUID session_id = it_session->first; + LLIMConversation *conversation_floater = (session_id.isNull() ? (LLIMConversation*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLIMConversation*)(LLIMFloater::findInstance(session_id))); + if (conversation_floater) + { + conversation_floater->setSortOrder(order); + } + } + gSavedSettings.setU32("ConversationSortOrder", (U32)order); } diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index a6f8677e46..5ae3f9f1d4 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -92,6 +92,7 @@ public: LLUUID getSelectedSession() { return mSelectedSession; } void setSelectedSession(LLUUID sessionID) { mSelectedSession = sessionID; } LLConversationItem* getSessionModel(const LLUUID& session_id) { return get_ptr_in_map(mConversationsItems,session_id); } + LLConversationSort& getSortOrder() { return mConversationViewModel.getSorter(); } private: typedef std::map avatarID_panel_map_t; diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 6afcf21348..e6eef56628 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -302,15 +302,6 @@ LLParticipantList::~LLParticipantList() delete mAvalineUpdater; } -/* -void LLParticipantList::setSpeakingIndicatorsVisible(BOOL visible) -{ - if (mAvatarList) - { - mAvatarList->setSpeakingIndicatorsVisible(visible); - } -} -*/ /* void LLParticipantList::onAvatarListDoubleClicked(LLUICtrl* ctrl) { diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 97e06dcfea..f4469b03f4 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -49,7 +49,6 @@ public: bool exclude_agent = true, bool can_toggle_icons = true); ~LLParticipantList(); -// void setSpeakingIndicatorsVisible(BOOL visible); enum EParticipantSortOrder { -- cgit v1.2.3