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/llimfloatercontainer.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f46ecd905a..00ae0b8fd8 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -358,16 +358,7 @@ void LLIMFloaterContainer::processParticipantsStyleUpdate() { LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); // Get the avatar name for this participant id from the cache and update the model - LLUUID participant_id = participant_model->getUUID(); - LLAvatarName av_name; - LLAvatarNameCache::get(participant_id,&av_name); - // Avoid updating the model though if the cache is still waiting for its first update - if (!av_name.mDisplayName.empty()) - { - participant_model->onAvatarNameCache(av_name); - } - // Bind update to the next cache name signal - LLAvatarNameCache::get(participant_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant_model, _2)); + participant_model->fetchAvatarName(); // Next participant current_participant_model++; } -- cgit v1.3 From a8ca9dc5a98d0bd99581d17be45a36c602ce87fd Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 31 Oct 2012 17:51:55 +0200 Subject: CHUI-374 ADD. FIX, CHUI-442 FIXED (Nearby chat is torn off and cannot be docked if nearby chat is received while conversation floater is closed) - implement. lazy creating of container --- indra/newview/llchicletbar.cpp | 2 +- indra/newview/llimconversation.cpp | 49 ++++++++++++++++++++++++++++++++++ indra/newview/llimconversation.h | 11 ++++++++ indra/newview/llimfloater.cpp | 34 ++--------------------- indra/newview/llimfloater.h | 1 - indra/newview/llimfloatercontainer.cpp | 8 +++--- indra/newview/llnearbychat.cpp | 34 ++--------------------- indra/newview/llnearbychat.h | 5 +--- 8 files changed, 70 insertions(+), 74 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index 39f5d0b8f6..3ebb83b336 100644 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -97,7 +97,7 @@ void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& nam // Do not spawn chiclet when using the new multitab conversation UI if (LLIMConversation::isChatMultiTab()) { - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); return; } diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 74bf8cb6fe..b687e18cae 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -116,6 +116,55 @@ LLIMConversation* LLIMConversation::getConversation(const LLUUID& uuid) return conv; }; +void LLIMConversation::setVisible(BOOL visible) +{ + LLTransientDockableFloater::setVisible(visible); + + if(visible) + { + LLIMConversation::addToHost(mSessionID); + } + setFocus(visible); +} + + + +void LLIMConversation::addToHost(const LLUUID& session_id) +{ + if ((session_id.notNull() && !gIMMgr->hasSession(session_id)) + || !LLIMConversation::isChatMultiTab()) + { + return; + } + + // Get the floater: this will create the instance if it didn't exist + LLIMConversation* conversp = LLIMConversation::getConversation(session_id); + if (conversp) + { + LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); + + // Do not add again existing floaters + if (floater_container && !conversp->isHostAttached()) + { + conversp->setHostAttached(true); + + if (!conversp->isNearbyChat() + || gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) + { + floater_container->addFloater(conversp, TRUE, LLTabContainer::END); + } + else + { + // setting of the "potential" host for Nearby Chat: this sequence sets + // LLFloater::mHostHandle = NULL (a current host), but + // LLFloater::mLastHostHandle = floater_container (a "future" host) + conversp->setHost(floater_container); + conversp->setHost(NULL); + } + + } + } +} BOOL LLIMConversation::postBuild() { diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 603e0d0197..bff4cb4a31 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -59,17 +59,27 @@ public: */ static bool isChatMultiTab(); + // add conversation to container + static void addToHost(const LLUUID& session_id); + + bool isHostAttached() {return mIsHostAttached;} + void setHostAttached(bool is_attached) {mIsHostAttached = is_attached;} + static LLIMConversation* findConversation(const LLUUID& uuid); static LLIMConversation* getConversation(const LLUUID& uuid); // show/hide the translation check box void showTranslationCheckbox(const BOOL visible = FALSE); + bool isNearbyChat() {return mIsNearbyChat;} + // LLFloater overrides /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL postBuild(); /*virtual*/ void draw(); + /*virtual*/ void setVisible(BOOL visible); + protected: @@ -139,6 +149,7 @@ private: void reshapeChatHistory(); bool checkIfTornOff(); + bool mIsHostAttached; LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called. }; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1af5def5f0..3545b8ff18 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -582,37 +582,6 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } -void LLIMFloater::addToHost(const LLUUID& session_id) -{ - if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) - { - return; - } - - // Test the existence of the floater before we try to create it - bool exist = findInstance(session_id); - - // Get the floater: this will create the instance if it didn't exist - LLIMFloater* floater = getInstance(session_id); - if (floater) - { - - LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - - // Do not add again existing floaters - if (!exist) - { - // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists - LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; - if (floater_container) - { - floater_container->addFloater(floater, FALSE, i_pt); - } - } - } -} - //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) @@ -721,7 +690,7 @@ void LLIMFloater::setVisible(BOOL visible) (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - LLTransientDockableFloater::setVisible(visible); + LLIMConversation::setVisible(visible); // update notification channel state if(channel) @@ -1309,6 +1278,7 @@ void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) floater->removeTypingIndicator(); } +// static void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) { LLIMFloater::addToHost(session_id); diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 8a0d6f10e0..6c69ed3462 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -72,7 +72,6 @@ public: static LLIMFloater* findInstance(const LLUUID& session_id); static LLIMFloater* getInstance(const LLUUID& session_id); - static void addToHost(const LLUUID& session_id); // LLFloater overrides /*virtual*/ void onClose(bool app_quitting); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 00ae0b8fd8..65dc024aea 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,7 +98,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); addConversationListItem(session_id); } @@ -109,7 +109,7 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::addToHost(session_id); + LLIMConversation::addToHost(session_id); addConversationListItem(session_id); } @@ -490,9 +490,9 @@ void LLIMFloaterContainer::setVisible(BOOL visible) } nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); - if (nearby_chat && !nearby_chat->isHostSet()) + if (nearby_chat) { - nearby_chat->addToHost(); + LLIMConversation::addToHost(LLUUID()); } // We need to show/hide all the associated conversations that have been torn off diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 5b274dd389..d1c7c6bfd7 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -91,8 +91,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd) : LLIMConversation(llsd), //mOutputMonitor(NULL), mSpeakerMgr(NULL), - mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT), - mIsHostSet(false) + mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) { mIsP2PChat = false; mIsNearbyChat = true; @@ -283,7 +282,7 @@ void LLNearbyChat::setFocus(BOOL focusFlag) } -void LLNearbyChat::setVisible(BOOL visible) +void LLNearbyChat::setVisible(BOOL visible) { LLIMConversation::setVisible(visible); @@ -304,35 +303,6 @@ void LLNearbyChat::onTearOffClicked() gSavedSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater); } -void LLNearbyChat::addToHost() -{ - if ( LLIMConversation::isChatMultiTab()) - { - LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - if (im_box) - { - if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) - { - im_box->addFloater(this, TRUE, LLTabContainer::END); - } - else - { - // setting of the "potential" host: this sequence sets - // LLFloater::mHostHandle = NULL (a current host), but - // LLFloater::mLastHostHandle = im_box (a "future" host) - setHost(im_box); - setHost(NULL); - } - } - - mIsHostSet = true; - } - } - -bool LLNearbyChat::isHostSet() -{ - return mIsHostSet; -} // virtual void LLNearbyChat::onOpen(const LLSD& key) diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 7ada4daea8..b155fd3c26 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -53,7 +53,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void setFocus(BOOL focusFlag); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(BOOL visible); void loadHistory(); void reloadMessages(); @@ -78,8 +78,6 @@ public: static void startChat(const char* line); static void stopChat(); - bool isHostSet(); - static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); @@ -121,7 +119,6 @@ private: LLHandle mPopupMenuHandle; std::vector mMessageArchive; - bool mIsHostSet; }; #endif -- cgit v1.3 From 424a80155ac755bc0191ddd44ef125bdbda39fa5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 1 Nov 2012 16:58:55 +0200 Subject: CHUI-445 FIXED Select the next conversation in the list when current conversation is deleted --- indra/newview/llimfloatercontainer.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'indra/newview/llimfloatercontainer.cpp') diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 65dc024aea..f85aa9a353 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -1206,6 +1206,7 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener bool isWidgetSelected = false; + LLFolderViewItem* new_selection = NULL; conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(uuid); if (widget_it != mConversationsWidgets.end()) { @@ -1213,6 +1214,11 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c if (widget) { isWidgetSelected = widget->isSelected(); + new_selection = mConversationsRoot->getNextFromChild(widget); + if(new_selection == NULL) + { + new_selection = mConversationsRoot->getPreviousFromChild(widget); + } widget->destroyView(); } } @@ -1225,12 +1231,13 @@ bool LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c if (change_focus) { setFocus(TRUE); - conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); - if (widget_it != mConversationsWidgets.end()) + if(new_selection != NULL) { - mSelectedSession = widget_it->first; - LLFolderViewItem* widget = widget_it->second; - widget->selectItem(); + LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); + if(vmi != NULL) + { + selectConversation(vmi->getUUID()); + } } } return isWidgetSelected; -- cgit v1.3