Test populating the experience keys UI with avatar name data.
parent
723ab8b108
commit
2cde962d5d
|
|
@ -70,3 +70,4 @@ glob:indra/newview/avatar_icons_cache.txt
|
|||
glob:indra/newview/avatar_lad.log
|
||||
glob:*.diff
|
||||
*.rej
|
||||
indra/newview/stat
|
||||
|
|
|
|||
|
|
@ -25,24 +25,20 @@
|
|||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llavatarname.h"
|
||||
#include "llframetimer.h"
|
||||
#include "llhttpclient.h"
|
||||
#include "llsdserialize.h"
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "llexperiencecache.h"
|
||||
|
||||
class LLExperienceData
|
||||
{
|
||||
public:
|
||||
std::string mDisplayName;
|
||||
};
|
||||
|
||||
|
||||
|
||||
namespace LLExperienceCache
|
||||
{
|
||||
bool sRunning = true;
|
||||
bool sRunning = false;
|
||||
std::string sLookupURL;
|
||||
|
||||
typedef std::set<LLUUID> ask_queue_t;
|
||||
|
|
@ -52,19 +48,122 @@ namespace LLExperienceCache
|
|||
pending_queue_t sPendingQueue;
|
||||
|
||||
|
||||
typedef std::map<LLUUID, LLExperienceData> cache_t;
|
||||
cache_t sCache;
|
||||
|
||||
LLFrameTimer sRequestTimer;
|
||||
|
||||
|
||||
|
||||
void processExperience( const LLUUID& agent_id, const LLExperienceData& experience, bool add_to_cache )
|
||||
{
|
||||
if(add_to_cache)
|
||||
{
|
||||
sCache[agent_id]=experience;
|
||||
|
||||
sPendingQueue.erase(agent_id);
|
||||
|
||||
|
||||
//signal
|
||||
}
|
||||
}
|
||||
|
||||
void initClass( bool running )
|
||||
{
|
||||
sRunning = false;
|
||||
}
|
||||
|
||||
const cache_t& getCached()
|
||||
{
|
||||
return sCache;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void importFile(std::istream& istr)
|
||||
{
|
||||
LLSD data;
|
||||
S32 parse_count = LLSDSerialize::fromXMLDocument(data, istr);
|
||||
if(parse_count < 1) return;
|
||||
|
||||
LLSD agents = data["agents"];
|
||||
|
||||
LLUUID agent_id;
|
||||
LLExperienceData experience;
|
||||
LLSD::map_const_iterator it = agents.beginMap();
|
||||
for(; it != agents.endMap() ; ++it)
|
||||
{
|
||||
agent_id.set(it->first);
|
||||
experience.fromLLSD( it->second);
|
||||
sCache[agent_id]=experience;
|
||||
}
|
||||
|
||||
LL_INFOS("ExperienceCache") << "loaded " << sCache.size() << LL_ENDL;
|
||||
}
|
||||
|
||||
void exportFile(std::ostream& ostr)
|
||||
{
|
||||
LLSD agents;
|
||||
|
||||
cache_t::const_iterator it =sCache.begin();
|
||||
for( ; it != sCache.end() ; ++it)
|
||||
{
|
||||
agents[it->first.asString()] = it->second.asLLSD();
|
||||
}
|
||||
|
||||
LLSD data;
|
||||
data["agents"] = agents;
|
||||
|
||||
LLSDSerialize::toPrettyXML(data, ostr);
|
||||
}
|
||||
|
||||
class LLExperienceResponder : public LLHTTPClient::Responder
|
||||
{
|
||||
public:
|
||||
LLExperienceResponder(std::vector<LLUUID> agent_ids)
|
||||
LLExperienceResponder(const std::vector<LLUUID>& agent_ids)
|
||||
:mAgentIds(agent_ids)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual void completedHeader(U32 status, const std::string& reason, const LLSD& content)
|
||||
{
|
||||
mHeaders = content;
|
||||
}
|
||||
|
||||
virtual void result(const LLSD& content)
|
||||
{
|
||||
LLSD agents = content["agents"];
|
||||
LLSD::array_const_iterator it = agents.beginArray();
|
||||
for( /**/ ; it != agents.endArray(); ++it)
|
||||
{
|
||||
const LLSD& row = *it;
|
||||
LLUUID agent_id = row["id"].asUUID();
|
||||
|
||||
LLExperienceData experience;
|
||||
|
||||
if(experience.fromLLSD(row))
|
||||
{
|
||||
LL_DEBUGS("ExperienceCache") << __FUNCTION__ << "Received result for " << agent_id
|
||||
<< "display '" << experience.mDisplayName << "'" << LL_ENDL ;
|
||||
|
||||
processExperience(agent_id, experience, true);
|
||||
}
|
||||
}
|
||||
|
||||
LLSD unresolved_agents = content["bad_ids"];
|
||||
S32 num_unresolved = unresolved_agents.size();
|
||||
if(num_unresolved > 0)
|
||||
{
|
||||
LL_DEBUGS("ExperienceCache") << __FUNCTION__ << "Ignoreing " << num_unresolved
|
||||
<< " bad ids" << LL_ENDL ;
|
||||
}
|
||||
|
||||
LL_DEBUGS("ExperienceCache") << __FUNCTION__ << sCache.size() << " cached experiences" << LL_ENDL;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<LLUUID> mAgentIds;
|
||||
LLSD mHeaders;
|
||||
};
|
||||
|
||||
void requestExperiences()
|
||||
|
|
@ -171,7 +270,7 @@ namespace LLExperienceCache
|
|||
|
||||
bool get( const LLUUID& agent_id, LLExperienceData* experience_data )
|
||||
{
|
||||
if(!sRunning)
|
||||
if(sRunning)
|
||||
{
|
||||
|
||||
cache_t::const_iterator it = sCache.find(agent_id);
|
||||
|
|
@ -193,3 +292,22 @@ namespace LLExperienceCache
|
|||
|
||||
|
||||
}
|
||||
|
||||
bool LLExperienceData::fromLLSD( const LLSD& sd )
|
||||
{
|
||||
mDisplayName = sd["display_name"].asString();
|
||||
mDescription = sd["username"].asString();
|
||||
|
||||
if(mDisplayName.empty() || mDescription.empty()) return false;
|
||||
|
||||
mDescription += " % Hey, this is a description!";
|
||||
return true;
|
||||
}
|
||||
|
||||
LLSD LLExperienceData::asLLSD() const
|
||||
{
|
||||
LLSD sd;
|
||||
sd["display_name"] = mDisplayName;
|
||||
sd["username"] = mDescription.substr(0, llmin(mDescription.size(),mDescription.find(" %")));
|
||||
return sd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,20 @@
|
|||
#include <string>
|
||||
|
||||
class LLUUID;
|
||||
class LLExperienceData;
|
||||
|
||||
|
||||
class LLExperienceData
|
||||
{
|
||||
public:
|
||||
bool fromLLSD(const LLSD& sd);
|
||||
LLSD asLLSD() const;
|
||||
|
||||
|
||||
std::string mDisplayName;
|
||||
std::string mDescription;
|
||||
};
|
||||
|
||||
|
||||
|
||||
namespace LLExperienceCache
|
||||
{
|
||||
|
|
@ -41,12 +54,18 @@ namespace LLExperienceCache
|
|||
|
||||
|
||||
void idle();
|
||||
void exportFile(std::ostream& ostr);
|
||||
void importFile(std::istream& istr);
|
||||
void initClass(bool running);
|
||||
|
||||
void erase(const LLUUID& agent_id);
|
||||
void fetch(const LLUUID& agent_id);
|
||||
void insert(const LLUUID& agent_id, const LLExperienceData& experience_data);
|
||||
bool get(const LLUUID& agent_id, LLExperienceData* experience_data);
|
||||
|
||||
typedef std::map<LLUUID, LLExperienceData> cache_t;
|
||||
|
||||
const cache_t& getCached();
|
||||
};
|
||||
|
||||
#endif // LL_LLEXPERIENCECACHE_H
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@
|
|||
// Linden library includes
|
||||
#include "llavatarnamecache.h"
|
||||
#include "lldiriterator.h"
|
||||
#include "llexperiencecache.h"
|
||||
#include "llimagej2c.h"
|
||||
#include "llmemory.h"
|
||||
#include "llprimitive.h"
|
||||
|
|
@ -4145,7 +4146,7 @@ void LLAppViewer::loadNameCache()
|
|||
}
|
||||
|
||||
void LLAppViewer::saveNameCache()
|
||||
{
|
||||
{
|
||||
// display names cache
|
||||
std::string filename =
|
||||
gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
|
||||
|
|
@ -4153,7 +4154,7 @@ void LLAppViewer::saveNameCache()
|
|||
if(name_cache_stream.is_open())
|
||||
{
|
||||
LLAvatarNameCache::exportFile(name_cache_stream);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gCacheName) return;
|
||||
|
||||
|
|
@ -4166,6 +4167,32 @@ void LLAppViewer::saveNameCache()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LLAppViewer::saveExperienceCache()
|
||||
{
|
||||
std::string filename =
|
||||
gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "experience_cache.xml");
|
||||
LL_INFOS("ExperienceCache") << "Saving " << filename << LL_ENDL;
|
||||
llofstream cache_stream(filename);
|
||||
if(cache_stream.is_open())
|
||||
{
|
||||
LLExperienceCache::exportFile(cache_stream);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAppViewer::loadExperienceCache()
|
||||
{
|
||||
std::string filename =
|
||||
gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "experience_cache.xml");
|
||||
LL_INFOS("ExperienceCache") << "Loading " << filename << LL_ENDL;
|
||||
llifstream cache_stream(filename);
|
||||
if(cache_stream.is_open())
|
||||
{
|
||||
LLExperienceCache::importFile(cache_stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*! @brief This class is an LLFrameTimer that can be created with
|
||||
an elapsed time that starts counting up from the given value
|
||||
rather than 0.0.
|
||||
|
|
@ -4368,7 +4395,7 @@ void LLAppViewer::idle()
|
|||
// floating throughout the various object lists.
|
||||
//
|
||||
idleNameCache();
|
||||
|
||||
idleExperienceCache();
|
||||
idleNetwork();
|
||||
|
||||
|
||||
|
|
@ -4782,6 +4809,22 @@ void LLAppViewer::idleNameCache()
|
|||
LLAvatarNameCache::idle();
|
||||
}
|
||||
|
||||
void LLAppViewer::idleExperienceCache()
|
||||
{
|
||||
LLViewerRegion* region = gAgent.getRegion();
|
||||
if (!region) return;
|
||||
|
||||
std::string lookup_url=region->getCapability("GetDisplayNames"); // use GetDisplayNames for testing round trip
|
||||
if(!lookup_url.empty() && lookup_url.back() != '/')
|
||||
{
|
||||
lookup_url += '/';
|
||||
}
|
||||
|
||||
LLExperienceCache::setLookupURL(lookup_url);
|
||||
|
||||
LLExperienceCache::idle();
|
||||
}
|
||||
|
||||
//
|
||||
// Handle messages, and all message related stuff
|
||||
//
|
||||
|
|
@ -4945,6 +4988,7 @@ void LLAppViewer::disconnectViewer()
|
|||
}
|
||||
|
||||
saveNameCache();
|
||||
saveExperienceCache();
|
||||
|
||||
// close inventory interface, close all windows
|
||||
LLFloaterInventory::cleanup();
|
||||
|
|
|
|||
|
|
@ -114,6 +114,10 @@ public:
|
|||
void loadNameCache();
|
||||
void saveNameCache();
|
||||
|
||||
void loadExperienceCache();
|
||||
void saveExperienceCache();
|
||||
|
||||
|
||||
void removeMarkerFile(bool leave_logout_marker = false);
|
||||
|
||||
// LLAppViewer testing helpers.
|
||||
|
|
@ -218,6 +222,7 @@ private:
|
|||
void idle();
|
||||
void idleShutdown();
|
||||
// update avatar SLID and display name caches
|
||||
void idleExperienceCache();
|
||||
void idleNameCache();
|
||||
void idleNetwork();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "llpanelprofile.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llexperiencecache.h"
|
||||
|
||||
#include "llpanelexperiences.h"
|
||||
|
||||
|
|
@ -34,15 +35,16 @@ BOOL LLPanelExperiences::postBuild( void )
|
|||
mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
|
||||
}
|
||||
|
||||
LLExperienceItem* item = new LLExperienceItem();
|
||||
item->setExperienceName("experience 1");
|
||||
item->setExperienceDescription("hey, I\'m an experience!");
|
||||
mExperiencesList->addItem(item);
|
||||
|
||||
item = new LLExperienceItem();
|
||||
item->setExperienceName("experience 2");
|
||||
item->setExperienceDescription("hey, I\'m another experience!");
|
||||
mExperiencesList->addItem(item);
|
||||
const LLExperienceCache::cache_t& experiences = LLExperienceCache::getCached();
|
||||
|
||||
LLExperienceCache::cache_t::const_iterator it = experiences.begin();
|
||||
for( ; it != experiences.end() && mExperiencesList->getChildCount() < 10 ; ++it)
|
||||
{
|
||||
LLExperienceItem* item = new LLExperienceItem();
|
||||
item->setExperienceName(it->second.mDisplayName);
|
||||
item->setExperienceDescription(it->second.mDescription);
|
||||
mExperiencesList->addItem(item);
|
||||
}
|
||||
|
||||
mExperiencesAccTab = getChild<LLAccordionCtrlTab>("tab_experiences");
|
||||
mExperiencesAccTab->setDropDownStateChangedCallback(boost::bind(&LLPanelExperiences::onAccordionStateChanged, this, mExperiencesAccTab));
|
||||
|
|
@ -179,7 +181,8 @@ LLExperienceItem::LLExperienceItem()
|
|||
|
||||
void LLExperienceItem::init( LLExperienceData* experience_data )
|
||||
{
|
||||
|
||||
setExperienceDescription(experience_data->mDescription);
|
||||
setExperienceName(experience_data->mDisplayName);
|
||||
}
|
||||
|
||||
void LLExperienceItem::setExperienceDescription( const std::string& val )
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "llflatlistview.h"
|
||||
#include "llpanelavatar.h"
|
||||
|
||||
class LLExperienceData;
|
||||
class LLExperienceItem;
|
||||
class LLPanelProfile;
|
||||
|
||||
|
|
@ -87,11 +88,6 @@ private:
|
|||
bool mNoExperiences;
|
||||
};
|
||||
|
||||
struct LLExperienceData
|
||||
{
|
||||
std::string name;
|
||||
std::string desc;
|
||||
};
|
||||
|
||||
class LLExperienceItem
|
||||
: public LLPanel
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
#include "llares.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llexperiencecache.h"
|
||||
#include "lllandmark.h"
|
||||
#include "llcachename.h"
|
||||
#include "lldir.h"
|
||||
|
|
@ -1398,6 +1399,9 @@ bool idle_startup()
|
|||
LLStartUp::initNameCache();
|
||||
display_startup();
|
||||
|
||||
LLStartUp::initExperienceCache();
|
||||
display_startup();
|
||||
|
||||
// update the voice settings *after* gCacheName initialization
|
||||
// so that we can construct voice UI that relies on the name cache
|
||||
LLVoiceClient::getInstance()->updateSettings();
|
||||
|
|
@ -2809,6 +2813,13 @@ void LLStartUp::initNameCache()
|
|||
LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames"));
|
||||
}
|
||||
|
||||
|
||||
void LLStartUp::initExperienceCache()
|
||||
{
|
||||
LLAppViewer::instance()->loadExperienceCache();
|
||||
LLExperienceCache::initClass(false);
|
||||
}
|
||||
|
||||
void LLStartUp::cleanupNameCache()
|
||||
{
|
||||
LLAvatarNameCache::cleanupClass();
|
||||
|
|
@ -3507,3 +3518,4 @@ void transition_back_to_login_panel(const std::string& emsg)
|
|||
reset_login(); // calls LLStartUp::setStartupState( STATE_LOGIN_SHOW );
|
||||
gSavedSettings.setBOOL("AutoLogin", FALSE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public:
|
|||
static void fontInit();
|
||||
|
||||
static void initNameCache();
|
||||
static void initExperienceCache();
|
||||
|
||||
static void cleanupNameCache();
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#include "llanimationstates.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llavatarpropertiesprocessor.h"
|
||||
#include "llexperiencecache.h"
|
||||
#include "llphysicsmotion.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llcallingcard.h" // IDEVO for LLAvatarTracker
|
||||
|
|
@ -2516,6 +2517,9 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
|
|||
idleUpdateBelowWater(); // wind effect uses this
|
||||
idleUpdateWindEffect();
|
||||
}
|
||||
|
||||
LLExperienceData ed;
|
||||
LLExperienceCache::get(getID(), &ed);
|
||||
|
||||
idleUpdateNameTag( root_pos_last );
|
||||
idleUpdateRenderCost();
|
||||
|
|
|
|||
Loading…
Reference in New Issue