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

meow-7.2.2
AlexanderP ProductEngine 2012-08-15 20:10:00 +03:00
parent c234ef4b3a
commit 3a21eb59f1
5 changed files with 52 additions and 54 deletions

View File

@ -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();

View File

@ -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());
}
else
{
// Docking may move chat window, hide it before moving, or user will see how window "jumps"
floater->setVisible(false);
if (floater->getDockControl() == NULL)
if (floater_container && floater_container->getVisible())
{
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);
}
floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(),
LLDockControl::BOTTOM));
floater->openFloater(floater->getKey());
floater->setVisible(TRUE);
}
else
{
floater->setVisible(FALSE);
}
// window is positioned, now we can show it.
}
return floater;
}
//static
LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
{
closeHiddenIMToasts();
if (!gIMMgr->hasSession(session_id))
return NULL;
// 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;

View File

@ -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

View File

@ -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);
}

View File

@ -183,7 +183,6 @@ BOOL LLNearbyChat::postBuild()
// virtual
void LLNearbyChat::refresh()
{
updateHeaderAndToolbar();
displaySpeakingIndicator();
updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState());