Centralized calls to retrieve LLPanelPeople in getPeoplePanel() in FSCommon

Ansariel 2013-03-19 14:53:46 +01:00
parent 8d1115566c
commit d365a8881d
8 changed files with 50 additions and 28 deletions

View File

@ -1163,11 +1163,11 @@ LLUUID cmdline_partial_name2key(std::string partial_name)
std::string av_name;
LLStringUtil::toLower(partial_name);
LLPanel* panel_people = LLFloaterSidePanelContainer::getPanel("people", "panel_people");
LLPanelPeople* panel_people = getPeoplePanel();
if (panel_people)
{
std::vector<LLPanel*> items;
LLAvatarList* nearbyList = ((LLPanelPeople*)panel_people)->getNearbyList();
LLAvatarList* nearbyList = panel_people->getNearbyList();
nearbyList->getItems(items);
for (std::vector<LLPanel*>::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
@ -1189,10 +1189,10 @@ LLUUID cmdline_partial_name2key(std::string partial_name)
void cmdline_tp2name(std::string target)
{
LLUUID avkey = cmdline_partial_name2key(target);
LLPanel* panel_people = LLFloaterSidePanelContainer::getPanel("people", "panel_people");
LLPanelPeople* panel_people = getPeoplePanel();
if (avkey.notNull() && panel_people)
{
LLAvatarListItem* avatar_list_item = ((LLPanelPeople*)panel_people)->getNearbyList()->getAvatarListItem(avkey);
LLAvatarListItem* avatar_list_item = panel_people->getNearbyList()->getAvatarListItem(avkey);
if (avatar_list_item)
{
LLVector3d pos = avatar_list_item->getPosition();

View File

@ -28,7 +28,10 @@
#include "llviewerprecompiledheaders.h"
#include "fscommon.h"
#include "llfloatersidepanelcontainer.h"
#include "llnotificationmanager.h"
#include "llpanel.h"
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
@ -111,6 +114,15 @@ std::string applyMuPose(const std::string& message)
return utf8_text;
}
LLPanelPeople* getPeoplePanel()
{
LLPanel* panel_people = LLFloaterSidePanelContainer::getPanel("people", "panel_people");
if (panel_people)
{
return dynamic_cast<LLPanelPeople*>(panel_people);
}
return NULL;
}
S32 FSCommon::secondsSinceEpochFromString(const std::string& format, const std::string& str)
{

View File

@ -29,10 +29,12 @@
#define FS_COMMON_H
#include "llchat.h"
#include "llpanelpeople.h"
void reportToNearbyChat(const std::string& message);
std::string applyAutoCloseOoc(const std::string& message);
std::string applyMuPose(const std::string& message);
LLPanelPeople* getPeoplePanel();
namespace FSCommon
{

View File

@ -26,17 +26,16 @@
*/
#include "llviewerprecompiledheaders.h"
#include "fslslbridgerequest.h"
#include "fscommon.h"
#include "fslslbridge.h"
#include "llagent.h" // for gAgent
#include "llhttpclient.h"
#include <string>
#include <boost/tokenizer.hpp> // for radar
#include "llpanel.h"
#include "llpanelpeople.h"
#include "llavatarlist.h"
#include "llavatarlistitem.h"
#include "llfloatersidepanelcontainer.h"
#ifdef LL_STANDALONE
#include <expat.h>
@ -63,13 +62,13 @@ void FSLSLBridgeRequestManager::processBridgeCall(const LLSD& content)
{
std::string strContent = content.asString();
llinfos << "Got info: " << strContent << llendl;
}
FSLSLBridgeRequestResponder::FSLSLBridgeRequestResponder()
{
//FSLSLBridgeRequestManager::instance().initSingleton();
}
//If we get back a normal response, handle it here
void FSLSLBridgeRequestResponder::result(const LLSD& content)
{
@ -88,17 +87,16 @@ void FSLSLBridgeRequestResponder::error(U32 status, const std::string& reason)
<< status << ": " << reason << ")" << llendl;
}
// AO: The below handler is used to parse return data from the bridge, requesting bulk ZOffset updates.
FSLSLBridgeRequestRadarPosResponder::FSLSLBridgeRequestRadarPosResponder()
{
}
void FSLSLBridgeRequestRadarPosResponder::result(const LLSD& content)
{
LLPanel* panel_people = LLFloaterSidePanelContainer::getPanel("people", "panel_people");
LLPanelPeople* panel_people = getPeoplePanel();
if (panel_people)
{
LLAvatarList* nearbyList = ((LLPanelPeople*)panel_people)->getNearbyList();
LLAvatarList* nearbyList = panel_people->getNearbyList();
std::string strContent = content.asString();
//llinfos << "Got info: " << strContent << llendl;

View File

@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "fsslurlcommand.h"
#include "fscommon.h"
#include "llagent.h"
#include "llavataractions.h"
#include "llavatarlist.h"
@ -39,7 +40,7 @@
LLAvatarListItem* getAvatarListItem(const LLUUID& avatar_id)
{
LLPanelPeople* panel_people = dynamic_cast<LLPanelPeople*>(LLFloaterSidePanelContainer::getPanel("people", "panel_people"));
LLPanelPeople* panel_people = getPeoplePanel();
if (panel_people)
{
return panel_people->getNearbyList()->getAvatarListItem(avatar_id);
@ -117,7 +118,7 @@ public:
{
if (gAgentID != target_id)
{
LLPanelPeople* panel_people = dynamic_cast<LLPanelPeople*>(LLFloaterSidePanelContainer::getPanel("people", "panel_people"));
LLPanelPeople* panel_people = getPeoplePanel();
LLAvatarListItem* avatar_list_item = getAvatarListItem(target_id);
if (avatar_list_item && panel_people)
{

View File

@ -840,11 +840,11 @@ BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id)
// aka radar when above 1020m.
if (isHigher1020mBug)
{
LLPanel* panel_people = LLFloaterSidePanelContainer::getPanel("people", "panel_people");
if (panel_people != NULL)
LLPanelPeople* panel_people = getPeoplePanel();
if (panel_people)
{
LLAvatarListItem* avatar_list_item = ((LLPanelPeople*)panel_people)->getNearbyList()->getAvatarListItem(avatar_id);
if (avatar_list_item != NULL)
LLAvatarListItem* avatar_list_item = panel_people->getNearbyList()->getAvatarListItem(avatar_id);
if (avatar_list_item)
{
F32 radar_distance = avatar_list_item->getRange();
@ -1304,7 +1304,7 @@ void LLNetMap::startTracking()
{
if (mClosestAgentAtLastRightClick.notNull())
{
LLPanelPeople* panel_people = (LLPanelPeople*)LLFloaterSidePanelContainer::getPanel("people", "panel_people");
LLPanelPeople* panel_people = getPeoplePanel();
if (panel_people != NULL)
{
panel_people->startTracking(mClosestAgentAtLastRightClick);

View File

@ -38,9 +38,10 @@
#include "llavataractions.h"
#include "llcallingcard.h" // for LLAvatarTracker
#include "llviewermenu.h" // for gMenuHolder
#include "llfloatersidepanelcontainer.h"
#include "llpanelpeople.h"
#include "fscommon.h"
namespace LLPanelPeopleMenus
{
@ -242,15 +243,21 @@ void NearbyMenu::teleportToAvatar()
// AO: wrapper for functionality managed by LLPanelPeople, because it manages the nearby avatar list.
// Will only work for avatars within radar range.
{
LLPanelPeople* peoplePanel = dynamic_cast<LLPanelPeople*>(LLFloaterSidePanelContainer::getPanel("people", "panel_people"));
peoplePanel->teleportToAvatar(mUUIDs.front());
LLPanelPeople* peoplePanel = getPeoplePanel();
if (peoplePanel)
{
peoplePanel->teleportToAvatar(mUUIDs.front());
}
}
// Ansariel: Avatar tracking feature
void NearbyMenu::onTrackAvatarMenuItemClick()
{
LLPanelPeople* peoplePanel = dynamic_cast<LLPanelPeople*>(LLFloaterSidePanelContainer::getPanel("people", "panel_people"));
peoplePanel->startTracking(mUUIDs.front());
LLPanelPeople* peoplePanel = getPeoplePanel();
if (peoplePanel)
{
peoplePanel->startTracking(mUUIDs.front());
}
}
} // namespace LLPanelPeopleMenus

View File

@ -5542,10 +5542,12 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
// AO: Hack for legacy radar script interface compatibility. Interpret certain
// sound assets as a request for a full radar update to a channel
if ((owner_id == gAgent.getID()) && (sound_id.asString() == gSavedSettings.getString("RadarLegacyChannelAlertRefreshUUID")))
{
LLPanelPeople* pPeoplePanel = dynamic_cast<LLPanelPeople*>(LLFloaterSidePanelContainer::getPanel("people", "panel_people"));
if (pPeoplePanel)
pPeoplePanel->requestRadarChannelAlertSync();
{
LLPanelPeople* pPeoplePanel = getPeoplePanel();
if (pPeoplePanel)
{
pPeoplePanel->requestRadarChannelAlertSync();
}
return;
}