Modernize the voice remote some.

This commit is contained in:
Lirusaito
2018-07-15 12:09:47 -04:00
parent 172eee49e5
commit e31c088470
4 changed files with 7 additions and 45 deletions

View File

@@ -49,14 +49,7 @@ LLVoiceRemoteCtrl::LLVoiceRemoteCtrl (const std::string& name) : LLPanel(name)
{ {
setIsChrome(TRUE); setIsChrome(TRUE);
if (gSavedSettings.getBOOL("ShowVoiceChannelPopup")) LLUICtrlFactory::getInstance()->buildPanel(this, gSavedSettings.getBOOL("ShowVoiceChannelPopup") ? "panel_voice_remote_expanded.xml" : "panel_voice_remote.xml");
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_voice_remote_expanded.xml");
}
else
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_voice_remote.xml");
}
setFocusRoot(TRUE); setFocusRoot(TRUE);
} }
@@ -73,7 +66,6 @@ BOOL LLVoiceRemoteCtrl::postBuild()
mTalkBtn->setMouseUpCallback(boost::bind(&LLVoiceRemoteCtrl::onBtnTalkReleased)); mTalkBtn->setMouseUpCallback(boost::bind(&LLVoiceRemoteCtrl::onBtnTalkReleased));
mTalkLockBtn = getChild<LLButton>("ptt_lock"); mTalkLockBtn = getChild<LLButton>("ptt_lock");
mTalkLockBtn->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onBtnLock,this));
mSpeakersBtn = getChild<LLButton>("speakers_btn"); mSpeakersBtn = getChild<LLButton>("speakers_btn");
mSpeakersBtn->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onClickSpeakers)); mSpeakersBtn->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onClickSpeakers));
@@ -92,12 +84,12 @@ BOOL LLVoiceRemoteCtrl::postBuild()
voice_channel_bg->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onClickVoiceChannel)); voice_channel_bg->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onClickVoiceChannel));
mVoiceVolIcon.connect(this,"voice_volume"); mVoiceVolIcon.connect(this,"voice_volume");
mShowChanBtn.connect(this,"show_channel");
return TRUE; return TRUE;
} }
void LLVoiceRemoteCtrl::draw() void LLVoiceRemoteCtrl::draw()
{ {
// Singu TODO: I'm pretty sure voice channel changing can be done outside of draw call ~Liru
BOOL voice_active = FALSE; BOOL voice_active = FALSE;
LLVoiceChannel* channelp = LLVoiceChannel::getCurrentVoiceChannel(); LLVoiceChannel* channelp = LLVoiceChannel::getCurrentVoiceChannel();
if (channelp) if (channelp)
@@ -108,15 +100,13 @@ void LLVoiceRemoteCtrl::draw()
mTalkBtn->setEnabled(voice_active); mTalkBtn->setEnabled(voice_active);
mTalkLockBtn->setEnabled(voice_active); mTalkLockBtn->setEnabled(voice_active);
static LLCachedControl<bool> ptt_currently_enabled("PTTCurrentlyEnabled",false);
// propagate ptt state to button display, // propagate ptt state to button display,
if (!mTalkBtn->hasMouseCapture()) if (!mTalkBtn->hasMouseCapture())
{ {
// not in push to talk mode, or push to talk is active means I'm talking // not in push to talk mode, or push to talk is active means I'm talking
mTalkBtn->setToggleState(!ptt_currently_enabled || LLVoiceClient::getInstance()->getUserPTTState()); mTalkBtn->setToggleState(!mTalkLockBtn->getToggleState() || LLVoiceClient::getInstance()->getUserPTTState());
} }
mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD())); mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD()));
mTalkLockBtn->setToggleState(!ptt_currently_enabled);
std::string talk_blip_image; std::string talk_blip_image;
if (LLVoiceClient::getInstance()->getIsSpeaking(gAgent.getID())) if (LLVoiceClient::getInstance()->getIsSpeaking(gAgent.getID()))
@@ -207,19 +197,6 @@ void LLVoiceRemoteCtrl::draw()
} }
} }
LLButton* expand_button = mShowChanBtn;
if (expand_button)
{
if (expand_button->getToggleState())
{
expand_button->setImageOverlay(std::string("arrow_down.tga"));
}
else
{
expand_button->setImageOverlay(std::string("arrow_up.tga"));
}
}
LLPanel::draw(); LLPanel::draw();
} }
@@ -250,27 +227,13 @@ void LLVoiceRemoteCtrl::onBtnTalkReleased()
} }
} }
void LLVoiceRemoteCtrl::onBtnLock(void* user_data)
{
LLVoiceRemoteCtrl* remotep = (LLVoiceRemoteCtrl*)user_data;
gSavedSettings.setBOOL("PTTCurrentlyEnabled", !remotep->mTalkLockBtn->getToggleState());
}
//static //static
void LLVoiceRemoteCtrl::onClickPopupBtn(void* user_data) void LLVoiceRemoteCtrl::onClickPopupBtn(void* user_data)
{ {
LLVoiceRemoteCtrl* remotep = (LLVoiceRemoteCtrl*)user_data; LLVoiceRemoteCtrl* remotep = (LLVoiceRemoteCtrl*)user_data;
remotep->deleteAllChildren(); remotep->deleteAllChildren();
if (gSavedSettings.getBOOL("ShowVoiceChannelPopup")) LLUICtrlFactory::getInstance()->buildPanel(remotep, gSavedSettings.getBOOL("ShowVoiceChannelPopup") ? "panel_voice_remote_expanded.xml" : "panel_voice_remote.xml");
{
LLUICtrlFactory::getInstance()->buildPanel(remotep, "panel_voice_remote_expanded.xml");
}
else
{
LLUICtrlFactory::getInstance()->buildPanel(remotep, "panel_voice_remote.xml");
}
gOverlayBar->layoutButtons(); gOverlayBar->layoutButtons();
} }

