Improve List menu with IsNearby check
Teleport To is now available whenever a user is nearby, regardless of list The local avs menu's Moderation submenu, Focus, and Track/Untrack has been adopted into the main avs list menu making the only difference submenuing Fix track/untrack not working, since it requires the radar to work right
This commit is contained in:
@@ -312,6 +312,42 @@ BOOL LLFloaterAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
return LLFloater::handleRightMouseDown(x, y, mask);
|
||||
}
|
||||
|
||||
bool is_nearby(const LLUUID& id)
|
||||
{
|
||||
if (id.isNull()) return false;
|
||||
if (const auto inst = LLFloaterAvatarList::getIfExists())
|
||||
return inst->getAvatarEntry(id);
|
||||
uuid_vec_t avatars;
|
||||
LLWorld::instance().getAvatars(&avatars);
|
||||
return std::find(avatars.begin(), avatars.end(), id) != avatars.end();
|
||||
}
|
||||
|
||||
void track_av(const LLUUID& id)
|
||||
{
|
||||
if (auto inst = LLFloaterAvatarList::getIfExists())
|
||||
if (inst->getAvatarEntry(id))
|
||||
{
|
||||
inst->trackAvatar(id);
|
||||
return;
|
||||
}
|
||||
|
||||
LLWorld::pos_map_t avatars;
|
||||
LLWorld::instance().getAvatars(&avatars);
|
||||
LLTracker::trackLocation(avatars[id], LLStringUtil::null, LLStringUtil::null);
|
||||
}
|
||||
|
||||
void teleport_to(const LLUUID& id)
|
||||
{
|
||||
if (auto entry = LLFloaterAvatarList::instanceExists() ? LLFloaterAvatarList::instance().getAvatarEntry(id) : nullptr)
|
||||
gAgent.teleportViaLocation(entry->getPosition());
|
||||
else
|
||||
{
|
||||
LLWorld::pos_map_t avatars;
|
||||
LLWorld::instance().getAvatars(&avatars);
|
||||
gAgent.teleportViaLocation(avatars[id]);
|
||||
}
|
||||
}
|
||||
|
||||
static void cmd_profile(const LLAvatarListEntry* entry);
|
||||
static void cmd_toggle_mark(LLAvatarListEntry* entry);
|
||||
static void cmd_ar(const LLAvatarListEntry* entry);
|
||||
@@ -369,7 +405,7 @@ namespace
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLFloaterAvatarList::instance().doCommand(cmd_teleport, true);
|
||||
teleport_to(get_focused_list_id_selected());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -388,13 +424,13 @@ void addMenu(view_listener_t* menu, const std::string& name);
|
||||
|
||||
void add_radar_listeners()
|
||||
{
|
||||
addMenu(new RadarTrack(), "Radar.Track");
|
||||
addMenu(new RadarMark(), "Radar.Mark");
|
||||
addMenu(new RadarFocus(), "Radar.Focus");
|
||||
addMenu(new RadarFocusPrev(), "Radar.FocusPrev");
|
||||
addMenu(new RadarFocusNext(), "Radar.FocusNext");
|
||||
addMenu(new RadarTeleportTo(), "Radar.TeleportTo");
|
||||
addMenu(new RadarAnnounceKeys(), "Radar.AnnounceKeys");
|
||||
addMenu(new RadarTrack, "Radar.Track");
|
||||
addMenu(new RadarMark, "Radar.Mark");
|
||||
addMenu(new RadarFocus, "Radar.Focus");
|
||||
addMenu(new RadarFocusPrev, "Radar.FocusPrev");
|
||||
addMenu(new RadarFocusNext, "Radar.FocusNext");
|
||||
addMenu(new RadarTeleportTo, "Radar.TeleportTo");
|
||||
addMenu(new RadarAnnounceKeys, "Radar.AnnounceKeys");
|
||||
}
|
||||
|
||||
BOOL LLFloaterAvatarList::postBuild()
|
||||
@@ -1099,8 +1135,11 @@ void LLFloaterAvatarList::onClickTrack()
|
||||
LLScrollListItem* item = mAvatarList->getFirstSelected();
|
||||
if (!item) return;
|
||||
|
||||
LLUUID agent_id = item->getUUID();
|
||||
trackAvatar(item->getUUID());
|
||||
}
|
||||
|
||||
void LLFloaterAvatarList::trackAvatar(const LLUUID& agent_id)
|
||||
{
|
||||
if (mTracking && mTrackedAvatar == agent_id)
|
||||
{
|
||||
LLTracker::stopTracking(false);
|
||||
|
||||
@@ -266,6 +266,7 @@ public:
|
||||
void focusOnNext(bool marked_only);
|
||||
|
||||
void refreshTracker();
|
||||
void trackAvatar(const LLUUID& agent_id);
|
||||
void trackAvatar(const LLAvatarListEntry* entry) const;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9347,6 +9347,26 @@ void parcel_mod_notice_callback(const uuid_vec_t& ids, S32 choice, boost::functi
|
||||
cb(*it, choice);
|
||||
}
|
||||
|
||||
bool is_nearby(const LLUUID& id);
|
||||
class ListIsNearby : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(is_nearby(get_focused_list_id_selected()));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void track_av(const LLUUID& id);
|
||||
class ListTrack : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
track_av(get_focused_list_id_selected());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void send_eject(const LLUUID& avatar_id, bool ban);
|
||||
class ListEject : public view_listener_t
|
||||
{
|
||||
@@ -9807,6 +9827,8 @@ void initialize_menus()
|
||||
addMenu(new ListStartConference(), "List.StartConference");
|
||||
addMenu(new ListStartIM(), "List.StartIM");
|
||||
addMenu(new ListAbuseReport(), "List.AbuseReport");
|
||||
addMenu(new ListIsNearby, "List.IsNearby");
|
||||
addMenu(new ListTrack, "List.Track");
|
||||
addMenu(new ListEject(), "List.ParcelEject");
|
||||
addMenu(new ListFreeze(), "List.Freeze");
|
||||
addMenu(new ListEstateBan(), "List.EstateBan");
|
||||
|
||||
@@ -44,14 +44,15 @@
|
||||
<on_click function="List.InviteToGroup"/>
|
||||
<on_visible function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Ban From Group" name="Ban From Group">
|
||||
<on_click function="List.BanFromGroup"/>
|
||||
<on_visible function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Offer Teleport" name="Offer Teleport">
|
||||
<on_click function="List.OfferTeleport"/>
|
||||
<on_enable function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Teleport To" name="Teleport To">
|
||||
<on_click function="Radar.TeleportTo"/>
|
||||
<on_enable function="List.EnableSingleSelected"/>
|
||||
<on_visible function="List.IsNearby"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Request Teleport" name="Request Teleport">
|
||||
<on_click function="List.RequestTeleport"/>
|
||||
<on_visible function="List.EnableSingleSelected"/>
|
||||
@@ -64,16 +65,12 @@
|
||||
<on_click function="List.ShowLog"/>
|
||||
<on_enable function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Track/Untrack" name="Track/Untrack">
|
||||
<on_click function="List.Track"/>
|
||||
<on_enable function="List.EnableSingleSelected"/>
|
||||
<on_visible function="List.IsNearby"/>
|
||||
</menu_item_call>
|
||||
<menu_item_separator/>
|
||||
<menu_item_call label="Mute/Unmute" name="Mute/Unmute">
|
||||
<on_click function="List.ToggleMute"/>
|
||||
<on_enable function="List.EnableMute"/>
|
||||
<on_visible function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Report Abuse" name="Report Abuse">
|
||||
<on_click function="List.AbuseReport"/>
|
||||
<on_visible function="List.EnableSingleSelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Copy Key" name="Copy Key">
|
||||
<on_click function="List.CopyUUIDs"/>
|
||||
<on_enable function="List.EnableAnySelected"/>
|
||||
@@ -82,4 +79,41 @@
|
||||
<on_click function="List.CopySLURL"/>
|
||||
<on_visible function="List.EnableSingleSelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Focus" name="Focus">
|
||||
<on_click function="Radar.Focus"/>
|
||||
<on_enable function="List.EnableSingleSelected"/>
|
||||
<on_visible function="List.IsNearby"/>
|
||||
</menu_item_call>
|
||||
<menu label="Moderation" name="Moderation" create_jump_keys="true">
|
||||
<menu_item_call label="Mute/Unmute" name="Mute/Unmute">
|
||||
<on_click function="List.ToggleMute"/>
|
||||
<on_enable function="List.EnableMute"/>
|
||||
<on_visible function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Ban From Group" name="Ban From Group">
|
||||
<on_click function="List.BanFromGroup"/>
|
||||
<on_visible function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Report Abuse" name="Report Abuse">
|
||||
<on_click function="List.AbuseReport"/>
|
||||
<on_visible function="List.EnableSingleSelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_separator/>
|
||||
<menu_item_call label="Freeze" name="Freeze">
|
||||
<on_click function="List.Freeze"/>
|
||||
<on_visible function="List.IsNearby"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Eject/Ban from Parcel" name="Eject/Ban from Parcel">
|
||||
<on_click function="List.ParcelEject"/>
|
||||
<on_visible function="List.IsNearby"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Eject from estate" name="Eject from estate">
|
||||
<on_click function="List.EstateEject"/>
|
||||
<on_visible function="List.IsNearby"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Eject and ban from estate" name="Eject and ban from estate">
|
||||
<on_click function="List.EstateBan"/>
|
||||
<on_visible function="List.IsNearby"/>
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
</menu>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<on_click function="List.OfferTeleport"/>
|
||||
<on_enable function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Teleport To" name="Teleport To" shortcut="control|Enter">
|
||||
<menu_item_call label="Teleport To" name="Teleport To">
|
||||
<on_click function="Radar.TeleportTo"/>
|
||||
<on_enable function="List.EnableSingleSelected"/>
|
||||
</menu_item_call>
|
||||
@@ -66,7 +66,7 @@
|
||||
<on_enable function="List.EnableAnySelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Track/Untrack" name="Track/Untrack">
|
||||
<on_click function="Radar.Track"/>
|
||||
<on_click function="List.Track"/>
|
||||
<on_enable function="List.EnableSingleSelected"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call label="Copy Key" name="Copy Key">
|
||||
|
||||
Reference in New Issue
Block a user