Skip to content
Snippets Groups Projects
Commit 213985ca authored by callum's avatar callum
Browse files

EXP-1302 PARTIAL Make the Speak button work as a toolbar button

First pass - no Push-To-Talk functionality.
parent ec5ea33c
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
......@@ -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.
......
......@@ -282,7 +282,21 @@ class LLAgent : public LLOldEvents::LLObservable
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
//--------------------------------------------------------------------
......
......@@ -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)
......
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