View File

@@ -48,7 +48,6 @@ public:
/*virtual*/ BOOL postBuild(); /*virtual*/ BOOL postBuild();
/*virtual*/ void draw(); /*virtual*/ void draw();
static void onBtnLock(void* user_data);
static void onBtnTalkHeld(); static void onBtnTalkHeld();
static void onBtnTalkReleased(); static void onBtnTalkReleased();
static void onBtnTalkClicked(); static void onBtnTalkClicked();
@@ -62,7 +61,6 @@ protected:
LLButton* mTalkLockBtn; LLButton* mTalkLockBtn;
LLButton* mSpeakersBtn; LLButton* mSpeakersBtn;
CachedUICtrl<LLIconCtrl> mVoiceVolIcon; CachedUICtrl<LLIconCtrl> mVoiceVolIcon;
CachedUICtrl<LLButton> mShowChanBtn;
}; };
#endif // LL_LLVOICEREMOTECTRL_H #endif // LL_LLVOICEREMOTECTRL_H

View File

@@ -9,7 +9,7 @@
</combo_box> </combo_box>
</layout_panel> </layout_panel>
<layout_panel auto_resize="true" bottom="0" can_resize="false" height="120" min_height="100" name="moderate_chat_panel" top_delta="0" user_resize="false" visible="true" width="140"> <layout_panel auto_resize="true" bottom="0" can_resize="false" height="120" min_height="100" name="moderate_chat_panel" top_delta="0" user_resize="false" visible="true" width="140">
<scroll_list bottom="78" can_resize="false" column_padding="0" draw_heading="true" draw_stripes="false" follows="left|top|bottom|right" left="0" multi_select="true" name="speakers_list" right="140" search_column="1" sort_column="2" top="113" menu_num="0"> <scroll_list bottom="78" can_resize="false" column_padding="0" draw_heading="true" draw_stripes="false" follows="left|top|bottom|right" left="0" multi_select="true" name="speakers_list" right="140" search_column="1" sort_column="2" top="113">
<column name="icon_speaking_status" sort="speaking_status" width="20"/> <column name="icon_speaking_status" sort="speaking_status" width="20"/>
<column dynamicwidth="true" label="Name" name="speaker_name"/> <column dynamicwidth="true" label="Name" name="speaker_name"/>
<column label="" name="speaking_status" width="0"/> <column label="" name="speaking_status" width="0"/>

View File

@@ -9,11 +9,12 @@
tab_stop="false" tool_tip="Hold the button to talk" width="60" /> tab_stop="false" tool_tip="Hold the button to talk" width="60" />
<button bottom="-19" height="16" image_selected="ptt_lock_on.tga" <button bottom="-19" height="16" image_selected="ptt_lock_on.tga"
image_unselected="ptt_lock_off.tga" label="" left_delta="4" name="ptt_lock" image_unselected="ptt_lock_off.tga" label="" left_delta="4" name="ptt_lock"
scale_image="false" toggle="true" scale_image="false" toggle="true" control_name="PTTCurrentlyEnabled"
tool_tip="Click lock to switch to talk mode" width="16" /> tool_tip="Click lock to switch to talk mode" width="16" />
<icon bottom="-19" height="16" image_name="icn_voice_ptt-off.tga" left_delta="42" <icon bottom="-19" height="16" image_name="icn_voice_ptt-off.tga" left_delta="42"
name="voice_volume" width="16" /> name="voice_volume" width="16" />
<button bottom="-22" control_name="ShowVoiceChannelPopup" height="22" label="" <button bottom="-22" control_name="ShowVoiceChannelPopup" height="22" label=""
left_delta="16" name="show_channel" scale_image="true" toggle="true" left_delta="16" name="show_channel" scale_image="true" toggle="true"
image_selected="arrow_down.tga" image_unselected="arrow_up.tga"
tool_tip="Click to show current voice channel" width="22" /> tool_tip="Click to show current voice channel" width="22" />
</panel> </panel>