summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authordolphin@dolphin-THINK.lindenlab.com <dolphin@dolphin-THINK.lindenlab.com>2012-11-19 08:06:42 -0800
committerdolphin@dolphin-THINK.lindenlab.com <dolphin@dolphin-THINK.lindenlab.com>2012-11-19 08:06:42 -0800
commit2cde962d5db94baf860eb94fecaf9671548b2c53 (patch)
treee0be2ff2ec0a6812ed4bcff88bada3dae85adec8 /indra/newview
parent723ab8b108beb7fc140b8be163d59b5dfa896ca8 (diff)
Test populating the experience keys UI with avatar name data.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp50
-rw-r--r--indra/newview/llappviewer.h5
-rw-r--r--indra/newview/llpanelexperiences.cpp23
-rw-r--r--indra/newview/llpanelexperiences.h6
-rwxr-xr-xindra/newview/llstartup.cpp12
-rwxr-xr-xindra/newview/llstartup.h1
-rwxr-xr-xindra/newview/llvoavatar.cpp4
7 files changed, 83 insertions, 18 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a674ab0cf8..b80202bd45 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -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();
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 7a474f9122..4bf6bec0e8 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -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();
diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp
index f174171a97..bc9d3cc0ee 100644
--- a/indra/newview/llpanelexperiences.cpp
+++ b/indra/newview/llpanelexperiences.cpp
@@ -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 )
diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h
index 2a0f101f8a..33bb0f944a 100644
--- a/indra/newview/llpanelexperiences.h
+++ b/indra/newview/llpanelexperiences.h
@@ -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
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 42648b82c2..7b12d5509e 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -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);
}
+
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index 760e38890b..00e03bcda6 100755
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -91,6 +91,7 @@ public:
static void fontInit();
static void initNameCache();
+ static void initExperienceCache();
static void cleanupNameCache();
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 627238b0f5..4635138fa3 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -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();