diff options
author | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-08-15 20:10:00 +0300 |
---|---|---|
committer | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-08-15 20:10:00 +0300 |
commit | 3a21eb59f1cf0b7672e2beb671e1dbc717e28b3f (patch) | |
tree | cba0242f33dad84ff8775c538b90e2eac9a357b7 /indra/newview | |
parent | c234ef4b3a1ab22132512958c324e5f796912144 (diff) |
CHUI-286 (Conversations floater opened by default when a new IM session is started (no IM toast shown): now floater silently adds itself to the container
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llimconversation.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 91 | ||||
-rw-r--r-- | indra/newview/llimfloater.h | 1 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 1 |
5 files changed, 50 insertions, 52 deletions
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index ec25583c8f..4ca9476458 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -153,6 +153,7 @@ void LLIMConversation::draw() } refresh(); + updateHeaderAndToolbar(); // Restart the refresh timer mRefreshTimer->setTimerExpirySec(REFRESH_INTERVAL); @@ -265,7 +266,7 @@ void LLIMConversation::hideAllStandardButtons() void LLIMConversation::updateHeaderAndToolbar() { - bool is_torn_off = isTornOff(); + bool is_torn_off = !getHost(); if (!is_torn_off) { hideAllStandardButtons(); diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 6a1437f318..cdd5ba6889 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -128,7 +128,7 @@ void LLIMFloater::onClickCloseBtn() if (session == NULL) { - llwarns << "Empty session." << llendl; + llwarns << "Empty session with id: " << (mSessionID.asString()) << llendl; return; } @@ -250,7 +250,7 @@ void LLIMFloater::initIMSession(const LLUUID& session_id) mSession = LLIMModel::getInstance()->findIMSession(mSessionID); if (mSession) -{ + { mIsP2PChat = mSession->isP2PSessionType(); mSessionInitialized = mSession->mSessionInitialized; @@ -593,38 +593,19 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } //static -LLIMFloater* LLIMFloater::show(const LLUUID& session_id) +LLIMFloater* LLIMFloater::addToIMContainer(const LLUUID& session_id) { - closeHiddenIMToasts(); - if (!gIMMgr->hasSession(session_id)) return NULL; - if(!isChatMultiTab()) - { - //hide all - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); - iter != inst_list.end(); ++iter) - { - LLIMFloater* floater = dynamic_cast<LLIMFloater*>(*iter); - if (floater && floater->isDocked()) - { - floater->setVisible(false); - } - } - } - // 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) - return NULL; - - if(isChatMultiTab()) + if (floater) { + LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); // Do not add again existing floaters @@ -639,33 +620,51 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) } } - floater->openFloater(floater->getKey()); + if (floater_container && floater_container->getVisible()) + { + floater->openFloater(floater->getKey()); + floater->setVisible(TRUE); + } + else + { + floater->setVisible(FALSE); + } } - else - { - // Docking may move chat window, hide it before moving, or user will see how window "jumps" - floater->setVisible(false); + return floater; +} - if (floater->getDockControl() == NULL) - { - LLChiclet* chiclet = - LLChicletBar::getInstance()->getChicletPanel()->findChiclet<LLChiclet>( - session_id); - if (chiclet == NULL) - { - llerror("Dock chiclet for LLIMFloater doesn't exists", 0); - } - else - { - LLChicletBar::getInstance()->getChicletPanel()->scrollToChiclet(chiclet); - } +//static +LLIMFloater* LLIMFloater::show(const LLUUID& session_id) +{ + closeHiddenIMToasts(); - floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(), - LLDockControl::BOTTOM)); - } + if (!gIMMgr->hasSession(session_id)) + return NULL; - // window is positioned, now we can show it. + // 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) + return NULL; + + 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, TRUE, i_pt); + } } + + floater->openFloater(floater->getKey()); + floater->setVisible(TRUE); return floater; diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 434613ff43..d528c77e8d 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -78,6 +78,7 @@ public: /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); // Make IM conversion visible and update the message history static LLIMFloater* show(const LLUUID& session_id); + static LLIMFloater* addToIMContainer(const LLUUID& session_id); // Toggle panel specified by session_id // Returns true iff panel became visible diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index fe47e03beb..bcad7adcce 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -75,13 +75,13 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - LLIMFloater::show(session_id); + LLIMFloater::addToIMContainer(session_id); addConversationListItem(session_id); } void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::show(session_id); + LLIMFloater::addToIMContainer(session_id); addConversationListItem(session_id); } @@ -93,8 +93,6 @@ void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) { - LLIMFloater* floaterp = LLIMFloater::findInstance(session_id); - LLFloater::onClickClose(floaterp); removeConversationListItem(session_id); } diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index fa8e423056..e1454fb5dc 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -183,7 +183,6 @@ BOOL LLNearbyChat::postBuild() // virtual void LLNearbyChat::refresh() { - updateHeaderAndToolbar(); displaySpeakingIndicator(); updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState()); |