summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/commands.xml4
-rwxr-xr-xindra/newview/llagent.cpp38
-rw-r--r--indra/newview/llagent.h16
-rw-r--r--indra/newview/llbottomtray.cpp3
4 files changed, 57 insertions, 4 deletions
diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml
index dab57d44bd..139eabcae4 100644
--- a/indra/newview/app_settings/commands.xml
+++ b/indra/newview/app_settings/commands.xml
@@ -207,11 +207,11 @@
icon="Command_Speak_Icon"
label_ref="Command_Speak_Label"
tooltip_ref="Command_Speak_Tooltip"
- execute_function="Floater.ToolbarToggle"
+ execute_function="Agent.ToggleMicrophone"
execute_parameters="speak"
is_enabled_function="Agent.IsActionAllowed"
is_enabled_parameters="speak"
- is_running_function="Floater.IsOpen"
+ is_running_function="Agent.IsMicrophoneOn"
is_running_parameters="speak"
/>
<command name="view"
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index ed29ac7960..8303a5942d 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -174,12 +174,43 @@ bool LLAgent::isActionAllowed(const LLSD& sdname)
}
else if (param == "speak")
{
- retval = true;
+ if ( gAgent.isVoiceConnected() )
+ {
+ retval = true;
+ }
+ else
+ {
+ retval = false;
+ }
}
return retval;
}
+// static
+void LLAgent::toggleMicrophone(const LLSD& name)
+{
+ gAgent.mMicrophoneOn = ! gAgent.mMicrophoneOn;
+
+ if ( gAgent.mMicrophoneOn )
+ {
+ LLFirstUse::speak(false);
+
+ LLVoiceClient::getInstance()->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(false);
+ }
+ else
+ {
+ LLVoiceClient::getInstance()->inputUserControlState(false);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
+ }
+}
+
+// static
+bool LLAgent::isMicrophoneOn(const LLSD& sdname)
+{
+ return gAgent.mMicrophoneOn;
+}
// ************************************************************
// Enabled this definition to compile a 'hacked' viewer that
@@ -261,6 +292,9 @@ LLAgent::LLAgent() :
mCurrentFidget(0),
mFirstLogin(FALSE),
mGenderChosen(FALSE),
+
+ mVoiceConnected(false),
+ mMicrophoneOn(false),
mAppearanceSerialNum(0),
@@ -280,6 +314,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::EnableCallbackRegistry::currentRegistrar().add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2));
}
// Requires gSavedSettings to be initialized.
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 1775a0235c..0355e68b6e 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -282,7 +282,21 @@ public:
static void toggleFlying();
static bool enableFlying();
BOOL canFly(); // Does this parcel allow you to fly?
-
+
+ //--------------------------------------------------------------------
+ // Voice
+ //--------------------------------------------------------------------
+public:
+ bool isVoiceConnected() const { return mVoiceConnected; }
+ void setVoiceConnected(const bool b) { mVoiceConnected = b; }
+
+ static void toggleMicrophone(const LLSD& name);
+ static bool isMicrophoneOn(const LLSD& sdname);
+
+private:
+ bool mVoiceConnected;
+ bool mMicrophoneOn;
+
//--------------------------------------------------------------------
// Chat
//--------------------------------------------------------------------
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 98712f1334..af91702f9b 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -387,6 +387,9 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b
if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL)
{
bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+
+ gAgent.setVoiceConnected(voice_status);
+
getChild<LLButton>("speak_flyout_btn")->setEnabled(voice_status);
gMenuBarView->getChild<LLView>("Nearby Voice")->setEnabled(voice_status);
if (voice_status)