From e9048b17792b91e6bf8a05692d859ea9c94011d6 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 9 Nov 2009 17:13:37 +0000 Subject: Central-source the authoritative state of mic openness. --- indra/newview/llspeakbutton.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llspeakbutton.cpp') diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp index cd765b0338..312d7050b9 100644 --- a/indra/newview/llspeakbutton.cpp +++ b/indra/newview/llspeakbutton.cpp @@ -62,6 +62,15 @@ LLSpeakButton::Params::Params() // See widgets/talk_button.xml } +void LLSpeakButton::draw() +{ + // gVoiceClient is the authoritative global source of info regarding our open-mic state, we merely reflect that state. + bool openmic = gVoiceClient->getUserPTTState(); + mSpeakBtn->setToggleState(openmic); + llinfos << "mic state " << int(openmic) << llendl; + LLUICtrl::draw(); +} + LLSpeakButton::LLSpeakButton(const Params& p) : LLUICtrl(p) , mPrivateCallPanel(NULL) -- cgit v1.2.3 From 8b9c031f596280f79d06f688c2f654d7ec07a7d0 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 9 Nov 2009 17:51:21 +0000 Subject: Smarter mildly-refactored voice-toggle state management. --- indra/newview/llspeakbutton.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'indra/newview/llspeakbutton.cpp') diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp index 312d7050b9..b2c0fcdaf2 100644 --- a/indra/newview/llspeakbutton.cpp +++ b/indra/newview/llspeakbutton.cpp @@ -93,7 +93,8 @@ LLSpeakButton::LLSpeakButton(const Params& p) addChild(mSpeakBtn); LLTransientFloaterMgr::getInstance()->addControlView(mSpeakBtn); - mSpeakBtn->setClickedCallback(boost::bind(&LLSpeakButton::onClick_SpeakBtn, this)); + mSpeakBtn->setMouseDownCallback(boost::bind(&LLSpeakButton::onMouseDown_SpeakBtn, this)); + mSpeakBtn->setMouseUpCallback(boost::bind(&LLSpeakButton::onMouseUp_SpeakBtn, this)); mSpeakBtn->setToggleState(FALSE); LLButton::Params show_params = p.show_button; @@ -131,15 +132,15 @@ LLSpeakButton::~LLSpeakButton() { } -void LLSpeakButton::setSpeakBtnToggleState(bool state) +void LLSpeakButton::onMouseDown_SpeakBtn() { - mSpeakBtn->setToggleState(state); + bool down = true; + gVoiceClient->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk } - -void LLSpeakButton::onClick_SpeakBtn() +void LLSpeakButton::onMouseUp_SpeakBtn() { - bool speaking = mSpeakBtn->getToggleState(); - gVoiceClient->setUserPTTState(speaking); + bool down = false; + gVoiceClient->inputUserControlState(down); } void LLSpeakButton::onClick_ShowBtn() -- cgit v1.2.3 From 0777c177525c8ff2889e9cd5f06877de3c5f9f31 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 9 Nov 2009 17:54:40 +0000 Subject: remove debug spew. --- indra/newview/llspeakbutton.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llspeakbutton.cpp') diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp index b2c0fcdaf2..d441762fa6 100644 --- a/indra/newview/llspeakbutton.cpp +++ b/indra/newview/llspeakbutton.cpp @@ -67,7 +67,6 @@ void LLSpeakButton::draw() // gVoiceClient is the authoritative global source of info regarding our open-mic state, we merely reflect that state. bool openmic = gVoiceClient->getUserPTTState(); mSpeakBtn->setToggleState(openmic); - llinfos << "mic state " << int(openmic) << llendl; LLUICtrl::draw(); } -- cgit v1.2.3