Added profile and estate kick function to top scripts floater

Ansariel 2012-04-06 23:42:17 +02:00
parent 490a53d288
commit 9a134d8c25
4 changed files with 112 additions and 1 deletions

View File

@ -51,6 +51,8 @@
#include "lluictrlfactory.h"
#include "llviewerwindow.h"
#include "llavataractions.h"
//LLFloaterTopObjects* LLFloaterTopObjects::sInstance = NULL;
// Globals
@ -83,7 +85,13 @@ LLFloaterTopObjects::LLFloaterTopObjects(const LLSD& key)
mCommitCallbackRegistrar.add("TopObjects.GetByObjectName", boost::bind(&LLFloaterTopObjects::onGetByObjectName, this));
mCommitCallbackRegistrar.add("TopObjects.GetByOwnerName", boost::bind(&LLFloaterTopObjects::onGetByOwnerName, this));
mCommitCallbackRegistrar.add("TopObjects.CommitObjectsList",boost::bind(&LLFloaterTopObjects::onCommitObjectsList, this));
// <FS:Ansariel> TP to object
mCommitCallbackRegistrar.add("TopObjects.TeleportToObject", boost::bind(&LLFloaterTopObjects::onTeleportToObject, this));
// <FS:Ansariel> Estate kick avatar
mCommitCallbackRegistrar.add("TopObjects.Kick", boost::bind(&LLFloaterTopObjects::onKick, this));
// <FS:Ansariel> Show profile
mCommitCallbackRegistrar.add("TopObjects.Profile", boost::bind(&LLFloaterTopObjects::onProfile, this));
}
LLFloaterTopObjects::~LLFloaterTopObjects()
@ -293,6 +301,24 @@ void LLFloaterTopObjects::updateSelectionInfo()
LLUUID object_id = list->getCurrentID();
if (object_id.isNull()) return;
// <FS:Ansariel> Use the avatar name cache to determine if selected object
// is an avatar or object and enable avatar-specific buttons
// accordingly.
LLAvatarName av_name;
if (LLAvatarNameCache::get(object_id, &av_name))
{
bool isAvatar = !av_name.mIsTemporaryName;
getChild<LLButton>("profile_btn")->setEnabled(isAvatar);
getChild<LLButton>("estate_kick_btn")->setEnabled(isAvatar);
}
else
{
getChild<LLButton>("profile_btn")->setEnabled(FALSE);
getChild<LLButton>("estate_kick_btn")->setEnabled(FALSE);
LLAvatarNameCache::get(object_id, boost::bind(&LLFloaterTopObjects::onAvatarCheck, this, _1, _2));
}
// </FS:Ansariel>
std::string object_id_string = object_id.asString();
getChild<LLUICtrl>("id_editor")->setValue(LLSD(object_id_string));
@ -502,6 +528,7 @@ void LLFloaterTopObjects::showBeacon()
LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM);
}
// </FS:Ansariel> TP to object
void LLFloaterTopObjects::onTeleportToObject()
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
@ -520,4 +547,51 @@ void LLFloaterTopObjects::onTeleportToObject()
LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
gAgent.teleportViaLocation(pos_global);
}
}
// </FS:Ansariel> TP to object
// <FS:Ansariel> Estate kick avatar
void LLFloaterTopObjects::onKick()
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
if (!list) return;
LLScrollListItem* first_selected = list->getFirstSelected();
if (!first_selected) return;
const LLUUID& objectId = first_selected->getUUID();
LLAvatarActions::estateKick(objectId);
}
// </FS:Ansariel> Estate kick avatar
// <FS:Ansariel> Show profile
void LLFloaterTopObjects::onProfile()
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
if (!list) return;
LLScrollListItem* first_selected = list->getFirstSelected();
if (!first_selected) return;
const LLUUID& objectId = first_selected->getUUID();
LLAvatarActions::showProfile(objectId);
}
// </FS:Ansariel> Show profile
// <FS:Ansariel> Enable avatar-specific buttons if current selection is an avatar
void LLFloaterTopObjects::onAvatarCheck(const LLUUID& avatar_id, LLAvatarName av_name)
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
if (!list) return;
LLScrollListItem* first_selected = list->getFirstSelected();
if (!first_selected) return;
if (first_selected->getUUID() == avatar_id)
{
bool isAvatar = !av_name.mIsTemporaryName;
getChild<LLButton>("profile_btn")->setEnabled(isAvatar);
getChild<LLButton>("estate_kick_btn")->setEnabled(isAvatar);
}
}
// </FS:Ansariel> Enable avatar-specific buttons if current selection is an avatar

View File

@ -28,6 +28,7 @@
#define LL_LLFLOATERTOPOBJECTS_H
#include "llfloater.h"
#include "llavatarname.h"
class LLUICtrl;
@ -68,7 +69,15 @@ private:
void onDisableAll();
void onDisableSelected();
// <FS:Ansariel> TP to object
void onTeleportToObject();
// <FS:Ansariel> Estate kick avatar
void onKick();
// <FS:Ansariel> Show profile
void onProfile();
// <FS:Ansariel> Enable avatar-specific buttons if current selection is an avatar
void onAvatarCheck(const LLUUID& avatar_id, const LLAvatarName av_name);
static bool callbackReturnAll(const LLSD& notification, const LLSD& response);
static bool callbackDisableAll(const LLSD& notification, const LLSD& response);

View File

@ -55,6 +55,8 @@
<button label="Auswahl zurückgeben" name="return_selected_btn" width="134"/>
<button label="Alle zurückgeben" left="150" name="return_all_btn" width="134"/>
<button label="Teleportieren zu" left="150" name="teleport_to_btn" width="134"/>
<button label="Profil" left="150" name="profile_btn" width="134"/>
<button label="Auswahl deaktivieren" name="disable_selected_btn" width="134"/>
<button label="Alle deaktivieren" left="150" name="disable_all_btn" width="134"/>
<button label="Estate: Hinauswerfen" left="150" name="estate_kick_btn" width="134"/>
</floater>

View File

@ -241,6 +241,19 @@
<button.commit_callback
function="TopObjects.TeleportToObject" />
</button>
<button
enabled="false"
follows="bottom|left"
height="23"
label="Profile"
layout="topleft"
left_pad="10"
name="profile_btn"
top_delta="0"
width="130">
<button.commit_callback
function="TopObjects.Profile" />
</button>
<button
follows="bottom|left"
height="23"
@ -265,4 +278,17 @@
<button.commit_callback
function="TopObjects.DisableAll" />
</button>
<button
enabled="false"
follows="bottom|left"
height="23"
label="Estate Kick"
layout="topleft"
left_pad="10"
name="estate_kick_btn"
top_delta="0"
width="130">
<button.commit_callback
function="TopObjects.Kick" />
</button>
</floater>