diff options
author | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-10-31 17:51:55 +0200 |
---|---|---|
committer | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-10-31 17:51:55 +0200 |
commit | a8ca9dc5a98d0bd99581d17be45a36c602ce87fd (patch) | |
tree | a951c1c95e0c9a6b0f2ced39f6614753dfc78368 /indra/newview | |
parent | ec57bd2f8e2859787b274c118fabbc19f76e04b1 (diff) |
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
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llchicletbar.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llimconversation.cpp | 49 | ||||
-rw-r--r-- | indra/newview/llimconversation.h | 11 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llimfloater.h | 1 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llnearbychat.h | 5 |
8 files changed, 70 insertions, 74 deletions
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<LLNearbyChat>("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<LLView> mPopupMenuHandle; std::vector<LLChat> mMessageArchive; - bool mIsHostSet; }; #endif |