summaryrefslogtreecommitdiff
path: root/indra/newview/llinspectavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinspectavatar.cpp')
-rw-r--r--indra/newview/llinspectavatar.cpp131
1 files changed, 98 insertions, 33 deletions
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index dae980feb1..14bc4376fe 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -51,6 +51,7 @@
#include "llviewermenu.h"
#include "llvoiceclient.h"
#include "llviewerobjectlist.h"
+#include "lltransientfloatermgr.h"
// Linden libraries
#include "llfloater.h"
@@ -71,7 +72,7 @@ class LLFetchAvatarData;
// Avatar Inspector, a small information window used when clicking
// on avatar names in the 2D UI and in the ambient inspector widget for
// the 3D world.
-class LLInspectAvatar : public LLInspect
+class LLInspectAvatar : public LLInspect, LLTransientFloater
{
friend class LLFloaterReg;
@@ -93,6 +94,12 @@ public:
// Update view based on information from avatar properties processor
void processAvatarData(LLAvatarData* data);
+ // override the inspector mouse leave so timer is only paused if
+ // gear menu is not open
+ /* virtual */ void onMouseLeave(S32 x, S32 y, MASK mask);
+
+ virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; }
+
private:
// Make network requests for all the data to display in this view.
// Used on construction and if avatar id changes.
@@ -112,9 +119,11 @@ private:
void onClickAddFriend();
void onClickViewProfile();
void onClickIM();
+ void onClickCall();
void onClickTeleport();
void onClickInviteToGroup();
void onClickPay();
+ void onClickShare();
void onToggleMute();
void onClickReport();
void onClickFreeze();
@@ -204,9 +213,11 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
mCommitCallbackRegistrar.add("InspectAvatar.AddFriend", boost::bind(&LLInspectAvatar::onClickAddFriend, this));
mCommitCallbackRegistrar.add("InspectAvatar.IM",
boost::bind(&LLInspectAvatar::onClickIM, this));
+ mCommitCallbackRegistrar.add("InspectAvatar.Call", boost::bind(&LLInspectAvatar::onClickCall, this));
mCommitCallbackRegistrar.add("InspectAvatar.Teleport", boost::bind(&LLInspectAvatar::onClickTeleport, this));
mCommitCallbackRegistrar.add("InspectAvatar.InviteToGroup", boost::bind(&LLInspectAvatar::onClickInviteToGroup, this));
mCommitCallbackRegistrar.add("InspectAvatar.Pay", boost::bind(&LLInspectAvatar::onClickPay, this));
+ mCommitCallbackRegistrar.add("InspectAvatar.Share", boost::bind(&LLInspectAvatar::onClickShare, this));
mCommitCallbackRegistrar.add("InspectAvatar.ToggleMute", boost::bind(&LLInspectAvatar::onToggleMute, this));
mCommitCallbackRegistrar.add("InspectAvatar.Freeze",
boost::bind(&LLInspectAvatar::onClickFreeze, this));
@@ -223,11 +234,15 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
mEnableCallbackRegistrar.add("InspectAvatar.VisibleZoomIn",
boost::bind(&LLInspectAvatar::onVisibleZoomIn, this));
mEnableCallbackRegistrar.add("InspectAvatar.Gear.Enable", boost::bind(&LLInspectAvatar::isNotFriend, this));
+ mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableCall", boost::bind(&LLAvatarActions::canCall));
mEnableCallbackRegistrar.add("InspectAvatar.EnableMute", boost::bind(&LLInspectAvatar::enableMute, this));
mEnableCallbackRegistrar.add("InspectAvatar.EnableUnmute", boost::bind(&LLInspectAvatar::enableUnmute, this));
// can't make the properties request until the widgets are constructed
// as it might return immediately, so do it in postBuild.
+
+ LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
+ LLTransientFloater::init(this);
}
LLInspectAvatar::~LLInspectAvatar()
@@ -236,6 +251,8 @@ LLInspectAvatar::~LLInspectAvatar()
// view
delete mPropertiesRequest;
mPropertiesRequest = NULL;
+
+ LLTransientFloaterMgr::getInstance()->removeControlView(this);
}
/*virtual*/
@@ -257,8 +274,6 @@ BOOL LLInspectAvatar::postBuild(void)
}
-
-
// Multiple calls to showInstance("inspect_avatar", foo) will provide different
// LLSD for foo, which we will catch here.
//virtual
@@ -274,7 +289,7 @@ void LLInspectAvatar::onOpen(const LLSD& data)
getChild<LLUICtrl>("gear_self_btn")->setVisible(self);
getChild<LLUICtrl>("gear_btn")->setVisible(!self);
-
+
// Position the inspector relative to the mouse cursor
// Similar to how tooltips are positioned
// See LLToolTipMgr::createToolTip
@@ -382,11 +397,32 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data)
mPropertiesRequest = NULL;
}
+// For the avatar inspector, we only want to unpause the fade timer
+// if neither the gear menu or self gear menu are open
+void LLInspectAvatar::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+ LLMenuGL* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
+ LLMenuGL* gear_menu_self = getChild<LLMenuButton>("gear_self_btn")->getMenu();
+ if ( gear_menu && gear_menu->getVisible() &&
+ gear_menu_self && gear_menu_self->getVisible() )
+ {
+ return;
+ }
+
+ if(childHasVisiblePopupMenu())
+ {
+ return;
+ }
+
+ mOpenTimer.unpause();
+}
+
void LLInspectAvatar::updateModeratorPanel()
{
bool enable_moderator_panel = false;
- if (LLVoiceChannel::getCurrentVoiceChannel())
+ if (LLVoiceChannel::getCurrentVoiceChannel() &&
+ mAvatarID != gAgent.getID())
{
LLUUID session_id = LLVoiceChannel::getCurrentVoiceChannel()->getSessionID();
@@ -400,6 +436,7 @@ void LLInspectAvatar::updateModeratorPanel()
LLPointer<LLSpeaker> selected_speakerp = speaker_mgr->findSpeaker(mAvatarID);
if(speaker_mgr->isVoiceActive() && selected_speakerp &&
+ selected_speakerp->isInVoiceChannel() &&
((self_speakerp && self_speakerp->mIsModerator) || gAgent.isGodlike()))
{
getChild<LLUICtrl>("enable_voice")->setVisible(selected_speakerp->mModeratorMutedVoice);
@@ -497,42 +534,58 @@ void LLInspectAvatar::toggleSelectedVoice(bool enabled)
void LLInspectAvatar::updateVolumeSlider()
{
- // By convention, we only display and toggle voice mutes, not all mutes
- bool is_muted = LLMuteList::getInstance()->
- isMuted(mAvatarID, LLMute::flagVoiceChat);
- bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
- LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
- mute_btn->setEnabled( voice_enabled );
- mute_btn->setValue( is_muted );
+ bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
- LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
- volume_slider->setEnabled( voice_enabled && !is_muted );
- const F32 DEFAULT_VOLUME = 0.5f;
- F32 volume;
- if (is_muted)
- {
- // it's clearer to display their volume as zero
- volume = 0.f;
- }
- else if (!voice_enabled)
+ // Do not display volume slider and mute button if it
+ // is ourself or we are not in a voice channel together
+ if (!voice_enabled || (mAvatarID == gAgent.getID()))
{
- // use nominal value rather than 0
- volume = DEFAULT_VOLUME;
+ getChild<LLUICtrl>("mute_btn")->setVisible(false);
+ getChild<LLUICtrl>("volume_slider")->setVisible(false);
}
- else
+
+ else
{
- // actual volume
- volume = gVoiceClient->getUserVolume(mAvatarID);
+ getChild<LLUICtrl>("mute_btn")->setVisible(true);
+ getChild<LLUICtrl>("volume_slider")->setVisible(true);
+
+ // By convention, we only display and toggle voice mutes, not all mutes
+ bool is_muted = LLMuteList::getInstance()->
+ isMuted(mAvatarID, LLMute::flagVoiceChat);
+
+ LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
+
+ bool is_linden = LLStringUtil::endsWith(mAvatarName, " Linden");
- // *HACK: Voice client doesn't have any data until user actually
- // says something.
- if (volume == 0.f)
+ mute_btn->setEnabled( !is_linden);
+ mute_btn->setValue( is_muted );
+
+ LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
+ volume_slider->setEnabled( !is_muted );
+
+ const F32 DEFAULT_VOLUME = 0.5f;
+ F32 volume;
+ if (is_muted)
{
- volume = DEFAULT_VOLUME;
+ // it's clearer to display their volume as zero
+ volume = 0.f;
}
+ else
+ {
+ // actual volume
+ volume = gVoiceClient->getUserVolume(mAvatarID);
+
+ // *HACK: Voice client doesn't have any data until user actually
+ // says something.
+ if (volume == 0.f)
+ {
+ volume = DEFAULT_VOLUME;
+ }
+ }
+ volume_slider->setValue( (F64)volume );
}
- volume_slider->setValue( (F64)volume );
+
}
void LLInspectAvatar::onClickMuteVolume()
@@ -611,6 +664,12 @@ void LLInspectAvatar::onClickIM()
closeFloater();
}
+void LLInspectAvatar::onClickCall()
+{
+ LLAvatarActions::startCall(mAvatarID);
+ closeFloater();
+}
+
void LLInspectAvatar::onClickTeleport()
{
LLAvatarActions::offerTeleport(mAvatarID);
@@ -629,6 +688,12 @@ void LLInspectAvatar::onClickPay()
closeFloater();
}
+void LLInspectAvatar::onClickShare()
+{
+ LLAvatarActions::share(mAvatarID);
+ closeFloater();
+}
+
void LLInspectAvatar::onToggleMute()
{
LLMute mute(mAvatarID, mAvatarName, LLMute::AGENT);
@@ -648,7 +713,7 @@ void LLInspectAvatar::onToggleMute()
void LLInspectAvatar::onClickReport()
{
- LLFloaterReporter::showFromObject(mAvatarID);
+ LLFloaterReporter::showFromAvatar(mAvatarID, mAvatarName);
closeFloater();
}