diff options
| author | Leyla Farazha <leyla@lindenlab.com> | 2011-05-30 15:38:37 -0700 | 
|---|---|---|
| committer | Leyla Farazha <leyla@lindenlab.com> | 2011-05-30 15:38:37 -0700 | 
| commit | bff172b374fa12e646d427e09f2ffac4289ab654 (patch) | |
| tree | 6ad85ce12eaa4a3f8ed417ecfac1d90f781f80fe | |
| parent | ae6ceb6193aa2070fbcafa79a8531af80cce1507 (diff) | |
EXP-824 Adding volume slider and block btn in basic mode IM panel
| -rw-r--r-- | indra/newview/llpanelimcontrolpanel.cpp | 92 | ||||
| -rw-r--r-- | indra/newview/llpanelimcontrolpanel.h | 6 | ||||
| -rw-r--r-- | indra/newview/skins/minimal/xui/en/panel_im_control_panel.xml | 249 | 
3 files changed, 257 insertions, 90 deletions
| diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index 0cc5dcda82..06c8d496ff 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -99,7 +99,8 @@ void LLPanelChatControlPanel::updateCallButton()  void LLPanelChatControlPanel::updateButtons(bool is_call_started)  {  	getChildView("end_call_btn_panel")->setVisible( is_call_started); -	getChildView("voice_ctrls_btn_panel")->setVisible( is_call_started); +	getChildView("volume_ctrl_panel")->setVisible( is_call_started); +	getChildView("voice_ctrls_btn_panel")->setVisible( is_call_started && findChild<LLView>("voice_ctrls_btn_panel"));  	getChildView("call_btn_panel")->setVisible( ! is_call_started);  	updateCallButton(); @@ -119,9 +120,9 @@ BOOL LLPanelChatControlPanel::postBuild()  	childSetAction("call_btn", boost::bind(&LLPanelChatControlPanel::onCallButtonClicked, this));  	childSetAction("end_call_btn", boost::bind(&LLPanelChatControlPanel::onEndCallButtonClicked, this));  	childSetAction("voice_ctrls_btn", boost::bind(&LLPanelChatControlPanel::onOpenVoiceControlsClicked, this)); - +	  	LLVoiceClient::getInstance()->addObserver(this); - +	  	return TRUE;  } @@ -156,13 +157,93 @@ BOOL LLPanelIMControlPanel::postBuild()  	childSetAction("share_btn", boost::bind(&LLPanelIMControlPanel::onShareButtonClicked, this));  	childSetAction("teleport_btn", boost::bind(&LLPanelIMControlPanel::onTeleportButtonClicked, this));  	childSetAction("pay_btn", boost::bind(&LLPanelIMControlPanel::onPayButtonClicked, this)); + +	childSetAction("mute_btn", boost::bind(&LLPanelIMControlPanel::onClickMuteVolume, this)); +	childSetAction("block_btn", boost::bind(&LLPanelIMControlPanel::onClickBlock, this)); +	childSetAction("unblock_btn", boost::bind(&LLPanelIMControlPanel::onClickUnblock, this)); +	 +	getChild<LLUICtrl>("volume_slider")->setCommitCallback(boost::bind(&LLPanelIMControlPanel::onVolumeChange, this, _2)); +  	getChildView("add_friend_btn")->setEnabled(!LLAvatarActions::isFriend(getChild<LLAvatarIconCtrl>("avatar_icon")->getAvatarId()));  	setFocusReceivedCallback(boost::bind(&LLPanelIMControlPanel::onFocusReceived, this)); -	 +  	return LLPanelChatControlPanel::postBuild();  } +void LLPanelIMControlPanel::draw() +{ +	bool is_muted = LLMuteList::getInstance()->isMuted(mAvatarID); + +	getChild<LLUICtrl>("block_btn_panel")->setVisible(!is_muted); +	getChild<LLUICtrl>("unblock_btn_panel")->setVisible(is_muted); + +	if (getChildView("volume_ctrl_panel")->getVisible()) +	{ + +		bool is_muted_voice = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat); + +		LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn"); +		mute_btn->setValue( is_muted_voice ); + +		LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider"); +		volume_slider->setEnabled( !is_muted_voice ); + +		F32 volume; + +		if (is_muted_voice) +		{ +			// it's clearer to display their volume as zero +			volume = 0.f; +		} +		else +		{ +			// actual volume +			volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID); +		} +		volume_slider->setValue( (F64)volume ); +	} + +	LLPanelChatControlPanel::draw(); +} + +void LLPanelIMControlPanel::onClickMuteVolume() +{ +	// By convention, we only display and toggle voice mutes, not all mutes +	LLMuteList* mute_list = LLMuteList::getInstance(); +	bool is_muted = mute_list->isMuted(mAvatarID, LLMute::flagVoiceChat); + +	LLMute mute(mAvatarID, getChild<LLTextBox>("avatar_name")->getText(), LLMute::AGENT); +	if (!is_muted) +	{ +		mute_list->add(mute, LLMute::flagVoiceChat); +	} +	else +	{ +		mute_list->remove(mute, LLMute::flagVoiceChat); +	} +} + +void LLPanelIMControlPanel::onClickBlock() +{ +	LLMute mute(mAvatarID, getChild<LLTextBox>("avatar_name")->getText(), LLMute::AGENT); +	 +	LLMuteList::getInstance()->add(mute); +} + +void LLPanelIMControlPanel::onClickUnblock() +{ +	LLMute mute(mAvatarID, getChild<LLTextBox>("avatar_name")->getText(), LLMute::AGENT); + +	LLMuteList::getInstance()->remove(mute); +} + +void LLPanelIMControlPanel::onVolumeChange(const LLSD& data) +{ +	F32 volume = (F32)data.asReal(); +	LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume); +} +  void LLPanelIMControlPanel::onTeleportButtonClicked()  {  	LLAvatarActions::offerTeleport(mAvatarID); @@ -262,6 +343,9 @@ void LLPanelIMControlPanel::onNameCache(const LLUUID& id, const std::string& ful  		std::string avatar_name = full_name;  		getChild<LLTextBox>("avatar_name")->setValue(avatar_name);  		getChild<LLTextBox>("avatar_name")->setToolTip(avatar_name); + +		bool is_linden = LLStringUtil::endsWith(full_name, " Linden"); +		getChild<LLUICtrl>("mute_btn")->setEnabled( !is_linden);  	}  } diff --git a/indra/newview/llpanelimcontrolpanel.h b/indra/newview/llpanelimcontrolpanel.h index 3bbe24ecb9..76d4475b74 100644 --- a/indra/newview/llpanelimcontrolpanel.h +++ b/indra/newview/llpanelimcontrolpanel.h @@ -94,6 +94,12 @@ private:  	void onPayButtonClicked();  	void onFocusReceived(); +	void onClickMuteVolume(); +	void onClickBlock(); +	void onClickUnblock(); +	/*virtual*/ void draw(); +	void onVolumeChange(const LLSD& data); +  	LLUUID mAvatarID;  }; diff --git a/indra/newview/skins/minimal/xui/en/panel_im_control_panel.xml b/indra/newview/skins/minimal/xui/en/panel_im_control_panel.xml index be13bc1bb7..a9c7b624fd 100644 --- a/indra/newview/skins/minimal/xui/en/panel_im_control_panel.xml +++ b/indra/newview/skins/minimal/xui/en/panel_im_control_panel.xml @@ -23,102 +23,179 @@       orientation="vertical"       top_pad="5"       width="145"> -      <layout_panel -       auto_resize="false" -       follows="top|left|right" -       height="20" -       layout="topleft" -       left="2" -       min_height="20" -       width="140" -       name="view_profile_btn_panel" -       top="0" -       user_resize="false"> -        <button -         follows="left|top|right" -         height="23" -         label="Profile" -         name="view_profile_btn" +        <layout_panel +         auto_resize="false" +         follows="top|left|right" +         height="20" +         layout="topleft" +         left="2" +         min_height="20" +         width="140" +         name="view_profile_btn_panel"           top="0" -         width="140" /> -      </layout_panel> -      <layout_panel -       auto_resize="false" -       follows="top|left|right" -       height="25" -       layout="topleft" -       min_height="25" -       width="140" -       name="add_friend_btn_panel" -       user_resize="false"> -        <button -         follows="left|top|right" -         height="23" -         label="Add Friend" -         name="add_friend_btn" -         top="5" -         width="140" /> -      </layout_panel> -      <layout_panel -       auto_resize="false" -       follows="top|left|right" -       height="25" -       layout="topleft" -       min_height="25" -       width="140" -       name="teleport_btn_panel" -       user_resize="false"> -        <button -             auto_resize="false" +         user_resize="false"> +            <button +             follows="left|top|right" +             height="23" +             label="Profile" +             name="view_profile_btn" +             top="0" +             width="140" /> +        </layout_panel> +        <layout_panel +         auto_resize="false" +         follows="top|left|right" +         height="25" +         layout="topleft" +         min_height="25" +         width="140" +         name="add_friend_btn_panel" +         user_resize="false"> +            <button               follows="left|top|right"               height="23" -             label="Teleport" -             name="teleport_btn" -             tool_tip = "Offer to teleport this person" +             label="Add Friend" +             name="add_friend_btn" +             top="5"               width="140" /> -      </layout_panel> -      <layout_panel +        </layout_panel> +        <layout_panel           auto_resize="false"           follows="top|left|right"           height="25"           layout="topleft"           min_height="25"           width="140" -         name="call_btn_panel" +         name="teleport_btn_panel"           user_resize="false"> -        <button -         follows="left|top|right" -         height="23" -         label="Call" -         name="call_btn" -         width="140" /> -      </layout_panel> -      <layout_panel -       auto_resize="false" -       follows="top|left|right" -       height="25" -       layout="topleft" -       min_height="25" -       width="140" -       name="end_call_btn_panel" -       user_resize="false" -       visible="false"> -        <button -         follows="left|top|right" -         height="23" -         label="End Call" -         name="end_call_btn" -         width="140" /> -      </layout_panel> -      <layout_panel -       mouse_opaque="false" -       auto_resize="true" -       follows="top|left" -       height="0" -       layout="topleft" -       min_height="0" -       width="140" -       name="spacer" -       user_resize="false" /> +            <button +                 auto_resize="false" +                 follows="left|top|right" +                 height="23" +                 label="Teleport" +                 name="teleport_btn" +                 tool_tip = "Offer to teleport this person" +                 width="140" /> +        </layout_panel> +        <layout_panel +           auto_resize="false" +           follows="top|left|right" +           height="25" +           layout="topleft" +           min_height="25" +           width="140" +           name="call_btn_panel" +           user_resize="false"> +            <button +             follows="left|top|right" +             height="23" +             label="Call" +             name="call_btn" +             width="140" /> +        </layout_panel> +        <layout_panel +         auto_resize="false" +         follows="top|left|right" +         height="25" +         layout="topleft" +         min_height="25" +         width="140" +         name="end_call_btn_panel" +         user_resize="false" +         visible="false"> +            <button +             follows="left|top|right" +             height="23" +             label="End Call" +             name="end_call_btn" +             width="140" /> +        </layout_panel> +        <layout_panel +         auto_resize="false" +         follows="top|left|right" +         height="25" +         layout="topleft" +         min_height="25" +         width="140" +         name="block_btn_panel" +         user_resize="false"> +            <button +             follows="left|top|right" +             height="23" +             label="Block" +             name="block_btn" +             width="140" /> +        </layout_panel> +        <layout_panel +         auto_resize="false" +         follows="top|left|right" +         height="25" +         layout="topleft" +         min_height="25" +         width="140" +         name="unblock_btn_panel" +         user_resize="false" +         visible="false"> +            <button +             follows="left|top|right" +             height="23" +             label="Unblock" +             name="unblock_btn" +             width="140" /> +        </layout_panel> +        <layout_panel +         auto_resize="false" +         follows="top|left|right" +         height="25" +         layout="topleft" +         min_height="54" +         width="140" +         name="volume_ctrl_panel" +         visible="false"  +         user_resize="false"> +            <text +             follows="left|top|right" +             left="5" +             top="14" +             height="23" +             name="volume_ctrl_text" +             width="140">Volume Control:</text> +            <slider +             follows="top|left" +             height="23" +             increment="0.01" +             left="0" +             max_val="0.95" +             min_val="0.05" +             name="volume_slider" +             show_text="false" +             tool_tip="Voice volume" +             top_pad="-5" +             value="0.5" +             width="125" /> +            <button +             follows="top|left" +             height="16" +             image_disabled="Audio_Off" +             image_disabled_selected="AudioMute_Off" +             image_hover_selected="AudioMute_Over" +             image_selected="AudioMute_Off" +             image_unselected="Audio_Off" +             is_toggle="true" +             left_pad="0" +             top_delta="4" +             name="mute_btn" +             width="16" /> +        </layout_panel> +        <layout_panel +         mouse_opaque="false" +         auto_resize="true" +         follows="top|left" +         height="0" +         layout="topleft" +         min_height="0" +         width="140" +         name="spacer" +         user_resize="false" />      </layout_stack>  </panel> | 
