EXT-2807 Update mini-inspector to include Group Voice Chat moderator controls
reviewed by Richard
parent
3b355848af
commit
f4fd622686
|
|
@ -42,10 +42,12 @@
|
|||
#include "lldateutil.h"
|
||||
#include "llfloaterreporter.h"
|
||||
#include "llfloaterworldmap.h"
|
||||
#include "llimview.h"
|
||||
#include "llinspect.h"
|
||||
#include "llmutelist.h"
|
||||
#include "llpanelblockedlist.h"
|
||||
#include "llstartup.h"
|
||||
#include "llspeakers.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "llvoiceclient.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
|
|
@ -99,6 +101,12 @@ private:
|
|||
// Set the volume slider to this user's current client-side volume setting,
|
||||
// hiding/disabling if the user is not nearby.
|
||||
void updateVolumeSlider();
|
||||
|
||||
// Shows/hides moderator panel depending on voice state
|
||||
void updateModeratorPanel();
|
||||
|
||||
// Moderator ability to enable/disable voice chat for avatar
|
||||
void toggleSelectedVoice(bool enabled);
|
||||
|
||||
// Button callbacks
|
||||
void onClickAddFriend();
|
||||
|
|
@ -205,6 +213,8 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
|
|||
mCommitCallbackRegistrar.add("InspectAvatar.Report", boost::bind(&LLInspectAvatar::onClickReport, this));
|
||||
mCommitCallbackRegistrar.add("InspectAvatar.FindOnMap", boost::bind(&LLInspectAvatar::onClickFindOnMap, this));
|
||||
mCommitCallbackRegistrar.add("InspectAvatar.ZoomIn", boost::bind(&LLInspectAvatar::onClickZoomIn, this));
|
||||
mCommitCallbackRegistrar.add("InspectAvatar.DisableVoice", boost::bind(&LLInspectAvatar::toggleSelectedVoice, this, false));
|
||||
mCommitCallbackRegistrar.add("InspectAvatar.EnableVoice", boost::bind(&LLInspectAvatar::toggleSelectedVoice, this, true));
|
||||
mEnableCallbackRegistrar.add("InspectAvatar.VisibleFindOnMap", boost::bind(&LLInspectAvatar::onVisibleFindOnMap, this));
|
||||
mEnableCallbackRegistrar.add("InspectAvatar.VisibleFreezeEject",
|
||||
boost::bind(&LLInspectAvatar::onVisibleFreezeEject, this));
|
||||
|
|
@ -277,6 +287,8 @@ void LLInspectAvatar::onOpen(const LLSD& data)
|
|||
requestUpdate();
|
||||
|
||||
updateVolumeSlider();
|
||||
|
||||
updateModeratorPanel();
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
|
@ -366,6 +378,119 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data)
|
|||
mPropertiesRequest = NULL;
|
||||
}
|
||||
|
||||
void LLInspectAvatar::updateModeratorPanel()
|
||||
{
|
||||
bool enable_moderator_panel = false;
|
||||
|
||||
if (LLVoiceChannel::getCurrentVoiceChannel())
|
||||
{
|
||||
LLUUID session_id = LLVoiceChannel::getCurrentVoiceChannel()->getSessionID();
|
||||
|
||||
if (session_id != LLUUID::null)
|
||||
{
|
||||
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
|
||||
|
||||
if (speaker_mgr)
|
||||
{
|
||||
LLPointer<LLSpeaker> self_speakerp = speaker_mgr->findSpeaker(gAgent.getID());
|
||||
LLPointer<LLSpeaker> selected_speakerp = speaker_mgr->findSpeaker(mAvatarID);
|
||||
|
||||
if(speaker_mgr->isVoiceActive() && selected_speakerp &&
|
||||
((self_speakerp && self_speakerp->mIsModerator) || gAgent.isGodlike()))
|
||||
{
|
||||
getChild<LLUICtrl>("enable_voice")->setVisible(selected_speakerp->mModeratorMutedVoice);
|
||||
getChild<LLUICtrl>("disable_voice")->setVisible(!selected_speakerp->mModeratorMutedVoice);
|
||||
|
||||
enable_moderator_panel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_moderator_panel)
|
||||
{
|
||||
if (!getChild<LLUICtrl>("moderator_panel")->getVisible())
|
||||
{
|
||||
getChild<LLUICtrl>("moderator_panel")->setVisible(true);
|
||||
// stretch the floater so it can accommodate the moderator panel
|
||||
reshape(getRect().getWidth(), getRect().getHeight() + getChild<LLUICtrl>("moderator_panel")->getRect().getHeight());
|
||||
}
|
||||
}
|
||||
else if (getChild<LLUICtrl>("moderator_panel")->getVisible())
|
||||
{
|
||||
getChild<LLUICtrl>("moderator_panel")->setVisible(false);
|
||||
// shrink the inspector floater back to original size
|
||||
reshape(getRect().getWidth(), getRect().getHeight() - getChild<LLUICtrl>("moderator_panel")->getRect().getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void LLInspectAvatar::toggleSelectedVoice(bool enabled)
|
||||
{
|
||||
LLUUID session_id = LLVoiceChannel::getCurrentVoiceChannel()->getSessionID();
|
||||
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
|
||||
|
||||
if (speaker_mgr)
|
||||
{
|
||||
if (!gAgent.getRegion())
|
||||
return;
|
||||
|
||||
std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest");
|
||||
LLSD data;
|
||||
data["method"] = "mute update";
|
||||
data["session-id"] = session_id;
|
||||
data["params"] = LLSD::emptyMap();
|
||||
data["params"]["agent_id"] = mAvatarID;
|
||||
data["params"]["mute_info"] = LLSD::emptyMap();
|
||||
// ctrl value represents ability to type, so invert
|
||||
data["params"]["mute_info"]["voice"] = !enabled;
|
||||
|
||||
class MuteVoiceResponder : public LLHTTPClient::Responder
|
||||
{
|
||||
public:
|
||||
MuteVoiceResponder(const LLUUID& session_id)
|
||||
{
|
||||
mSessionID = session_id;
|
||||
}
|
||||
|
||||
virtual void error(U32 status, const std::string& reason)
|
||||
{
|
||||
llwarns << status << ": " << reason << llendl;
|
||||
|
||||
if ( gIMMgr )
|
||||
{
|
||||
//403 == you're not a mod
|
||||
//should be disabled if you're not a moderator
|
||||
if ( 403 == status )
|
||||
{
|
||||
gIMMgr->showSessionEventError(
|
||||
"mute",
|
||||
"not_a_moderator",
|
||||
mSessionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
gIMMgr->showSessionEventError(
|
||||
"mute",
|
||||
"generic",
|
||||
mSessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
LLUUID mSessionID;
|
||||
};
|
||||
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new MuteVoiceResponder(speaker_mgr->getSessionID()));
|
||||
}
|
||||
|
||||
closeFloater();
|
||||
|
||||
}
|
||||
|
||||
void LLInspectAvatar::updateVolumeSlider()
|
||||
{
|
||||
// By convention, we only display and toggle voice mutes, not all mutes
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
[SL_PROFILE]
|
||||
</string>
|
||||
<text
|
||||
follows="all"
|
||||
follows="top|left"
|
||||
font="SansSerifLarge"
|
||||
height="16"
|
||||
left="8"
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
value="Grumpity ProductEngine"
|
||||
width="175" />
|
||||
<text
|
||||
follows="all"
|
||||
follows="top|left"
|
||||
height="16"
|
||||
left="8"
|
||||
name="user_subtitle"
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
value="0.5"
|
||||
width="195" />
|
||||
<button
|
||||
follows="all"
|
||||
follows="top|left"
|
||||
height="16"
|
||||
image_disabled="Audio_Off"
|
||||
image_disabled_selected="AudioMute_Off"
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
name="mute_btn"
|
||||
width="16" />
|
||||
<avatar_icon
|
||||
follows="all"
|
||||
follows="top|left"
|
||||
height="38"
|
||||
right="-10"
|
||||
bevel_style="in"
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
llinspectavatar.cpp makes visible the most likely default action
|
||||
-->
|
||||
<button
|
||||
follows="bottom|left"
|
||||
follows="top|left"
|
||||
height="20"
|
||||
label="Add Friend"
|
||||
left="8"
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
name="add_friend_btn"
|
||||
width="90" />
|
||||
<button
|
||||
follows="bottom|left"
|
||||
follows="top|left"
|
||||
height="20"
|
||||
label="IM"
|
||||
left_delta="0"
|
||||
|
|
@ -129,7 +129,8 @@
|
|||
tab_stop="false"
|
||||
width="80" />
|
||||
<!-- gear buttons here -->
|
||||
<menu_button
|
||||
<menu_button
|
||||
follows="top|left"
|
||||
height="20"
|
||||
layout="topleft"
|
||||
image_overlay="OptionsMenu_Off"
|
||||
|
|
@ -147,4 +148,33 @@
|
|||
right="-5"
|
||||
top_delta="0"
|
||||
width="35" />
|
||||
<panel
|
||||
follows="top|left"
|
||||
top="148"
|
||||
left="0"
|
||||
height="60"
|
||||
width="228"
|
||||
visible="false"
|
||||
background_visible="true"
|
||||
name="moderator_panel"
|
||||
background_opaque="true"
|
||||
bg_opaque_color="MouseGray">
|
||||
<button
|
||||
name="disable_voice"
|
||||
label="Disable Voice"
|
||||
top="20"
|
||||
width="95"
|
||||
height="20"
|
||||
left="10"
|
||||
commit_callback.function="InspectAvatar.DisableVoice"/>
|
||||
<button
|
||||
name="enable_voice"
|
||||
label="Enable Voice"
|
||||
top="20"
|
||||
width="95"
|
||||
height="20"
|
||||
left="10"
|
||||
visible="false"
|
||||
commit_callback.function="InspectAvatar.EnableVoice"/>
|
||||
</panel>
|
||||
</floater>
|
||||
|
|
|
|||
Loading…
Reference in New Issue