Skip to content
Snippets Groups Projects
Commit 5fe36755 authored by Leyla Farazha's avatar Leyla Farazha
Browse files

EXP-761, EXP-758

parent 31496167
No related branches found
No related tags found
No related merge requests found
......@@ -378,12 +378,13 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b
}
// We have to enable/disable right and left parts of speak button separately (EXT-4648)
mSpeakBtn->setSpeakBtnEnabled(enable);
getChild<LLButton>("speak_btn")->setEnabled(enable);
// skipped to avoid button blinking
if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL)
{
bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
mSpeakBtn->setFlyoutBtnEnabled(voice_status);
getChild<LLButton>("speak_flyout_btn")->setEnabled(voice_status);
if (voice_status)
{
LLFirstUse::speak(true);
......@@ -566,17 +567,21 @@ BOOL LLBottomTray::postBuild()
setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));
mSpeakPanel = getChild<LLPanel>("speak_panel");
mSpeakBtn = getChild<LLSpeakButton>("talk");
LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle());
mSpeakBtn = findChild<LLSpeakButton>("talk");
if (mSpeakBtn)
{
LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle());
// Localization tool doesn't understand custom buttons like <talk_button>
mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") );
mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") );
}
// Both parts of speak button should be initially disabled because
// it takes some time between logging in to world and connecting to voice channel.
mSpeakBtn->setSpeakBtnEnabled(false);
mSpeakBtn->setFlyoutBtnEnabled(false);
getChild<LLButton>("speak_btn")->setEnabled(false);
getChild<LLButton>("speak_flyout_btn")->setEnabled(false);
// Localization tool doesn't understand custom buttons like <talk_button>
mSpeakBtn->setSpeakToolTip( getString("SpeakBtnToolTip") );
mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") );
// Registering Chat Bar to receive Voice client status change notifications.
LLVoiceClient::getInstance()->addObserver(this);
......@@ -872,6 +877,10 @@ void LLBottomTray::draw()
getChild<LLButton>("show_help_btn")->setToggleState(help_floater_visible);
bool openmic = LLVoiceClient::getInstance()->getUserPTTState();
bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled();
getChild<LLButton>("speak_btn")->setToggleState(openmic && voiceenabled);
getChild<LLOutputMonitorCtrl>("chat_zone_indicator")->setIsMuted(!voiceenabled);
}
......@@ -1345,7 +1354,11 @@ void LLBottomTray::processShrinkButtons(S32& required_width, S32& buttons_freed_
if (possible_shrink_width > 0)
{
mSpeakBtn->setLabelVisible(false);
if (mSpeakBtn)
{
mSpeakBtn->setLabelVisible(false);
}
mSpeakPanel->reshape(panel_width - possible_shrink_width, mSpeakPanel->getRect().getHeight());
required_width += possible_shrink_width;
......@@ -1442,10 +1455,13 @@ void LLBottomTray::processExtendButtons(S32& available_width)
S32 possible_extend_width = panel_max_width - panel_width;
if (possible_extend_width >= 0 && possible_extend_width <= available_width + available_width_chiclet) // HACK: this button doesn't change size so possible_extend_width will be 0
{
mSpeakBtn->setLabelVisible(true);
{
if (mSpeakBtn)
{
mSpeakBtn->setLabelVisible(true);
}
mSpeakPanel->reshape(panel_max_width, mSpeakPanel->getRect().getHeight());
log(mSpeakBtn, "speak button is extended");
if( available_width > possible_extend_width)
{
......
......@@ -54,26 +54,6 @@ LLSpeakButton::Params::Params()
// See widgets/talk_button.xml
}
void LLSpeakButton::draw()
{
// LLVoiceClient::getInstance() is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
bool openmic = LLVoiceClient::getInstance()->getUserPTTState();
bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled();
mSpeakBtn->setToggleState(openmic && voiceenabled);
mOutputMonitor->setIsMuted(!voiceenabled);
LLUICtrl::draw();
}
void LLSpeakButton::setSpeakBtnEnabled(bool enabled)
{
LLButton* speak_btn = getChild<LLButton>("speak_btn");
speak_btn->setEnabled(enabled);
}
void LLSpeakButton::setFlyoutBtnEnabled(bool enabled)
{
LLButton* show_btn = getChild<LLBottomtrayButton>("speak_flyout_btn");
show_btn->setEnabled(enabled);
}
LLSpeakButton::LLSpeakButton(const Params& p)
: LLUICtrl(p)
, mOutputMonitor(NULL)
......
......@@ -53,12 +53,7 @@ class LLSpeakButton : public LLUICtrl
};
/*virtual*/ ~LLSpeakButton();
/*virtual*/ void draw();
// methods for enabling/disabling right and left parts of speak button separately(EXT-4648)
void setSpeakBtnEnabled(bool enabled);
void setFlyoutBtnEnabled(bool enabled);
// *HACK: Need to put tooltips in a translatable location,
// the panel that contains this button.
void setSpeakToolTip(const std::string& msg);
......
......@@ -105,7 +105,7 @@
min_height="28"
min_width="20"
mouse_opaque="false"
name="flyout_panel"
name="speak_flyout_panel"
top_delta="0"
user_resize="false"
width="20">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment