diff options
author | callum <none@none> | 2011-10-11 15:33:43 -0700 |
---|---|---|
committer | callum <none@none> | 2011-10-11 15:33:43 -0700 |
commit | ecdcaf149b7def0e40898ac202539376a673c7b1 (patch) | |
tree | db0a507df37bf1e5bc0499dd065365aaba67e6a3 | |
parent | c1a9ca33b27f4e741eeacf781a09156009167ad3 (diff) |
FIX EXP-1302 Make the Speak button work as a toolbar button and
EXP-1324 Push to talk hot key doesn't change button state of speak button
-rw-r--r-- | indra/newview/app_settings/commands.xml | 4 | ||||
-rwxr-xr-x | indra/newview/llagent.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llagent.h | 4 |
3 files changed, 15 insertions, 20 deletions
diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 296d992b34..3625ce5088 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -215,9 +215,9 @@ icon="Command_Speak_Icon" label_ref="Command_Speak_Label" tooltip_ref="Command_Speak_Tooltip" - execute_function="Agent.ToggleMicrophone" + execute_function="Agent.PressMicrophone" execute_parameters="speak" - execute_stop_function="" + execute_stop_function="Agent.ReleaseMicrophone" execute_stop_parameters="speak" is_enabled_function="Agent.IsActionAllowed" is_enabled_parameters="speak" diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 8303a5942d..31a73c8c31 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -188,28 +188,23 @@ bool LLAgent::isActionAllowed(const LLSD& sdname) } // static -void LLAgent::toggleMicrophone(const LLSD& name) +void LLAgent::pressMicrophone(const LLSD& name) { - gAgent.mMicrophoneOn = ! gAgent.mMicrophoneOn; + LLFirstUse::speak(false); - if ( gAgent.mMicrophoneOn ) - { - LLFirstUse::speak(false); + LLVoiceClient::getInstance()->inputUserControlState(true); +} - LLVoiceClient::getInstance()->inputUserControlState(true); - LLVoiceClient::getInstance()->inputUserControlState(false); - } - else - { - LLVoiceClient::getInstance()->inputUserControlState(false); - LLVoiceClient::getInstance()->inputUserControlState(true); - } +// static +void LLAgent::releaseMicrophone(const LLSD& name) +{ + LLVoiceClient::getInstance()->inputUserControlState(false); } // static bool LLAgent::isMicrophoneOn(const LLSD& sdname) { - return gAgent.mMicrophoneOn; + return LLVoiceClient::getInstance()->getUserPTTState(); } // ************************************************************ @@ -294,7 +289,6 @@ LLAgent::LLAgent() : mGenderChosen(FALSE), mVoiceConnected(false), - mMicrophoneOn(false), mAppearanceSerialNum(0), @@ -314,7 +308,8 @@ LLAgent::LLAgent() : LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); - LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 0355e68b6e..0f7ed9ce68 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -290,12 +290,12 @@ public: bool isVoiceConnected() const { return mVoiceConnected; } void setVoiceConnected(const bool b) { mVoiceConnected = b; } - static void toggleMicrophone(const LLSD& name); + static void pressMicrophone(const LLSD& name); + static void releaseMicrophone(const LLSD& name); static bool isMicrophoneOn(const LLSD& sdname); private: bool mVoiceConnected; - bool mMicrophoneOn; //-------------------------------------------------------------------- // Chat |