[Voice Update] Fix the current voice chat button

If the current voice chat's floater is undocked, grab it by session id so that it's not labeled blank
When the button is clicked, open the current voice chat floater, not the communications floater, this is the intended action.. how it should have acted in the first place.
This commit is contained in:
Lirusaito
2013-06-09 11:32:51 -04:00
parent cbfa47c0da
commit cc107c55cd

View File

@@ -158,13 +158,17 @@ void LLVoiceRemoteCtrl::draw()
}
LLFloater* voice_floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater();
LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel();
if (!voice_floater) // Maybe it's undocked
{
voice_floater = gIMMgr->findFloaterBySession(current_channel->getSessionID());
}
std::string active_channel_name;
if (voice_floater)
{
active_channel_name = voice_floater->getShortTitle();
}
LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel();
if (LLButton* end_call_btn = findChild<LLButton>("end_call_btn"))
end_call_btn->setEnabled(LLVoiceClient::getInstance()->voiceEnabled()
&& current_channel
@@ -290,5 +294,16 @@ void LLVoiceRemoteCtrl::onClickSpeakers()
//static
void LLVoiceRemoteCtrl::onClickVoiceChannel()
{
LLFloaterChatterBox::showInstance();
if (LLFloater* floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater())
{
if (LLMultiFloater* mf = floater->getHost()) // Docked
mf->showFloater(floater);
else // Probably only local chat
floater->open();
}
else if (LLVoiceChannel* chan = LLVoiceChannel::getCurrentVoiceChannel()) // Detached chat floater
{
if (LLFloaterIMPanel* floater = gIMMgr->findFloaterBySession(chan->getSessionID()))
floater->open();
}
}