From 5fe3675564f1c7d8cf13e94f43d32be5ea45940b Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 29 Apr 2011 15:53:14 -0700 Subject: EXP-761, EXP-758 --- indra/newview/llbottomtray.cpp | 42 +++++++++++++++------- indra/newview/llspeakbutton.cpp | 20 ----------- indra/newview/llspeakbutton.h | 5 --- .../skins/minimal/xui/en/panel_bottomtray.xml | 2 +- 4 files changed, 30 insertions(+), 39 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 0371b7be71..6d40786b08 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -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("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("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("speak_panel"); - mSpeakBtn = getChild("talk"); - LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle()); + mSpeakBtn = findChild("talk"); + if (mSpeakBtn) + { + LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle()); + + // Localization tool doesn't understand custom buttons like + 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("speak_btn")->setEnabled(false); + getChild("speak_flyout_btn")->setEnabled(false); - // Localization tool doesn't understand custom buttons like - 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("show_help_btn")->setToggleState(help_floater_visible); + bool openmic = LLVoiceClient::getInstance()->getUserPTTState(); + bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled(); + getChild("speak_btn")->setToggleState(openmic && voiceenabled); + getChild("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) { diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp index d52e0a6c86..d3e96f8dfb 100644 --- a/indra/newview/llspeakbutton.cpp +++ b/indra/newview/llspeakbutton.cpp @@ -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("speak_btn"); - speak_btn->setEnabled(enabled); -} -void LLSpeakButton::setFlyoutBtnEnabled(bool enabled) -{ - LLButton* show_btn = getChild("speak_flyout_btn"); - show_btn->setEnabled(enabled); -} - LLSpeakButton::LLSpeakButton(const Params& p) : LLUICtrl(p) , mOutputMonitor(NULL) diff --git a/indra/newview/llspeakbutton.h b/indra/newview/llspeakbutton.h index 2fdf80c1f2..7db01112ef 100644 --- a/indra/newview/llspeakbutton.h +++ b/indra/newview/llspeakbutton.h @@ -53,12 +53,7 @@ public: }; /*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); diff --git a/indra/newview/skins/minimal/xui/en/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/en/panel_bottomtray.xml index aff22c7e45..49eead5079 100644 --- a/indra/newview/skins/minimal/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/minimal/xui/en/panel_bottomtray.xml @@ -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"> -- cgit v1.2.3