diff --git a/.hgtags b/.hgtags
index a4fb6ce9f8..b333b9384d 100755
--- a/.hgtags
+++ b/.hgtags
@@ -553,3 +553,6 @@ ab2ec5c5423b277d23fd0511ce50c15123ff2e03 6.2.3-release
67297f9902857e357570c44722ad84de3aff974e 6.2.4-release
9777aec6dc4a30a24537297ac040861ce16b82ae 6.3.0-release
ece699718f163921717bb95a6131e94af4c4138f 6.3.1-release
+07f5d5bc9faebb45695853d40a9549773db816c0 6.3.2-release
+d9a4bd15e2c852953d6c8e84d6f3b7ca442c0e7f 6.3.3-release
+4033b3f57e76f087235145a3016886ccdc87ffa3 6.3.4-release
diff --git a/autobuild.xml b/autobuild.xml
index 5f072512c1..88db33e317 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -2918,7 +2918,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
license
Mixed
license_file
- LICENSES/slvoice.txt
+ LICENSES/vivox_licenses.txt
name
slvoice
platforms
@@ -2940,9 +2940,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
archive
name
darwin64
@@ -2976,9 +2976,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
archive
name
windows
@@ -2988,16 +2988,16 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
archive
name
windows64
version
- 4.9.0002.30313.517593
+ 4.10.0000.32327.5fc3fe7c.531581
tut
vlc-bin
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 62e78d3f51..69efb1a824 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -1450,6 +1450,7 @@ Tonya Souther
STORM-1905
BUG-3875
BUG-3968
+ OPEN-345
Torben Trautman
TouchaHoney Perhaps
TraductoresAnonimos Alter
diff --git a/indra/cmake/BuildPackagesInfo.cmake b/indra/cmake/BuildPackagesInfo.cmake
index 93461cea95..4314cca33d 100644
--- a/indra/cmake/BuildPackagesInfo.cmake
+++ b/indra/cmake/BuildPackagesInfo.cmake
@@ -8,7 +8,7 @@ include(Python)
# building in an IDE, it probably isn't. Set it explicitly using
# run_build_test.py.
add_custom_command(OUTPUT packages-info.txt
- COMMENT Generating packages-info.txt for the about box
+ COMMENT "Generating packages-info.txt for the about box"
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/../autobuild.xml
DEPENDS ${CMAKE_SOURCE_DIR}/../scripts/packages-formatter.py
${CMAKE_SOURCE_DIR}/../autobuild.xml
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
index dde53835fb..c73a1fdb47 100644
--- a/indra/cmake/Copy3rdPartyLibs.cmake
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -17,17 +17,16 @@ if(WINDOWS)
#*******************************
# VIVOX - *NOTE: no debug version
- set(vivox_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
- set(vivox_files
- SLVoice.exe
- )
+ set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
+ set(slvoice_src_dir "${ARCH_PREBUILT_BIN_RELEASE}")
+ set(slvoice_files SLVoice.exe )
if (ADDRESS_SIZE EQUAL 64)
- list(APPEND vivox_files
+ list(APPEND vivox_libs
vivoxsdk_x64.dll
ortp_x64.dll
)
else (ADDRESS_SIZE EQUAL 64)
- list(APPEND vivox_files
+ list(APPEND vivox_libs
vivoxsdk.dll
ortp.dll
)
@@ -169,11 +168,10 @@ elseif(DARWIN)
set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/Resources")
set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}/Release/Resources")
- set(vivox_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
- set(vivox_files
- SLVoice
+ set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
+ set(slvoice_files SLVoice)
+ set(vivox_libs
libortp.dylib
- libvivoxplatform.dylib
libvivoxsdk.dylib
)
set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
@@ -206,15 +204,15 @@ elseif(LINUX)
set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}")
set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}")
- set(vivox_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
- set(vivox_files
+ set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
+ set(vivox_libs
libsndfile.so.1
libortp.so
libvivoxoal.so.1
- libvivoxplatform.so
libvivoxsdk.so
- SLVoice
- )
+ )
+ set(slvoice_files SLVoice)
+
# *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
# or ARCH_PREBUILT_DIRS
set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
@@ -251,8 +249,8 @@ elseif(LINUX)
else(WINDOWS)
message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...")
- set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
- set(vivox_files "")
+ set(vivox_lib_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
+ set(vivox_libs "")
# *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
# or ARCH_PREBUILT_DIRS
set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/debug")
@@ -275,39 +273,36 @@ endif(WINDOWS)
################################################################
copy_if_different(
- ${vivox_src_dir}
+ ${vivox_lib_dir}
"${SHARED_LIB_STAGING_DIR_DEBUG}"
out_targets
- ${vivox_files}
+ ${vivox_libs}
)
set(third_party_targets ${third_party_targets} ${out_targets})
copy_if_different(
- ${vivox_src_dir}
+ ${slvoice_src_dir}
"${SHARED_LIB_STAGING_DIR_RELEASE}"
out_targets
- ${vivox_files}
+ ${slvoice_files}
)
+copy_if_different(
+ ${vivox_lib_dir}
+ "${SHARED_LIB_STAGING_DIR_RELEASE}"
+ out_targets
+ ${vivox_libs}
+ )
+
set(third_party_targets ${third_party_targets} ${out_targets})
copy_if_different(
- ${vivox_src_dir}
+ ${vivox_lib_dir}
"${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
out_targets
- ${vivox_files}
+ ${vivox_libs}
)
set(third_party_targets ${third_party_targets} ${out_targets})
-
-
-#copy_if_different(
-# ${debug_src_dir}
-# "${SHARED_LIB_STAGING_DIR_DEBUG}"
-# out_targets
-# ${debug_files}
-# )
-#set(third_party_targets ${third_party_targets} ${out_targets})
-
copy_if_different(
${release_src_dir}
"${SHARED_LIB_STAGING_DIR_RELEASE}"
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 2e6cf53912..4bc70b2ca4 100755
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -27,6 +27,7 @@ THE SOFTWARE.
$/LicenseInfo$
"""
+from collections import namedtuple, defaultdict
import commands
import errno
import filecmp
@@ -312,6 +313,8 @@ class LLManifestRegistry(type):
if match:
cls.manifests[match.group(1).lower()] = cls
+MissingFile = namedtuple("MissingFile", ("pattern", "tried"))
+
class LLManifest(object):
__metaclass__ = LLManifestRegistry
manifests = {}
@@ -333,7 +336,8 @@ class LLManifest(object):
self.dst_prefix = [args['dest']]
self.created_paths = []
self.package_name = "Unknown"
-
+ self.missing = []
+
def default_channel(self):
return self.args.get('channel', None) == RELEASE_CHANNEL
@@ -592,6 +596,40 @@ class LLManifest(object):
def package_action(self, src, dst):
pass
+ def finish(self):
+ """
+ generic finish, always called before the ${action}_finish() methods
+ """
+ # Collecting MissingFile instances in self.missing, and checking that
+ # here, is intended to minimize the number of (potentially lengthy)
+ # build cycles a developer must run in order to fix missing-files
+ # errors. The manifest processing is necessarily the last step in a
+ # build, and if we only caught a single missing file error per run,
+ # the developer would need to run a build for each additional missing-
+ # file error until all were resolved. This way permits the developer
+ # to resolve them all at once.
+ if self.missing:
+ print '*' * 72
+ print "Missing files:"
+ # Instead of just dumping each missing file and all the places we
+ # looked for it, group by common sets of places we looked. Use a
+ # set to store the 'tried' directories, to avoid mismatches due to
+ # reordering -- but since we intend to use the set of 'tried'
+ # directories as a dict key, it must be a frozenset.
+ organize = defaultdict(set)
+ for missingfile in self.missing:
+ organize[frozenset(missingfile.tried)].add(missingfile.pattern)
+ # Now dump all the patterns sought in each group of 'tried'
+ # directories.
+ for tried, patterns in organize.items():
+ print " Could not find in:"
+ for dir in sorted(tried):
+ print " %s" % dir
+ for pattern in sorted(patterns):
+ print " %s" % pattern
+ print '*' * 72
+ raise MissingError('%s patterns could not be found' % len(self.missing))
+
def copy_finish(self):
pass
@@ -825,17 +863,23 @@ class LLManifest(object):
return count
try_prefixes = [self.get_src_prefix(), self.get_artwork_prefix(), self.get_build_prefix()]
- tried=[]
- count=0
- while not count and try_prefixes:
- pfx = try_prefixes.pop(0)
+ for pfx in try_prefixes:
try:
count = try_path(os.path.join(pfx, src))
except MissingError:
- tried.append(pfx)
- if not try_prefixes:
- # no more prefixes left to try
- print "unable to find '%s'; looked in:\n %s" % (src, '\n '.join(tried))
+ # if we produce MissingError, just try the next prefix
+ continue
+ # If we actually found nonzero files, stop looking
+ if count:
+ break
+ else:
+ # no more prefixes left to try
+ print("\nunable to find '%s'; looked in:\n %s" % (src, '\n '.join(try_prefixes)))
+ self.missing.append(MissingFile(pattern=src, tried=try_prefixes))
+ # At this point 'count' might never have been successfully
+ # assigned! Even if it was, though, we can be sure it is 0.
+ return 0
+
print "%d files" % count
# Let caller check whether we processed as many files as expected. In
@@ -846,6 +890,8 @@ class LLManifest(object):
self.actions = actions
self.construct()
# perform finish actions
+ # generic finish first
+ self.finish()
for action in self.actions:
methodname = action + "_finish"
method = getattr(self, methodname, None)
diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp
index 0e29bbe783..6b7dc41ffd 100644
--- a/indra/llappearance/llwearabletype.cpp
+++ b/indra/llappearance/llwearabletype.cpp
@@ -29,18 +29,6 @@
#include "llinventorytype.h"
#include "llinventorydefines.h"
-static LLTranslationBridge* sTrans = NULL;
-
-// static
-void LLWearableType::initClass(LLTranslationBridge* trans)
-{
- sTrans = trans;
-}
-
-void LLWearableType::cleanupClass()
-{
- delete sTrans;
-}
struct WearableEntry : public LLDictionaryEntry
{
@@ -53,7 +41,7 @@ struct WearableEntry : public LLDictionaryEntry
LLDictionaryEntry(name),
mAssetType(assetType),
mDefaultNewName(default_new_name),
- mLabel(sTrans->getString(name)),
+ mLabel(LLWearableType::getInstance()->mTrans->getString(name)),
mIconName(iconName),
mDisableCameraSwitch(disable_camera_switch),
mAllowMultiwear(allow_multiwear)
@@ -68,7 +56,7 @@ struct WearableEntry : public LLDictionaryEntry
BOOL mAllowMultiwear;
};
-class LLWearableDictionary : public LLSingleton,
+class LLWearableDictionary : public LLParamSingleton,
public LLDictionary
{
LLSINGLETON(LLWearableDictionary);
@@ -99,6 +87,27 @@ LLWearableDictionary::LLWearableDictionary()
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
}
+
+// class LLWearableType
+
+LLWearableType::LLWearableType(LLTranslationBridge* trans)
+{
+ mTrans = trans;
+}
+
+LLWearableType::~LLWearableType()
+{
+ delete mTrans;
+}
+
+void LLWearableType::initSingleton()
+{
+ // To make sure all wrapping functions will crash without initing LLWearableType;
+ LLWearableDictionary::initParamSingleton();
+
+ // Todo: consider merging LLWearableType and LLWearableDictionary
+}
+
// static
LLWearableType::EType LLWearableType::typeNameToType(const std::string& type_name)
{
diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h
index ac81376538..80bb9a10b4 100644
--- a/indra/llappearance/llwearabletype.h
+++ b/indra/llappearance/llwearabletype.h
@@ -42,8 +42,12 @@ public:
};
-class LLWearableType
+class LLWearableType : public LLParamSingleton
{
+ LLSINGLETON(LLWearableType, LLTranslationBridge* trans);
+ ~LLWearableType();
+ friend struct WearableEntry;
+ void initSingleton();
public:
enum EType
{
@@ -70,9 +74,8 @@ public:
WT_NONE = -1,
};
- static void initClass(LLTranslationBridge* trans); // initializes static members
- static void cleanupClass(); // initializes static members
-
+ // Most methods are wrappers for dictionary, but if LLWearableType is not initialized,
+ // they will crash. Whole LLWearableType is just wrapper for convinient calls.
static const std::string& getTypeName(EType type);
static const std::string& getTypeDefaultNewName(EType type);
static const std::string& getTypeLabel(EType type);
@@ -81,11 +84,12 @@ public:
static LLInventoryType::EIconName getIconName(EType type);
static BOOL getDisableCameraSwitch(EType type);
static BOOL getAllowMultiwear(EType type);
- static EType inventoryFlagsToWearableType(U32 flags);
+
+ static EType inventoryFlagsToWearableType(U32 flags);
protected:
- LLWearableType() {}
- ~LLWearableType() {}
+
+ LLTranslationBridge* mTrans;
};
#endif // LL_LLWEARABLETYPE_H
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index 2024d707da..d463fc9d65 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -199,14 +199,10 @@ private:
friend BlockTimer timeThisBlock(BlockTimerStatHandle&);
BlockTimer(BlockTimerStatHandle& timer);
-#if !defined(MSC_VER) || MSC_VER < 1700
- // Visual Studio 2010 has a bug where capturing an object returned by value
- // into a local reference requires access to the copy constructor at the call site.
- // This appears to be fixed in 2012.
-public:
-#endif
+
// no-copy
- BlockTimer(const BlockTimer& other) {};
+ BlockTimer(const BlockTimer& other);
+ BlockTimer& operator=(const BlockTimer& other);
private:
U64 mStartTime;
diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp
index 287f096eae..93c7d520f2 100644
--- a/indra/llcommon/llmortician.cpp
+++ b/indra/llcommon/llmortician.cpp
@@ -37,6 +37,42 @@ LLMortician::~LLMortician()
sGraveyard.remove(this);
}
+U32 LLMortician::logClass(std::stringstream &str)
+{
+ U32 size = sGraveyard.size();
+ str << "Mortician graveyard count: " << size;
+ str << " Zealous: " << (sDestroyImmediate ? "True" : "False");
+ if (size == 0)
+ {
+ return size;
+ }
+ str << " Output:\n";
+ std::list::iterator iter = sGraveyard.begin();
+ std::list::iterator end = sGraveyard.end();
+ while (iter!=end)
+ {
+ LLMortician* dead = *iter;
+ iter++;
+ // Be as detailed and safe as possible to figure out issues
+ str << "Pointer: " << dead;
+ if (dead)
+ {
+ try
+ {
+ str << " Is dead: " << (dead->isDead() ? "True" : "False");
+ str << " Name: " << typeid(*dead).name();
+ }
+ catch (...)
+ {
+
+ }
+ }
+ str << "\n";
+ }
+ str << "--------------------------------------------";
+ return size;
+}
+
void LLMortician::updateClass()
{
while (!sGraveyard.empty())
diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h
index 9517e2db5e..41cb49fab1 100644
--- a/indra/llcommon/llmortician.h
+++ b/indra/llcommon/llmortician.h
@@ -34,6 +34,8 @@ class LL_COMMON_API LLMortician
{
public:
LLMortician() { mIsDead = FALSE; }
+ static U32 graveyardCount() { return sGraveyard.size(); };
+ static U32 logClass(std::stringstream &str);
static void updateClass();
virtual ~LLMortician();
void die();
diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp
index 9fbd78a000..c45c144570 100644
--- a/indra/llcommon/llsingleton.cpp
+++ b/indra/llcommon/llsingleton.cpp
@@ -134,12 +134,6 @@ LLSingletonBase::list_t& LLSingletonBase::get_initializing()
return LLSingletonBase::MasterList::instance().get_initializing_();
}
-//static
-LLSingletonBase::list_t& LLSingletonBase::get_initializing_from(MasterList* master)
-{
- return master->get_initializing_();
-}
-
LLSingletonBase::~LLSingletonBase() {}
void LLSingletonBase::push_initializing(const char* name)
@@ -156,7 +150,7 @@ void LLSingletonBase::pop_initializing()
if (list.empty())
{
logerrs("Underflow in stack of currently-initializing LLSingletons at ",
- demangle(typeid(*this).name()).c_str(), "::getInstance()");
+ classname(this).c_str(), "::getInstance()");
}
// Now we know list.back() exists: capture it
@@ -178,14 +172,39 @@ void LLSingletonBase::pop_initializing()
if (back != this)
{
logerrs("Push/pop mismatch in stack of currently-initializing LLSingletons: ",
- demangle(typeid(*this).name()).c_str(), "::getInstance() trying to pop ",
- demangle(typeid(*back).name()).c_str());
+ classname(this).c_str(), "::getInstance() trying to pop ",
+ classname(back).c_str());
}
// log AFTER popping so logging singletons don't cry circularity
log_initializing("Popping", typeid(*back).name());
}
+void LLSingletonBase::reset_initializing(list_t::size_type size)
+{
+ // called for cleanup in case the LLSingleton subclass constructor throws
+ // an exception
+
+ // The tricky thing about this, the reason we have a separate method
+ // instead of just calling pop_initializing(), is (hopefully remote)
+ // possibility that the exception happened *before* the
+ // push_initializing() call in LLSingletonBase's constructor. So only
+ // remove the stack top if in fact we've pushed something more than the
+ // previous size.
+ list_t& list(get_initializing());
+
+ while (list.size() > size)
+ {
+ list.pop_back();
+ }
+
+ // as in pop_initializing()
+ if (list.empty())
+ {
+ MasterList::instance().cleanup_initializing_();
+ }
+}
+
//static
void LLSingletonBase::log_initializing(const char* verb, const char* name)
{
@@ -197,7 +216,7 @@ void LLSingletonBase::log_initializing(const char* verb, const char* name)
ri != rend; ++ri)
{
LLSingletonBase* sb(*ri);
- LL_CONT << ' ' << demangle(typeid(*sb).name());
+ LL_CONT << ' ' << classname(sb);
}
LL_ENDL;
}
@@ -231,7 +250,7 @@ void LLSingletonBase::capture_dependency(list_t& initializing, EInitState initSt
// 'found' is an iterator; *found is an LLSingletonBase*; **found
// is the actual LLSingletonBase instance.
LLSingletonBase* foundp(*found);
- out << demangle(typeid(*foundp).name()) << " -> ";
+ out << classname(foundp) << " -> ";
}
// We promise to capture dependencies from both the constructor
// and the initSingleton() method, so an LLSingleton's instance
@@ -245,7 +264,7 @@ void LLSingletonBase::capture_dependency(list_t& initializing, EInitState initSt
if (initState == CONSTRUCTING)
{
logerrs("LLSingleton circularity in Constructor: ", out.str().c_str(),
- demangle(typeid(*this).name()).c_str(), "");
+ classname(this).c_str(), "");
}
else if (it_next == initializing.end())
{
@@ -256,14 +275,14 @@ void LLSingletonBase::capture_dependency(list_t& initializing, EInitState initSt
// Example: LLNotifications singleton initializes default channels.
// Channels register themselves with singleton once done.
logdebugs("LLSingleton circularity: ", out.str().c_str(),
- demangle(typeid(*this).name()).c_str(), "");
+ classname(this).c_str(), "");
}
else
{
// Actual circularity with other singleton (or single singleton is used extensively).
// Dependency can be unclear.
logwarns("LLSingleton circularity: ", out.str().c_str(),
- demangle(typeid(*this).name()).c_str(), "");
+ classname(this).c_str(), "");
}
}
else
@@ -276,8 +295,8 @@ void LLSingletonBase::capture_dependency(list_t& initializing, EInitState initSt
if (current->mDepends.insert(this).second)
{
// only log the FIRST time we hit this dependency!
- logdebugs(demangle(typeid(*current).name()).c_str(),
- " depends on ", demangle(typeid(*this).name()).c_str());
+ logdebugs(classname(current).c_str(),
+ " depends on ", classname(this).c_str());
}
}
}
@@ -336,19 +355,19 @@ void LLSingletonBase::cleanupAll()
sp->mCleaned = true;
logdebugs("calling ",
- demangle(typeid(*sp).name()).c_str(), "::cleanupSingleton()");
+ classname(sp).c_str(), "::cleanupSingleton()");
try
{
sp->cleanupSingleton();
}
catch (const std::exception& e)
{
- logwarns("Exception in ", demangle(typeid(*sp).name()).c_str(),
+ logwarns("Exception in ", classname(sp).c_str(),
"::cleanupSingleton(): ", e.what());
}
catch (...)
{
- logwarns("Unknown exception in ", demangle(typeid(*sp).name()).c_str(),
+ logwarns("Unknown exception in ", classname(sp).c_str(),
"::cleanupSingleton()");
}
}
@@ -363,7 +382,7 @@ void LLSingletonBase::deleteAll()
{
// Capture the class name first: in case of exception, don't count on
// being able to extract it later.
- const std::string name = demangle(typeid(*sp).name());
+ const std::string name = classname(sp);
try
{
// Call static method through instance function pointer.
@@ -440,7 +459,17 @@ void LLSingletonBase::logerrs(const char* p1, const char* p2, const char* p3, co
log(LLError::LEVEL_ERROR, p1, p2, p3, p4);
// The other important side effect of LL_ERRS() is
// https://www.youtube.com/watch?v=OMG7paGJqhQ (emphasis on OMG)
- LLError::crashAndLoop(std::string());
+ std::ostringstream out;
+ out << p1 << p2 << p3 << p4;
+ auto crash = LLError::getFatalFunction();
+ if (crash)
+ {
+ crash(out.str());
+ }
+ else
+ {
+ LLError::crashAndLoop(out.str());
+ }
}
std::string LLSingletonBase::demangle(const char* mangled)
diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h
index 859e271e26..0da6d548ab 100644
--- a/indra/llcommon/llsingleton.h
+++ b/indra/llcommon/llsingleton.h
@@ -31,6 +31,18 @@
#include
#include
+#if LL_WINDOWS
+#pragma warning (push)
+#pragma warning (disable:4265)
+#endif
+// warning C4265: 'std::_Pad' : class has virtual functions, but destructor is not virtual
+
+#include
+
+#if LL_WINDOWS
+#pragma warning (pop)
+#endif
+
class LLSingletonBase: private boost::noncopyable
{
public:
@@ -43,7 +55,6 @@ private:
// This, on the other hand, is a stack whose top indicates the LLSingleton
// currently being initialized.
static list_t& get_initializing();
- static list_t& get_initializing_from(MasterList*);
// Produce a vector of master list, in dependency order.
typedef std::vector vec_t;
static vec_t dep_sort();
@@ -57,10 +68,11 @@ protected:
typedef enum e_init_state
{
UNINITIALIZED = 0, // must be default-initialized state
- CONSTRUCTING,
- INITIALIZING,
- INITIALIZED,
- DELETED
+ CONSTRUCTING, // within DERIVED_TYPE constructor
+ CONSTRUCTED, // finished DERIVED_TYPE constructor
+ INITIALIZING, // within DERIVED_TYPE::initSingleton()
+ INITIALIZED, // normal case
+ DELETED // deleteSingleton() or deleteAll() called
} EInitState;
// Define tag to pass to our template constructor. You can't explicitly
@@ -100,6 +112,9 @@ protected:
// That being the case, we control exactly when it happens -- and we can
// pop the stack immediately thereafter.
void pop_initializing();
+ // Remove 'this' from the init stack in case of exception in the
+ // LLSingleton subclass constructor.
+ static void reset_initializing(list_t::size_type size);
private:
// logging
static void log_initializing(const char* verb, const char* name);
@@ -115,6 +130,10 @@ protected:
static void logwarns(const char* p1, const char* p2="",
const char* p3="", const char* p4="");
static std::string demangle(const char* mangled);
+ template
+ static std::string classname() { return demangle(typeid(T).name()); }
+ template
+ static std::string classname(T* ptr) { return demangle(typeid(*ptr).name()); }
// Default methods in case subclass doesn't declare them.
virtual void initSingleton() {}
@@ -178,7 +197,15 @@ struct LLSingleton_manage_master
void remove(LLSingletonBase* sb) { sb->remove_master(); }
void push_initializing(LLSingletonBase* sb) { sb->push_initializing(typeid(T).name()); }
void pop_initializing (LLSingletonBase* sb) { sb->pop_initializing(); }
- LLSingletonBase::list_t& get_initializing(T*) { return LLSingletonBase::get_initializing(); }
+ // used for init stack cleanup in case an LLSingleton subclass constructor
+ // throws an exception
+ void reset_initializing(LLSingletonBase::list_t::size_type size)
+ {
+ LLSingletonBase::reset_initializing(size);
+ }
+ // For any LLSingleton subclass except the MasterList, obtain the init
+ // stack from the MasterList singleton instance.
+ LLSingletonBase::list_t& get_initializing() { return LLSingletonBase::get_initializing(); }
};
// But for the specific case of LLSingletonBase::MasterList, don't.
@@ -189,9 +216,14 @@ struct LLSingleton_manage_master
void remove(LLSingletonBase*) {}
void push_initializing(LLSingletonBase*) {}
void pop_initializing (LLSingletonBase*) {}
- LLSingletonBase::list_t& get_initializing(LLSingletonBase::MasterList* instance)
+ // since we never pushed, no need to clean up
+ void reset_initializing(LLSingletonBase::list_t::size_type size) {}
+ LLSingletonBase::list_t& get_initializing()
{
- return LLSingletonBase::get_initializing_from(instance);
+ // The MasterList shouldn't depend on any other LLSingletons. We'd
+ // get into trouble if we tried to recursively engage that machinery.
+ static LLSingletonBase::list_t sDummyList;
+ return sDummyList;
}
};
@@ -201,10 +233,19 @@ LLSingletonBase::LLSingletonBase(tag):
mCleaned(false),
mDeleteSingleton(NULL)
{
- // Make this the currently-initializing LLSingleton.
+ // This is the earliest possible point at which we can push this new
+ // instance onto the init stack. LLSingleton::constructSingleton() can't
+ // do it before calling the constructor, because it doesn't have an
+ // instance pointer until the constructor returns. Fortunately this
+ // constructor is guaranteed to be called before any subclass constructor.
+ // Make this new instance the currently-initializing LLSingleton.
LLSingleton_manage_master().push_initializing(this);
}
+// forward declare for friend directive within LLSingleton
+template
+class LLParamSingleton;
+
/**
* LLSingleton implements the getInstance() method part of the Singleton
* pattern. It can't make the derived class constructors protected, though, so
@@ -270,9 +311,94 @@ template
class LLSingleton : public LLSingletonBase
{
private:
- static DERIVED_TYPE* constructSingleton()
+ // Allow LLParamSingleton subclass -- but NOT DERIVED_TYPE itself -- to
+ // access our private members.
+ friend class LLParamSingleton;
+
+ // LLSingleton only supports a nullary constructor. However, the specific
+ // purpose for its subclass LLParamSingleton is to support Singletons
+ // requiring constructor arguments. constructSingleton() supports both use
+ // cases.
+ template
+ static void constructSingleton(Args&&... args)
{
- return new DERIVED_TYPE();
+ auto prev_size = LLSingleton_manage_master().get_initializing().size();
+ // getInstance() calls are from within constructor
+ sData.mInitState = CONSTRUCTING;
+ try
+ {
+ sData.mInstance = new DERIVED_TYPE(std::forward(args)...);
+ // we have called constructor, have not yet called initSingleton()
+ sData.mInitState = CONSTRUCTED;
+ }
+ catch (const std::exception& err)
+ {
+ // LLSingletonBase might -- or might not -- have pushed the new
+ // instance onto the init stack before the exception. Reset the
+ // init stack to its previous size BEFORE logging so log-machinery
+ // LLSingletons don't record a dependency on DERIVED_TYPE!
+ LLSingleton_manage_master().reset_initializing(prev_size);
+ logwarns("Error constructing ", classname().c_str(),
+ ": ", err.what());
+ // There isn't a separate EInitState value meaning "we attempted
+ // to construct this LLSingleton subclass but could not," so use
+ // DELETED. That seems slightly more appropriate than UNINITIALIZED.
+ sData.mInitState = DELETED;
+ // propagate the exception
+ throw;
+ }
+ }
+
+ static void finishInitializing()
+ {
+ // getInstance() calls are from within initSingleton()
+ sData.mInitState = INITIALIZING;
+ try
+ {
+ // initialize singleton after constructing it so that it can
+ // reference other singletons which in turn depend on it, thus
+ // breaking cyclic dependencies
+ sData.mInstance->initSingleton();
+ sData.mInitState = INITIALIZED;
+
+ // pop this off stack of initializing singletons
+ pop_initializing();
+ }
+ catch (const std::exception& err)
+ {
+ // pop this off stack of initializing singletons here, too --
+ // BEFORE logging, so log-machinery LLSingletons don't record a
+ // dependency on DERIVED_TYPE!
+ pop_initializing();
+ logwarns("Error in ", classname().c_str(),
+ "::initSingleton(): ", err.what());
+ // and get rid of the instance entirely
+ deleteSingleton();
+ // propagate the exception
+ throw;
+ }
+ }
+
+ static void pop_initializing()
+ {
+ // route through LLSingleton_manage_master so we Do The Right Thing
+ // (namely, nothing) for MasterList
+ LLSingleton_manage_master().pop_initializing(sData.mInstance);
+ }
+
+ // Without this 'using' declaration, the static method we're declaring
+ // here would hide the base-class method we want it to call.
+ using LLSingletonBase::capture_dependency;
+ static void capture_dependency()
+ {
+ // By this point, if DERIVED_TYPE was pushed onto the initializing
+ // stack, it has been popped off. So the top of that stack, if any, is
+ // an LLSingleton that directly depends on DERIVED_TYPE. If
+ // getInstance() was called by another LLSingleton, rather than from
+ // vanilla application code, record the dependency.
+ sData.mInstance->capture_dependency(
+ LLSingleton_manage_master().get_initializing(),
+ sData.mInitState);
}
// We know of no way to instruct the compiler that every subclass
@@ -285,34 +411,17 @@ private:
// subclass body.
virtual void you_must_use_LLSINGLETON_macro() = 0;
- // stores pointer to singleton instance
- struct SingletonLifetimeManager
+ // The purpose of this struct is to engage the C++11 guarantee that static
+ // variables declared in function scope are initialized exactly once, even
+ // if multiple threads concurrently reach the same declaration.
+ // https://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables
+ // Since getInstance() declares a static instance of SingletonInitializer,
+ // only the first call to getInstance() calls constructSingleton().
+ struct SingletonInitializer
{
- SingletonLifetimeManager()
+ SingletonInitializer()
{
- construct();
- }
-
- static void construct()
- {
- sData.mInitState = CONSTRUCTING;
- sData.mInstance = constructSingleton();
- sData.mInitState = INITIALIZING;
- }
-
- ~SingletonLifetimeManager()
- {
- // The dependencies between LLSingletons, and the arbitrary order
- // of static-object destruction, mean that we DO NOT WANT this
- // destructor to delete this LLSingleton. This destructor will run
- // without regard to any other LLSingleton whose cleanup might
- // depend on its existence. If you want to clean up LLSingletons,
- // call LLSingletonBase::deleteAll() sometime before static-object
- // destruction begins. That method will properly honor cross-
- // LLSingleton dependencies. Otherwise we simply leak LLSingleton
- // instances at shutdown. Since the whole process is terminating
- // anyway, that's not necessarily a bad thing; it depends on what
- // resources your LLSingleton instances are managing.
+ constructSingleton();
}
};
@@ -363,64 +472,59 @@ public:
static void deleteSingleton()
{
delete sData.mInstance;
- sData.mInstance = NULL;
- sData.mInitState = DELETED;
+ // SingletonData state handled by destructor, above
}
static DERIVED_TYPE* getInstance()
{
- static SingletonLifetimeManager sLifeTimeMgr;
+ // call constructSingleton() only the first time we get here
+ static SingletonInitializer sInitializer;
switch (sData.mInitState)
{
case UNINITIALIZED:
// should never be uninitialized at this point
logerrs("Uninitialized singleton ",
- demangle(typeid(DERIVED_TYPE).name()).c_str());
+ classname().c_str());
return NULL;
case CONSTRUCTING:
+ // here if DERIVED_TYPE's constructor (directly or indirectly)
+ // calls DERIVED_TYPE::getInstance()
logerrs("Tried to access singleton ",
- demangle(typeid(DERIVED_TYPE).name()).c_str(),
+ classname().c_str(),
" from singleton constructor!");
return NULL;
- case INITIALIZING:
- // go ahead and flag ourselves as initialized so we can be
- // reentrant during initialization
- sData.mInitState = INITIALIZED;
- // initialize singleton after constructing it so that it can
- // reference other singletons which in turn depend on it, thus
- // breaking cyclic dependencies
- sData.mInstance->initSingleton();
- // pop this off stack of initializing singletons
- LLSingleton_manage_master().pop_initializing(sData.mInstance);
+ case CONSTRUCTED:
+ // first time through: set to CONSTRUCTED by
+ // constructSingleton(), called by sInitializer's constructor;
+ // still have to call initSingleton()
+ finishInitializing();
break;
+ case INITIALIZING:
+ // here if DERIVED_TYPE::initSingleton() (directly or indirectly)
+ // calls DERIVED_TYPE::getInstance(): go ahead and allow it
case INITIALIZED:
+ // normal subsequent calls
break;
case DELETED:
+ // called after deleteSingleton()
logwarns("Trying to access deleted singleton ",
- demangle(typeid(DERIVED_TYPE).name()).c_str(),
+ classname().c_str(),
" -- creating new instance");
- SingletonLifetimeManager::construct();
- // same as first time construction
- sData.mInitState = INITIALIZED;
- sData.mInstance->initSingleton();
- // pop this off stack of initializing singletons
- LLSingleton_manage_master().pop_initializing(sData.mInstance);
+ // This recovery sequence is NOT thread-safe! We would need a
+ // recursive_mutex a la LLParamSingleton.
+ constructSingleton();
+ finishInitializing();
break;
}
- // By this point, if DERIVED_TYPE was pushed onto the initializing
- // stack, it has been popped off. So the top of that stack, if any, is
- // an LLSingleton that directly depends on DERIVED_TYPE. If this call
- // came from another LLSingleton, rather than from vanilla application
- // code, record the dependency.
- sData.mInstance->capture_dependency(
- LLSingleton_manage_master().get_initializing(sData.mInstance),
- sData.mInitState);
+ // record the dependency, if any: check if we got here from another
+ // LLSingleton's constructor or initSingleton() method
+ capture_dependency();
return sData.mInstance;
}
@@ -460,6 +564,173 @@ private:
template
typename LLSingleton::SingletonData LLSingleton::sData;
+
+/**
+ * LLParamSingleton is like LLSingleton, except in the following ways:
+ *
+ * * It is NOT instantiated on demand (instance() or getInstance()). You must
+ * first call initParamSingleton(constructor args...).
+ * * Before initParamSingleton(), calling instance() or getInstance() dies with
+ * LL_ERRS.
+ * * initParamSingleton() may be called only once. A second call dies with
+ * LL_ERRS.
+ * * However, distinct initParamSingleton() calls can be used to engage
+ * different constructors, as long as only one such call is executed at
+ * runtime.
+ * * Unlike LLSingleton, an LLParamSingleton cannot be "revived" by an
+ * instance() or getInstance() call after deleteSingleton().
+ *
+ * Importantly, though, each LLParamSingleton subclass does participate in the
+ * dependency-ordered LLSingletonBase::deleteAll() processing.
+ */
+template
+class LLParamSingleton : public LLSingleton
+{
+private:
+ typedef LLSingleton super;
+ // Use a recursive_mutex in case of constructor circularity. With a
+ // non-recursive mutex, that would result in deadlock rather than the
+ // logerrs() call in getInstance().
+ typedef std::recursive_mutex mutex_t;
+
+public:
+ using super::deleteSingleton;
+ using super::instanceExists;
+ using super::wasDeleted;
+
+ // Passes arguments to DERIVED_TYPE's constructor and sets appropriate states
+ template
+ static void initParamSingleton(Args&&... args)
+ {
+ // In case racing threads both call initParamSingleton() at the same
+ // time, serialize them. One should initialize; the other should see
+ // mInitState already set.
+ std::unique_lock lk(getMutex());
+ // For organizational purposes this function shouldn't be called twice
+ if (super::sData.mInitState != super::UNINITIALIZED)
+ {
+ super::logerrs("Tried to initialize singleton ",
+ super::template classname().c_str(),
+ " twice!");
+ }
+ else
+ {
+ super::constructSingleton(std::forward(args)...);
+ super::finishInitializing();
+ }
+ }
+
+ static DERIVED_TYPE* getInstance()
+ {
+ // In case racing threads call getInstance() at the same moment as
+ // initParamSingleton(), serialize the calls.
+ std::unique_lock lk(getMutex());
+
+ switch (super::sData.mInitState)
+ {
+ case super::UNINITIALIZED:
+ super::logerrs("Uninitialized param singleton ",
+ super::template classname().c_str());
+ break;
+
+ case super::CONSTRUCTING:
+ super::logerrs("Tried to access param singleton ",
+ super::template classname().c_str(),
+ " from singleton constructor!");
+ break;
+
+ case super::CONSTRUCTED:
+ // Should never happen!? The CONSTRUCTED state is specifically to
+ // navigate through LLSingleton::SingletonInitializer getting
+ // constructed (once) before LLSingleton::getInstance()'s switch
+ // on mInitState. But our initParamSingleton() method calls
+ // constructSingleton() and then calls finishInitializing(), which
+ // immediately sets INITIALIZING. Why are we here?
+ super::logerrs("Param singleton ",
+ super::template classname().c_str(),
+ "::initSingleton() not yet called");
+ break;
+
+ case super::INITIALIZING:
+ // As with LLSingleton, explicitly permit circular calls from
+ // within initSingleton()
+ case super::INITIALIZED:
+ // for any valid call, capture dependencies
+ super::capture_dependency();
+ return super::sData.mInstance;
+
+ case super::DELETED:
+ super::logerrs("Trying to access deleted param singleton ",
+ super::template classname().c_str());
+ break;
+ }
+
+ // should never actually get here; this is to pacify the compiler,
+ // which assumes control might return from logerrs()
+ return nullptr;
+ }
+
+ // instance() is replicated here so it calls
+ // LLParamSingleton::getInstance() rather than LLSingleton::getInstance()
+ // -- avoid making getInstance() virtual
+ static DERIVED_TYPE& instance()
+ {
+ return *getInstance();
+ }
+
+private:
+ // sMutex must be a function-local static rather than a static member. One
+ // of the essential features of LLSingleton and friends is that they must
+ // support getInstance() even when the containing module's static
+ // variables have not yet been runtime-initialized. A mutex requires
+ // construction. A static class member might not yet have been
+ // constructed.
+ //
+ // We could store a dumb mutex_t*, notice when it's NULL and allocate a
+ // heap mutex -- but that's vulnerable to race conditions. And we can't
+ // defend the dumb pointer with another mutex.
+ //
+ // We could store a std::atomic -- but a default-constructed
+ // std::atomic does not contain a valid T, even a default-constructed
+ // T! Which means std::atomic, too, requires runtime initialization.
+ //
+ // But a function-local static is guaranteed to be initialized exactly
+ // once, the first time control reaches that declaration.
+ static mutex_t& getMutex()
+ {
+ static mutex_t sMutex;
+ return sMutex;
+ }
+};
+
+/**
+ * Initialization locked singleton, only derived class can decide when to initialize.
+ * Starts locked.
+ * For cases when singleton has a dependency onto something or.
+ *
+ * LLLockedSingleton is like an LLParamSingleton with a nullary constructor.
+ * It cannot be instantiated on demand (instance() or getInstance() call) --
+ * it must be instantiated by calling construct(). However, it does
+ * participate in dependency-ordered LLSingletonBase::deleteAll() processing.
+ */
+template
+class LLLockedSingleton : public LLParamSingleton
+{
+ typedef LLParamSingleton super;
+
+public:
+ using super::deleteSingleton;
+ using super::getInstance;
+ using super::instance;
+ using super::instanceExists;
+ using super::wasDeleted;
+
+ static void construct()
+ {
+ super::initParamSingleton();
+ }
+};
+
/**
* Use LLSINGLETON(Foo); at the start of an LLSingleton subclass body
* when you want to declare an out-of-line constructor:
@@ -484,13 +755,13 @@ typename LLSingleton::SingletonData LLSingleton::sData;
* file, use 'inline' (unless it's a template class) to avoid duplicate-symbol
* errors at link time.
*/
-#define LLSINGLETON(DERIVED_CLASS) \
+#define LLSINGLETON(DERIVED_CLASS, ...) \
private: \
/* implement LLSingleton pure virtual method whose sole purpose */ \
/* is to remind people to use this macro */ \
virtual void you_must_use_LLSINGLETON_macro() {} \
friend class LLSingleton; \
- DERIVED_CLASS()
+ DERIVED_CLASS(__VA_ARGS__)
/**
* Use LLSINGLETON_EMPTY_CTOR(Foo); at the start of an LLSingleton
diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp
index a459d17fb8..fa02d2bb1a 100644
--- a/indra/llcommon/tests/lleventcoro_test.cpp
+++ b/indra/llcommon/tests/lleventcoro_test.cpp
@@ -506,16 +506,10 @@ namespace tut
replyName = waiter.getName0();
errorName = waiter.getName1();
WrapLLErrs capture;
- try
- {
- result = waiter.suspendWithLog();
- debug("no exception");
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- debug(STRINGIZE("exception " << e.what()));
- threw = e.what();
- }
+ threw = capture.catch_llerrs([&waiter, &debug](){
+ result = waiter.suspendWithLog();
+ debug("no exception");
+ });
}
END
}
@@ -762,18 +756,13 @@ namespace tut
{
LLCoroEventPumps waiter;
WrapLLErrs capture;
- try
- {
- result = waiter.postAndSuspendWithLog(
- LLSDMap("value", 31)("fail", LLSD()),
- immediateAPI.getPump(), "reply", "error");
- debug("no exception");
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- debug(STRINGIZE("exception " << e.what()));
- threw = e.what();
- }
+ threw = capture.catch_llerrs(
+ [&waiter, &debug](){
+ result = waiter.postAndSuspendWithLog(
+ LLSDMap("value", 31)("fail", LLSD()),
+ immediateAPI.getPump(), "reply", "error");
+ debug("no exception");
+ });
}
END
}
diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp
index 5a4df81bf1..a181d5c941 100644
--- a/indra/llcommon/tests/lleventdispatcher_test.cpp
+++ b/indra/llcommon/tests/lleventdispatcher_test.cpp
@@ -22,6 +22,7 @@
#include "llsdutil.h"
#include "stringize.h"
#include "tests/wrapllerrs.h"
+#include "../test/catch_and_store_what_in.h"
#include
#include
@@ -630,16 +631,9 @@ namespace tut
void call_exc(const std::string& func, const LLSD& args, const std::string& exc_frag)
{
- std::string threw;
- try
- {
- work(func, args);
- }
- catch (const std::runtime_error& e)
- {
- cout << "*** " << e.what() << '\n';
- threw = e.what();
- }
+ std::string threw = catch_what([this, &func, &args](){
+ work(func, args);
+ });
ensure_has(threw, exc_frag);
}
@@ -717,15 +711,9 @@ namespace tut
LLSD attempts(LLSDArray(17)(LLSDMap("pi", 3.14)("two", 2)));
foreach(LLSD ae, inArray(attempts))
{
- std::string threw;
- try
- {
- work.add("freena_err", "freena", freena, ae);
- }
- catch (const std::exception& e)
- {
- threw = e.what();
- }
+ std::string threw = catch_what([this, &ae](){
+ work.add("freena_err", "freena", freena, ae);
+ });
ensure_has(threw, "must be an array");
}
}
@@ -734,15 +722,9 @@ namespace tut
void object::test<2>()
{
set_test_name("map-style registration with badly-formed defaults");
- std::string threw;
- try
- {
- work.add("freena_err", "freena", freena, LLSDArray("a")("b"), 17);
- }
- catch (const std::exception& e)
- {
- threw = e.what();
- }
+ std::string threw = catch_what([this](){
+ work.add("freena_err", "freena", freena, LLSDArray("a")("b"), 17);
+ });
ensure_has(threw, "must be a map or an array");
}
@@ -750,17 +732,11 @@ namespace tut
void object::test<3>()
{
set_test_name("map-style registration with too many array defaults");
- std::string threw;
- try
- {
- work.add("freena_err", "freena", freena,
- LLSDArray("a")("b"),
- LLSDArray(17)(0.9)("gack"));
- }
- catch (const std::exception& e)
- {
- threw = e.what();
- }
+ std::string threw = catch_what([this](){
+ work.add("freena_err", "freena", freena,
+ LLSDArray("a")("b"),
+ LLSDArray(17)(0.9)("gack"));
+ });
ensure_has(threw, "shorter than");
}
@@ -768,17 +744,11 @@ namespace tut
void object::test<4>()
{
set_test_name("map-style registration with too many map defaults");
- std::string threw;
- try
- {
- work.add("freena_err", "freena", freena,
- LLSDArray("a")("b"),
- LLSDMap("b", 17)("foo", 3.14)("bar", "sinister"));
- }
- catch (const std::exception& e)
- {
- threw = e.what();
- }
+ std::string threw = catch_what([this](){
+ work.add("freena_err", "freena", freena,
+ LLSDArray("a")("b"),
+ LLSDMap("b", 17)("foo", 3.14)("bar", "sinister"));
+ });
ensure_has(threw, "nonexistent params");
ensure_has(threw, "foo");
ensure_has(threw, "bar");
@@ -1039,16 +1009,9 @@ namespace tut
// We don't have a comparable helper function for the one-arg
// operator() method, and it's not worth building one just for this
// case. Write it out.
- std::string threw;
- try
- {
- work(LLSDMap("op", "freek"));
- }
- catch (const std::runtime_error& e)
- {
- cout << "*** " << e.what() << "\n";
- threw = e.what();
- }
+ std::string threw = catch_what([this](){
+ work(LLSDMap("op", "freek"));
+ });
ensure_has(threw, "bad");
ensure_has(threw, "op");
ensure_has(threw, "freek");
diff --git a/indra/llcommon/tests/lleventfilter_test.cpp b/indra/llcommon/tests/lleventfilter_test.cpp
index eb98b12ef5..1875013794 100644
--- a/indra/llcommon/tests/lleventfilter_test.cpp
+++ b/indra/llcommon/tests/lleventfilter_test.cpp
@@ -350,15 +350,9 @@ namespace tut
// Now let the timer expire.
filter.forceTimeout();
// Notice the timeout.
- std::string threw;
- try
- {
- mainloop.post(17);
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- threw = e.what();
- }
+ std::string threw = capture.catch_llerrs([this](){
+ mainloop.post(17);
+ });
ensure_contains("errorAfter() timeout exception", threw, "timeout");
// Timing out cancels the timer. Verify that.
listener0.reset(0);
diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp
index c7d4b8a06b..d94fc0c56d 100644
--- a/indra/llcommon/tests/llinstancetracker_test.cpp
+++ b/indra/llcommon/tests/llinstancetracker_test.cpp
@@ -198,14 +198,9 @@ namespace tut
{
WrapLLErrs wrapper;
Keyed::instance_iter i(Keyed::beginInstances());
- try
- {
- delete keyed;
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- what = e.what();
- }
+ what = wrapper.catch_llerrs([&keyed](){
+ delete keyed;
+ });
}
ensure(! what.empty());
}
@@ -219,14 +214,9 @@ namespace tut
{
WrapLLErrs wrapper;
Keyed::key_iter i(Keyed::beginKeys());
- try
- {
- delete keyed;
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- what = e.what();
- }
+ what = wrapper.catch_llerrs([&keyed](){
+ delete keyed;
+ });
}
ensure(! what.empty());
}
@@ -240,14 +230,9 @@ namespace tut
{
WrapLLErrs wrapper;
Unkeyed::instance_iter i(Unkeyed::beginInstances());
- try
- {
- delete unkeyed;
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- what = e.what();
- }
+ what = wrapper.catch_llerrs([&unkeyed](){
+ delete unkeyed;
+ });
}
ensure(! what.empty());
}
diff --git a/indra/llcommon/tests/lllazy_test.cpp b/indra/llcommon/tests/lllazy_test.cpp
index 32a717f4fc..542306ee22 100644
--- a/indra/llcommon/tests/lllazy_test.cpp
+++ b/indra/llcommon/tests/lllazy_test.cpp
@@ -38,6 +38,7 @@
#include
// other Linden headers
#include "../test/lltut.h"
+#include "../test/catch_and_store_what_in.h"
namespace bll = boost::lambda;
@@ -200,15 +201,9 @@ namespace tut
void lllazy_object::test<2>()
{
TestNeedsTesting tnt;
- std::string threw;
- try
- {
- tnt.toolate();
- }
- catch (const LLLazyCommon::InstanceChange& e)
- {
- threw = e.what();
- }
+ std::string threw = catch_what([&tnt](){
+ tnt.toolate();
+ });
ensure_contains("InstanceChange exception", threw, "replace LLLazy instance");
}
diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp
index 45648536c4..bf0a74d10d 100644
--- a/indra/llcommon/tests/llleap_test.cpp
+++ b/indra/llcommon/tests/llleap_test.cpp
@@ -23,7 +23,7 @@
#include "../test/lltut.h"
#include "../test/namedtempfile.h"
#include "../test/catch_and_store_what_in.h"
-#include "wrapllerrs.h"
+#include "wrapllerrs.h" // CaptureLog
#include "llevents.h"
#include "llprocess.h"
#include "llstring.h"
@@ -290,12 +290,9 @@ namespace tut
void object::test<6>()
{
set_test_name("empty plugin vector");
- std::string threw;
- try
- {
- LLLeap::create("empty", StringVec());
- }
- CATCH_AND_STORE_WHAT_IN(threw, LLLeap::Error)
+ std::string threw = catch_what([](){
+ LLLeap::create("empty", StringVec());
+ });
ensure_contains("LLLeap::Error", threw, "no plugin");
// try the suppress-exception variant
ensure("bad launch returned non-NULL", ! LLLeap::create("empty", StringVec(), false));
@@ -308,12 +305,9 @@ namespace tut
// Synthesize bogus executable name
std::string BADPYTHON(PYTHON.substr(0, PYTHON.length()-1) + "x");
CaptureLog log;
- std::string threw;
- try
- {
- LLLeap::create("bad exe", BADPYTHON);
- }
- CATCH_AND_STORE_WHAT_IN(threw, LLLeap::Error)
+ std::string threw = catch_what([&BADPYTHON](){
+ LLLeap::create("bad exe", BADPYTHON);
+ });
ensure_contains("LLLeap::create() didn't throw", threw, "failed");
log.messageWith("failed");
log.messageWith(BADPYTHON);
diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp
index 5c87cdabd9..222d832084 100644
--- a/indra/llcommon/tests/llprocess_test.cpp
+++ b/indra/llcommon/tests/llprocess_test.cpp
@@ -25,8 +25,6 @@
#include
#include
#include
-//#include
-//#include
// other Linden headers
#include "../test/lltut.h"
#include "../test/namedtempfile.h"
@@ -35,7 +33,7 @@
#include "llsdutil.h"
#include "llevents.h"
#include "llstring.h"
-#include "wrapllerrs.h"
+#include "wrapllerrs.h" // CaptureLog
#if defined(LL_WINDOWS)
#define sleep(secs) _sleep((secs) * 1000)
@@ -45,8 +43,7 @@
#include
#endif
-//namespace lambda = boost::lambda;
- std::string apr_strerror_helper(apr_status_t rv)
+std::string apr_strerror_helper(apr_status_t rv)
{
char errbuf[256];
apr_strerror(rv, errbuf, sizeof(errbuf));
@@ -960,12 +957,9 @@ namespace tut
#define CATCH_IN(THREW, EXCEPTION, CODE) \
do \
{ \
- (THREW).clear(); \
- try \
- { \
- CODE; \
- } \
- CATCH_AND_STORE_WHAT_IN(THREW, EXCEPTION) \
+ (THREW) = catch_what([&](){ \
+ CODE; \
+ }); \
ensure("failed to throw " #EXCEPTION ": " #CODE, ! (THREW).empty()); \
} while (0)
diff --git a/indra/llcommon/tests/llsingleton_test.cpp b/indra/llcommon/tests/llsingleton_test.cpp
index 56886bc73f..75ddff9d7d 100644
--- a/indra/llcommon/tests/llsingleton_test.cpp
+++ b/indra/llcommon/tests/llsingleton_test.cpp
@@ -29,7 +29,8 @@
#include "llsingleton.h"
#include "../test/lltut.h"
-
+#include "wrapllerrs.h"
+#include "llsd.h"
// Capture execution sequence by appending to log string.
std::string sLog;
@@ -198,4 +199,134 @@ namespace tut
TESTS(A, B, 4, 5, 6, 7)
TESTS(B, A, 8, 9, 10, 11)
+
+#define PARAMSINGLETON(cls) \
+ class cls: public LLParamSingleton \
+ { \
+ LLSINGLETON(cls, const LLSD::String& str): mDesc(str) {} \
+ cls(LLSD::Integer i): mDesc(i) {} \
+ \
+ public: \
+ std::string desc() const { return mDesc.asString(); } \
+ \
+ private: \
+ LLSD mDesc; \
+ }
+
+ // Declare two otherwise-identical LLParamSingleton classes so we can
+ // validly initialize each using two different constructors. If we tried
+ // to test that with a single LLParamSingleton class within the same test
+ // program, we'd get 'trying to use deleted LLParamSingleton' errors.
+ PARAMSINGLETON(PSing1);
+ PARAMSINGLETON(PSing2);
+
+ template<> template<>
+ void singleton_object_t::test<12>()
+ {
+ set_test_name("LLParamSingleton");
+
+ WrapLLErrs catcherr;
+ // query methods
+ ensure("false positive on instanceExists()", ! PSing1::instanceExists());
+ ensure("false positive on wasDeleted()", ! PSing1::wasDeleted());
+ // try to reference before initializing
+ std::string threw = catcherr.catch_llerrs([](){
+ (void)PSing1::instance();
+ });
+ ensure_contains("too-early instance() didn't throw", threw, "Uninitialized");
+ // getInstance() behaves the same as instance()
+ threw = catcherr.catch_llerrs([](){
+ (void)PSing1::getInstance();
+ });
+ ensure_contains("too-early getInstance() didn't throw", threw, "Uninitialized");
+ // initialize using LLSD::String constructor
+ PSing1::initParamSingleton("string");
+ ensure_equals(PSing1::instance().desc(), "string");
+ ensure("false negative on instanceExists()", PSing1::instanceExists());
+ // try to initialize again
+ threw = catcherr.catch_llerrs([](){
+ PSing1::initParamSingleton("again");
+ });
+ ensure_contains("second ctor(string) didn't throw", threw, "twice");
+ // try to initialize using the other constructor -- should be
+ // well-formed, but illegal at runtime
+ threw = catcherr.catch_llerrs([](){
+ PSing1::initParamSingleton(17);
+ });
+ ensure_contains("other ctor(int) didn't throw", threw, "twice");
+ PSing1::deleteSingleton();
+ ensure("false negative on wasDeleted()", PSing1::wasDeleted());
+ threw = catcherr.catch_llerrs([](){
+ (void)PSing1::instance();
+ });
+ ensure_contains("accessed deleted LLParamSingleton", threw, "deleted");
+ }
+
+ template<> template<>
+ void singleton_object_t::test<13>()
+ {
+ set_test_name("LLParamSingleton alternate ctor");
+
+ WrapLLErrs catcherr;
+ // We don't have to restate all the tests for PSing1. Only test validly
+ // using the other constructor.
+ PSing2::initParamSingleton(17);
+ ensure_equals(PSing2::instance().desc(), "17");
+ // can't do it twice
+ std::string threw = catcherr.catch_llerrs([](){
+ PSing2::initParamSingleton(34);
+ });
+ ensure_contains("second ctor(int) didn't throw", threw, "twice");
+ // can't use the other constructor either
+ threw = catcherr.catch_llerrs([](){
+ PSing2::initParamSingleton("string");
+ });
+ ensure_contains("other ctor(string) didn't throw", threw, "twice");
+ }
+
+ class CircularPCtor: public LLParamSingleton
+ {
+ LLSINGLETON(CircularPCtor)
+ {
+ // never mind indirection, just go straight for the circularity
+ (void)instance();
+ }
+ };
+
+ template<> template<>
+ void singleton_object_t::test<14>()
+ {
+ set_test_name("Circular LLParamSingleton constructor");
+ WrapLLErrs catcherr;
+ std::string threw = catcherr.catch_llerrs([](){
+ CircularPCtor::initParamSingleton();
+ });
+ ensure_contains("constructor circularity didn't throw", threw, "constructor");
+ }
+
+ class CircularPInit: public LLParamSingleton
+ {
+ LLSINGLETON_EMPTY_CTOR(CircularPInit);
+ public:
+ virtual void initSingleton()
+ {
+ // never mind indirection, just go straight for the circularity
+ CircularPInit *pt = getInstance();
+ if (!pt)
+ {
+ throw;
+ }
+ }
+ };
+
+ template<> template<>
+ void singleton_object_t::test<15>()
+ {
+ set_test_name("Circular LLParamSingleton initSingleton()");
+ WrapLLErrs catcherr;
+ std::string threw = catcherr.catch_llerrs([](){
+ CircularPInit::initParamSingleton();
+ });
+ ensure("initSingleton() circularity threw", threw.empty());
+ }
}
diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h
index 08fbf19b1c..b07d5afbd8 100644
--- a/indra/llcommon/tests/wrapllerrs.h
+++ b/indra/llcommon/tests/wrapllerrs.h
@@ -37,6 +37,7 @@
#include "llerrorcontrol.h"
#include "llexception.h"
#include "stringize.h"
+#include "../test/catch_and_store_what_in.h"
#include
#include
#include
@@ -81,6 +82,31 @@ struct WrapLLErrs
LLTHROW(FatalException(message));
}
+ /// Convenience wrapper for catch_what()
+ //
+ // The implementation makes it clear that this function need not be a
+ // member; it could easily be a free function. It is a member because it
+ // makes no sense to attempt to catch FatalException unless there is a
+ // WrapLLErrs instance in scope. Without a live WrapLLErrs instance, any
+ // LL_ERRS() reached by code within 'func' would terminate the test
+ // program instead of throwing FatalException.
+ //
+ // We were tempted to introduce a free function, likewise accepting
+ // arbitrary 'func', that would instantiate WrapLLErrs and then call
+ // catch_llerrs() on that instance. We decided against it, for this
+ // reason: on extending a test function containing a single call to that
+ // free function, a maintainer would most likely make additional calls to
+ // that free function, instead of switching to an explicit WrapLLErrs
+ // declaration with several calls to its catch_llerrs() member function.
+ // Even a construct such as WrapLLErrs().catch_llerrs(...) would make the
+ // object declaration more visible; it's not unreasonable to expect a
+ // maintainer to extend that by naming and reusing the WrapLLErrs instance.
+ template
+ std::string catch_llerrs(FUNC func)
+ {
+ return catch_what(func);
+ }
+
std::string error;
LLError::SettingsStoragePtr mPriorErrorSettings;
LLError::FatalFunction mPriorFatal;
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 680fbf548f..9dea876114 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -583,39 +583,29 @@ static void bilinear_scale(const U8 *src, U32 srcW, U32 srcH, U32 srcCh, U32 src
// LLImage
//---------------------------------------------------------------------------
-//static
-std::string LLImage::sLastErrorMessage;
-LLMutex* LLImage::sMutex = NULL;
-bool LLImage::sUseNewByteRange = false;
-S32 LLImage::sMinimalReverseByteRangePercent = 75;
-
-//static
-void LLImage::initClass(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent)
+LLImage::LLImage(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent)
{
- sUseNewByteRange = use_new_byte_range;
- sMinimalReverseByteRangePercent = minimal_reverse_byte_range_percent;
- sMutex = new LLMutex();
+ mMutex = new LLMutex();
+ mUseNewByteRange = use_new_byte_range;
+ mMinimalReverseByteRangePercent = minimal_reverse_byte_range_percent;
}
-//static
-void LLImage::cleanupClass()
+LLImage::~LLImage()
{
- delete sMutex;
- sMutex = NULL;
+ delete mMutex;
+ mMutex = NULL;
}
-//static
-const std::string& LLImage::getLastError()
+const std::string& LLImage::getLastErrorMessage()
{
static const std::string noerr("No Error");
- return sLastErrorMessage.empty() ? noerr : sLastErrorMessage;
+ return mLastErrorMessage.empty() ? noerr : mLastErrorMessage;
}
-//static
-void LLImage::setLastError(const std::string& message)
+void LLImage::setLastErrorMessage(const std::string& message)
{
- LLMutexLock m(sMutex);
- sLastErrorMessage = message;
+ LLMutexLock m(mMutex);
+ mLastErrorMessage = message;
}
//---------------------------------------------------------------------------
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 8ec49d3f0f..9f8d061293 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -30,6 +30,7 @@
#include "lluuid.h"
#include "llstring.h"
#include "llpointer.h"
+#include "llsingleton.h"
#include "lltrace.h"
const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2
@@ -88,23 +89,25 @@ typedef enum e_image_codec
//============================================================================
// library initialization class
-class LLImage
+class LLImage : public LLParamSingleton
{
+ LLSINGLETON(LLImage, bool use_new_byte_range = false, S32 minimal_reverse_byte_range_percent = 75);
+ ~LLImage();
public:
- static void initClass(bool use_new_byte_range = false, S32 minimal_reverse_byte_range_percent = 75);
- static void cleanupClass();
- static const std::string& getLastError();
- static void setLastError(const std::string& message);
-
- static bool useNewByteRange() { return sUseNewByteRange; }
- static S32 getReverseByteRangePercent() { return sMinimalReverseByteRangePercent; }
-
-protected:
- static LLMutex* sMutex;
- static std::string sLastErrorMessage;
- static bool sUseNewByteRange;
- static S32 sMinimalReverseByteRangePercent;
+ const std::string& getLastErrorMessage();
+ static const std::string& getLastError() { return getInstance()->getLastErrorMessage(); };
+ void setLastErrorMessage(const std::string& message);
+ static void setLastError(const std::string& message) { getInstance()->setLastErrorMessage(message); }
+
+ bool useNewByteRange() { return mUseNewByteRange; }
+ S32 getReverseByteRangePercent() { return mMinimalReverseByteRangePercent; }
+
+private:
+ LLMutex* mMutex;
+ std::string mLastErrorMessage;
+ bool mUseNewByteRange;
+ S32 mMinimalReverseByteRangePercent;
};
//============================================================================
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp
index 4bff21610f..71cab0554d 100644
--- a/indra/llimage/llimagej2c.cpp
+++ b/indra/llimage/llimagej2c.cpp
@@ -281,7 +281,7 @@ S32 LLImageJ2C::calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 r
S32 bytes;
S32 new_bytes = (S32) (sqrt((F32)(w*h))*(F32)(comp)*rate*1000.f/layer_factor);
S32 old_bytes = (S32)((F32)(w*h*comp)*rate);
- bytes = (LLImage::useNewByteRange() && (new_bytes < old_bytes) ? new_bytes : old_bytes);
+ bytes = (LLImage::getInstance()->useNewByteRange() && (new_bytes < old_bytes) ? new_bytes : old_bytes);
bytes = llmax(bytes, calcHeaderSizeJ2C());
return bytes;
}
@@ -322,7 +322,7 @@ S32 LLImageJ2C::calcDiscardLevelBytes(S32 bytes)
{
S32 bytes_needed = calcDataSize(discard_level);
// Use TextureReverseByteRange percent (see settings.xml) of the optimal size to qualify as correct rendering for the given discard level
- if (bytes >= (bytes_needed*LLImage::getReverseByteRangePercent()/100))
+ if (bytes >= (bytes_needed*LLImage::getInstance()->getReverseByteRangePercent()/100))
{
break;
}
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index ba1a2a035e..6a287f0cc5 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -49,101 +49,22 @@
#include
#include
-namespace LLAvatarNameCache
-{
- use_display_name_signal_t mUseDisplayNamesSignal;
- // Cache starts in a paused state until we can determine if the
- // current region supports display names.
- bool sRunning = false;
-
- // Use the People API (modern) for fetching name if true. Use the old legacy protocol if false.
- // For testing, there's a UsePeopleAPI setting that can be flipped (must restart viewer).
- bool sUsePeopleAPI = true;
-
- // Base lookup URL for name service.
- // On simulator, loaded from indra.xml
- // On viewer, usually a simulator capability (at People API team's request)
- // Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/agents/"
- std::string sNameLookupURL;
+// Time-to-live for a temp cache entry.
+const F64 TEMP_CACHE_ENTRY_LIFETIME = 60.0;
+// Maximum time an unrefreshed cache entry is allowed.
+const F64 MAX_UNREFRESHED_TIME = 20.0 * 60.0;
- // Accumulated agent IDs for next query against service
- typedef std::set ask_queue_t;
- ask_queue_t sAskQueue;
+// Send bulk lookup requests a few times a second at most.
+// Only need per-frame timing resolution.
+static LLFrameTimer sRequestTimer;
- // Agent IDs that have been requested, but with no reply.
- // Maps agent ID to frame time request was made.
- typedef std::map pending_queue_t;
- pending_queue_t sPendingQueue;
-
- // Callbacks to fire when we received a name.
- // May have multiple callbacks for a single ID, which are
- // represented as multiple slots bound to the signal.
- // Avoid copying signals via pointers.
- typedef std::map signal_map_t;
- signal_map_t sSignalMap;
-
- // The cache at last, i.e. avatar names we know about.
- typedef std::map cache_t;
- cache_t sCache;
-
- // Send bulk lookup requests a few times a second at most.
- // Only need per-frame timing resolution.
- LLFrameTimer sRequestTimer;
-
- // Maximum time an unrefreshed cache entry is allowed.
- const F64 MAX_UNREFRESHED_TIME = 20.0 * 60.0;
-
- // Time when unrefreshed cached names were checked last.
- static F64 sLastExpireCheck;
-
- // Time-to-live for a temp cache entry.
- const F64 TEMP_CACHE_ENTRY_LIFETIME = 60.0;
-
- LLCore::HttpRequest::ptr_t sHttpRequest;
- LLCore::HttpHeaders::ptr_t sHttpHeaders;
- LLCore::HttpOptions::ptr_t sHttpOptions;
- LLCore::HttpRequest::policy_t sHttpPolicy;
- LLCore::HttpRequest::priority_t sHttpPriority;
-
- //-----------------------------------------------------------------------
- // Internal methods
- //-----------------------------------------------------------------------
-
- // Handle name response off network.
- void processName(const LLUUID& agent_id,
- const LLAvatarName& av_name);
-
- void requestNamesViaCapability();
-
- // Legacy name system callbacks
- void legacyNameCallback(const LLUUID& agent_id,
- const std::string& full_name,
- bool is_group);
- void legacyNameFetch(const LLUUID& agent_id,
- const std::string& full_name,
- bool is_group);
-
- void requestNamesViaLegacy();
-
- // Do a single callback to a given slot
- void fireSignal(const LLUUID& agent_id,
- const callback_slot_t& slot,
- const LLAvatarName& av_name);
-
- // Is a request in-flight over the network?
- bool isRequestPending(const LLUUID& agent_id);
-
- // Erase expired names from cache
- void eraseUnrefreshed();
-
- bool expirationFromCacheControl(const LLSD& headers, F64 *expires);
-
- // This is a coroutine.
- void requestAvatarNameCache_(std::string url, std::vector agentIds);
-
- void handleAvNameCacheSuccess(const LLSD &data, const LLSD &httpResult);
-}
+// static to avoid unnessesary dependencies
+LLCore::HttpRequest::ptr_t sHttpRequest;
+LLCore::HttpHeaders::ptr_t sHttpHeaders;
+LLCore::HttpOptions::ptr_t sHttpOptions;
+LLCore::HttpRequest::policy_t sHttpPolicy;
+LLCore::HttpRequest::priority_t sHttpPriority;
/* Sample response:
@@ -187,6 +108,30 @@ namespace LLAvatarNameCache
// Coroutine for sending and processing avatar name cache requests.
// Do not call directly. See documentation in lleventcoro.h and llcoro.h for
// further explanation.
+
+LLAvatarNameCache::LLAvatarNameCache()
+{
+ // Will be set to running later
+ // For now fail immediate lookups and query async ones.
+ mRunning = false;
+
+ mUsePeopleAPI = true;
+
+ sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
+ sHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
+ sHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
+ sHttpPolicy = LLCore::HttpRequest::DEFAULT_POLICY_ID;
+ sHttpPriority = 0;
+}
+
+LLAvatarNameCache::~LLAvatarNameCache()
+{
+ sHttpRequest.reset();
+ sHttpHeaders.reset();
+ sHttpOptions.reset();
+ mCache.clear();
+}
+
void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector agentIds)
{
LL_DEBUGS("AvNameCache") << "Entering coroutine " << LLCoros::instance().getName()
@@ -205,7 +150,7 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vectorhandleAgentError(agent_id);
}
return;
}
- LLAvatarNameCache::handleAvNameCacheSuccess(results, httpResults);
+ LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults);
}
catch (...)
@@ -300,15 +245,15 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h
}
}
LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result "
- << LLAvatarNameCache::sCache.size() << " cached names"
+ << LLAvatarNameCache::mCache.size() << " cached names"
<< LL_ENDL;
}
// Provide some fallback for agents that return errors
void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
{
- std::map::iterator existing = sCache.find(agent_id);
- if (existing == sCache.end())
+ std::map::iterator existing = mCache.find(agent_id);
+ if (existing == mCache.end())
{
// there is no existing cache entry, so make a temporary name from legacy
LL_WARNS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
@@ -322,7 +267,7 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
// been returned by the get method, there is no need to signal anyone
// Clear this agent from the pending list
- LLAvatarNameCache::sPendingQueue.erase(agent_id);
+ LLAvatarNameCache::mPendingQueue.erase(agent_id);
LLAvatarName& av_name = existing->second;
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " << agent_id << LL_ENDL;
@@ -341,19 +286,19 @@ void LLAvatarNameCache::processName(const LLUUID& agent_id, const LLAvatarName&
}
// Add to the cache
- sCache[agent_id] = av_name;
+ mCache[agent_id] = av_name;
// Suppress request from the queue
- sPendingQueue.erase(agent_id);
+ mPendingQueue.erase(agent_id);
// Signal everyone waiting on this name
- signal_map_t::iterator sig_it = sSignalMap.find(agent_id);
- if (sig_it != sSignalMap.end())
+ signal_map_t::iterator sig_it = mSignalMap.find(agent_id);
+ if (sig_it != mSignalMap.end())
{
callback_signal_t* signal = sig_it->second;
(*signal)(agent_id, av_name);
- sSignalMap.erase(agent_id);
+ mSignalMap.erase(agent_id);
delete signal;
signal = NULL;
@@ -379,16 +324,16 @@ void LLAvatarNameCache::requestNamesViaCapability()
U32 ids = 0;
ask_queue_t::const_iterator it;
- while(!sAskQueue.empty())
+ while(!mAskQueue.empty())
{
- it = sAskQueue.begin();
+ it = mAskQueue.begin();
LLUUID agent_id = *it;
- sAskQueue.erase(it);
+ mAskQueue.erase(it);
if (url.empty())
{
// ...starting new request
- url += sNameLookupURL;
+ url += mNameLookupURL;
url += "?ids=";
ids = 1;
}
@@ -402,7 +347,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
agent_ids.push_back(agent_id);
// mark request as pending
- sPendingQueue[agent_id] = now;
+ mPendingQueue[agent_id] = now;
if (url.size() > NAME_URL_SEND_THRESHOLD)
{
@@ -432,7 +377,7 @@ void LLAvatarNameCache::legacyNameCallback(const LLUUID& agent_id,
// Retrieve the name and set it to never (or almost never...) expire: when we are using the legacy
// protocol, we do not get an expiration date for each name and there's no reason to ask the
// data again and again so we set the expiration time to the largest value admissible.
- std::map::iterator av_record = sCache.find(agent_id);
+ std::map::iterator av_record = LLAvatarNameCache::getInstance()->mCache.find(agent_id);
LLAvatarName& av_name = av_record->second;
av_name.setExpires(MAX_UNREFRESHED_TIME);
}
@@ -451,7 +396,7 @@ void LLAvatarNameCache::legacyNameFetch(const LLUUID& agent_id,
av_name.fromString(full_name);
// Add to cache: we're still using the new cache even if we're using the old (legacy) protocol.
- processName(agent_id, av_name);
+ LLAvatarNameCache::getInstance()->processName(agent_id, av_name);
}
void LLAvatarNameCache::requestNamesViaLegacy()
@@ -460,15 +405,15 @@ void LLAvatarNameCache::requestNamesViaLegacy()
F64 now = LLFrameTimer::getTotalSeconds();
std::string full_name;
ask_queue_t::const_iterator it;
- for (S32 requests = 0; !sAskQueue.empty() && requests < MAX_REQUESTS; ++requests)
+ for (S32 requests = 0; !mAskQueue.empty() && requests < MAX_REQUESTS; ++requests)
{
- it = sAskQueue.begin();
+ it = mAskQueue.begin();
LLUUID agent_id = *it;
- sAskQueue.erase(it);
+ mAskQueue.erase(it);
// Mark as pending first, just in case the callback is immediately
// invoked below. This should never happen in practice.
- sPendingQueue[agent_id] = now;
+ mPendingQueue[agent_id] = now;
LL_DEBUGS("AvNameCache") << "agent " << agent_id << LL_ENDL;
@@ -477,26 +422,6 @@ void LLAvatarNameCache::requestNamesViaLegacy()
}
}
-void LLAvatarNameCache::initClass(bool running, bool usePeopleAPI)
-{
- sRunning = running;
- sUsePeopleAPI = usePeopleAPI;
-
- sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
- sHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders());
- sHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
- sHttpPolicy = LLCore::HttpRequest::DEFAULT_POLICY_ID;
- sHttpPriority = 0;
-}
-
-void LLAvatarNameCache::cleanupClass()
-{
- sHttpRequest.reset();
- sHttpHeaders.reset();
- sHttpOptions.reset();
- sCache.clear();
-}
-
bool LLAvatarNameCache::importFile(std::istream& istr)
{
LLSD data;
@@ -517,9 +442,9 @@ bool LLAvatarNameCache::importFile(std::istream& istr)
{
agent_id.set(it->first);
av_name.fromLLSD( it->second );
- sCache[agent_id] = av_name;
+ mCache[agent_id] = av_name;
}
- LL_INFOS("AvNameCache") << "LLAvatarNameCache loaded " << sCache.size() << LL_ENDL;
+ LL_INFOS("AvNameCache") << "LLAvatarNameCache loaded " << mCache.size() << LL_ENDL;
// Some entries may have expired since the cache was stored,
// but they will be flushed in the first call to eraseUnrefreshed
// from LLAvatarNameResponder::idle
@@ -531,9 +456,9 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr)
{
LLSD agents;
F64 max_unrefreshed = LLFrameTimer::getTotalSeconds() - MAX_UNREFRESHED_TIME;
- LL_INFOS("AvNameCache") << "LLAvatarNameCache at exit cache has " << sCache.size() << LL_ENDL;
- cache_t::const_iterator it = sCache.begin();
- for ( ; it != sCache.end(); ++it)
+ LL_INFOS("AvNameCache") << "LLAvatarNameCache at exit cache has " << mCache.size() << LL_ENDL;
+ cache_t::const_iterator it = mCache.begin();
+ for ( ; it != mCache.end(); ++it)
{
const LLUUID& agent_id = it->first;
const LLAvatarName& av_name = it->second;
@@ -552,23 +477,28 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr)
void LLAvatarNameCache::setNameLookupURL(const std::string& name_lookup_url)
{
- sNameLookupURL = name_lookup_url;
+ mNameLookupURL = name_lookup_url;
}
bool LLAvatarNameCache::hasNameLookupURL()
{
- return !sNameLookupURL.empty();
+ return !mNameLookupURL.empty();
+}
+
+void LLAvatarNameCache::setUsePeopleAPI(bool use_api)
+{
+ mUsePeopleAPI = use_api;
}
bool LLAvatarNameCache::usePeopleAPI()
{
- return hasNameLookupURL() && sUsePeopleAPI;
+ return hasNameLookupURL() && mUsePeopleAPI;
}
void LLAvatarNameCache::idle()
{
// By convention, start running at first idle() call
- sRunning = true;
+ mRunning = true;
// *TODO: Possibly re-enabled this based on People API load measurements
// 100 ms is the threshold for "user speed" operations, so we can
@@ -579,7 +509,7 @@ void LLAvatarNameCache::idle()
return;
}
- if (!sAskQueue.empty())
+ if (!mAskQueue.empty())
{
if (usePeopleAPI())
{
@@ -592,7 +522,7 @@ void LLAvatarNameCache::idle()
}
}
- if (sAskQueue.empty())
+ if (mAskQueue.empty())
{
// cleared the list, reset the request timer.
sRequestTimer.resetWithExpiry(SECS_BETWEEN_REQUESTS);
@@ -607,8 +537,8 @@ bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id)
bool isPending = false;
const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0;
- pending_queue_t::const_iterator it = sPendingQueue.find(agent_id);
- if (it != sPendingQueue.end())
+ pending_queue_t::const_iterator it = mPendingQueue.find(agent_id);
+ if (it != mPendingQueue.end())
{
// in the list of requests in flight, retry if too old
F64 expire_time = LLFrameTimer::getTotalSeconds() - PENDING_TIMEOUT_SECS;
@@ -622,11 +552,11 @@ void LLAvatarNameCache::eraseUnrefreshed()
F64 now = LLFrameTimer::getTotalSeconds();
F64 max_unrefreshed = now - MAX_UNREFRESHED_TIME;
- if (!sLastExpireCheck || sLastExpireCheck < max_unrefreshed)
+ if (!mLastExpireCheck || mLastExpireCheck < max_unrefreshed)
{
- sLastExpireCheck = now;
+ mLastExpireCheck = now;
S32 expired = 0;
- for (cache_t::iterator it = sCache.begin(); it != sCache.end();)
+ for (cache_t::iterator it = mCache.begin(); it != mCache.end();)
{
const LLAvatarName& av_name = it->second;
if (av_name.mExpires < max_unrefreshed)
@@ -635,7 +565,7 @@ void LLAvatarNameCache::eraseUnrefreshed()
<< " user '" << av_name.getAccountName() << "' "
<< "expired " << now - av_name.mExpires << " secs ago"
<< LL_ENDL;
- sCache.erase(it++);
+ mCache.erase(it++);
expired++;
}
else
@@ -644,19 +574,24 @@ void LLAvatarNameCache::eraseUnrefreshed()
}
}
LL_INFOS("AvNameCache") << "LLAvatarNameCache expired " << expired << " cached avatar names, "
- << sCache.size() << " remaining" << LL_ENDL;
+ << mCache.size() << " remaining" << LL_ENDL;
}
}
-// fills in av_name if it has it in the cache, even if expired (can check expiry time)
-// returns bool specifying if av_name was filled, false otherwise
+//static, wrapper
bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
{
- if (sRunning)
+ return LLAvatarNameCache::getInstance()->getName(agent_id, av_name);
+}
+// fills in av_name if it has it in the cache, even if expired (can check expiry time)
+// returns bool specifying if av_name was filled, false otherwise
+bool LLAvatarNameCache::getName(const LLUUID& agent_id, LLAvatarName *av_name)
+{
+ if (mRunning)
{
// ...only do immediate lookups when cache is running
- std::map::iterator it = sCache.find(agent_id);
- if (it != sCache.end())
+ std::map::iterator it = mCache.find(agent_id);
+ if (it != mCache.end())
{
*av_name = it->second;
@@ -667,7 +602,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
{
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache refresh agent " << agent_id
<< LL_ENDL;
- sAskQueue.insert(agent_id);
+ mAskQueue.insert(agent_id);
}
}
@@ -678,7 +613,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
if (!isRequestPending(agent_id))
{
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache queue request for agent " << agent_id << LL_ENDL;
- sAskQueue.insert(agent_id);
+ mAskQueue.insert(agent_id);
}
return false;
@@ -693,15 +628,21 @@ void LLAvatarNameCache::fireSignal(const LLUUID& agent_id,
signal(agent_id, av_name);
}
+// static, wrapper
LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& agent_id, callback_slot_t slot)
+{
+ return LLAvatarNameCache::getInstance()->getNameCallback(agent_id, slot);
+}
+
+LLAvatarNameCache::callback_connection_t LLAvatarNameCache::getNameCallback(const LLUUID& agent_id, callback_slot_t slot)
{
callback_connection_t connection;
- if (sRunning)
+ if (mRunning)
{
// ...only do immediate lookups when cache is running
- std::map::iterator it = sCache.find(agent_id);
- if (it != sCache.end())
+ std::map::iterator it = mCache.find(agent_id);
+ if (it != mCache.end())
{
const LLAvatarName& av_name = it->second;
@@ -717,17 +658,17 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag
// schedule a request
if (!isRequestPending(agent_id))
{
- sAskQueue.insert(agent_id);
+ mAskQueue.insert(agent_id);
}
// always store additional callback, even if request is pending
- signal_map_t::iterator sig_it = sSignalMap.find(agent_id);
- if (sig_it == sSignalMap.end())
+ signal_map_t::iterator sig_it = mSignalMap.find(agent_id);
+ if (sig_it == mSignalMap.end())
{
// ...new callback for this id
callback_signal_t* signal = new callback_signal_t();
connection = signal->connect(slot);
- sSignalMap[agent_id] = signal;
+ mSignalMap[agent_id] = signal;
}
else
{
@@ -760,20 +701,20 @@ void LLAvatarNameCache::setUseUsernames(bool use)
void LLAvatarNameCache::erase(const LLUUID& agent_id)
{
- sCache.erase(agent_id);
+ mCache.erase(agent_id);
}
void LLAvatarNameCache::insert(const LLUUID& agent_id, const LLAvatarName& av_name)
{
// *TODO: update timestamp if zero?
- sCache[agent_id] = av_name;
+ mCache[agent_id] = av_name;
}
LLUUID LLAvatarNameCache::findIdByName(const std::string& name)
{
std::map::iterator it;
- std::map::iterator end = sCache.end();
- for (it = sCache.begin(); it != end; ++it)
+ std::map::iterator end = mCache.end();
+ for (it = mCache.begin(); it != end; ++it)
{
if (it->second.getUserName() == name)
{
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index 63e067c939..ba89d569f3 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -29,21 +29,20 @@
#define LLAVATARNAMECACHE_H
#include "llavatarname.h" // for convenience
+#include "llsingleton.h"
#include
+#include
class LLSD;
class LLUUID;
-namespace LLAvatarNameCache
+class LLAvatarNameCache : public LLSingleton
{
+ LLSINGLETON(LLAvatarNameCache);
+ ~LLAvatarNameCache();
+public:
typedef boost::signals2::signal use_display_name_signal_t;
- // Until the cache is set running, immediate lookups will fail and
- // async lookups will be queued. This allows us to block requests
- // until we know if the first region supports display names.
- void initClass(bool running, bool usePeopleAPI);
- void cleanupClass();
-
// Import/export the name cache to file.
bool importFile(std::istream& istr);
void exportFile(std::ostream& ostr);
@@ -55,6 +54,7 @@ namespace LLAvatarNameCache
// Do we have a valid lookup URL, i.e. are we trying to use the
// more recent display name lookup system?
bool hasNameLookupURL();
+ void setUsePeopleAPI(bool use_api);
bool usePeopleAPI();
// Periodically makes a batch request for display names not already in
@@ -63,7 +63,8 @@ namespace LLAvatarNameCache
// If name is in cache, returns true and fills in provided LLAvatarName
// otherwise returns false.
- bool get(const LLUUID& agent_id, LLAvatarName *av_name);
+ static bool get(const LLUUID& agent_id, LLAvatarName *av_name);
+ bool getName(const LLUUID& agent_id, LLAvatarName *av_name);
// Callback types for get() below
typedef boost::signals2::signal<
@@ -74,7 +75,8 @@ namespace LLAvatarNameCache
// Fetches name information and calls callbacks.
// If name information is in cache, callbacks will be called immediately.
- callback_connection_t get(const LLUUID& agent_id, callback_slot_t slot);
+ static callback_connection_t get(const LLUUID& agent_id, callback_slot_t slot);
+ callback_connection_t getNameCallback(const LLUUID& agent_id, callback_slot_t slot);
// Set display name: flips the switch and triggers the callbacks.
void setUseDisplayNames(bool use);
@@ -100,7 +102,83 @@ namespace LLAvatarNameCache
F64 nameExpirationFromHeaders(const LLSD& headers);
void addUseDisplayNamesCallback(const use_display_name_signal_t::slot_type& cb);
-}
+
+private:
+ // Handle name response off network.
+ void processName(const LLUUID& agent_id,
+ const LLAvatarName& av_name);
+
+ void requestNamesViaCapability();
+
+ // Legacy name system callbacks
+ static void legacyNameCallback(const LLUUID& agent_id,
+ const std::string& full_name,
+ bool is_group);
+ static void legacyNameFetch(const LLUUID& agent_id,
+ const std::string& full_name,
+ bool is_group);
+
+ void requestNamesViaLegacy();
+
+ // Do a single callback to a given slot
+ void fireSignal(const LLUUID& agent_id,
+ const callback_slot_t& slot,
+ const LLAvatarName& av_name);
+
+ // Is a request in-flight over the network?
+ bool isRequestPending(const LLUUID& agent_id);
+
+ // Erase expired names from cache
+ void eraseUnrefreshed();
+
+ bool expirationFromCacheControl(const LLSD& headers, F64 *expires);
+
+ // This is a coroutine.
+ static void requestAvatarNameCache_(std::string url, std::vector agentIds);
+
+ void handleAvNameCacheSuccess(const LLSD &data, const LLSD &httpResult);
+
+private:
+
+ use_display_name_signal_t mUseDisplayNamesSignal;
+
+ // Cache starts in a paused state until we can determine if the
+ // current region supports display names.
+ bool mRunning;
+
+ // Use the People API (modern) for fetching name if true. Use the old legacy protocol if false.
+ // For testing, there's a UsePeopleAPI setting that can be flipped (must restart viewer).
+ bool mUsePeopleAPI;
+
+ // Base lookup URL for name service.
+ // On simulator, loaded from indra.xml
+ // On viewer, usually a simulator capability (at People API team's request)
+ // Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/agents/"
+ std::string mNameLookupURL;
+
+ // Accumulated agent IDs for next query against service
+ typedef std::set ask_queue_t;
+ ask_queue_t mAskQueue;
+
+ // Agent IDs that have been requested, but with no reply.
+ // Maps agent ID to frame time request was made.
+ typedef std::map pending_queue_t;
+ pending_queue_t mPendingQueue;
+
+ // Callbacks to fire when we received a name.
+ // May have multiple callbacks for a single ID, which are
+ // represented as multiple slots bound to the signal.
+ // Avoid copying signals via pointers.
+ typedef std::map signal_map_t;
+ signal_map_t mSignalMap;
+
+ // The cache at last, i.e. avatar names we know about.
+ typedef std::map cache_t;
+ cache_t mCache;
+
+ // Time when unrefreshed cached names were checked last.
+ F64 mLastExpireCheck;
+};
// Parse a cache-control header to get the max-age delta-seconds.
// Returns true if header has max-age param and it parses correctly.
diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp
index dea03aab85..950599217f 100644
--- a/indra/llmessage/llproxy.cpp
+++ b/indra/llmessage/llproxy.cpp
@@ -403,8 +403,11 @@ LLSocks5AuthType LLProxy::getSelectedAuthMethod() const
//static
void LLProxy::cleanupClass()
{
- getInstance()->stopSOCKSProxy();
- deleteSingleton();
+ if (instanceExists())
+ {
+ getInstance()->stopSOCKSProxy();
+ deleteSingleton();
+ }
}
/**
diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp
index c04696c86b..254185cbd0 100644
--- a/indra/llmessage/tests/llareslistener_test.cpp
+++ b/indra/llmessage/tests/llareslistener_test.cpp
@@ -138,15 +138,9 @@ namespace tut
WrapLLErrs capture;
LLSD request;
request["op"] = "foo";
- std::string threw;
- try
- {
- LLEventPumps::instance().obtain("LLAres").post(request);
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- threw = e.what();
- }
+ std::string threw = capture.catch_llerrs([&request](){
+ LLEventPumps::instance().obtain("LLAres").post(request);
+ });
ensure_contains("LLAresListener bad op", threw, "bad");
}
@@ -157,15 +151,9 @@ namespace tut
WrapLLErrs capture;
LLSD request;
request["op"] = "rewriteURI";
- std::string threw;
- try
- {
- LLEventPumps::instance().obtain("LLAres").post(request);
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- threw = e.what();
- }
+ std::string threw = capture.catch_llerrs([&request](){
+ LLEventPumps::instance().obtain("LLAres").post(request);
+ });
ensure_contains("LLAresListener bad req", threw, "missing");
ensure_contains("LLAresListener bad req", threw, "reply");
ensure_contains("LLAresListener bad req", threw, "uri");
@@ -179,15 +167,9 @@ namespace tut
LLSD request;
request["op"] = "rewriteURI";
request["reply"] = "nonexistent";
- std::string threw;
- try
- {
- LLEventPumps::instance().obtain("LLAres").post(request);
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- threw = e.what();
- }
+ std::string threw = capture.catch_llerrs([&request](){
+ LLEventPumps::instance().obtain("LLAres").post(request);
+ });
ensure_contains("LLAresListener bad req", threw, "missing");
ensure_contains("LLAresListener bad req", threw, "uri");
ensure_does_not_contain("LLAresListener bad req", threw, "reply");
@@ -201,15 +183,9 @@ namespace tut
LLSD request;
request["op"] = "rewriteURI";
request["uri"] = "foo.bar.com";
- std::string threw;
- try
- {
- LLEventPumps::instance().obtain("LLAres").post(request);
- }
- catch (const WrapLLErrs::FatalException& e)
- {
- threw = e.what();
- }
+ std::string threw = capture.catch_llerrs([&request](){
+ LLEventPumps::instance().obtain("LLAres").post(request);
+ });
ensure_contains("LLAresListener bad req", threw, "missing");
ensure_contains("LLAresListener bad req", threw, "reply");
ensure_does_not_contain("LLAresListener bad req", threw, "uri");
diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp
index 4e2ebfd51e..4eb0203245 100644
--- a/indra/llrender/llrender2dutils.cpp
+++ b/indra/llrender/llrender2dutils.cpp
@@ -46,8 +46,6 @@
// Globals
//
const LLColor4 UI_VERTEX_COLOR(1.f, 1.f, 1.f, 1.f);
-/*static*/ LLVector2 LLRender2D::sGLScaleFactor(1.f, 1.f);
-/*static*/ LLImageProviderInterface* LLRender2D::sImageProvider = NULL;
//
// Functions
@@ -108,10 +106,11 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe
top += LLFontGL::sCurOrigin.mY;
gGL.loadUIIdentity();
- gl_rect_2d(llfloor((F32)left * LLRender2D::sGLScaleFactor.mV[VX]) - pixel_offset,
- llfloor((F32)top * LLRender2D::sGLScaleFactor.mV[VY]) + pixel_offset,
- llfloor((F32)right * LLRender2D::sGLScaleFactor.mV[VX]) + pixel_offset,
- llfloor((F32)bottom * LLRender2D::sGLScaleFactor.mV[VY]) - pixel_offset,
+ LLRender2D *r2d_inst = LLRender2D::getInstance();
+ gl_rect_2d(llfloor((F32)left * r2d_inst->mGLScaleFactor.mV[VX]) - pixel_offset,
+ llfloor((F32)top * r2d_inst->mGLScaleFactor.mV[VY]) + pixel_offset,
+ llfloor((F32)right * r2d_inst->mGLScaleFactor.mV[VX]) + pixel_offset,
+ llfloor((F32)bottom * r2d_inst->mGLScaleFactor.mV[VY]) - pixel_offset,
filled);
gGL.popUIMatrix();
}
@@ -800,7 +799,7 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
}
gGL.end();
- LLRender2D::setLineWidth(1.f);
+ LLRender2D::getInstance()->setLineWidth(1.f);
}
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle)
@@ -967,7 +966,7 @@ void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
}
else
{ //polygon stipple is deprecated, use "Checker" texture
- LLPointer img = LLRender2D::getUIImage("Checker");
+ LLPointer img = LLRender2D::getInstance()->getUIImage("Checker");
gGL.getTexUnit(0)->bind(img->getImage());
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
@@ -1567,25 +1566,26 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
}
-// static
-void LLRender2D::initClass(LLImageProviderInterface* image_provider,
- const LLVector2* scale_factor)
+LLRender2D::LLRender2D(LLImageProviderInterface* image_provider)
{
- sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor;
- sImageProvider = image_provider;
+ mGLScaleFactor = LLVector2(1.f, 1.f);
+ mImageProvider = image_provider;
+ if(mImageProvider)
+ {
+ mImageProvider->addOnRemovalCallback(resetProvider);
+ }
}
-// static
-void LLRender2D::cleanupClass()
+LLRender2D::~LLRender2D()
{
- if(sImageProvider)
+ if(mImageProvider)
{
- sImageProvider->cleanUp();
+ mImageProvider->cleanUp();
+ mImageProvider->deleteOnRemovalCallback(resetProvider);
}
}
-//static
void LLRender2D::translate(F32 x, F32 y, F32 z)
{
gGL.translateUI(x,y,z);
@@ -1594,14 +1594,12 @@ void LLRender2D::translate(F32 x, F32 y, F32 z)
LLFontGL::sCurDepth += z;
}
-//static
void LLRender2D::pushMatrix()
{
gGL.pushUIMatrix();
LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
}
-//static
void LLRender2D::popMatrix()
{
gGL.popUIMatrix();
@@ -1610,7 +1608,6 @@ void LLRender2D::popMatrix()
LLFontGL::sOriginStack.pop_back();
}
-//static
void LLRender2D::loadIdentity()
{
gGL.loadUIIdentity();
@@ -1619,25 +1616,22 @@ void LLRender2D::loadIdentity()
LLFontGL::sCurDepth = 0.f;
}
-//static
void LLRender2D::setScaleFactor(const LLVector2 &scale_factor)
{
- sGLScaleFactor = scale_factor;
+ mGLScaleFactor = scale_factor;
}
-//static
void LLRender2D::setLineWidth(F32 width)
{
gGL.flush();
- glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f));
+ glLineWidth(width * lerp(mGLScaleFactor.mV[VX], mGLScaleFactor.mV[VY], 0.5f));
}
-//static
LLPointer LLRender2D::getUIImageByID(const LLUUID& image_id, S32 priority)
{
- if (sImageProvider)
+ if (mImageProvider)
{
- return sImageProvider->getUIImageByID(image_id, priority);
+ return mImageProvider->getUIImageByID(image_id, priority);
}
else
{
@@ -1645,12 +1639,49 @@ LLPointer LLRender2D::getUIImageByID(const LLUUID& image_id, S32 prio
}
}
-//static
LLPointer LLRender2D::getUIImage(const std::string& name, S32 priority)
{
- if (!name.empty() && sImageProvider)
- return sImageProvider->getUIImage(name, priority);
+ if (!name.empty() && mImageProvider)
+ return mImageProvider->getUIImage(name, priority);
else
return NULL;
}
+// static
+void LLRender2D::resetProvider()
+{
+ if (LLRender2D::instanceExists)
+ {
+ LLRender2D::getInstance()->mImageProvider = NULL;
+ }
+}
+
+// class LLImageProviderInterface
+
+LLImageProviderInterface::~LLImageProviderInterface()
+{
+ for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end();)
+ {
+ callback_list_t::iterator curiter = iter++;
+ (*curiter)();
+ }
+}
+
+void LLImageProviderInterface::addOnRemovalCallback(callback_t func)
+{
+ if (!func)
+ {
+ return;
+ }
+ mCallbackList.push_back(func);
+}
+
+void LLImageProviderInterface::deleteOnRemovalCallback(callback_t func)
+{
+ callback_list_t::iterator iter = std::find(mCallbackList.begin(), mCallbackList.end(), func);
+ if (iter != mCallbackList.end())
+ {
+ mCallbackList.erase(iter);
+ }
+}
+
diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h
index cce3b4ed51..70ab006fd6 100644
--- a/indra/llrender/llrender2dutils.h
+++ b/indra/llrender/llrender2dutils.h
@@ -121,39 +121,54 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL
class LLImageProviderInterface;
-class LLRender2D
+class LLRender2D : public LLParamSingleton
{
+ LLSINGLETON(LLRender2D, LLImageProviderInterface* image_provider);
LOG_CLASS(LLRender2D);
+ ~LLRender2D();
public:
- static void initClass(LLImageProviderInterface* image_provider,
- const LLVector2* scale_factor);
- static void cleanupClass();
+ void pushMatrix();
+ void popMatrix();
+ void loadIdentity();
+ void translate(F32 x, F32 y, F32 z = 0.0f);
- static void pushMatrix();
- static void popMatrix();
- static void loadIdentity();
- static void translate(F32 x, F32 y, F32 z = 0.0f);
+ void setLineWidth(F32 width);
+ void setScaleFactor(const LLVector2& scale_factor);
- static void setLineWidth(F32 width);
- static void setScaleFactor(const LLVector2& scale_factor);
+ LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0);
+ LLPointer getUIImage(const std::string& name, S32 priority = 0);
- static LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0);
- static LLPointer getUIImage(const std::string& name, S32 priority = 0);
+ LLVector2 mGLScaleFactor;
+
+protected:
+ // since LLRender2D has no control of image provider's lifecycle
+ // we need a way to tell LLRender2D that provider died and
+ // LLRender2D needs to be updated.
+ static void resetProvider();
- static LLVector2 sGLScaleFactor;
private:
- static LLImageProviderInterface* sImageProvider;
+ LLImageProviderInterface* mImageProvider;
};
class LLImageProviderInterface
{
protected:
LLImageProviderInterface() {};
- virtual ~LLImageProviderInterface() {};
+ virtual ~LLImageProviderInterface();
public:
virtual LLPointer getUIImage(const std::string& name, S32 priority) = 0;
virtual LLPointer getUIImageByID(const LLUUID& id, S32 priority) = 0;
virtual void cleanUp() = 0;
+
+ // to notify holders when pointer gets deleted
+ typedef void(*callback_t)();
+ void addOnRemovalCallback(callback_t func);
+ void deleteOnRemovalCallback(callback_t func);
+
+private:
+
+ typedef std::list< callback_t > callback_list_t;
+ callback_list_t mCallbackList;
};
diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp
index 5d8f92b2e6..c8337feabb 100644
--- a/indra/llrender/lluiimage.cpp
+++ b/indra/llrender/lluiimage.cpp
@@ -120,12 +120,12 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
}
}
- LLRender2D::pushMatrix();
+ LLRender2D::getInstance()->pushMatrix();
{
LLVector3 rect_origin = origin_agent + (rect.mLeft * x_axis) + (rect.mBottom * y_axis);
- LLRender2D::translate(rect_origin.mV[VX],
- rect_origin.mV[VY],
- rect_origin.mV[VZ]);
+ LLRender2D::getInstance()->translate(rect_origin.mV[VX],
+ rect_origin.mV[VY],
+ rect_origin.mV[VZ]);
gGL.getTexUnit(0)->bind(getImage());
gGL.color4fv(color.mV);
@@ -142,7 +142,7 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
rect.getWidth() * x_axis,
rect.getHeight() * y_axis);
- } LLRender2D::popMatrix();
+ } LLRender2D::getInstance()->popMatrix();
}
@@ -199,7 +199,7 @@ namespace LLInitParam
return;
}
- LLUIImage* imagep = LLRender2D::getUIImage(name());
+ LLUIImage* imagep = LLRender2D::getInstance()->getUIImage(name());
if (imagep)
{
updateValue(imagep);
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index eaf1284237..1034a21905 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -977,7 +977,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
LLRect screen_rect;
localRectToScreen(child->getRect(),&screen_rect);
- if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
+ if ( root_rect.overlaps(screen_rect) && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
{
gGL.matrixMode(LLRender::MM_MODELVIEW);
LLUI::pushMatrix();
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 6b7a8a8b86..27444b7f5b 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -90,8 +90,8 @@ LLButton::Params::Params()
image_overlay_disabled_color("image_overlay_disabled_color", LLColor4::white % 0.3f),
image_overlay_selected_color("image_overlay_selected_color", LLColor4::white),
flash_color("flash_color"),
- pad_right("pad_right", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")),
- pad_left("pad_left", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")),
+ pad_right("pad_right", LLUI::getInstance()->mSettingGroups["config"]->getS32("ButtonHPad")),
+ pad_left("pad_left", LLUI::getInstance()->mSettingGroups["config"]->getS32("ButtonHPad")),
pad_bottom("pad_bottom"),
click_callback("click_callback"),
mouse_down_callback("mouse_down_callback"),
@@ -614,7 +614,7 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
// virtual
void LLButton::draw()
{
- static LLCachedControl sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true);
+ static LLCachedControl sEnableButtonFlashing(*LLUI::getInstance()->mSettingGroups["config"], "EnableButtonFlashing", true);
F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
bool pressed_by_keyboard = FALSE;
@@ -628,7 +628,7 @@ void LLButton::draw()
{
S32 local_mouse_x ;
S32 local_mouse_y;
- LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
+ LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
mouse_pressed_and_over = pointInView(local_mouse_x, local_mouse_y);
}
@@ -1261,10 +1261,10 @@ void LLButton::showHelp(LLUICtrl* ctrl, const LLSD& sdname)
// search back through the button's parents for a panel
// with a help_topic string defined
std::string help_topic;
- if (LLUI::sHelpImpl &&
+ if (LLUI::getInstance()->mHelpImpl &&
ctrl->findHelpTopic(help_topic))
{
- LLUI::sHelpImpl->showTopic(help_topic);
+ LLUI::getInstance()->mHelpImpl->showTopic(help_topic);
return; // success
}
diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp
index dac001afab..c506576126 100644
--- a/indra/llui/llchatentry.cpp
+++ b/indra/llui/llchatentry.cpp
@@ -201,7 +201,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -225,7 +225,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index b2ad38bddf..c7f0326ed4 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -668,7 +668,7 @@ void LLComboBox::showList()
mButton->setToggleState(TRUE);
mList->setVisible(TRUE);
- LLUI::addPopup(this);
+ LLUI::getInstance()->addPopup(this);
setUseBoundingRect(TRUE);
// updateBoundingRect();
@@ -694,7 +694,7 @@ void LLComboBox::hideList()
mList->mouseOverHighlightNthItem(-1);
setUseBoundingRect(FALSE);
- LLUI::removePopup(this);
+ LLUI::getInstance()->removePopup(this);
// updateBoundingRect();
}
}
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 26ae31cac6..5f50e46233 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -68,7 +68,7 @@ LLConsole::LLConsole(const LLConsole::Params& p)
setFontSize(p.font_size_index);
}
mFadeTime = mLinePersistTime - FADE_DURATION;
- setMaxLines(LLUI::sSettingGroups["config"]->getS32("ConsoleMaxLines"));
+ setMaxLines(LLUI::getInstance()->mSettingGroups["config"]->getS32("ConsoleMaxLines"));
}
void LLConsole::setLinePersistTime(F32 seconds)
@@ -180,7 +180,7 @@ void LLConsole::draw()
LLUIImagePtr imagep = LLUI::getUIImage("transparent");
- F32 console_opacity = llclamp(LLUI::sSettingGroups["config"]->getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
+ F32 console_opacity = llclamp(LLUI::getInstance()->mSettingGroups["config"]->getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground");
color.mV[VALPHA] *= console_opacity;
diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h
index 5ff05698b0..04f5e71609 100644
--- a/indra/llui/llconsole.h
+++ b/indra/llui/llconsole.h
@@ -51,7 +51,7 @@ public:
Optional persist_time;
Optional font_size_index;
Params()
- : max_lines("max_lines", LLUI::sSettingGroups["config"]->getS32("ConsoleMaxLines")),
+ : max_lines("max_lines", LLUI::getInstance()->mSettingGroups["config"]->getS32("ConsoleMaxLines")),
persist_time("persist_time", 0.f), // forever
font_size_index("font_size_index")
{
diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp
index 6d9c429b08..39793316f4 100644
--- a/indra/llui/llflashtimer.cpp
+++ b/indra/llui/llflashtimer.cpp
@@ -40,10 +40,10 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period)
// By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973.
// Due to Timer is implemented as derived class from EventTimer it is impossible to change period
// in runtime. So, both settings are made as required restart.
- mFlashCount = 2 * ((count > 0) ? count : LLUI::sSettingGroups["config"]->getS32("FlashCount"));
+ mFlashCount = 2 * ((count > 0) ? count : LLUI::getInstance()->mSettingGroups["config"]->getS32("FlashCount"));
if (mPeriod <= 0)
{
- mPeriod = LLUI::sSettingGroups["config"]->getF32("FlashPeriod");
+ mPeriod = LLUI::getInstance()->mSettingGroups["config"]->getF32("FlashPeriod");
}
}
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index a245dd8f78..42802cd339 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -215,14 +215,14 @@ void LLFloater::initClass()
sButtonToolTips[i] = LLTrans::getString( sButtonToolTipsIndex[i] );
}
- LLControlVariable* ctrl = LLUI::sSettingGroups["config"]->getControl("ActiveFloaterTransparency").get();
+ LLControlVariable* ctrl = LLUI::getInstance()->mSettingGroups["config"]->getControl("ActiveFloaterTransparency").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateActiveFloaterTransparency));
updateActiveFloaterTransparency();
}
- ctrl = LLUI::sSettingGroups["config"]->getControl("InactiveFloaterTransparency").get();
+ ctrl = LLUI::getInstance()->mSettingGroups["config"]->getControl("InactiveFloaterTransparency").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateInactiveFloaterTransparency));
@@ -374,13 +374,13 @@ void LLFloater::layoutDragHandle()
// static
void LLFloater::updateActiveFloaterTransparency()
{
- sActiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
+ sActiveControlTransparency = LLUI::getInstance()->mSettingGroups["config"]->getF32("ActiveFloaterTransparency");
}
// static
void LLFloater::updateInactiveFloaterTransparency()
{
- sInactiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
+ sInactiveControlTransparency = LLUI::getInstance()->mSettingGroups["config"]->getF32("InactiveFloaterTransparency");
}
void LLFloater::addResizeCtrls()
@@ -579,7 +579,7 @@ std::string LLFloater::getControlName(const std::string& name, const LLSD& key)
LLControlGroup* LLFloater::getControlGroup()
{
// Floater size, position, visibility, etc are saved in per-account settings.
- return LLUI::sSettingGroups["account"];
+ return LLUI::getInstance()->mSettingGroups["account"];
}
void LLFloater::setVisible( BOOL visible )
@@ -592,7 +592,7 @@ void LLFloater::setVisible( BOOL visible )
if( !visible )
{
- LLUI::removePopup(this);
+ LLUI::getInstance()->removePopup(this);
if( gFocusMgr.childHasMouseCapture( this ) )
{
@@ -818,7 +818,7 @@ void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent)
void LLFloater::releaseFocus()
{
- LLUI::removePopup(this);
+ LLUI::getInstance()->removePopup(this);
setFocus(FALSE);
@@ -1771,13 +1771,13 @@ void LLFloater::onClickDock(LLFloater* self)
// static
void LLFloater::onClickHelp( LLFloater* self )
{
- if (self && LLUI::sHelpImpl)
+ if (self && LLUI::getInstance()->mHelpImpl)
{
// find the current help context for this floater
std::string help_topic;
if (self->findHelpTopic(help_topic))
{
- LLUI::sHelpImpl->showTopic(help_topic);
+ LLUI::getInstance()->mHelpImpl->showTopic(help_topic);
}
}
}
@@ -2931,7 +2931,7 @@ void LLFloaterView::syncFloaterTabOrder()
if (modal_dialog)
{
// If we have a visible modal dialog, make sure that it has focus
- LLUI::addPopup(modal_dialog);
+ LLUI::getInstance()->addPopup(modal_dialog);
if( !gFocusMgr.childHasKeyboardFocus( modal_dialog ) )
{
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 9ef290abc0..85e07fc6a6 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -445,7 +445,7 @@ void LLFloaterReg::registerControlVariables()
}
}
- const LLSD& exclude_list = LLUI::sSettingGroups["config"]->getLLSD("always_showable_floaters");
+ const LLSD& exclude_list = LLUI::getInstance()->mSettingGroups["config"]->getLLSD("always_showable_floaters");
for (LLSD::array_const_iterator iter = exclude_list.beginArray();
iter != exclude_list.endArray();
iter++)
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 1b213c3418..7b0a6cbdae 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -183,7 +183,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
}
}
- LLUI::removePopup(view);
+ LLUI::getInstance()->removePopup(view);
}
void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL keystrokes_only)
@@ -481,7 +481,7 @@ void LLFocusMgr::setAppHasFocus(BOOL focus)
// release focus from "top ctrl"s, which generally hides them
if (!focus)
{
- LLUI::clearPopups();
+ LLUI::getInstance()->clearPopups();
}
mAppHasFocus = focus;
}
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 895753aeae..b05a9807d0 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -338,7 +338,7 @@ static LLTrace::BlockTimerStatHandle FTM_FILTER("Filter Folder View");
void LLFolderView::filter( LLFolderViewFilter& filter )
{
LL_RECORD_BLOCK_TIME(FTM_FILTER);
- filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
+ filter.resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
// Note: we filter the model, not the view
getViewModelItem()->filter(filter);
@@ -657,7 +657,7 @@ void LLFolderView::draw()
closeAutoOpenedFolders();
}
- if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size())
+ if (mSearchTimer.getElapsedTimeF32() > LLUI::getInstance()->mSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size())
{
mSearchString.clear();
}
@@ -733,7 +733,7 @@ void LLFolderView::closeRenamer( void )
if (mRenamer && mRenamer->getVisible())
{
// Triggers onRenamerLost() that actually closes the renamer.
- LLUI::removePopup(mRenamer);
+ LLUI::getInstance()->removePopup(mRenamer);
}
}
@@ -1064,7 +1064,7 @@ void LLFolderView::startRenamingSelectedItem( void )
// set focus will fail unless item is visible
mRenamer->setFocus( TRUE );
mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this));
- LLUI::addPopup(mRenamer);
+ LLUI::getInstance()->addPopup(mRenamer);
}
}
@@ -1321,7 +1321,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
}
//do text search
- if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout"))
+ if (mSearchTimer.getElapsedTimeF32() > LLUI::getInstance()->mSettingGroups["config"]->getF32("TypeAheadTimeout"))
{
mSearchString.clear();
}
@@ -1803,7 +1803,7 @@ void LLFolderView::updateRenamerPosition()
screenPointToLocal( x, y, &x, &y );
mRenamer->setOrigin( x, y );
- LLRect scroller_rect(0, 0, (S32)LLUI::getWindowSize().mV[VX], 0);
+ LLRect scroller_rect(0, 0, (S32)LLUI::getInstance()->getWindowSize().mV[VX], 0);
if (mScrollContainer)
{
scroller_rect = mScrollContainer->getContentWindowRect();
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 0510e472c5..2de47f1a19 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -548,7 +548,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
{
- static LLCachedControl drag_and_drop_threshold(*LLUI::sSettingGroups["config"],"DragAndDropDistanceThreshold", 3);
+ static LLCachedControl drag_and_drop_threshold(*LLUI::getInstance()->mSettingGroups["config"],"DragAndDropDistanceThreshold", 3);
mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight));
diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp
index 3363dc5316..3b45fb53a2 100644
--- a/indra/llui/llfolderviewmodel.cpp
+++ b/indra/llui/llfolderviewmodel.cpp
@@ -48,7 +48,7 @@ std::string LLFolderViewModelCommon::getStatusText()
void LLFolderViewModelCommon::filter()
{
- getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100));
+ getFilter().resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100));
mFolderView->getViewModelItem()->filter(getFilter());
}
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 955e7089f4..4a464b3507 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -209,7 +209,7 @@ LLLayoutStack::Params::Params()
open_time_constant("open_time_constant", 0.02f),
close_time_constant("close_time_constant", 0.03f),
resize_bar_overlap("resize_bar_overlap", 1),
- border_size("border_size", LLCachedControl(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0)),
+ border_size("border_size", LLCachedControl(*LLUI::getInstance()->mSettingGroups["config"], "UIResizeBarHeight", 0)),
show_drag_handle("show_drag_handle", false),
drag_handle_first_indent("drag_handle_first_indent", 0),
drag_handle_second_indent("drag_handle_second_indent", 0),
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index ff8bf30319..3ad504d68d 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -941,7 +941,7 @@ void LLLineEditor::removeChar()
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
@@ -992,7 +992,7 @@ void LLLineEditor::addChar(const llwchar uni_char)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
getWindow()->hideCursorUntilMouseMove();
@@ -1088,7 +1088,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
break;
@@ -1104,7 +1104,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
break;
@@ -1184,7 +1184,7 @@ void LLLineEditor::cut()
if( need_to_rollback )
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
else
{
@@ -1288,7 +1288,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
}
// Truncate the clean string at the limit of what will fit
clean_string = clean_string.substr(0, wchars_that_fit);
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
if (mMaxLengthChars)
@@ -1300,7 +1300,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
clean_string = clean_string.substr(0, available_chars);
}
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
mText.insert(getCursor(), clean_string);
@@ -1312,7 +1312,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
if( need_to_rollback )
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
else
{
@@ -1376,7 +1376,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
handled = TRUE;
@@ -1425,7 +1425,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1452,7 +1452,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1469,7 +1469,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1486,7 +1486,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1567,7 +1567,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
{
rollback.doRollback(this);
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
// Notify owner if requested
@@ -1623,7 +1623,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
// Notify owner if requested
@@ -1674,7 +1674,7 @@ void LLLineEditor::doDelete()
if( need_to_rollback )
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
else
{
@@ -2478,7 +2478,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
{
LLRect control_rect_screen;
localRectToScreen(getRect(), &control_rect_screen);
- LLUI::screenRectToGL(control_rect_screen, control);
+ LLUI::getInstance()->screenRectToGL(control_rect_screen, control);
}
S32 preedit_left_column, preedit_right_column;
@@ -2508,7 +2508,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
S32 query_local = findPixelNearestPos(query - getCursor());
S32 query_screen_x, query_screen_y;
localPointToScreen(query_local, getRect().getHeight() / 2, &query_screen_x, &query_screen_y);
- LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
+ LLUI::getInstance()->screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
}
if (bounds)
@@ -2524,7 +2524,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
LLRect preedit_rect_local(preedit_left_local, getRect().getHeight(), preedit_right_local, 0);
LLRect preedit_rect_screen;
localRectToScreen(preedit_rect_local, &preedit_rect_screen);
- LLUI::screenRectToGL(preedit_rect_screen, bounds);
+ LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds);
}
return TRUE;
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 92543b952e..200dd2fdca 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3263,7 +3263,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
menu->needsArrange();
menu->arrangeAndClear();
- LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y);
+ LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y);
LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y);
const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect();
diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp
index 8cf88ad5eb..5cfa8ea973 100644
--- a/indra/llui/llmodaldialog.cpp
+++ b/indra/llui/llmodaldialog.cpp
@@ -105,7 +105,7 @@ void LLModalDialog::onOpen(const LLSD& key)
// This is a modal dialog. It sucks up all mouse and keyboard operations.
gFocusMgr.setMouseCapture( this );
- LLUI::addPopup(this);
+ LLUI::getInstance()->addPopup(this);
setFocus(TRUE);
sModalStack.push_front( this );
@@ -147,7 +147,7 @@ void LLModalDialog::setVisible( BOOL visible )
gFocusMgr.setMouseCapture( this );
// The dialog view is a root view
- LLUI::addPopup(this);
+ LLUI::getInstance()->addPopup(this);
setFocus( TRUE );
}
else
@@ -165,7 +165,7 @@ BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask)
if (popup_menu != NULL)
{
S32 mx, my;
- LLUI::getMousePositionScreen(&mx, &my);
+ LLUI::getInstance()->getMousePositionScreen(&mx, &my);
LLRect menu_screen_rc = popup_menu->calcScreenRect();
if(!menu_screen_rc.pointInRect(mx, my))
{
@@ -202,7 +202,7 @@ BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask)
if (popup_menu != NULL)
{
S32 mx, my;
- LLUI::getMousePositionScreen(&mx, &my);
+ LLUI::getInstance()->getMousePositionScreen(&mx, &my);
LLRect menu_screen_rc = popup_menu->calcScreenRect();
if(menu_screen_rc.pointInRect(mx, my))
{
@@ -286,7 +286,7 @@ void LLModalDialog::draw()
void LLModalDialog::centerOnScreen()
{
- LLVector2 window_size = LLUI::getWindowSize();
+ LLVector2 window_size = LLUI::getInstance()->getWindowSize();
centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
}
@@ -316,7 +316,7 @@ void LLModalDialog::onAppFocusGained()
// This is a modal dialog. It sucks up all mouse and keyboard operations.
gFocusMgr.setMouseCapture( instance );
instance->setFocus(TRUE);
- LLUI::addPopup(instance);
+ LLUI::getInstance()->addPopup(instance);
instance->centerOnScreen();
}
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 7bafd711cb..9fc6c05ead 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -130,7 +130,7 @@ bool handleIgnoredNotification(const LLSD& payload)
response = pNotif->getResponseTemplate(LLNotification::WITH_DEFAULT_BUTTON);
break;
case LLNotificationForm::IGNORE_WITH_LAST_RESPONSE:
- response = LLUI::sSettingGroups["ignores"]->getLLSD("Default" + pNotif->getName());
+ response = LLUI::getInstance()->mSettingGroups["ignores"]->getLLSD("Default" + pNotif->getName());
break;
case LLNotificationForm::IGNORE_SHOW_AGAIN:
break;
@@ -197,6 +197,7 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica
{
mIgnoreMsg = p.ignore.text;
+ LLUI *ui_inst = LLUI::getInstance();
if (!p.ignore.save_option)
{
mIgnore = p.ignore.session_only ? IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY : IGNORE_WITH_DEFAULT_RESPONSE;
@@ -205,19 +206,19 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica
{
// remember last option chosen by user and automatically respond with that in the future
mIgnore = IGNORE_WITH_LAST_RESPONSE;
- LLUI::sSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name));
+ ui_inst->mSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name));
}
BOOL show_notification = TRUE;
if (p.ignore.control.isProvided())
{
- mIgnoreSetting = LLUI::sSettingGroups["config"]->getControl(p.ignore.control);
+ mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control);
mInvertSetting = p.ignore.invert_control;
}
else
{
- LLUI::sSettingGroups["ignores"]->declareBOOL(name, show_notification, "Show notification with this name", LLControlVariable::PERSIST_NONDFT);
- mIgnoreSetting = LLUI::sSettingGroups["ignores"]->getControl(name);
+ ui_inst->mSettingGroups["ignores"]->declareBOOL(name, show_notification, "Show notification with this name", LLControlVariable::PERSIST_NONDFT);
+ mIgnoreSetting = ui_inst->mSettingGroups["ignores"]->getControl(name);
}
}
@@ -432,7 +433,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par
mSoundName("")
{
if (p.sound.isProvided()
- && LLUI::sSettingGroups["config"]->controlExists(p.sound))
+ && LLUI::getInstance()->mSettingGroups["config"]->controlExists(p.sound))
{
mSoundName = p.sound;
}
@@ -700,7 +701,7 @@ void LLNotification::respond(const LLSD& response)
mForm->setIgnored(mIgnored);
if (mIgnored && mForm->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
{
- LLUI::sSettingGroups["ignores"]->setLLSD("Default" + getName(), response);
+ LLUI::getInstance()->mSettingGroups["ignores"]->setLLSD("Default" + getName(), response);
}
}
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index ee90574161..00da0f5fec 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -609,7 +609,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
return formatted_string.getString();
}
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
- if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
+ if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
}
@@ -628,7 +628,7 @@ std::string LLPanel::getString(const std::string& name) const
return found_it->second;
}
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
- if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
+ if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
}
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 76134144a0..b3a79bc1eb 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -84,7 +84,7 @@ LLScrollbar::LLScrollbar(const Params & p)
mThumbImageH(p.thumb_image_horizontal),
mTrackImageV(p.track_image_vertical),
mTrackImageH(p.track_image_horizontal),
- mThickness(p.thickness.isProvided() ? p.thickness : LLUI::sSettingGroups["config"]->getS32("UIScrollbarSize")),
+ mThickness(p.thickness.isProvided() ? p.thickness : LLUI::getInstance()->mSettingGroups["config"]->getS32("UIScrollbarSize")),
mBGVisible(p.bg_visible),
mBGColor(p.bg_color)
{
@@ -488,7 +488,7 @@ void LLScrollbar::draw()
S32 local_mouse_x;
S32 local_mouse_y;
- LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
+ LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this;
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
if (hovered)
@@ -645,5 +645,5 @@ void LLScrollbar::onLineDownBtnPressed( const LLSD& data )
void LLScrollbar::setThickness(S32 thickness)
{
- mThickness = thickness < 0 ? LLUI::sSettingGroups["config"]->getS32("UIScrollbarSize") : thickness;
+ mThickness = thickness < 0 ? LLUI::getInstance()->mSettingGroups["config"]->getS32("UIScrollbarSize") : thickness;
}
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp
index 7f64743e99..296ea09079 100644
--- a/indra/llui/llspellcheck.cpp
+++ b/indra/llui/llspellcheck.cpp
@@ -44,7 +44,6 @@ static const std::string DICT_FILE_IGNORE = "user_ignore.dic";
static const std::string DICT_FILE_MAIN = "dictionaries.xml";
static const std::string DICT_FILE_USER = "user_dictionaries.xml";
-LLSD LLSpellChecker::sDictMap;
LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal;
LLSpellChecker::LLSpellChecker()
@@ -94,10 +93,9 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector, public LLInitClass
+class LLSpellChecker : public LLSingleton
{
LLSINGLETON(LLSpellChecker);
- friend class LLInitClass;
~LLSpellChecker();
public:
@@ -57,26 +56,24 @@ public:
bool isActiveDictionary(const std::string& dict_language) const;
void setSecondaryDictionaries(dict_list_t dict_list);
- static bool canRemoveDictionary(const std::string& dict_language);
+ bool canRemoveDictionary(const std::string& dict_language);
static const std::string getDictionaryAppPath();
static const std::string getDictionaryUserPath();
- static const LLSD getDictionaryData(const std::string& dict_language);
- static const LLSD& getDictionaryMap() { return sDictMap; }
+ const LLSD getDictionaryData(const std::string& dict_language);
+ const LLSD& getDictionaryMap() { return mDictMap; }
static bool getUseSpellCheck();
- static bool hasDictionary(const std::string& dict_language, bool check_installed = false);
- static void refreshDictionaryMap();
- static void removeDictionary(const std::string& dict_language);
+ bool hasDictionary(const std::string& dict_language, bool check_installed = false);
+ void refreshDictionaryMap();
+ void removeDictionary(const std::string& dict_language);
static void setUseSpellCheck(const std::string& dict_language);
protected:
static LLSD loadUserDictionaryMap();
- static void setDictionaryData(const LLSD& dict_info);
+ void setDictionaryData(const LLSD& dict_info);
static void saveUserDictionaryMap(const LLSD& dict_map);
public:
typedef boost::signals2::signal settings_change_signal_t;
static boost::signals2::connection setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb);
-protected:
- static void initClass();
protected:
Hunspell* mHunspell;
@@ -84,8 +81,8 @@ protected:
std::string mDictFile;
dict_list_t mDictSecondary;
std::vector mIgnoreList;
+ LLSD mDictMap;
- static LLSD sDictMap;
static settings_change_signal_t sSettingsChangeSignal;
};
diff --git a/indra/llui/llstatview.cpp b/indra/llui/llstatview.cpp
index eda2d6047f..bb4969c81f 100644
--- a/indra/llui/llstatview.cpp
+++ b/indra/llui/llstatview.cpp
@@ -43,7 +43,7 @@ LLStatView::LLStatView(const LLStatView::Params& p)
BOOL isopen = getDisplayChildren();
if (mSetting.length() > 0)
{
- isopen = LLUI::sSettingGroups["config"]->getBOOL(mSetting);
+ isopen = LLUI::getInstance()->mSettingGroups["config"]->getBOOL(mSetting);
}
setDisplayChildren(isopen);
}
@@ -54,7 +54,7 @@ LLStatView::~LLStatView()
if (mSetting.length() > 0)
{
BOOL isopen = getDisplayChildren();
- LLUI::sSettingGroups["config"]->setBOOL(mSetting, isopen);
+ LLUI::getInstance()->mSettingGroups["config"]->setBOOL(mSetting, isopen);
}
}
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 4505e3d572..10494b8877 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3258,7 +3258,7 @@ BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask)
// Only process the click if it's actually in this segment, not to the right of the end-of-line.
if(mEditor.getSegmentAtLocalPos(x, y, false) == this)
{
- LLUI::getWindow()->setCursor(UI_CURSOR_HAND);
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
return TRUE;
}
}
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 9faff1278d..0afd32f332 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -107,7 +107,7 @@ BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask)
if (!handled && mClickedCallback && mShowCursorHand)
{
// Clickable text boxes change the cursor to a hand
- LLUI::getWindow()->setCursor(UI_CURSOR_HAND);
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
return TRUE;
}
return handled;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 137167db2a..b1f8b00cab 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1045,7 +1045,7 @@ void LLTextEditor::removeCharOrTab()
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
@@ -1068,7 +1068,7 @@ void LLTextEditor::removeChar()
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
@@ -1315,7 +1315,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
break;
@@ -1333,7 +1333,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
break;
@@ -1665,7 +1665,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
break;
@@ -2750,7 +2750,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
{
LLRect control_rect_screen;
localRectToScreen(mVisibleTextRect, &control_rect_screen);
- LLUI::screenRectToGL(control_rect_screen, control);
+ LLUI::getInstance()->screenRectToGL(control_rect_screen, control);
}
S32 preedit_left_position, preedit_right_position;
@@ -2804,7 +2804,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
const S32 query_y = mVisibleTextRect.mTop - (current_line - first_visible_line) * line_height - line_height / 2;
S32 query_screen_x, query_screen_y;
localPointToScreen(query_x, query_y, &query_screen_x, &query_screen_y);
- LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
+ LLUI::getInstance()->screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
}
if (bounds)
@@ -2831,7 +2831,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
const LLRect preedit_rect_local(preedit_left, preedit_top, preedit_right, preedit_bottom);
LLRect preedit_rect_screen;
localRectToScreen(preedit_rect_local, &preedit_rect_screen);
- LLUI::screenRectToGL(preedit_rect_screen, bounds);
+ LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds);
}
return TRUE;
diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp
index f6b2ee1dc0..538508b856 100644
--- a/indra/llui/lltextutil.cpp
+++ b/indra/llui/lltextutil.cpp
@@ -78,7 +78,7 @@ void LLTextUtil::textboxSetGreyedVal(LLTextBox *txtbox, const LLStyle::Params& n
const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str)
{
- static const std::string PHONE_SEPARATOR = LLUI::sSettingGroups["config"]->getString("AvalinePhoneSeparator");
+ static const std::string PHONE_SEPARATOR = LLUI::getInstance()->mSettingGroups["config"]->getString("AvalinePhoneSeparator");
static const S32 PHONE_PART_LEN = 2;
static std::string formatted_phone_str;
diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp
index ccb92ffbb2..3e56e0a589 100644
--- a/indra/llui/lltoggleablemenu.cpp
+++ b/indra/llui/lltoggleablemenu.cpp
@@ -55,7 +55,7 @@ boost::signals2::connection LLToggleableMenu::setVisibilityChangeCallback(const
void LLToggleableMenu::onVisibilityChange (BOOL curVisibilityIn)
{
S32 x,y;
- LLUI::getMousePositionLocal(LLUI::getRootView(), &x, &y);
+ LLUI::getInstance()->getMousePositionLocal(LLUI::getInstance()->getRootView(), &x, &y);
// STORM-1879: also check MouseCapture to see if the button was really
// clicked (otherwise the VisibilityChange was triggered via keyboard shortcut)
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index abc2b6e9ca..e6f466ec78 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -1125,7 +1125,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
BOOL handled = FALSE;
S32 mouse_distance_squared = (x - mMouseDownX) * (x - mMouseDownX) + (y - mMouseDownY) * (y - mMouseDownY);
- S32 drag_threshold = LLUI::sSettingGroups["config"]->getS32("DragAndDropDistanceThreshold");
+ S32 drag_threshold = LLUI::getInstance()->mSettingGroups["config"]->getS32("DragAndDropDistanceThreshold");
if (mouse_distance_squared > drag_threshold * drag_threshold
&& hasMouseCapture() &&
mStartDragItemCallback && mHandleDragItemCallback)
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 698b128d45..422534b781 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -145,10 +145,10 @@ LLToolTip::Params::Params()
wrap("wrap", true),
pos("pos"),
message("message"),
- delay_time("delay_time", LLUI::sSettingGroups["config"]->getF32( "ToolTipDelay" )),
- visible_time_over("visible_time_over", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeOver" )),
- visible_time_near("visible_time_near", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeNear" )),
- visible_time_far("visible_time_far", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )),
+ delay_time("delay_time", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" )),
+ visible_time_over("visible_time_over", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipVisibleTimeOver" )),
+ visible_time_near("visible_time_near", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipVisibleTimeNear" )),
+ visible_time_far("visible_time_far", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )),
sticky_rect("sticky_rect"),
image("image"),
text_color("text_color"),
@@ -358,7 +358,7 @@ void LLToolTip::draw()
if (mFadeTimer.getStarted())
{
- F32 tool_tip_fade_time = LLUI::sSettingGroups["config"]->getF32("ToolTipFadeTime");
+ F32 tool_tip_fade_time = LLUI::getInstance()->mSettingGroups["config"]->getF32("ToolTipFadeTime");
alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, tool_tip_fade_time, 1.f, 0.f);
if (alpha == 0.f)
{
@@ -436,12 +436,12 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
{
LLCoordGL pos = params.pos;
// try to spawn at requested position
- LLUI::positionViewNearMouse(mToolTip, pos.mX, pos.mY);
+ LLUI::getInstance()->positionViewNearMouse(mToolTip, pos.mX, pos.mY);
}
else
{
// just spawn at mouse location
- LLUI::positionViewNearMouse(mToolTip);
+ LLUI::getInstance()->positionViewNearMouse(mToolTip);
}
//...update "sticky" rect and tooltip position
@@ -453,7 +453,7 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
{
S32 mouse_x;
S32 mouse_y;
- LLUI::getMousePositionLocal(gToolTipView->getParent(), &mouse_x, &mouse_y);
+ LLUI::getInstance()->getMousePositionLocal(gToolTipView->getParent(), &mouse_x, &mouse_y);
// allow mouse a little bit of slop before changing tooltips
mMouseNearRect.setCenterAndSize(mouse_x, mouse_y, 3, 3);
@@ -491,7 +491,7 @@ void LLToolTipMgr::show(const LLToolTip::Params& params)
// are we ready to show the tooltip?
if (!mToolTipsBlocked // we haven't hit a key, moved the mouse, etc.
- && LLUI::getMouseIdleTime() > params_with_defaults.delay_time) // the mouse has been still long enough
+ && LLUI::getInstance()->getMouseIdleTime() > params_with_defaults.delay_time) // the mouse has been still long enough
{
bool tooltip_changed = mLastToolTipParams.message() != params_with_defaults.message()
|| mLastToolTipParams.pos() != params_with_defaults.pos()
@@ -563,7 +563,7 @@ void LLToolTipMgr::updateToolTipVisibility()
}
// hide tooltips when mouse cursor is hidden
- if (LLUI::getWindow()->isCursorHidden())
+ if (LLUI::getInstance()->getWindow()->isCursorHidden())
{
blockToolTips();
return;
@@ -574,7 +574,7 @@ void LLToolTipMgr::updateToolTipVisibility()
if (toolTipVisible())
{
S32 mouse_x, mouse_y;
- LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y);
+ LLUI::getInstance()->getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y);
// mouse far away from tooltip
tooltip_timeout = mLastToolTipParams.visible_time_far;
diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp
index b1534bb5e4..5da722a72b 100644
--- a/indra/llui/lltransutil.cpp
+++ b/indra/llui/lltransutil.cpp
@@ -44,6 +44,7 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::setdumpCurrentDirectories(LLError::LEVEL_WARN);
LL_ERRS() << "Couldn't load string table " << xml_filename << ". Please reinstall viewer from https://secondlife.com/support/downloads/ and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
return false;
}
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 52190a1473..656b69d3ed 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -75,19 +75,6 @@
// Language for UI construction
std::map gTranslation;
std::list gUntranslated;
-/*static*/ LLUI::settings_map_t LLUI::sSettingGroups;
-/*static*/ LLUIAudioCallback LLUI::sAudioCallback = NULL;
-/*static*/ LLUIAudioCallback LLUI::sDeferredAudioCallback = NULL;
-/*static*/ LLWindow* LLUI::sWindow = NULL;
-/*static*/ LLView* LLUI::sRootView = NULL;
-/*static*/ BOOL LLUI::sDirty = FALSE;
-/*static*/ LLRect LLUI::sDirtyRect;
-/*static*/ LLHelp* LLUI::sHelpImpl = NULL;
-/*static*/ std::vector LLUI::sXUIPaths;
-/*static*/ LLFrameTimer LLUI::sMouseIdleTimer;
-/*static*/ LLUI::add_popup_t LLUI::sAddPopupFunc;
-/*static*/ LLUI::remove_popup_t LLUI::sRemovePopupFunc;
-/*static*/ LLUI::clear_popups_t LLUI::sClearPopupsFunc;
// register filter editor here
static LLDefaultChildRegistry::Register register_filter_editor("filter_editor");
@@ -106,18 +93,19 @@ LLUUID find_ui_sound(const char * namep)
{
std::string name = ll_safe_string(namep);
LLUUID uuid = LLUUID(NULL);
- if (!LLUI::sSettingGroups["config"]->controlExists(name))
+ LLUI *ui_inst = LLUI::getInstance();
+ if (!ui_inst->mSettingGroups["config"]->controlExists(name))
{
LL_WARNS() << "tried to make UI sound for unknown sound name: " << name << LL_ENDL;
}
else
{
- uuid = LLUUID(LLUI::sSettingGroups["config"]->getString(name));
+ uuid = LLUUID(ui_inst->mSettingGroups["config"]->getString(name));
if (uuid.isNull())
{
- if (LLUI::sSettingGroups["config"]->getString(name) == LLUUID::null.asString())
+ if (ui_inst->mSettingGroups["config"]->getString(name) == LLUUID::null.asString())
{
- if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
+ if (ui_inst->mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
{
LL_INFOS() << "UI sound name: " << name << " triggered but silent (null uuid)" << LL_ENDL;
}
@@ -127,9 +115,9 @@ LLUUID find_ui_sound(const char * namep)
LL_WARNS() << "UI sound named: " << name << " does not translate to a valid uuid" << LL_ENDL;
}
}
- else if (LLUI::sAudioCallback != NULL)
+ else if (ui_inst->mAudioCallback != NULL)
{
- if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
+ if (ui_inst->mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
{
LL_INFOS() << "UI sound name: " << name << LL_ENDL;
}
@@ -144,7 +132,7 @@ void make_ui_sound(const char* namep)
LLUUID soundUUID = find_ui_sound(namep);
if(soundUUID.notNull())
{
- LLUI::sAudioCallback(soundUUID);
+ LLUI::getInstance()->mAudioCallback(soundUUID);
}
}
@@ -153,30 +141,31 @@ void make_ui_sound_deferred(const char* namep)
LLUUID soundUUID = find_ui_sound(namep);
if(soundUUID.notNull())
{
- LLUI::sDeferredAudioCallback(soundUUID);
+ LLUI::getInstance()->mDeferredAudioCallback(soundUUID);
}
}
-void LLUI::initClass(const settings_map_t& settings,
- LLImageProviderInterface* image_provider,
- LLUIAudioCallback audio_callback,
- LLUIAudioCallback deferred_audio_callback,
- const LLVector2* scale_factor,
- const std::string& language)
+LLUI::LLUI(const settings_map_t& settings,
+ LLImageProviderInterface* image_provider,
+ LLUIAudioCallback audio_callback,
+ LLUIAudioCallback deferred_audio_callback)
+: mSettingGroups(settings),
+mAudioCallback(audio_callback),
+mDeferredAudioCallback(deferred_audio_callback),
+mWindow(NULL), // set later in startup
+mRootView(NULL),
+mDirty(FALSE),
+mHelpImpl(NULL)
{
- LLRender2D::initClass(image_provider,scale_factor);
- sSettingGroups = settings;
+ LLRender2D::initParamSingleton(image_provider);
- if ((get_ptr_in_map(sSettingGroups, std::string("config")) == NULL) ||
- (get_ptr_in_map(sSettingGroups, std::string("floater")) == NULL) ||
- (get_ptr_in_map(sSettingGroups, std::string("ignores")) == NULL))
+ if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) ||
+ (get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) ||
+ (get_ptr_in_map(mSettingGroups, std::string("ignores")) == NULL))
{
LL_ERRS() << "Failure to initialize configuration groups" << LL_ENDL;
}
- sAudioCallback = audio_callback;
- sDeferredAudioCallback = deferred_audio_callback;
- sWindow = NULL; // set later in startup
LLFontGL::sShadowColor = LLUIColorTable::instance().getColor("ColorDropShadow");
LLUICtrl::CommitCallbackRegistry::Registrar& reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar();
@@ -207,33 +196,26 @@ void LLUI::initClass(const settings_map_t& settings,
LLCommandManager::load();
}
-void LLUI::cleanupClass()
-{
- SUBSYSTEM_CLEANUP(LLRender2D);
-}
-
void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups)
{
- sAddPopupFunc = add_popup;
- sRemovePopupFunc = remove_popup;
- sClearPopupsFunc = clear_popups;
+ mAddPopupFunc = add_popup;
+ mRemovePopupFunc = remove_popup;
+ mClearPopupsFunc = clear_popups;
}
-//static
void LLUI::dirtyRect(LLRect rect)
{
- if (!sDirty)
+ if (!mDirty)
{
- sDirtyRect = rect;
- sDirty = TRUE;
+ mDirtyRect = rect;
+ mDirty = TRUE;
}
else
{
- sDirtyRect.unionWith(rect);
- }
+ mDirtyRect.unionWith(rect);
+ }
}
-
-//static
+
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
#if defined(LL_DARWIN)
@@ -247,7 +229,6 @@ void LLUI::setMousePositionScreen(S32 x, S32 y)
LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
-//static
void LLUI::getMousePositionScreen(S32 *x, S32 *y)
{
LLCoordWindow cursor_pos_window;
@@ -257,7 +238,6 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y)
*y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VY]);
}
-//static
void LLUI::setMousePositionLocal(const LLView* viewp, S32 x, S32 y)
{
S32 screen_x, screen_y;
@@ -266,7 +246,6 @@ void LLUI::setMousePositionLocal(const LLView* viewp, S32 x, S32 y)
setMousePositionScreen(screen_x, screen_y);
}
-//static
void LLUI::getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y)
{
S32 screen_x, screen_y;
@@ -280,20 +259,19 @@ void LLUI::getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y)
// or on Windows if the SecondLife.exe executable is run directly, the
// language follows the OS language. In all cases the user can override
// the language manually in preferences. JC
-// static
-std::string LLUI::getLanguage()
+std::string LLUI::getUILanguage()
{
std::string language = "en";
- if (sSettingGroups["config"])
+ if (mSettingGroups["config"])
{
- language = sSettingGroups["config"]->getString("Language");
+ language = mSettingGroups["config"]->getString("Language");
if (language.empty() || language == "default")
{
- language = sSettingGroups["config"]->getString("InstallLanguage");
+ language = mSettingGroups["config"]->getString("InstallLanguage");
}
if (language.empty() || language == "default")
{
- language = sSettingGroups["config"]->getString("SystemLanguage");
+ language = mSettingGroups["config"]->getString("SystemLanguage");
}
if (language.empty() || language == "default")
{
@@ -303,6 +281,13 @@ std::string LLUI::getLanguage()
return language;
}
+// static
+std::string LLUI::getLanguage()
+{
+ // Note: lldateutil_test redefines this function
+ return LLUI::getInstance()->getUILanguage();
+}
+
struct SubDir : public LLInitParam::Block
{
Mandatory value;
@@ -362,37 +347,32 @@ std::string LLUI::locateSkin(const std::string& filename)
return "";
}
-//static
LLVector2 LLUI::getWindowSize()
{
LLCoordWindow window_rect;
- sWindow->getSize(&window_rect);
+ mWindow->getSize(&window_rect);
return LLVector2(window_rect.mX / getScaleFactor().mV[VX], window_rect.mY / getScaleFactor().mV[VY]);
}
-//static
void LLUI::screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y)
{
*gl_x = ll_round((F32)screen_x * getScaleFactor().mV[VX]);
*gl_y = ll_round((F32)screen_y * getScaleFactor().mV[VY]);
}
-//static
void LLUI::glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y)
{
*screen_x = ll_round((F32)gl_x / getScaleFactor().mV[VX]);
*screen_y = ll_round((F32)gl_y / getScaleFactor().mV[VY]);
}
-//static
void LLUI::screenRectToGL(const LLRect& screen, LLRect *gl)
{
screenPointToGL(screen.mLeft, screen.mTop, &gl->mLeft, &gl->mTop);
screenPointToGL(screen.mRight, screen.mBottom, &gl->mRight, &gl->mBottom);
}
-//static
void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen)
{
glPointToScreen(gl.mLeft, gl.mTop, &screen->mLeft, &screen->mTop);
@@ -402,8 +382,8 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen)
LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname)
{
- for (settings_map_t::iterator itor = sSettingGroups.begin();
- itor != sSettingGroups.end(); ++itor)
+ for (settings_map_t::iterator itor = mSettingGroups.begin();
+ itor != mSettingGroups.end(); ++itor)
{
LLControlGroup* control_group = itor->second;
if(control_group != NULL)
@@ -413,43 +393,38 @@ LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname)
}
}
- return *sSettingGroups["config"]; // default group
+ return *mSettingGroups["config"]; // default group
}
-//static
void LLUI::addPopup(LLView* viewp)
{
- if (sAddPopupFunc)
+ if (mAddPopupFunc)
{
- sAddPopupFunc(viewp);
+ mAddPopupFunc(viewp);
}
}
-//static
void LLUI::removePopup(LLView* viewp)
{
- if (sRemovePopupFunc)
+ if (mRemovePopupFunc)
{
- sRemovePopupFunc(viewp);
+ mRemovePopupFunc(viewp);
}
}
-//static
void LLUI::clearPopups()
{
- if (sClearPopupsFunc)
+ if (mClearPopupsFunc)
{
- sClearPopupsFunc();
+ mClearPopupsFunc();
}
}
-//static
void LLUI::reportBadKeystroke()
{
make_ui_sound("UISndBadKeystroke");
}
-
-//static
+
// spawn_x and spawn_y are top left corner of view in screen GL coordinates
void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
{
@@ -460,7 +435,7 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
S32 mouse_x;
S32 mouse_y;
- LLUI::getMousePositionScreen(&mouse_x, &mouse_y);
+ getMousePositionScreen(&mouse_x, &mouse_y);
// If no spawn location provided, use mouse position
if (spawn_x == S32_MAX || spawn_y == S32_MAX)
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index d7151dbee9..e1c51deba9 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -109,8 +109,16 @@ class LLImageProviderInterface;
typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
-class LLUI
+class LLUI : public LLParamSingleton
{
+public:
+ typedef std::map settings_map_t;
+
+private:
+ LLSINGLETON(LLUI , const settings_map_t &settings,
+ LLImageProviderInterface* image_provider,
+ LLUIAudioCallback audio_callback,
+ LLUIAudioCallback deferred_audio_callback);
LOG_CLASS(LLUI);
public:
//
@@ -232,36 +240,24 @@ public:
//
// Methods
//
- typedef std::map settings_map_t;
typedef boost::function add_popup_t;
typedef boost::function remove_popup_t;
typedef boost::function clear_popups_t;
- static void initClass(const settings_map_t& settings,
- LLImageProviderInterface* image_provider,
- LLUIAudioCallback audio_callback = NULL,
- LLUIAudioCallback deferred_audio_callback = NULL,
- const LLVector2 *scale_factor = NULL,
- const std::string& language = LLStringUtil::null);
- static void cleanupClass();
- static void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& );
+ void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& );
- static void pushMatrix() { LLRender2D::pushMatrix(); }
- static void popMatrix() { LLRender2D::popMatrix(); }
- static void loadIdentity() { LLRender2D::loadIdentity(); }
- static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); }
-
- static LLRect sDirtyRect;
- static BOOL sDirty;
- static void dirtyRect(LLRect rect);
+ LLRect mDirtyRect;
+ BOOL mDirty;
+ void dirtyRect(LLRect rect);
// Return the ISO639 language name ("en", "ko", etc.) for the viewer UI.
// http://www.loc.gov/standards/iso639-2/php/code_list.php
- static std::string getLanguage();
+ std::string getUILanguage();
+ static std::string getLanguage(); // static for lldateutil_test compatibility
//helper functions (should probably move free standing rendering helper functions here)
- static LLView* getRootView() { return sRootView; }
- static void setRootView(LLView* view) { sRootView = view; }
+ LLView* getRootView() { return mRootView; }
+ void setRootView(LLView* view) { mRootView = view; }
/**
* Walk the LLView tree to resolve a path
* Paths can be discovered using Develop > XUI > Show XUI Paths
@@ -287,58 +283,65 @@ public:
* tree, the first "bar" anywhere under it, and "baz"
* as a direct child of that
*/
- static const LLView* resolvePath(const LLView* context, const std::string& path);
- static LLView* resolvePath(LLView* context, const std::string& path);
+ const LLView* resolvePath(const LLView* context, const std::string& path);
+ LLView* resolvePath(LLView* context, const std::string& path);
static std::string locateSkin(const std::string& filename);
- static void setMousePositionScreen(S32 x, S32 y);
- static void getMousePositionScreen(S32 *x, S32 *y);
- static void setMousePositionLocal(const LLView* viewp, S32 x, S32 y);
- static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y);
- static LLVector2& getScaleFactor() { return LLRender2D::sGLScaleFactor; }
- static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::setScaleFactor(scale_factor); }
- static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); }
- static LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0)
- { return LLRender2D::getUIImageByID(image_id, priority); }
- static LLPointer getUIImage(const std::string& name, S32 priority = 0)
- { return LLRender2D::getUIImage(name, priority); }
- static LLVector2 getWindowSize();
- static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y);
- static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y);
- static void screenRectToGL(const LLRect& screen, LLRect *gl);
- static void glRectToScreen(const LLRect& gl, LLRect *screen);
+ void setMousePositionScreen(S32 x, S32 y);
+ void getMousePositionScreen(S32 *x, S32 *y);
+ void setMousePositionLocal(const LLView* viewp, S32 x, S32 y);
+ void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y);
+ LLVector2 getWindowSize();
+ void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y);
+ void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y);
+ void screenRectToGL(const LLRect& screen, LLRect *gl);
+ void glRectToScreen(const LLRect& gl, LLRect *screen);
// Returns the control group containing the control name, or the default group
- static LLControlGroup& getControlControlGroup (const std::string& controlname);
- static F32 getMouseIdleTime() { return sMouseIdleTimer.getElapsedTimeF32(); }
- static void resetMouseIdleTimer() { sMouseIdleTimer.reset(); }
- static LLWindow* getWindow() { return sWindow; }
+ LLControlGroup& getControlControlGroup (const std::string& controlname);
+ F32 getMouseIdleTime() { return mMouseIdleTimer.getElapsedTimeF32(); }
+ void resetMouseIdleTimer() { mMouseIdleTimer.reset(); }
+ LLWindow* getWindow() { return mWindow; }
- static void addPopup(LLView*);
- static void removePopup(LLView*);
- static void clearPopups();
+ void addPopup(LLView*);
+ void removePopup(LLView*);
+ void clearPopups();
- static void reportBadKeystroke();
+ void reportBadKeystroke();
// Ensures view does not overlap mouse cursor, but is inside
// the view's parent rectangle. Used for tooltips, inspectors.
// Optionally override the view's default X/Y, which are relative to the
// view's parent.
- static void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX);
+ void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX);
+
+ // LLRender2D wrappers
+ static void pushMatrix() { LLRender2D::getInstance()->pushMatrix(); }
+ static void popMatrix() { LLRender2D::getInstance()->popMatrix(); }
+ static void loadIdentity() { LLRender2D::getInstance()->loadIdentity(); }
+ static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::getInstance()->translate(x, y, z); }
+
+ static LLVector2& getScaleFactor() { return LLRender2D::getInstance()->mGLScaleFactor; }
+ static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::getInstance()->setScaleFactor(scale_factor); }
+ static void setLineWidth(F32 width) { LLRender2D::getInstance()->setLineWidth(width); }
+ static LLPointer getUIImageByID(const LLUUID& image_id, S32 priority = 0)
+ { return LLRender2D::getInstance()->getUIImageByID(image_id, priority); }
+ static LLPointer getUIImage(const std::string& name, S32 priority = 0)
+ { return LLRender2D::getInstance()->getUIImage(name, priority); }
//
// Data
//
- static settings_map_t sSettingGroups;
- static LLUIAudioCallback sAudioCallback;
- static LLUIAudioCallback sDeferredAudioCallback;
- static LLWindow* sWindow;
- static LLView* sRootView;
- static LLHelp* sHelpImpl;
+ settings_map_t mSettingGroups;
+ LLUIAudioCallback mAudioCallback;
+ LLUIAudioCallback mDeferredAudioCallback;
+ LLWindow* mWindow;
+ LLView* mRootView;
+ LLHelp* mHelpImpl;
private:
- static std::vector sXUIPaths;
- static LLFrameTimer sMouseIdleTimer;
- static add_popup_t sAddPopupFunc;
- static remove_popup_t sRemovePopupFunc;
- static clear_popups_t sClearPopupsFunc;
+ std::vector mXUIPaths;
+ LLFrameTimer mMouseIdleTimer;
+ add_popup_t mAddPopupFunc;
+ remove_popup_t mRemovePopupFunc;
+ clear_popups_t mClearPopupsFunc;
};
@@ -363,7 +366,7 @@ public:
LLUICachedControl(const std::string& name,
const T& default_value,
const std::string& comment = "Declared In Code")
- : LLCachedControl(LLUI::getControlControlGroup(name), name, default_value, comment)
+ : LLCachedControl(LLUI::getInstance()->getControlControlGroup(name), name, default_value, comment)
{}
};
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index cd9b52d164..63ed427ab5 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -176,7 +176,7 @@ void LLUrlEntryBase::callObservers(const std::string &id,
bool LLUrlEntryBase::isLinkDisabled() const
{
// this allows us to have a global setting to turn off text hyperlink highlighting/action
- bool globally_disabled = LLUI::sSettingGroups["config"]->getBOOL("DisableTextHyperlinkActions");
+ bool globally_disabled = LLUI::getInstance()->mSettingGroups["config"]->getBOOL("DisableTextHyperlinkActions");
return globally_disabled;
}
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 89ad8138d8..2a190365b3 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -816,7 +816,7 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask)
}
// This call differentiates this method from childrenHandleMouseEvent().
- LLUI::sWindow->setCursor(viewp->getHoverCursor());
+ LLUI::getInstance()->mWindow->setCursor(viewp->getHoverCursor());
if (viewp->handleHover(local_x, local_y, mask)
|| viewp->blockMouseEvent(local_x, local_y))
@@ -873,8 +873,8 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
// allow "scrubbing" over ui by showing next tooltip immediately
// if previous one was still visible
F32 timeout = LLToolTipMgr::instance().toolTipVisible()
- ? LLUI::sSettingGroups["config"]->getF32( "ToolTipFastDelay" )
- : LLUI::sSettingGroups["config"]->getF32( "ToolTipDelay" );
+ ? LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipFastDelay" )
+ : LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" );
LLToolTipMgr::instance().show(LLToolTip::Params()
.message(tooltip)
.sticky_rect(calcScreenRect())
@@ -1142,7 +1142,7 @@ void LLView::drawChildren()
{
if (!mChildList.empty())
{
- LLView* rootp = LLUI::getRootView();
+ LLView* rootp = LLUI::getInstance()->getRootView();
++sDepth;
for (child_list_reverse_iter_t child_iter = mChildList.rbegin(); child_iter != mChildList.rend();) // ++child_iter)
@@ -1158,7 +1158,7 @@ void LLView::drawChildren()
if (viewp->getVisible() && viewp->getRect().isValid())
{
LLRect screen_rect = viewp->calcScreenRect();
- if ( rootp->getLocalRect().overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
+ if ( rootp->getLocalRect().overlaps(screen_rect) && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
{
LLUI::pushMatrix();
{
@@ -1200,7 +1200,7 @@ void LLView::dirtyRect()
parent = parent->getParent();
}
- LLUI::dirtyRect(cur->calcScreenRect());
+ LLUI::getInstance()->dirtyRect(cur->calcScreenRect());
}
//Draw a box for debugging.
@@ -2223,9 +2223,9 @@ LLControlVariable *LLView::findControl(const std::string& name)
std::string control_group_key = name.substr(0, key_pos);
LLControlVariable* control;
// check if it's in the control group that name indicated
- if(LLUI::sSettingGroups[control_group_key])
+ if(LLUI::getInstance()->mSettingGroups[control_group_key])
{
- control = LLUI::sSettingGroups[control_group_key]->getControl(name);
+ control = LLUI::getInstance()->mSettingGroups[control_group_key]->getControl(name);
if (control)
{
return control;
@@ -2233,7 +2233,7 @@ LLControlVariable *LLView::findControl(const std::string& name)
}
}
- LLControlGroup& control_group = LLUI::getControlControlGroup(name);
+ LLControlGroup& control_group = LLUI::getInstance()->getControlControlGroup(name);
return control_group.getControl(name);
}
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 8494bb338a..e36ca7c8c6 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -498,7 +498,7 @@ public:
// return query for iterating over focus roots in tab order
static const LLViewQuery & getFocusRootsQuery();
- static LLWindow* getWindow(void) { return LLUI::sWindow; }
+ static LLWindow* getWindow(void) { return LLUI::getInstance()->mWindow; }
// Set up params after XML load before calling new(),
// usually to adjust layout.
diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp
index 8754cfebbb..cb000aef74 100644
--- a/indra/llui/llviewereventrecorder.cpp
+++ b/indra/llui/llviewereventrecorder.cpp
@@ -44,7 +44,7 @@ LLViewerEventRecorder::LLViewerEventRecorder() {
bool LLViewerEventRecorder::displayViewerEventRecorderMenuItems() {
- return LLUI::sSettingGroups["config"]->getBOOL("ShowEventRecorderMenuItems");
+ return LLUI::getInstance()->mSettingGroups["config"]->getBOOL("ShowEventRecorderMenuItems");
}
@@ -99,7 +99,7 @@ void LLViewerEventRecorder::setMouseGlobalCoords(S32 x, S32 y) {
void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 global_x, S32 global_y, std::string mName) {
- LLView * target_view = LLUI::resolvePath(LLUI::getRootView(), xui);
+ LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), xui);
if (! target_view) {
LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo - xui path on file at moment is NOT valid - so DO NOT record these local coords" << LL_ENDL;
return;
@@ -216,7 +216,7 @@ void LLViewerEventRecorder::playbackRecording() {
LLSD LeapCommand;
// ivita sets this on startup, it also sends commands to the viewer to make start, stop, and playback menu items visible in viewer
- LeapCommand =LLUI::sSettingGroups["config"]->getLLSD("LeapPlaybackEventsCommand");
+ LeapCommand =LLUI::getInstance()->mSettingGroups["config"]->getLLSD("LeapPlaybackEventsCommand");
LL_DEBUGS() << "[VITA] launching playback - leap command is: " << LLSDXMLStreamer(LeapCommand) << LL_ENDL;
LLLeap::create("", LeapCommand, false); // exception=false
diff --git a/indra/llui/llviewinject.h b/indra/llui/llviewinject.h
index 0de3d155c4..7f18ec6fbe 100644
--- a/indra/llui/llviewinject.h
+++ b/indra/llui/llviewinject.h
@@ -32,7 +32,7 @@ namespace llview
public:
/**
* Construct TargetEvent with the desired target LLView*. (See
- * LLUI::resolvePath() to obtain an LLView* given a string pathname.)
+ * LLUI::getInstance()->resolvePath() to obtain an LLView* given a string pathname.)
* This sets up for operator().
*/
TargetEvent(LLView* view);
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 18836e54b0..2076ce334e 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -1033,24 +1033,24 @@ bool LLDir::setCacheDir(const std::string &path)
}
}
-void LLDir::dumpCurrentDirectories()
+void LLDir::dumpCurrentDirectories(LLError::ELevel level)
{
- LL_DEBUGS("AppInit","Directories") << "Current Directories:" << LL_ENDL;
+ LL_VLOGS(level, "AppInit","Directories") << "Current Directories:" << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " CurPath: " << getCurPath() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " AppName: " << getAppName() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " ExecutableFilename: " << getExecutableFilename() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " ExecutableDir: " << getExecutableDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " WorkingDir: " << getWorkingDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " AppRODataDir: " << getAppRODataDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " OSUserDir: " << getOSUserDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " OSUserAppDir: " << getOSUserAppDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " LindenUserDir: " << getLindenUserDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " TempDir: " << getTempDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " CAFile: " << getCAFile() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " SkinBaseDir: " << getSkinBaseDir() << LL_ENDL;
- LL_DEBUGS("AppInit","Directories") << " SkinDir: " << getSkinDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " CurPath: " << getCurPath() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " AppName: " << getAppName() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " ExecutableFilename: " << getExecutableFilename() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " ExecutableDir: " << getExecutableDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " WorkingDir: " << getWorkingDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " AppRODataDir: " << getAppRODataDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " OSUserDir: " << getOSUserDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " OSUserAppDir: " << getOSUserAppDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " LindenUserDir: " << getLindenUserDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " TempDir: " << getTempDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " CAFile: " << getCAFile() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " SkinBaseDir: " << getSkinBaseDir() << LL_ENDL;
+ LL_VLOGS(level, "AppInit", "Directories") << " SkinDir: " << getSkinDir() << LL_ENDL;
}
void LLDir::append(std::string& destpath, const std::string& name) const
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index e233413a7f..38e204ef04 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -194,7 +194,7 @@ class LLDir
virtual bool setCacheDir(const std::string &path);
virtual void updatePerAccountChatLogsDir();
- virtual void dumpCurrentDirectories();
+ virtual void dumpCurrentDirectories(LLError::ELevel level = LLError::LEVEL_DEBUG);
// Utility routine
std::string buildSLOSCacheDir() const;
diff --git a/indra/llwindow/llappdelegate-objc.h b/indra/llwindow/llappdelegate-objc.h
index 6daf1ac55b..0b38647b4a 100644
--- a/indra/llwindow/llappdelegate-objc.h
+++ b/indra/llwindow/llappdelegate-objc.h
@@ -46,3 +46,6 @@
- (void) languageUpdated;
- (bool) romanScript;
@end
+
+@interface LLApplication : NSApplication
+@end
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index 33eed7227a..1990499459 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -509,15 +509,6 @@ attributedStringInfo getSegments(NSAttributedString *str)
{
[[self inputContext] handleEvent:theEvent];
}
-
- // OS X intentionally does not send us key-up information on cmd-key combinations.
- // This behaviour is not a bug, and only applies to cmd-combinations (no others).
- // Since SL assumes we receive those, we fake it here.
- if (mModifiers & NSCommandKeyMask && !mHasMarkedText)
- {
- eventData.mKeyEvent = NativeKeyEventData::KEYUP;
- callKeyUp(&eventData, [theEvent keyCode], mModifiers);
- }
}
- (void)flagsChanged:(NSEvent *)theEvent
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 46fd0f3fd1..694e89ab99 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1377,8 +1377,12 @@ if (DARWIN)
PROPERTIES
COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}"
# BugsplatMac is a module, imported with @import. That language feature
- # demands these switches.
- COMPILE_FLAGS "-fmodules -fcxx-modules"
+ # demands these -f switches.
+ # Xcode 10.2 requires that Objective-C++ headers declare nullability of
+ # pointer variables. As of 2019-06-26, the BugsplatMac version we're using
+ # does not yet do so in its own header files. This -W flag prevents fatal
+ # warnings.
+ COMPILE_FLAGS "-fmodules -fcxx-modules -Wno-nullability-completeness"
)
find_library(AGL_LIBRARY AGL)
@@ -2117,7 +2121,7 @@ if (DARWIN)
set(MACOSX_BUNDLE_BUNDLE_VERSION "${VIEWER_SHORT_VERSION}${VIEWER_MACOSX_PHASE}${VIEWER_REVISION}")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © Linden Research, Inc. 2018")
set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "SecondLife.nib")
- set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "NSApplication")
+ set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "LLApplication")
# https://blog.kitware.com/upcoming-in-cmake-2-8-12-osx-rpath-support/
set(CMAKE_MACOSX_RPATH 1)
diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt
index 91e4a9f262..b98d1d3fa7 100644
--- a/indra/newview/VIEWER_VERSION.txt
+++ b/indra/newview/VIEWER_VERSION.txt
@@ -1 +1 @@
-6.3.2
+6.3.5
diff --git a/indra/newview/installers/windows/lang_en-us.nsi b/indra/newview/installers/windows/lang_en-us.nsi
index fd4d340816..ea680f08e4 100644
Binary files a/indra/newview/installers/windows/lang_en-us.nsi and b/indra/newview/installers/windows/lang_en-us.nsi differ
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 8b2d591da5..31b8b90518 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3710,6 +3710,23 @@ BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global )
return TRUE;
}
+bool LLAgent::isInHomeRegion()
+{
+ if(!mHaveHomePosition)
+ {
+ return false;
+ }
+ if (!getRegion())
+ {
+ return false;
+ }
+ if (getRegion()->getHandle() != mHomeRegionHandle)
+ {
+ return false;
+ }
+ return true;
+}
+
void LLAgent::clearVisualParams(void *data)
{
if (isAgentAvatarValid())
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index ea6f68c482..5ba1083d8e 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -233,6 +233,8 @@ public:
void setStartPosition(U32 location_id); // Marks current location as start, sends information to servers
void setHomePosRegion(const U64& region_handle, const LLVector3& pos_region);
BOOL getHomePosGlobal(LLVector3d* pos_global);
+ bool isInHomeRegion();
+
private:
void setStartPositionSuccess(const LLSD &result);
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 92a3026096..0b4b848014 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1140,7 +1140,7 @@ void LLAgentCamera::updateCamera()
mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation();
}
- if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getActiveFollowCamParams())
+ if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getInstance()->getActiveFollowCamParams())
{
mAllowChangeToFollow = FALSE;
mFocusOnAvatar = TRUE;
@@ -1240,7 +1240,7 @@ void LLAgentCamera::updateCamera()
// *TODO: use combined rotation of frameagent and sit object
LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
- LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams();
+ LLFollowCamParams* current_cam = LLFollowCamMgr::getInstance()->getActiveFollowCamParams();
if (current_cam)
{
mFollowCam.copyParams(*current_cam);
@@ -2046,7 +2046,7 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate)
// Menus should not remain open on switching to mouselook...
LLMenuGL::sMenuContainer->hideMenus();
- LLUI::clearPopups();
+ LLUI::getInstance()->clearPopups();
// unpause avatar animation
gAgent.unpauseAnimation();
@@ -2100,7 +2100,7 @@ void LLAgentCamera::changeCameraToDefault()
return;
}
- if (LLFollowCamMgr::getActiveFollowCamParams())
+ if (LLFollowCamMgr::getInstance()->getActiveFollowCamParams())
{
changeCameraToFollow();
}
diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm
index 1d55537427..47fde299c7 100644
--- a/indra/newview/llappdelegate-objc.mm
+++ b/indra/newview/llappdelegate-objc.mm
@@ -342,3 +342,16 @@ struct AttachmentInfo
#endif // LL_BUGSPLAT
@end
+
+@implementation LLApplication
+
+- (void)sendEvent:(NSEvent *)event
+{
+ [super sendEvent:event];
+ if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask))
+ {
+ [[self keyWindow] sendEvent:event];
+ }
+}
+
+@end
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 22bcbad7da..7325ec598a 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -148,7 +148,7 @@ public:
{
// support secondlife:///app/appearance/show, but for now we just
// make all secondlife:///app/appearance SLapps behave this way
- if (!LLUI::sSettingGroups["config"]->getBOOL("EnableAppearance"))
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAppearance"))
{
LLNotificationsUtil::add("NoAppearance", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
return true;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index be5611899a..ff897ef962 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -100,7 +100,6 @@
#include "llscenemonitor.h"
#include "llavatarrenderinfoaccountant.h"
#include "lllocalbitmaps.h"
-#include "llskinningutil.h"
// Linden library includes
#include "llavatarnamecache.h"
@@ -774,7 +773,7 @@ bool LLAppViewer::init()
// initialize LLWearableType translation bridge.
// Memory will be cleaned up in ::cleanupClass()
- LLWearableType::initClass(new LLUITranslationBridge());
+ LLWearableType::initParamSingleton(new LLUITranslationBridge());
// initialize SSE options
LLVector4a::initClass();
@@ -798,9 +797,6 @@ bool LLAppViewer::init()
LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
- // initialize skinning util
- LLSkinningUtil::initClass();
-
//set the max heap size.
initMaxHeapSize() ;
LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize"));
@@ -848,11 +844,10 @@ bool LLAppViewer::init()
settings_map["floater"] = &gSavedSettings; // *TODO: New settings file
settings_map["account"] = &gSavedPerAccountSettings;
- LLUI::initClass(settings_map,
+ LLUI::initParamSingleton(settings_map,
LLUIImageList::getInstance(),
ui_audio_callback,
- deferred_ui_audio_callback,
- &LLUI::getScaleFactor());
+ deferred_ui_audio_callback);
LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ;
// NOW LLUI::getLanguage() should work. gDirUtilp must know the language
@@ -896,8 +891,6 @@ bool LLAppViewer::init()
// LLKeyboard relies on LLUI to know what some accelerator keys are called.
LLKeyboard::setStringTranslatorFunc( LLTrans::getKeyboardString );
- LLWeb::initClass(); // do this after LLUI
-
// Provide the text fields with callbacks for opening Urls
LLUrlAction::setOpenURLCallback(boost::bind(&LLWeb::loadURL, _1, LLStringUtil::null, LLStringUtil::null));
LLUrlAction::setOpenURLInternalCallback(boost::bind(&LLWeb::loadURLInternal, _1, LLStringUtil::null, LLStringUtil::null, false));
@@ -905,7 +898,7 @@ bool LLAppViewer::init()
LLUrlAction::setExecuteSLURLCallback(&LLURLDispatcher::dispatchFromTextEditor);
// Let code in llui access the viewer help floater
- LLUI::sHelpImpl = LLViewerHelp::getInstance();
+ LLUI::getInstance()->mHelpImpl = LLViewerHelp::getInstance();
LL_INFOS("InitInfo") << "UI initialization is done." << LL_ENDL ;
@@ -1211,9 +1204,6 @@ bool LLAppViewer::init()
<< LL_ENDL;
}
- LLViewerMedia::initClass();
- LL_INFOS("InitInfo") << "Viewer media initialized." << LL_ENDL ;
-
LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
//EXT-7013 - On windows for some locale (Japanese) standard
@@ -1253,7 +1243,7 @@ bool LLAppViewer::init()
// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
LLVoiceChannel::initClass();
- LLVoiceClient::getInstance()->init(gServicePump);
+ LLVoiceClient::initParamSingleton(gServicePump);
LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLFloaterIMContainer::onCurrentChannelChanged, _1), true);
joystick = LLViewerJoystick::getInstance();
@@ -1750,8 +1740,6 @@ bool LLAppViewer::cleanup()
gTransferManager.cleanup();
#endif
- SUBSYSTEM_CLEANUP(LLLocalBitmapMgr);
-
// Note: this is where gWorldMap used to be deleted.
// Note: this is where gHUDManager used to be deleted.
@@ -1894,12 +1882,9 @@ bool LLAppViewer::cleanup()
//end_messaging_system();
- SUBSYSTEM_CLEANUP(LLFollowCamMgr);
- //SUBSYSTEM_CLEANUP(LLVolumeMgr);
LLPrimitive::cleanupVolumeManager();
SUBSYSTEM_CLEANUP(LLWorldMapView);
SUBSYSTEM_CLEANUP(LLFolderViewItem);
- SUBSYSTEM_CLEANUP(LLUI);
//
// Shut down the VFS's AFTER the decode manager cleans up (since it cleans up vfiles).
@@ -2049,13 +2034,10 @@ bool LLAppViewer::cleanup()
//Note:
//SUBSYSTEM_CLEANUP(LLViewerMedia) has to be put before gTextureList.shutdown()
//because some new image might be generated during cleaning up media. --bao
- SUBSYSTEM_CLEANUP(LLViewerMedia);
- SUBSYSTEM_CLEANUP(LLViewerParcelMedia);
gTextureList.shutdown(); // shutdown again in case a callback added something
LLUIImageList::getInstance()->cleanUp();
// This should eventually be done in LLAppViewer
- SUBSYSTEM_CLEANUP(LLImage);
SUBSYSTEM_CLEANUP(LLVFSThread);
SUBSYSTEM_CLEANUP(LLLFSThread);
@@ -2103,8 +2085,6 @@ bool LLAppViewer::cleanup()
SUBSYSTEM_CLEANUP(LLProxy);
LLCore::LLHttp::cleanup();
- SUBSYSTEM_CLEANUP(LLWearableType);
-
LLMainLoopRepeater::instance().stop();
ll_close_fail_log();
@@ -2163,7 +2143,7 @@ bool LLAppViewer::initThreads()
{
static const bool enable_threads = true;
- LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
+ LLImage::initParamSingleton(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
LLVFSThread::initClass(enable_threads && false);
LLLFSThread::initClass(enable_threads && false);
@@ -2882,6 +2862,7 @@ void LLAppViewer::initStrings()
if (strings_path_full.empty() || !LLFile::isfile(strings_path_full))
{
// initial check to make sure files are there failed
+ gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);
LL_ERRS() << "Viewer failed to find localization and UI files. Please reinstall viewer from https://secondlife.com/support/downloads/ and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
}
LLTransUtil::parseStrings(strings_file, default_trans_args);
@@ -3046,7 +3027,7 @@ bool LLAppViewer::initWindow()
gViewerWindow->getWindow()->maximize();
}
- LLUI::sWindow = gViewerWindow->getWindow();
+ LLUI::getInstance()->mWindow = gViewerWindow->getWindow();
// Show watch cursor
gViewerWindow->setCursor(UI_CURSOR_WAIT);
@@ -4145,7 +4126,7 @@ bool LLAppViewer::initCache()
mPurgeCache = false;
BOOL read_only = mSecondInstance ? TRUE : FALSE;
LLAppViewer::getTextureCache()->setReadOnly(read_only) ;
- LLVOCache::getInstance()->setReadOnly(read_only);
+ LLVOCache::initParamSingleton(read_only);
bool texture_cache_mismatch = false;
if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion())
@@ -4217,7 +4198,8 @@ bool LLAppViewer::initCache()
S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
texture_cache_size -= extra;
- LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion()) ;
+
+ LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion());
LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS"));
@@ -4504,10 +4486,37 @@ void LLAppViewer::saveFinalSnapshot()
std::string snap_filename = gDirUtilp->getLindenUserDir();
snap_filename += gDirUtilp->getDirDelimiter();
- snap_filename += SCREEN_LAST_FILENAME;
+ snap_filename += LLStartUp::getScreenLastFilename();
// use full pixel dimensions of viewer window (not post-scale dimensions)
- gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, TRUE);
+ gViewerWindow->saveSnapshot(snap_filename,
+ gViewerWindow->getWindowWidthRaw(),
+ gViewerWindow->getWindowHeightRaw(),
+ FALSE,
+ TRUE,
+ LLSnapshotModel::SNAPSHOT_TYPE_COLOR,
+ LLSnapshotModel::SNAPSHOT_FORMAT_PNG);
mSavedFinalSnapshot = TRUE;
+
+ if (gAgent.isInHomeRegion())
+ {
+ LLVector3d home;
+ if (gAgent.getHomePosGlobal(&home) && dist_vec(home, gAgent.getPositionGlobal()) < 10)
+ {
+ // We are at home position or close to it, see if we need to create home screenshot
+ // Notes:
+ // 1. It might be beneficial to also replace home if file is too old
+ // 2. This is far from best way/place to update screenshot since location might be not fully loaded,
+ // but we don't have many options
+ std::string snap_home = gDirUtilp->getLindenUserDir();
+ snap_home += gDirUtilp->getDirDelimiter();
+ snap_home += LLStartUp::getScreenHomeFilename();
+ if (!gDirUtilp->fileExists(snap_home))
+ {
+ // We are at home position yet no home image exist, fix it
+ LLFile::copy(snap_filename, snap_home);
+ }
+ }
+ }
}
}
@@ -4520,7 +4529,7 @@ void LLAppViewer::loadNameCache()
llifstream name_cache_stream(filename.c_str());
if(name_cache_stream.is_open())
{
- if ( ! LLAvatarNameCache::importFile(name_cache_stream))
+ if ( ! LLAvatarNameCache::getInstance()->importFile(name_cache_stream))
{
LL_WARNS("AppInit") << "removing invalid '" << filename << "'" << LL_ENDL;
name_cache_stream.close();
@@ -4547,7 +4556,7 @@ void LLAppViewer::saveNameCache()
llofstream name_cache_stream(filename.c_str());
if(name_cache_stream.is_open())
{
- LLAvatarNameCache::exportFile(name_cache_stream);
+ LLAvatarNameCache::getInstance()->exportFile(name_cache_stream);
}
// real names cache
@@ -5154,7 +5163,8 @@ void LLAppViewer::idleNameCache()
// granted to neighbor regions before the main agent gets there. Can't
// do it in the move-into-region code because cap not guaranteed to be
// granted yet, for example on teleport.
- bool had_capability = LLAvatarNameCache::hasNameLookupURL();
+ LLAvatarNameCache *name_cache = LLAvatarNameCache::getInstance();
+ bool had_capability = LLAvatarNameCache::getInstance()->hasNameLookupURL();
std::string name_lookup_url;
name_lookup_url.reserve(128); // avoid a memory allocation below
name_lookup_url = region->getCapability("GetDisplayNames");
@@ -5171,12 +5181,12 @@ void LLAppViewer::idleNameCache()
{
name_lookup_url += '/';
}
- LLAvatarNameCache::setNameLookupURL(name_lookup_url);
+ name_cache->setNameLookupURL(name_lookup_url);
}
else
{
// Display names not available on this region
- LLAvatarNameCache::setNameLookupURL( std::string() );
+ name_cache->setNameLookupURL( std::string() );
}
// Error recovery - did we change state?
@@ -5186,7 +5196,7 @@ void LLAppViewer::idleNameCache()
LLVOAvatar::invalidateNameTags();
}
- LLAvatarNameCache::idle();
+ name_cache->idle();
}
//
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index fff2653c98..d208e135bb 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -312,12 +312,12 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
#if DEBUGGING_SEH_FILTER
# define WINMAIN DebuggingWinMain
#else
-# define WINMAIN WinMain
+# define WINMAIN wWinMain
#endif
int APIENTRY WINMAIN(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
+ PWSTR pCmdLine,
int nCmdShow)
{
const S32 MAX_HEAPS = 255;
@@ -356,8 +356,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
// *FIX: global
gIconResource = MAKEINTRESOURCE(IDI_LL_ICON);
- LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(lpCmdLine);
-
+ LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(ll_convert_wide_to_string(pCmdLine).c_str());
+
gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);
viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
@@ -469,9 +469,9 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
// in a method that uses object destructors. Go figure.
// This winmain just calls the real winmain inside __try.
// The __except calls our exception filter function. For debugging purposes.
-int APIENTRY WinMain(HINSTANCE hInstance,
+int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
+ PWSTR lpCmdLine,
int nCmdShow)
{
__try
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 513f25e301..b0715a3afd 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -154,7 +154,7 @@ LLAvatarList::LLAvatarList(const Params& p)
mLITUpdateTimer->start();
}
- LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this));
+ LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this));
}
diff --git a/indra/newview/llbrowsernotification.cpp b/indra/newview/llbrowsernotification.cpp
index 19747757db..0460bff1b4 100644
--- a/indra/newview/llbrowsernotification.cpp
+++ b/indra/newview/llbrowsernotification.cpp
@@ -50,7 +50,7 @@ bool LLBrowserNotification::processNotification(const LLNotificationPtr& notific
}
else if (LLViewerMediaFocus::instance().getControlsMediaID() == media_id)
{
- LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(media_id);
+ LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(media_id);
if (impl)
{
impl->showNotification(notification);
diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp
index d6240838b6..0b7b9cbbc7 100644
--- a/indra/newview/llchannelmanager.cpp
+++ b/indra/newview/llchannelmanager.cpp
@@ -58,15 +58,22 @@ LLChannelManager::LLChannelManager()
//--------------------------------------------------------------------------
LLChannelManager::~LLChannelManager()
{
- for(std::vector::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it)
- {
- LLScreenChannelBase* channel = it->channel.get();
- if (!channel) continue;
+}
- delete channel;
- }
+//--------------------------------------------------------------------------
+void LLChannelManager::cleanupSingleton()
+{
+ // Note: LLScreenChannelBase is a LLUICtrl and depends onto other singletions
+ // not captured by singleton-dependency, so cleanup it here instead of destructor
+ for (std::vector::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it)
+ {
+ LLScreenChannelBase* channel = it->channel.get();
+ if (!channel) continue;
- mChannelList.clear();
+ delete channel;
+ }
+
+ mChannelList.clear();
}
//--------------------------------------------------------------------------
diff --git a/indra/newview/llchannelmanager.h b/indra/newview/llchannelmanager.h
index 8b9d0dda8b..8abe350196 100644
--- a/indra/newview/llchannelmanager.h
+++ b/indra/newview/llchannelmanager.h
@@ -46,6 +46,7 @@ class LLChannelManager : public LLSingleton
LLSINGLETON(LLChannelManager);
virtual ~LLChannelManager();
+ void cleanupSingleton();
public:
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index b47e0930a3..1caefd58ab 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -502,13 +502,14 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel
{
mAttachments->sort();
mAttachments->notify(REARRANGE); //notifying the parent about the list's size change (cause items were added with rearrange=false)
- setAttachmentsTitle();
}
else
{
mAttachments->setNoItemsCommentText(LLTrans::getString("no_attachments"));
}
+ setAttachmentsTitle();
+
if (mBodyParts->size())
{
mBodyParts->sort();
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index d24dac385f..92eeebd705 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -327,10 +327,13 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj)
{
LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR);
- cav->mRootVolp = obj;
+ if (cav)
+ {
+ cav->mRootVolp = obj;
- // Sync up position/rotation with object
- cav->matchVolumeTransform();
+ // Sync up position/rotation with object
+ cav->matchVolumeTransform();
+ }
return cav;
}
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 9ccf9b98f7..f7c61efce0 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -189,16 +189,6 @@ LLConversationLog::LLConversationLog() :
mAvatarNameCacheConnection(),
mLoggingEnabled(false)
{
- if(gSavedPerAccountSettings.controlExists("KeepConversationLogTranscripts"))
- {
- LLControlVariable * keep_log_ctrlp = gSavedPerAccountSettings.getControl("KeepConversationLogTranscripts").get();
- S32 log_mode = keep_log_ctrlp->getValue();
- keep_log_ctrlp->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2));
- if (log_mode > 0)
- {
- enableLogging(log_mode);
- }
- }
}
void LLConversationLog::enableLogging(S32 log_mode)
@@ -443,6 +433,20 @@ bool LLConversationLog::moveLog(const std::string &originDirectory, const std::s
return true;
}
+void LLConversationLog::initLoggingState()
+{
+ if (gSavedPerAccountSettings.controlExists("KeepConversationLogTranscripts"))
+ {
+ LLControlVariable * keep_log_ctrlp = gSavedPerAccountSettings.getControl("KeepConversationLogTranscripts").get();
+ S32 log_mode = keep_log_ctrlp->getValue();
+ keep_log_ctrlp->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2));
+ if (log_mode > 0)
+ {
+ enableLogging(log_mode);
+ }
+ }
+}
+
std::string LLConversationLog::getFileName()
{
std::string filename = "conversation";
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index 035cbcb945..46e46a3278 100644
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -111,7 +111,6 @@ class LLConversationLog : public LLSingleton, LLIMSessionObse
{
LLSINGLETON(LLConversationLog);
public:
-
void removeConversation(const LLConversation& conversation);
/**
@@ -148,6 +147,12 @@ public:
bool getIsLoggingEnabled() { return mLoggingEnabled; }
bool isLogEmpty() { return mConversations.empty(); }
+ /**
+ * inits connection to per account settings,
+ * loads saved file and inits enabled state
+ */
+ void initLoggingState();
+
/**
* constructs file name in which conversations log will be saved
* file name is conversation.log
diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index 7d2712eec7..cb5f9c8a2c 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -48,7 +48,6 @@ const char * LLDoNotDisturbNotificationStorage::offerName = "UserGiveItem";
LLDoNotDisturbNotificationStorageTimer::LLDoNotDisturbNotificationStorageTimer() : LLEventTimer(DND_TIMER)
{
-
}
LLDoNotDisturbNotificationStorageTimer::~LLDoNotDisturbNotificationStorageTimer()
@@ -74,6 +73,7 @@ LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
{
nameToPayloadParameterMap[toastName] = "SESSION_ID";
nameToPayloadParameterMap[offerName] = "object_id";
+ initialize();
}
LLDoNotDisturbNotificationStorage::~LLDoNotDisturbNotificationStorage()
diff --git a/indra/newview/lldonotdisturbnotificationstorage.h b/indra/newview/lldonotdisturbnotificationstorage.h
index e6cb7835e3..c6f0bf1ab5 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.h
+++ b/indra/newview/lldonotdisturbnotificationstorage.h
@@ -45,7 +45,7 @@ public:
BOOL tick();
};
-class LLDoNotDisturbNotificationStorage : public LLSingleton, public LLNotificationStorage
+class LLDoNotDisturbNotificationStorage : public LLParamSingleton, public LLNotificationStorage
{
LLSINGLETON(LLDoNotDisturbNotificationStorage);
~LLDoNotDisturbNotificationStorage();
@@ -55,7 +55,6 @@ public:
static const char * toastName;
static const char * offerName;
- void initialize();
bool getDirty();
void resetDirty();
void saveNotifications();
@@ -66,6 +65,8 @@ public:
protected:
private:
+ void initialize();
+
bool mDirty;
LLDoNotDisturbNotificationStorageTimer mTimer;
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index d657f04457..3395777aab 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -97,7 +97,7 @@ public:
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) { mEditor.onCommit(); return TRUE; }
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask)
{
- LLUI::getWindow()->setCursor(UI_CURSOR_HAND);
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
return TRUE;
}
private:
diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp
index 776bbf78c2..b66eb754a4 100644
--- a/indra/newview/llexternaleditor.cpp
+++ b/indra/newview/llexternaleditor.cpp
@@ -184,9 +184,9 @@ std::string LLExternalEditor::findCommand(
cmd = override;
LL_INFOS() << "Using override" << LL_ENDL;
}
- else if (!LLUI::sSettingGroups["config"]->getString(sSetting).empty())
+ else if (!LLUI::getInstance()->mSettingGroups["config"]->getString(sSetting).empty())
{
- cmd = LLUI::sSettingGroups["config"]->getString(sSetting);
+ cmd = LLUI::getInstance()->mSettingGroups["config"]->getString(sSetting);
LL_INFOS() << "Using setting" << LL_ENDL;
}
else // otherwise use the path specified by the environment variable
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 912bde9986..1587903a15 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -228,12 +228,6 @@ void LLFace::destroy()
mVObjp = NULL;
}
-
-// static
-void LLFace::initClass()
-{
-}
-
void LLFace::setWorldMatrix(const LLMatrix4 &mat)
{
LL_ERRS() << "Faces on this drawable are not independently modifiable\n" << LL_ENDL;
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index a08e730e54..77861f7d2f 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -80,8 +80,6 @@ public:
PARTICLE = 0x0080,
};
- static void initClass();
-
static void cacheFaceInVRAM(const LLVolumeFace& vf);
public:
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 8d07035b97..aa9cba0c18 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -522,7 +522,7 @@ void LLFeatureManager::cleanupFeatureTables()
mMaskList.clear();
}
-void LLFeatureManager::init()
+void LLFeatureManager::initSingleton()
{
// load the tables
loadFeatureTables();
diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h
index f77861a1a7..42a226cd18 100644
--- a/indra/newview/llfeaturemanager.h
+++ b/indra/newview/llfeaturemanager.h
@@ -100,9 +100,10 @@ class LLFeatureManager : public LLFeatureList, public LLSingleton LLFirstUse::sConfigVariables;
-
-// static
-void LLFirstUse::addConfigVariable(const std::string& var)
-{
- sConfigVariables.insert(var);
-}
-
-// static
-void LLFirstUse::disableFirstUse()
-{
- // Set all first-use warnings to disabled
- for (std::set::iterator iter = sConfigVariables.begin();
- iter != sConfigVariables.end(); ++iter)
- {
- gWarningSettings.setBOOL(*iter, FALSE);
- }
-}
-
-// static
-void LLFirstUse::resetFirstUse()
-{
- // Set all first-use warnings to disabled
- for (std::set::iterator iter = sConfigVariables.begin();
- iter != sConfigVariables.end(); ++iter)
- {
- gWarningSettings.setBOOL(*iter, TRUE);
- }
-}
-
// static
void LLFirstUse::otherAvatarChatFirst(bool enable)
{
diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h
index 4c8c9d3cde..80b83580b3 100644
--- a/indra/newview/llfirstuse.h
+++ b/indra/newview/llfirstuse.h
@@ -78,14 +78,6 @@ class LLNotification;
class LLFirstUse
{
public:
-
- // Add a config variable to be reset on resetFirstUse()
- static void addConfigVariable(const std::string& var);
-
- // Sets all controls back to show the dialogs.
- static void disableFirstUse();
- static void resetFirstUse();
-
static void otherAvatarChatFirst(bool enable = true);
static void speak(bool enable = true);
static void sit(bool enable = true);
@@ -100,7 +92,6 @@ public:
protected:
static void firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args = LLSD(), LLSD payload = LLSD());
- static std::set sConfigVariables;
static void init();
static bool processNotification(const LLSD& notify);
diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp
index 080d0ed8ea..ee7e6f8562 100644
--- a/indra/newview/llfloaterbvhpreview.cpp
+++ b/indra/newview/llfloaterbvhpreview.cpp
@@ -527,7 +527,7 @@ BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask)
mAnimPreview->requestUpdate();
- LLUI::setMousePositionLocal(this, mLastMouseX, mLastMouseY);
+ LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
}
if (!mPreviewRect.pointInRect(x, y) || !mAnimPreview)
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index 20d650fa37..f3406d93bb 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -351,7 +351,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val)
mCurrMode(CAMERA_CTRL_MODE_PAN),
mPrevMode(CAMERA_CTRL_MODE_PAN)
{
- LLHints::registerHintTarget("view_popup", getHandle());
+ LLHints::getInstance()->registerHintTarget("view_popup", getHandle());
mCommitCallbackRegistrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
}
diff --git a/indra/newview/llfloaterchatvoicevolume.cpp b/indra/newview/llfloaterchatvoicevolume.cpp
index 3c76a3a43c..45aea00a49 100644
--- a/indra/newview/llfloaterchatvoicevolume.cpp
+++ b/indra/newview/llfloaterchatvoicevolume.cpp
@@ -35,7 +35,7 @@ LLFloaterChatVoiceVolume::LLFloaterChatVoiceVolume(const LLSD& key)
void LLFloaterChatVoiceVolume::onOpen(const LLSD& key)
{
LLInspect::onOpen(key);
- LLUI::positionViewNearMouse(this);
+ LLUI::getInstance()->positionViewNearMouse(this);
}
LLFloaterChatVoiceVolume::~LLFloaterChatVoiceVolume()
diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp
index 66198b3bf6..55561fa128 100644
--- a/indra/newview/llfloaterconversationpreview.cpp
+++ b/indra/newview/llfloaterconversationpreview.cpp
@@ -111,7 +111,7 @@ void LLFloaterConversationPreview::setPages(std::list* messages, const std
getChild("page_num_label")->setValue(total_page_num);
mShowHistory = true;
}
- LLLoadHistoryThread* loadThread = LLLogChat::getLoadHistoryThread(mSessionID);
+ LLLoadHistoryThread* loadThread = LLLogChat::getInstance()->getLoadHistoryThread(mSessionID);
if (loadThread)
{
loadThread->removeLoadEndSignal(boost::bind(&LLFloaterConversationPreview::setPages, this, _1, _2));
@@ -135,7 +135,7 @@ void LLFloaterConversationPreview::onOpen(const LLSD& key)
return;
}
mOpened = true;
- if (!LLLogChat::historyThreadsFinished(mSessionID))
+ if (!LLLogChat::getInstance()->historyThreadsFinished(mSessionID))
{
LLNotificationsUtil::add("ChatHistoryIsBusyAlert");
mHistoryThreadsBusy = true;
@@ -165,15 +165,16 @@ void LLFloaterConversationPreview::onOpen(const LLSD& key)
// LLDeleteHistoryThread is started in destructor
std::list* messages = new std::list();
- LLLogChat::cleanupHistoryThreads();
+ LLLogChat *log_chat_inst = LLLogChat::getInstance();
+ log_chat_inst->cleanupHistoryThreads();
LLLoadHistoryThread* loadThread = new LLLoadHistoryThread(mChatHistoryFileName, messages, load_params);
loadThread->setLoadEndSignal(boost::bind(&LLFloaterConversationPreview::setPages, this, _1, _2));
loadThread->start();
- LLLogChat::addLoadHistoryThread(mSessionID, loadThread);
+ log_chat_inst->addLoadHistoryThread(mSessionID, loadThread);
LLDeleteHistoryThread* deleteThread = new LLDeleteHistoryThread(messages, loadThread);
- LLLogChat::addDeleteHistoryThread(mSessionID, deleteThread);
+ log_chat_inst->addDeleteHistoryThread(mSessionID, deleteThread);
mShowHistory = true;
}
@@ -183,7 +184,7 @@ void LLFloaterConversationPreview::onClose(bool app_quitting)
mOpened = false;
if (!mHistoryThreadsBusy)
{
- LLDeleteHistoryThread* deleteThread = LLLogChat::getDeleteHistoryThread(mSessionID);
+ LLDeleteHistoryThread* deleteThread = LLLogChat::getInstance()->getDeleteHistoryThread(mSessionID);
if (deleteThread)
{
deleteThread->start();
@@ -221,7 +222,7 @@ void LLFloaterConversationPreview::showHistory()
else
{
std::string legacy_name = gCacheName->buildLegacyName(from);
- from_id = LLAvatarNameCache::findIdByName(legacy_name);
+ from_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
}
LLChat chat;
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index 3c428a70f3..d4b0fa85ab 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -503,7 +503,7 @@ BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask)
mSculptedPreview->refresh();
}
- LLUI::setMousePositionLocal(this, mLastMouseX, mLastMouseY);
+ LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
}
if (!mPreviewRect.pointInRect(x, y) || !mAvatarPreview || !mSculptedPreview)
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 30d05ae287..21420b122b 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -237,7 +237,7 @@ BOOL LLFloaterIMContainer::postBuild()
collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed"));
collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed"), false);
- LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
+ LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
mMicroChangedSignal = LLVoiceClient::getInstance()->MicroChangedCallback(boost::bind(&LLFloaterIMContainer::updateSpeakBtnState, this));
if (! mMessagesPane->isCollapsed() && ! mConversationsPane->isCollapsed())
@@ -267,7 +267,7 @@ BOOL LLFloaterIMContainer::postBuild()
// We'll take care of view updates on idle
gIdleCallbacks.addFunction(idle, this);
// When display name option change, we need to reload all participant names
- LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLFloaterIMContainer::processParticipantsStyleUpdate, this));
+ LLAvatarNameCache::getInstance()->addUseDisplayNamesCallback(boost::bind(&LLFloaterIMContainer::processParticipantsStyleUpdate, this));
mParticipantRefreshTimer.setTimerExpirySec(0);
mParticipantRefreshTimer.start();
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index f9efd13608..a6531ed7e1 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -228,7 +228,7 @@ void LLFloaterIMNearbyChat::loadHistory()
else
{
std::string legacy_name = gCacheName->buildLegacyName(from);
- from_id = LLAvatarNameCache::findIdByName(legacy_name);
+ from_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
}
LLChat chat;
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 9c2ddfb68d..e1665dc255 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -896,7 +896,7 @@ BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask)
mModelPreview->refresh();
- LLUI::setMousePositionLocal(this, mLastMouseX, mLastMouseY);
+ LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY);
}
if (!mPreviewRect.pointInRect(x, y) || !mModelPreview)
diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp
index fa2de21a8f..6f9a6c9066 100644
--- a/indra/newview/llfloatermyscripts.cpp
+++ b/indra/newview/llfloatermyscripts.cpp
@@ -41,6 +41,7 @@ const S32 SIZE_OF_ONE_KB = 1024;
LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed)
: LLFloater(seed),
mGotAttachmentMemoryUsed(false),
+ mAttachmentDetailsRequested(false),
mAttachmentMemoryMax(0),
mAttachmentMemoryUsed(0),
mGotAttachmentURLsUsed(false),
@@ -55,12 +56,24 @@ BOOL LLFloaterMyScripts::postBuild()
std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
getChild("loading_text")->setValue(LLSD(msg_waiting));
- return requestAttachmentDetails();
+ mAttachmentDetailsRequested = requestAttachmentDetails();
+ return TRUE;
}
-BOOL LLFloaterMyScripts::requestAttachmentDetails()
+// virtual
+void LLFloaterMyScripts::onOpen(const LLSD& key)
{
- if (!gAgent.getRegion()) return FALSE;
+ if (!mAttachmentDetailsRequested)
+ {
+ mAttachmentDetailsRequested = requestAttachmentDetails();
+ }
+
+ LLFloater::onOpen(key);
+}
+
+bool LLFloaterMyScripts::requestAttachmentDetails()
+{
+ if (!gAgent.getRegion()) return false;
LLSD body;
std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
@@ -68,11 +81,11 @@ BOOL LLFloaterMyScripts::requestAttachmentDetails()
{
LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro",
boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url));
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
@@ -284,7 +297,7 @@ void LLFloaterMyScripts::onClickRefresh(void* userdata)
btn->setEnabled(false);
}
instance->clearList();
- instance->requestAttachmentDetails();
+ instance->mAttachmentDetailsRequested = instance->requestAttachmentDetails();
}
else
{
diff --git a/indra/newview/llfloatermyscripts.h b/indra/newview/llfloatermyscripts.h
index fe33ab90ae..3c053a0223 100644
--- a/indra/newview/llfloatermyscripts.h
+++ b/indra/newview/llfloatermyscripts.h
@@ -36,15 +36,17 @@ public:
LLFloaterMyScripts(const LLSD& seed);
BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
void setAttachmentDetails(LLSD content);
void setAttachmentSummary(LLSD content);
- BOOL requestAttachmentDetails();
+ bool requestAttachmentDetails();
void clearList();
private:
void getAttachmentLimitsCoro(std::string url);
bool mGotAttachmentMemoryUsed;
+ bool mAttachmentDetailsRequested;
S32 mAttachmentMemoryMax;
S32 mAttachmentMemoryUsed;
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 64961fc99c..fe347a91a3 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -254,8 +254,8 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response
if ( option == 0 ) // YES
{
// clean web
- LLViewerMedia::clearAllCaches();
- LLViewerMedia::clearAllCookies();
+ LLViewerMedia::getInstance()->clearAllCaches();
+ LLViewerMedia::getInstance()->clearAllCookies();
// clean nav bar history
LLNavigationBar::getInstance()->clearHistoryCache();
@@ -278,13 +278,13 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response
void handleNameTagOptionChanged(const LLSD& newvalue)
{
- LLAvatarNameCache::setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
+ LLAvatarNameCache::getInstance()->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
LLVOAvatar::invalidateNameTags();
}
void handleDisplayNamesOptionChanged(const LLSD& newvalue)
{
- LLAvatarNameCache::setUseDisplayNames(newvalue.asBoolean());
+ LLAvatarNameCache::getInstance()->setUseDisplayNames(newvalue.asBoolean());
LLVOAvatar::invalidateNameTags();
}
@@ -523,7 +523,7 @@ BOOL LLFloaterPreference::postBuild()
// set 'enable' property for 'Clear log...' button
changed();
- LLLogChat::setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this));
+ LLLogChat::getInstance()->setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this));
LLSliderCtrl* fov_slider = getChild("camera_fov");
fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
@@ -635,14 +635,14 @@ void LLFloaterPreference::apply()
std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
setCacheLocation(cache_location);
- LLViewerMedia::setCookiesEnabled(getChild("cookies_enabled")->getValue());
+ LLViewerMedia::getInstance()->setCookiesEnabled(getChild("cookies_enabled")->getValue());
if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE))
{
bool proxy_enable = getChild("web_proxy_enabled")->getValue();
std::string proxy_address = getChild("web_proxy_editor")->getValue();
int proxy_port = getChild("web_proxy_port")->getValue();
- LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port);
+ LLViewerMedia::getInstance()->setProxyConfig(proxy_enable, proxy_address, proxy_port);
}
if (mGotPersonalInfo)
@@ -1234,7 +1234,7 @@ void LLFloaterPreference::buildPopupLists()
{
if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
{
- LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName);
+ LLSD last_response = LLUI::getInstance()->mSettingGroups["config"]->getLLSD("Default" + templatep->mName);
if (!last_response.isUndefined())
{
for (LLSD::map_const_iterator it = last_response.beginMap();
@@ -1739,7 +1739,7 @@ void LLFloaterPreference::onClickEnablePopup()
LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
//gSavedSettings.setWarning(templatep->mName, TRUE);
std::string notification_name = templatep->mName;
- LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE);
+ LLUI::getInstance()->mSettingGroups["ignores"]->setBOOL(notification_name, TRUE);
}
buildPopupLists();
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index d94bf3f651..960fd9620d 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -38,7 +38,7 @@
#include "llcallbacklist.h"
#include "llcheckboxctrl.h"
#include "llfontgl.h"
-#include "llimagebmp.h"
+#include "llimagepng.h"
#include "llimagej2c.h"
#include "llinventory.h"
#include "llnotificationsutil.h"
@@ -89,7 +89,7 @@
#include "llcorehttputil.h"
#include "llviewerassetupload.h"
-const std::string SCREEN_PREV_FILENAME = "screen_report_last.bmp";
+const std::string SCREEN_PREV_FILENAME = "screen_report_last.png";
//=========================================================================
//-----------------------------------------------------------------------------
@@ -872,10 +872,10 @@ void LLFloaterReporter::takeScreenshot(bool use_prev_screenshot)
if(!use_prev_screenshot)
{
std::string screenshot_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_PREV_FILENAME);
- LLPointer bmp_image = new LLImageBMP;
- if(bmp_image->encode(mImageRaw, 0.0f))
+ LLPointer png_image = new LLImagePNG;
+ if(png_image->encode(mImageRaw, 0.0f))
{
- bmp_image->save(screenshot_filename);
+ png_image->save(screenshot_filename);
}
}
else
@@ -948,10 +948,10 @@ void LLFloaterReporter::takeNewSnapshot()
{
std::string screenshot_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_PREV_FILENAME);
mPrevImageRaw = new LLImageRaw;
- LLPointer start_image_bmp = new LLImageBMP;
- if(start_image_bmp->load(screenshot_filename))
+ LLPointer start_image_png = new LLImagePNG;
+ if(start_image_png->load(screenshot_filename))
{
- if (start_image_bmp->decode(mPrevImageRaw, 0.0f))
+ if (start_image_png->decode(mPrevImageRaw, 0.0f))
{
LLNotificationsUtil::add("LoadPreviousReportScreenshot", LLSD(), LLSD(), boost::bind(&LLFloaterReporter::onLoadScreenshotDialog,this, _1, _2));
return;
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index 66e832111b..779542cfcc 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -48,7 +48,7 @@ public:
LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
{
- if (!LLUI::sSettingGroups["config"]->getBOOL("EnableSearch"))
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableSearch"))
{
LLNotificationsUtil::add("NoSearch", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
return true;
@@ -120,6 +120,7 @@ void LLFloaterSearch::onOpen(const LLSD& key)
p.allow_address_entry = false;
LLFloaterWebContent::onOpen(p);
+ mWebBrowser->setFocus(TRUE);
search(p.search);
}
diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp
index b87044ef5a..de5d59f484 100644
--- a/indra/newview/llfloaterspellchecksettings.cpp
+++ b/indra/newview/llfloaterspellchecksettings.cpp
@@ -56,7 +56,7 @@ void LLFloaterSpellCheckerSettings::draw()
bool enable_remove = !sel_items.empty();
for (std::vector::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
{
- enable_remove &= LLSpellChecker::canRemoveDictionary((*sel_it)->getValue().asString());
+ enable_remove &= LLSpellChecker::getInstance()->canRemoveDictionary((*sel_it)->getValue().asString());
}
getChild("spellcheck_remove_btn")->setEnabled(enable_remove);
}
@@ -121,7 +121,7 @@ void LLFloaterSpellCheckerSettings::onClose(bool app_quitting)
for (std::vector::const_iterator item_it = list_items.begin(); item_it != list_items.end(); ++item_it)
{
const std::string language = (*item_it)->getValue().asString();
- if (LLSpellChecker::hasDictionary(language, true))
+ if (LLSpellChecker::getInstance()->hasDictionary(language, true))
{
list_dict.push_back(language);
}
@@ -164,7 +164,7 @@ void LLFloaterSpellCheckerSettings::refreshDictionaries(bool from_settings)
}
dict_combo->clearRows();
- const LLSD& dict_map = LLSpellChecker::getDictionaryMap();
+ const LLSD& dict_map = LLSpellChecker::getInstance()->getDictionaryMap();
if (dict_map.size())
{
for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
@@ -216,7 +216,7 @@ void LLFloaterSpellCheckerSettings::refreshDictionaries(bool from_settings)
for (LLSpellChecker::dict_list_t::const_iterator it = active_list.begin(); it != active_list.end(); ++it)
{
const std::string language = *it;
- const LLSD dict = LLSpellChecker::getDictionaryData(language);
+ const LLSD dict = LLSpellChecker::getInstance()->getDictionaryData(language);
row["value"] = language;
row["columns"][0]["value"] = (!dict["user_installed"].asBoolean()) ? language : language + " " + LLTrans::getString("UserDictionary");
active_ctrl->addElement(row);
@@ -380,7 +380,7 @@ void LLFloaterSpellCheckerImport::onBtnOK()
custom_file_out.close();
}
- LLSpellChecker::refreshDictionaryMap();
+ LLSpellChecker::getInstance()->refreshDictionaryMap();
}
closeFloater(false);
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index c2c15ee12b..0429749e11 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -850,6 +850,18 @@ void LLFloaterTools::onOpen(const LLSD& key)
{
mTab->selectTabByName(panel);
}
+
+ LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (tool == LLToolCompInspect::getInstance()
+ || tool == LLToolDragAndDrop::getInstance())
+ {
+ // Something called floater up while it was supressed (during drag n drop, inspect),
+ // so it won't be getting any layout or visibility updates, update once
+ // further updates will come from updateLayout()
+ LLCoordGL select_center_screen;
+ MASK mask = gKeyboard->currentMask(TRUE);
+ updatePopup(select_center_screen, mask);
+ }
//gMenuBarView->setItemVisible("BuildTools", TRUE);
}
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index db5a192287..e67c79a3a0 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -291,8 +291,8 @@ bool LLPreviewedFloater::sShowRectangles = false;
// Changes are made here
LLLocalizationResetForcer::LLLocalizationResetForcer(LLFloaterUIPreview* floater, S32 ID)
{
- mSavedLocalization = LLUI::sSettingGroups["config"]->getString("Language"); // save current localization setting
- LLUI::sSettingGroups["config"]->setString("Language", floater->getLocStr(ID));// hack language to be the one we want to preview floaters in
+ mSavedLocalization = LLUI::getInstance()->mSettingGroups["config"]->getString("Language"); // save current localization setting
+ LLUI::getInstance()->mSettingGroups["config"]->setString("Language", floater->getLocStr(ID));// hack language to be the one we want to preview floaters in
// forcibly reset XUI paths with this new language
gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), floater->getLocStr(ID));
}
@@ -301,7 +301,7 @@ LLLocalizationResetForcer::LLLocalizationResetForcer(LLFloaterUIPreview* floater
// Changes are reversed here
LLLocalizationResetForcer::~LLLocalizationResetForcer()
{
- LLUI::sSettingGroups["config"]->setString("Language", mSavedLocalization); // reset language to what it was before we changed it
+ LLUI::getInstance()->mSettingGroups["config"]->setString("Language", mSavedLocalization); // reset language to what it was before we changed it
// forcibly reset XUI paths with this new language
gDirUtilp->setSkinFolder(gDirUtilp->getSkinFolder(), mSavedLocalization);
}
diff --git a/indra/newview/llfloatervoicevolume.cpp b/indra/newview/llfloatervoicevolume.cpp
index 38446e46df..59e1f49f81 100644
--- a/indra/newview/llfloatervoicevolume.cpp
+++ b/indra/newview/llfloatervoicevolume.cpp
@@ -127,7 +127,7 @@ void LLFloaterVoiceVolume::onOpen(const LLSD& data)
// Extract appropriate avatar id
mAvatarID = data["avatar_id"];
- LLUI::positionViewNearMouse(this);
+ LLUI::getInstance()->positionViewNearMouse(this);
getChild("avatar_name")->setValue("");
updateVolumeControls();
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 13953d6be5..c591dfacaf 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -234,7 +234,7 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
void LLFloaterWebContent::open_media(const Params& p)
{
- LLViewerMedia::proxyWindowOpened(p.target(), p.id());
+ LLViewerMedia::getInstance()->proxyWindowOpened(p.target(), p.id());
mWebBrowser->setHomePageUrl(p.url);
mWebBrowser->setTarget(p.target);
mWebBrowser->navigateTo(p.url);
@@ -308,7 +308,7 @@ void LLFloaterWebContent::onClose(bool app_quitting)
LLTwitterConnect::instance().setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_FAILED);
}
}
- LLViewerMedia::proxyWindowClosed(mUUID);
+ LLViewerMedia::getInstance()->proxyWindowClosed(mUUID);
destroy();
}
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 1e9c9ce5e0..27197f0b06 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -122,7 +122,7 @@ public:
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
{
- if (!LLUI::sSettingGroups["config"]->getBOOL("EnableWorldMap"))
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
{
LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
return true;
@@ -160,7 +160,7 @@ public:
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
{
- if (!LLUI::sSettingGroups["config"]->getBOOL("EnableWorldMap"))
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
{
LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
return true;
diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp
index 612afc0d18..c2ea3b07c1 100644
--- a/indra/newview/llfollowcam.cpp
+++ b/indra/newview/llfollowcam.cpp
@@ -29,12 +29,6 @@
#include "llfollowcam.h"
#include "llagent.h"
-//-------------------------------------------------------
-// class statics
-//-------------------------------------------------------
-std::map LLFollowCamMgr::sParamMap;
-std::vector LLFollowCamMgr::sParamStack;
-
//-------------------------------------------------------
// constants
//-------------------------------------------------------
@@ -668,18 +662,20 @@ LLFollowCam::~LLFollowCam()
//-------------------------------------------------------
// LLFollowCamMgr
//-------------------------------------------------------
-//static
-void LLFollowCamMgr::cleanupClass()
+LLFollowCamMgr::LLFollowCamMgr()
{
- for (param_map_t::iterator iter = sParamMap.begin(); iter != sParamMap.end(); ++iter)
- {
- LLFollowCamParams* params = iter->second;
- delete params;
- }
- sParamMap.clear();
}
-//static
+LLFollowCamMgr::~LLFollowCamMgr()
+{
+ for (param_map_t::iterator iter = mParamMap.begin(); iter != mParamMap.end(); ++iter)
+ {
+ LLFollowCamParams* params = iter->second;
+ delete params;
+ }
+ mParamMap.clear();
+}
+
void LLFollowCamMgr::setPositionLag( const LLUUID& source, F32 lag)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -689,7 +685,6 @@ void LLFollowCamMgr::setPositionLag( const LLUUID& source, F32 lag)
}
}
-//static
void LLFollowCamMgr::setFocusLag( const LLUUID& source, F32 lag)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -699,7 +694,6 @@ void LLFollowCamMgr::setFocusLag( const LLUUID& source, F32 lag)
}
}
-//static
void LLFollowCamMgr::setFocusThreshold( const LLUUID& source, F32 threshold)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -710,7 +704,6 @@ void LLFollowCamMgr::setFocusThreshold( const LLUUID& source, F32 threshold)
}
-//static
void LLFollowCamMgr::setPositionThreshold( const LLUUID& source, F32 threshold)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -720,7 +713,6 @@ void LLFollowCamMgr::setPositionThreshold( const LLUUID& source, F32 threshold)
}
}
-//static
void LLFollowCamMgr::setDistance( const LLUUID& source, F32 distance)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -730,7 +722,6 @@ void LLFollowCamMgr::setDistance( const LLUUID& source, F32 distance)
}
}
-//static
void LLFollowCamMgr::setPitch( const LLUUID& source, F32 pitch)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -740,7 +731,6 @@ void LLFollowCamMgr::setPitch( const LLUUID& source, F32 pitch)
}
}
-//static
void LLFollowCamMgr::setFocusOffset( const LLUUID& source, const LLVector3& offset)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -750,7 +740,6 @@ void LLFollowCamMgr::setFocusOffset( const LLUUID& source, const LLVector3& offs
}
}
-//static
void LLFollowCamMgr::setBehindnessAngle( const LLUUID& source, F32 angle)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -760,7 +749,6 @@ void LLFollowCamMgr::setBehindnessAngle( const LLUUID& source, F32 angle)
}
}
-//static
void LLFollowCamMgr::setBehindnessLag( const LLUUID& source, F32 force)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -770,7 +758,6 @@ void LLFollowCamMgr::setBehindnessLag( const LLUUID& source, F32 force)
}
}
-//static
void LLFollowCamMgr::setPosition( const LLUUID& source, const LLVector3 position)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -780,7 +767,6 @@ void LLFollowCamMgr::setPosition( const LLUUID& source, const LLVector3 position
}
}
-//static
void LLFollowCamMgr::setFocus( const LLUUID& source, const LLVector3 focus)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -790,7 +776,6 @@ void LLFollowCamMgr::setFocus( const LLUUID& source, const LLVector3 focus)
}
}
-//static
void LLFollowCamMgr::setPositionLocked( const LLUUID& source, bool locked)
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -800,7 +785,6 @@ void LLFollowCamMgr::setPositionLocked( const LLUUID& source, bool locked)
}
}
-//static
void LLFollowCamMgr::setFocusLocked( const LLUUID& source, bool locked )
{
LLFollowCamParams* paramsp = getParamsForID(source);
@@ -810,16 +794,15 @@ void LLFollowCamMgr::setFocusLocked( const LLUUID& source, bool locked )
}
}
-//static
LLFollowCamParams* LLFollowCamMgr::getParamsForID(const LLUUID& source)
{
LLFollowCamParams* params = NULL;
- param_map_t::iterator found_it = sParamMap.find(source);
- if (found_it == sParamMap.end()) // didn't find it?
+ param_map_t::iterator found_it = mParamMap.find(source);
+ if (found_it == mParamMap.end()) // didn't find it?
{
params = new LLFollowCamParams();
- sParamMap[source] = params;
+ mParamMap[source] = params;
}
else
{
@@ -829,56 +812,51 @@ LLFollowCamParams* LLFollowCamMgr::getParamsForID(const LLUUID& source)
return params;
}
-//static
LLFollowCamParams* LLFollowCamMgr::getActiveFollowCamParams()
{
- if (sParamStack.empty())
+ if (mParamStack.empty())
{
return NULL;
}
- return sParamStack.back();
+ return mParamStack.back();
}
-//static
void LLFollowCamMgr::setCameraActive( const LLUUID& source, bool active )
{
LLFollowCamParams* params = getParamsForID(source);
- param_stack_t::iterator found_it = std::find(sParamStack.begin(), sParamStack.end(), params);
- if (found_it != sParamStack.end())
+ param_stack_t::iterator found_it = std::find(mParamStack.begin(), mParamStack.end(), params);
+ if (found_it != mParamStack.end())
{
- sParamStack.erase(found_it);
+ mParamStack.erase(found_it);
}
// put on top of stack
if(active)
{
- sParamStack.push_back(params);
+ mParamStack.push_back(params);
}
}
-//static
void LLFollowCamMgr::removeFollowCamParams(const LLUUID& source)
{
setCameraActive(source, FALSE);
LLFollowCamParams* params = getParamsForID(source);
- sParamMap.erase(source);
+ mParamMap.erase(source);
delete params;
}
-//static
bool LLFollowCamMgr::isScriptedCameraSource(const LLUUID& source)
{
- param_map_t::iterator found_it = sParamMap.find(source);
- return (found_it != sParamMap.end());
+ param_map_t::iterator found_it = mParamMap.find(source);
+ return (found_it != mParamMap.end());
}
-//static
void LLFollowCamMgr::dump()
{
S32 param_count = 0;
LL_INFOS() << "Scripted camera active stack" << LL_ENDL;
- for (param_stack_t::iterator param_it = sParamStack.begin();
- param_it != sParamStack.end();
+ for (param_stack_t::iterator param_it = mParamStack.begin();
+ param_it != mParamStack.end();
++param_it)
{
LL_INFOS() << param_count++ <<
diff --git a/indra/newview/llfollowcam.h b/indra/newview/llfollowcam.h
index f4b7b2723a..7995848160 100644
--- a/indra/newview/llfollowcam.h
+++ b/indra/newview/llfollowcam.h
@@ -193,40 +193,40 @@ protected:
};// end of FollowCam class
-class LLFollowCamMgr
+class LLFollowCamMgr : public LLSingleton
{
-public:
- static void cleanupClass ( );
-
- static void setPositionLag ( const LLUUID& source, F32 lag);
- static void setFocusLag ( const LLUUID& source, F32 lag);
- static void setFocusThreshold ( const LLUUID& source, F32 threshold);
- static void setPositionThreshold ( const LLUUID& source, F32 threshold);
- static void setDistance ( const LLUUID& source, F32 distance);
- static void setPitch ( const LLUUID& source, F32 pitch);
- static void setFocusOffset ( const LLUUID& source, const LLVector3& offset);
- static void setBehindnessAngle ( const LLUUID& source, F32 angle);
- static void setBehindnessLag ( const LLUUID& source, F32 lag);
- static void setPosition ( const LLUUID& source, const LLVector3 position);
- static void setFocus ( const LLUUID& source, const LLVector3 focus);
- static void setPositionLocked ( const LLUUID& source, bool locked);
- static void setFocusLocked ( const LLUUID& source, bool locked );
+ LLSINGLETON(LLFollowCamMgr);
+ ~LLFollowCamMgr();
+public:
+ void setPositionLag ( const LLUUID& source, F32 lag);
+ void setFocusLag ( const LLUUID& source, F32 lag);
+ void setFocusThreshold ( const LLUUID& source, F32 threshold);
+ void setPositionThreshold ( const LLUUID& source, F32 threshold);
+ void setDistance ( const LLUUID& source, F32 distance);
+ void setPitch ( const LLUUID& source, F32 pitch);
+ void setFocusOffset ( const LLUUID& source, const LLVector3& offset);
+ void setBehindnessAngle ( const LLUUID& source, F32 angle);
+ void setBehindnessLag ( const LLUUID& source, F32 lag);
+ void setPosition ( const LLUUID& source, const LLVector3 position);
+ void setFocus ( const LLUUID& source, const LLVector3 focus);
+ void setPositionLocked ( const LLUUID& source, bool locked);
+ void setFocusLocked ( const LLUUID& source, bool locked );
- static void setCameraActive ( const LLUUID& source, bool active );
+ void setCameraActive ( const LLUUID& source, bool active );
- static LLFollowCamParams* getActiveFollowCamParams();
- static LLFollowCamParams* getParamsForID(const LLUUID& source);
- static void removeFollowCamParams(const LLUUID& source);
- static bool isScriptedCameraSource(const LLUUID& source);
- static void dump();
+ LLFollowCamParams* getActiveFollowCamParams();
+ LLFollowCamParams* getParamsForID(const LLUUID& source);
+ void removeFollowCamParams(const LLUUID& source);
+ bool isScriptedCameraSource(const LLUUID& source);
+ void dump();
protected:
typedef std::map param_map_t;
- static param_map_t sParamMap;
+ param_map_t mParamMap;
typedef std::vector param_stack_t;
- static param_stack_t sParamStack;
+ param_stack_t mParamStack;
};
#endif //LL_FOLLOWCAM_H
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 913efd6434..599790d2bb 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -55,7 +55,7 @@ public:
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
{
- if (!LLUI::sSettingGroups["config"]->getBOOL("EnableGroupInfo"))
+ if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableGroupInfo"))
{
LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
return true;
diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp
index 197408b40e..7271376a3c 100644
--- a/indra/newview/llhints.cpp
+++ b/indra/newview/llhints.cpp
@@ -240,7 +240,7 @@ void LLHintPopup::draw()
}
else
{
- LLView* targetp = LLHints::getHintTarget(mTarget).get();
+ LLView* targetp = LLHints::getInstance()->getHintTarget(mTarget).get();
if (!targetp)
{
// target widget is no longer valid, go away
@@ -349,10 +349,20 @@ void LLHintPopup::draw()
}
-LLRegistry > LLHints::sTargetRegistry;
-std::map LLHints::sHints;
+/// LLHints
+
+LLHints::LLHints()
+{
+ LLControlVariablePtr control = gSavedSettings.getControl("EnableUIHints");
+ mControlConnection = control->getSignal()->connect(boost::bind(&LLHints::showHints, this, _2));
+ gViewerWindow->getHintHolder()->setVisible(control->getValue().asBoolean());
+}
+
+LLHints::~LLHints()
+{
+ mControlConnection.disconnect();
+}
-//static
void LLHints::show(LLNotificationPtr hint)
{
LLHintPopup::Params p(LLUICtrlFactory::getDefaultParams());
@@ -365,7 +375,7 @@ void LLHints::show(LLNotificationPtr hint)
{
LLHintPopup* popup = new LLHintPopup(p);
- sHints[hint] = popup;
+ mHints[hint] = popup;
LLView* hint_holder = gViewerWindow->getHintHolder();
if (hint_holder)
@@ -376,27 +386,24 @@ void LLHints::show(LLNotificationPtr hint)
}
}
-//static
void LLHints::hide(LLNotificationPtr hint)
{
- hint_map_t::iterator found_it = sHints.find(hint);
- if (found_it != sHints.end())
+ hint_map_t::iterator found_it = mHints.find(hint);
+ if (found_it != mHints.end())
{
found_it->second->hide();
- sHints.erase(found_it);
+ mHints.erase(found_it);
}
}
-//static
void LLHints::registerHintTarget(const std::string& name, LLHandle target)
{
- sTargetRegistry.defaultRegistrar().replace(name, target);
+ mTargetRegistry.defaultRegistrar().replace(name, target);
}
-//static
LLHandle LLHints::getHintTarget(const std::string& name)
{
- LLHandle* handlep = sTargetRegistry.getValue(name);
+ LLHandle* handlep = mTargetRegistry.getValue(name);
if (handlep)
{
return *handlep;
@@ -407,18 +414,6 @@ LLHandle LLHints::getHintTarget(const std::string& name)
}
}
-//static
-void LLHints::initClass()
-{
- sRegister.reference();
-
- LLControlVariablePtr control = gSavedSettings.getControl("EnableUIHints");
- control->getSignal()->connect(boost::bind(&showHints, _2));
- gViewerWindow->getHintHolder()->setVisible(control->getValue().asBoolean());
-
-}
-
-//staic
void LLHints::showHints(const LLSD& show)
{
bool visible = show.asBoolean();
diff --git a/indra/newview/llhints.h b/indra/newview/llhints.h
index dd6195a9ce..1f730734d0 100644
--- a/indra/newview/llhints.h
+++ b/indra/newview/llhints.h
@@ -32,19 +32,22 @@
#include "llinitdestroyclass.h"
-class LLHints : public LLInitClass
+class LLHints : public LLSingleton
{
+ LLSINGLETON(LLHints);
+ ~LLHints();
public:
- static void show(LLNotificationPtr hint);
- static void hide(LLNotificationPtr hint);
- static void registerHintTarget(const std::string& name, LLHandle target);
- static LLHandle getHintTarget(const std::string& name);
- static void initClass();
+ void show(LLNotificationPtr hint);
+ void hide(LLNotificationPtr hint);
+ void registerHintTarget(const std::string& name, LLHandle target);
+ LLHandle getHintTarget(const std::string& name);
private:
- static LLRegistry > sTargetRegistry;
+ LLRegistry > mTargetRegistry;
typedef std::map hint_map_t;
- static hint_map_t sHints;
- static void showHints(const LLSD& show);
+ hint_map_t mHints;
+ void showHints(const LLSD& show);
+
+ boost::signals2::connection mControlConnection;
};
diff --git a/indra/newview/llimagefiltersmanager.cpp b/indra/newview/llimagefiltersmanager.cpp
index ee6b39efac..c23cdc8103 100644
--- a/indra/newview/llimagefiltersmanager.cpp
+++ b/indra/newview/llimagefiltersmanager.cpp
@@ -48,7 +48,7 @@ LLImageFiltersManager::~LLImageFiltersManager()
{
}
-// virtual static
+// virtual
void LLImageFiltersManager::initSingleton()
{
loadAllFilters();
diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp
index d59c301210..3606a439a6 100644
--- a/indra/newview/llimprocessing.cpp
+++ b/indra/newview/llimprocessing.cpp
@@ -695,7 +695,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
// The group notice packet does not have an AgentID. Obtain one from the name cache.
// If last name is "Resident" strip it out so the cache name lookup works.
std::string legacy_name = gCacheName->buildLegacyName(original_name);
- agent_id = LLAvatarNameCache::findIdByName(legacy_name);
+ agent_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
if (agent_id.isNull())
{
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 0f5d514660..e331a51bda 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -83,11 +83,6 @@ void startConfrenceCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId,
void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType);
void start_deprecated_conference_chat(const LLUUID& temp_session_id, const LLUUID& creator_id, const LLUUID& other_participant_id, const LLSD& agents_to_invite);
-std::string LLCallDialogManager::sPreviousSessionlName = "";
-LLIMModel::LLIMSession::SType LLCallDialogManager::sPreviousSessionType = LLIMModel::LLIMSession::P2P_SESSION;
-std::string LLCallDialogManager::sCurrentSessionlName = "";
-LLIMModel::LLIMSession* LLCallDialogManager::sSession = NULL;
-LLVoiceChannel::EState LLCallDialogManager::sOldState = LLVoiceChannel::STATE_READY;
const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-1417BF03DDB4");
//
// Globals
@@ -811,7 +806,7 @@ void LLIMModel::LLIMSession::addMessagesFromHistory(const std::list& histo
{
// convert it to a legacy name if we have a complete name
std::string legacy_name = gCacheName->buildLegacyName(from);
- from_id = LLAvatarNameCache::findIdByName(legacy_name);
+ from_id = LLAvatarNameCache::getInstance()->findIdByName(legacy_name);
}
std::string timestamp = msg[LL_IM_TIME];
@@ -1786,7 +1781,12 @@ LLIMMgr::onConfirmForceCloseError(
// Class LLCallDialogManager
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LLCallDialogManager::LLCallDialogManager()
+LLCallDialogManager::LLCallDialogManager():
+mPreviousSessionlName(""),
+mPreviousSessionType(LLIMModel::LLIMSession::P2P_SESSION),
+mCurrentSessionlName(""),
+mSession(NULL),
+mOldState(LLVoiceChannel::STATE_READY)
{
}
@@ -1794,39 +1794,45 @@ LLCallDialogManager::~LLCallDialogManager()
{
}
-void LLCallDialogManager::initClass()
+void LLCallDialogManager::initSingleton()
{
LLVoiceChannel::setCurrentVoiceChannelChangedCallback(LLCallDialogManager::onVoiceChannelChanged);
}
+// static
void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
+{
+ LLCallDialogManager::getInstance()->onVoiceChannelChangedInt(session_id);
+}
+
+void LLCallDialogManager::onVoiceChannelChangedInt(const LLUUID &session_id)
{
LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id);
if(!session)
{
- sPreviousSessionlName = sCurrentSessionlName;
- sCurrentSessionlName = ""; // Empty string results in "Nearby Voice Chat" after substitution
+ mPreviousSessionlName = mCurrentSessionlName;
+ mCurrentSessionlName = ""; // Empty string results in "Nearby Voice Chat" after substitution
return;
}
- if (sSession)
+ if (mSession)
{
// store previous session type to process Avaline calls in dialogs
- sPreviousSessionType = sSession->mSessionType;
+ mPreviousSessionType = mSession->mSessionType;
}
- sSession = session;
+ mSession = session;
static boost::signals2::connection prev_channel_state_changed_connection;
// disconnect previously connected callback to avoid have invalid sSession in onVoiceChannelStateChanged()
prev_channel_state_changed_connection.disconnect();
prev_channel_state_changed_connection =
- sSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
+ mSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3, _4));
- if(sCurrentSessionlName != session->mName)
+ if(mCurrentSessionlName != session->mName)
{
- sPreviousSessionlName = sCurrentSessionlName;
- sCurrentSessionlName = session->mName;
+ mPreviousSessionlName = mCurrentSessionlName;
+ mCurrentSessionlName = session->mName;
}
if (LLVoiceChannel::getCurrentVoiceChannel()->getState() == LLVoiceChannel::STATE_CALL_STARTED &&
@@ -1835,14 +1841,14 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
//*TODO get rid of duplicated code
LLSD mCallDialogPayload;
- mCallDialogPayload["session_id"] = sSession->mSessionID;
- mCallDialogPayload["session_name"] = sSession->mName;
- mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID;
- mCallDialogPayload["old_channel_name"] = sPreviousSessionlName;
- mCallDialogPayload["old_session_type"] = sPreviousSessionType;
+ mCallDialogPayload["session_id"] = mSession->mSessionID;
+ mCallDialogPayload["session_name"] = mSession->mName;
+ mCallDialogPayload["other_user_id"] = mSession->mOtherParticipantID;
+ mCallDialogPayload["old_channel_name"] = mPreviousSessionlName;
+ mCallDialogPayload["old_session_type"] = mPreviousSessionType;
mCallDialogPayload["state"] = LLVoiceChannel::STATE_CALL_STARTED;
- mCallDialogPayload["disconnected_channel_name"] = sSession->mName;
- mCallDialogPayload["session_type"] = sSession->mSessionType;
+ mCallDialogPayload["disconnected_channel_name"] = mSession->mName;
+ mCallDialogPayload["session_type"] = mSession->mSessionType;
LLOutgoingCallDialog* ocd = LLFloaterReg::getTypedInstance("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
if(ocd)
@@ -1853,26 +1859,32 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
}
+// static
void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent)
+{
+ LLCallDialogManager::getInstance()->onVoiceChannelStateChangedInt(old_state, new_state, direction, ended_by_agent);
+}
+
+void LLCallDialogManager::onVoiceChannelStateChangedInt(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent)
{
LLSD mCallDialogPayload;
LLOutgoingCallDialog* ocd = NULL;
- if(sOldState == new_state)
+ if(mOldState == new_state)
{
return;
}
- sOldState = new_state;
+ mOldState = new_state;
- mCallDialogPayload["session_id"] = sSession->mSessionID;
- mCallDialogPayload["session_name"] = sSession->mName;
- mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID;
- mCallDialogPayload["old_channel_name"] = sPreviousSessionlName;
- mCallDialogPayload["old_session_type"] = sPreviousSessionType;
+ mCallDialogPayload["session_id"] = mSession->mSessionID;
+ mCallDialogPayload["session_name"] = mSession->mName;
+ mCallDialogPayload["other_user_id"] = mSession->mOtherParticipantID;
+ mCallDialogPayload["old_channel_name"] = mPreviousSessionlName;
+ mCallDialogPayload["old_session_type"] = mPreviousSessionType;
mCallDialogPayload["state"] = new_state;
- mCallDialogPayload["disconnected_channel_name"] = sSession->mName;
- mCallDialogPayload["session_type"] = sSession->mSessionType;
+ mCallDialogPayload["disconnected_channel_name"] = mSession->mName;
+ mCallDialogPayload["session_type"] = mSession->mSessionType;
mCallDialogPayload["ended_by_agent"] = ended_by_agent;
switch(new_state)
@@ -1887,7 +1899,7 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat
case LLVoiceChannel::STATE_HUNG_UP:
// this state is coming before session is changed, so, put it into payload map
- mCallDialogPayload["old_session_type"] = sSession->mSessionType;
+ mCallDialogPayload["old_session_type"] = mSession->mSessionType;
break;
case LLVoiceChannel::STATE_CONNECTED :
@@ -1925,7 +1937,7 @@ LLCallDialog::LLCallDialog(const LLSD& payload)
LLCallDialog::~LLCallDialog()
{
- LLUI::removePopup(this);
+ LLUI::getInstance()->removePopup(this);
}
BOOL LLCallDialog::postBuild()
@@ -2002,7 +2014,7 @@ void LLCallDialog::onOpen(const LLSD& key)
LLDockableFloater::onOpen(key);
// it should be over the all floaters. EXT-5116
- LLUI::addPopup(this);
+ LLUI::getInstance()->addPopup(this);
}
void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 81d3ffa1a6..2a9e4679a8 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -499,22 +499,26 @@ private:
LLSD mPendingAgentListUpdates;
};
-class LLCallDialogManager : public LLInitClass
+class LLCallDialogManager : public LLSingleton
{
-public:
- LLCallDialogManager();
+ LLSINGLETON(LLCallDialogManager);
~LLCallDialogManager();
-
- static void initClass();
+public:
+ // static for convinience
static void onVoiceChannelChanged(const LLUUID &session_id);
static void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent);
+private:
+ void initSingleton();
+ void onVoiceChannelChangedInt(const LLUUID &session_id);
+ void onVoiceChannelStateChangedInt(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent);
+
protected:
- static std::string sPreviousSessionlName;
- static LLIMModel::LLIMSession::SType sPreviousSessionType;
- static std::string sCurrentSessionlName;
- static LLIMModel::LLIMSession* sSession;
- static LLVoiceChannel::EState sOldState;
+ std::string mPreviousSessionlName;
+ LLIMModel::LLIMSession::SType mPreviousSessionType;
+ std::string mCurrentSessionlName;
+ LLIMModel::LLIMSession* mSession;
+ LLVoiceChannel::EState mOldState;
};
class LLCallDialog : public LLDockableFloater
diff --git a/indra/newview/llinspect.cpp b/indra/newview/llinspect.cpp
index e6cb068613..479e8f9abf 100644
--- a/indra/newview/llinspect.cpp
+++ b/indra/newview/llinspect.cpp
@@ -28,7 +28,7 @@
#include "lltooltip.h"
#include "llcontrol.h" // LLCachedControl
-#include "llui.h" // LLUI::sSettingsGroups
+#include "llui.h" // LLUI::getInstance()->mSettingsGroups
#include "llviewermenu.h"
LLInspect::LLInspect(const LLSD& key)
@@ -45,8 +45,8 @@ LLInspect::~LLInspect()
// virtual
void LLInspect::draw()
{
- static LLCachedControl FADE_TIME(*LLUI::sSettingGroups["config"], "InspectorFadeTime", 1.f);
- static LLCachedControl STAY_TIME(*LLUI::sSettingGroups["config"], "InspectorShowTime", 1.f);
+ static LLCachedControl FADE_TIME(*LLUI::getInstance()->mSettingGroups["config"], "InspectorFadeTime", 1.f);
+ static LLCachedControl STAY_TIME(*LLUI::getInstance()->mSettingGroups["config"], "InspectorShowTime", 1.f);
if (mOpenTimer.getStarted())
{
LLFloater::draw();
@@ -113,7 +113,7 @@ BOOL LLInspect::handleToolTip(S32 x, S32 y, MASK mask)
params.fillFrom(LLUICtrlFactory::instance().getDefaultParams());
params.message = child_handler->getToolTip();
//set up delay if there is no visible tooltip at this moment
- params.delay_time = LLToolTipMgr::instance().toolTipVisible() ? 0.f : LLUI::sSettingGroups["config"]->getF32( "ToolTipDelay" );
+ params.delay_time = LLToolTipMgr::instance().toolTipVisible() ? 0.f : LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" );
LLToolTipMgr::instance().show(params);
handled = TRUE;
}
@@ -137,7 +137,7 @@ bool LLInspect::childHasVisiblePopupMenu()
LLRect floater_rc = calcScreenRect();
LLRect menu_screen_rc = child_menu->calcScreenRect();
S32 mx, my;
- LLUI::getMousePositionScreen(&mx, &my);
+ LLUI::getInstance()->getMousePositionScreen(&mx, &my);
// This works wrong if we spawn a menu near Inspector and menu overlaps Inspector.
if(floater_rc.overlaps(menu_screen_rc) && menu_screen_rc.pointInRect(mx, my))
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 88e7ad1b71..10814ac076 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -207,11 +207,11 @@ void LLInspectAvatar::onOpen(const LLSD& data)
// See LLToolTipMgr::createToolTip
if (data.has("pos"))
{
- LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
+ LLUI::getInstance()->positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
}
else
{
- LLUI::positionViewNearMouse(this);
+ LLUI::getInstance()->positionViewNearMouse(this);
}
// Generate link to avatar profile.
diff --git a/indra/newview/llinspectgroup.cpp b/indra/newview/llinspectgroup.cpp
index 8332443162..fa8a53c546 100644
--- a/indra/newview/llinspectgroup.cpp
+++ b/indra/newview/llinspectgroup.cpp
@@ -129,11 +129,11 @@ void LLInspectGroup::onOpen(const LLSD& data)
// See LLToolTipMgr::createToolTip
if (data.has("pos"))
{
- LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
+ LLUI::getInstance()->positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
}
else
{
- LLUI::positionViewNearMouse(this);
+ LLUI::getInstance()->positionViewNearMouse(this);
}
// can't call from constructor as widgets are not built yet
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index 46019557f8..f78a5cc64e 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -202,11 +202,11 @@ void LLInspectObject::onOpen(const LLSD& data)
// See LLToolTipMgr::createToolTip
if (data.has("pos"))
{
- LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
+ LLUI::getInstance()->positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
}
else
{
- LLUI::positionViewNearMouse(this);
+ LLUI::getInstance()->positionViewNearMouse(this);
}
// Promote hovered object to a complete selection, which will also force
@@ -241,7 +241,7 @@ void LLInspectObject::onOpen(const LLSD& data)
if(!mMediaEntry)
return;
- mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mMediaEntry->getMediaID());
+ mMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaEntry->getMediaID());
}
}
@@ -300,7 +300,7 @@ void LLInspectObject::update()
if(!mMediaEntry)
return;
- mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mMediaEntry->getMediaID());
+ mMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mMediaEntry->getMediaID());
updateMediaCurrentURL();
updateSecureBrowsing();
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
index b64df2bd47..272c8acbd5 100644
--- a/indra/newview/llinspectremoteobject.cpp
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -116,11 +116,11 @@ void LLInspectRemoteObject::onOpen(const LLSD& data)
// See LLToolTipMgr::createToolTip
if (data.has("pos"))
{
- LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
+ LLUI::getInstance()->positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger());
}
else
{
- LLUI::positionViewNearMouse(this);
+ LLUI::getInstance()->positionViewNearMouse(this);
}
}
diff --git a/indra/newview/llinspecttoast.cpp b/indra/newview/llinspecttoast.cpp
index 47560341e7..d0034eff13 100644
--- a/indra/newview/llinspecttoast.cpp
+++ b/indra/newview/llinspecttoast.cpp
@@ -110,7 +110,7 @@ void LLInspectToast::onOpen(const LLSD& notification_id)
panel_rect = panel->getRect();
reshape(panel_rect.getWidth(), panel_rect.getHeight());
- LLUI::positionViewNearMouse(this);
+ LLUI::getInstance()->positionViewNearMouse(this);
}
// virtual
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index a50a66a8ce..349ba6183b 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -107,6 +107,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
bool confirm_attachment_rez(const LLSD& notification, const LLSD& response);
void teleport_via_landmark(const LLUUID& asset_id);
static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit);
+static bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_cat, U32 wear_limit);
static BOOL can_move_to_landmarks(LLInventoryItem* inv_item);
static bool check_category(LLInventoryModel* model,
const LLUUID& cat_id,
@@ -2269,7 +2270,7 @@ public:
// Can be destroyed (or moved to trash)
BOOL LLFolderBridge::isItemRemovable() const
{
- if (!get_is_category_removable(getInventoryModel(), mUUID))
+ if (!get_is_category_removable(getInventoryModel(), mUUID) || isMarketplaceListingsFolder())
{
return FALSE;
}
@@ -2285,11 +2286,6 @@ BOOL LLFolderBridge::isItemRemovable() const
return FALSE;
}
}
-
- if (isMarketplaceListingsFolder() && LLMarketplaceData::instance().getActivationState(mUUID))
- {
- return FALSE;
- }
return TRUE;
}
@@ -2511,9 +2507,28 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
is_movable = FALSE;
// tooltip?
}
+
+ U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
if (is_movable && move_is_into_outfit)
{
- if((mUUID == my_outifts_id) || (getCategory() && getCategory()->getPreferredType() == LLFolderType::FT_NONE))
+ if (mUUID == my_outifts_id)
+ {
+ if (source != LLToolDragAndDrop::SOURCE_AGENT || move_is_from_marketplacelistings)
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutfitNotInInventory");
+ is_movable = false;
+ }
+ else if (can_move_to_my_outfits(model, inv_cat, max_items_to_wear))
+ {
+ is_movable = true;
+ }
+ else
+ {
+ tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit");
+ is_movable = false;
+ }
+ }
+ else if(getCategory() && getCategory()->getPreferredType() == LLFolderType::FT_NONE)
{
is_movable = ((inv_cat->getPreferredType() == LLFolderType::FT_NONE) || (inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT));
}
@@ -2558,7 +2573,6 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
}
}
}
- U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
if (is_movable
&& move_is_into_current_outfit
&& descendent_items.size() > max_items_to_wear)
@@ -2713,8 +2727,14 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
}
}
+ if (mUUID == my_outifts_id)
+ {
+ // Category can contains objects,
+ // create a new folder and populate it with links to original objects
+ dropToMyOutfits(inv_cat);
+ }
// if target is current outfit folder we use link
- if (move_is_into_current_outfit &&
+ else if (move_is_into_current_outfit &&
(inv_cat->getPreferredType() == LLFolderType::FT_NONE ||
inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT))
{
@@ -3724,12 +3744,40 @@ void LLFolderBridge::perform_pasteFromClipboard()
return;
}
}
- if (move_is_into_current_outfit || move_is_into_outfit)
+ if (move_is_into_outfit)
+ {
+ if (!move_is_into_my_outfits && item && can_move_to_outfit(item, move_is_into_current_outfit))
+ {
+ dropToOutfit(item, move_is_into_current_outfit);
+ }
+ else if (move_is_into_my_outfits && LLAssetType::AT_CATEGORY == obj->getType())
+ {
+ LLInventoryCategory* cat = model->getCategory(item_id);
+ U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
+ if (cat && can_move_to_my_outfits(model, cat, max_items_to_wear))
+ {
+ dropToMyOutfits(cat);
+ }
+ else
+ {
+ LLNotificationsUtil::add("MyOutfitsPasteFailed");
+ }
+ }
+ else
+ {
+ LLNotificationsUtil::add("MyOutfitsPasteFailed");
+ }
+ }
+ else if (move_is_into_current_outfit)
{
if (item && can_move_to_outfit(item, move_is_into_current_outfit))
{
dropToOutfit(item, move_is_into_current_outfit);
}
+ else
+ {
+ LLNotificationsUtil::add("MyOutfitsPasteFailed");
+ }
}
else if (move_is_into_favorites)
{
@@ -4675,6 +4723,46 @@ static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_curr
return TRUE;
}
+// Returns true if folder's content can be moved to Current Outfit or any outfit folder.
+static bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_cat, U32 wear_limit)
+{
+ LLInventoryModel::cat_array_t *cats;
+ LLInventoryModel::item_array_t *items;
+ model->getDirectDescendentsOf(inv_cat->getUUID(), cats, items);
+
+ if (items->size() > wear_limit)
+ {
+ return false;
+ }
+
+ if (items->size() == 0)
+ {
+ // Nothing to move(create)
+ return false;
+ }
+
+ if (cats->size() > 0)
+ {
+ // We do not allow subfolders in outfits of "My Outfits" yet
+ return false;
+ }
+
+ LLInventoryModel::item_array_t::iterator iter = items->begin();
+ LLInventoryModel::item_array_t::iterator end = items->end();
+
+ while (iter != end)
+ {
+ LLViewerInventoryItem *item = *iter;
+ if (!can_move_to_outfit(item, false))
+ {
+ return false;
+ }
+ iter++;
+ }
+
+ return true;
+}
+
// Returns TRUE if item is a landmark or a link to a landmark
// and can be moved to Favorites or Landmarks folder.
static BOOL can_move_to_landmarks(LLInventoryItem* inv_item)
@@ -4743,6 +4831,56 @@ void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_c
}
}
+void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat)
+{
+ // make a folder in the My Outfits directory.
+ const LLUUID dest_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+
+ // Note: creation will take time, so passing folder id to callback is slightly unreliable,
+ // but so is collecting and passing descendants' ids
+ inventory_func_type func = boost::bind(&LLFolderBridge::outfitFolderCreatedCallback, this, inv_cat->getUUID(), _1);
+ gInventory.createNewCategory(dest_id,
+ LLFolderType::FT_OUTFIT,
+ inv_cat->getName(),
+ func);
+}
+
+void LLFolderBridge::outfitFolderCreatedCallback(LLUUID cat_source_id, LLUUID cat_dest_id)
+{
+ LLInventoryModel::cat_array_t* categories;
+ LLInventoryModel::item_array_t* items;
+ getInventoryModel()->getDirectDescendentsOf(cat_source_id, categories, items);
+
+ LLInventoryObject::const_object_list_t link_array;
+
+
+ LLInventoryModel::item_array_t::iterator iter = items->begin();
+ LLInventoryModel::item_array_t::iterator end = items->end();
+ while (iter!=end)
+ {
+ const LLViewerInventoryItem* item = (*iter);
+ // By this point everything is supposed to be filtered,
+ // but there was a delay to create folder so something could have changed
+ LLInventoryType::EType inv_type = item->getInventoryType();
+ if ((inv_type == LLInventoryType::IT_WEARABLE) ||
+ (inv_type == LLInventoryType::IT_GESTURE) ||
+ (inv_type == LLInventoryType::IT_ATTACHMENT) ||
+ (inv_type == LLInventoryType::IT_OBJECT) ||
+ (inv_type == LLInventoryType::IT_SNAPSHOT) ||
+ (inv_type == LLInventoryType::IT_TEXTURE))
+ {
+ link_array.push_back(LLConstPointer(item));
+ }
+ iter++;
+ }
+
+ if (!link_array.empty())
+ {
+ LLPointer cb = NULL;
+ link_inventory_array(cat_dest_id, link_array, cb);
+ }
+}
+
// Callback for drop item if DAMA required...
void LLFolderBridge::callback_dropItemIntoFolder(const LLSD& notification, const LLSD& response, LLInventoryItem* inv_item)
{
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index f4df566fa6..0823cf8b52 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -359,6 +359,7 @@ protected:
void dropToFavorites(LLInventoryItem* inv_item);
void dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit);
+ void dropToMyOutfits(LLInventoryCategory* inv_cat);
//--------------------------------------------------------------------
// Messy hacks for handling folder options
@@ -368,6 +369,7 @@ public:
static void staticFolderOptionsMenu();
protected:
+ void outfitFolderCreatedCallback(LLUUID cat_source_id, LLUUID cat_dest_id);
void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response);
void perform_pasteFromClipboard();
void gatherMessage(std::string& message, S32 depth, LLError::ELevel log_level);
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 0243e2183e..b8bde39bd1 100644
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -69,9 +69,6 @@
/*=======================================*/
/* Formal declarations, constants, etc. */
/*=======================================*/
-std::list LLLocalBitmapMgr::sBitmapList;
-LLLocalBitmapTimer LLLocalBitmapMgr::sTimer;
-bool LLLocalBitmapMgr::sNeedsRebake;
static const F32 LL_LOCAL_TIMER_HEARTBEAT = 3.0;
static const BOOL LL_LOCAL_USE_MIPMAPS = true;
@@ -131,7 +128,7 @@ LLLocalBitmap::~LLLocalBitmap()
if(LL_LOCAL_REPLACE_ON_DEL && mValid && gAgentAvatarp) // fix for STORM-1837
{
replaceIDs(mWorldID, IMG_DEFAULT);
- LLLocalBitmapMgr::doRebake();
+ LLLocalBitmapMgr::getInstance()->doRebake();
}
// delete self from gimagelist
@@ -571,7 +568,7 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp
gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index);
gAgentAvatarp->wearableUpdated(type);
/* telling the manager to rebake once update cycle is fully done */
- LLLocalBitmapMgr::setNeedsRebake();
+ LLLocalBitmapMgr::getInstance()->setNeedsRebake();
}
}
@@ -905,7 +902,7 @@ bool LLLocalBitmapTimer::isRunning()
BOOL LLLocalBitmapTimer::tick()
{
- LLLocalBitmapMgr::doUpdates();
+ LLLocalBitmapMgr::getInstance()->doUpdates();
return FALSE;
}
@@ -914,17 +911,12 @@ BOOL LLLocalBitmapTimer::tick()
/*=======================================*/
LLLocalBitmapMgr::LLLocalBitmapMgr()
{
- // The class is all made of static members, should i even bother instantiating?
}
LLLocalBitmapMgr::~LLLocalBitmapMgr()
{
-}
-
-void LLLocalBitmapMgr::cleanupClass()
-{
- std::for_each(sBitmapList.begin(), sBitmapList.end(), DeletePointer());
- sBitmapList.clear();
+ std::for_each(mBitmapList.begin(), mBitmapList.end(), DeletePointer());
+ mBitmapList.clear();
}
bool LLLocalBitmapMgr::addUnit()
@@ -934,7 +926,7 @@ bool LLLocalBitmapMgr::addUnit()
LLFilePicker& picker = LLFilePicker::instance();
if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE))
{
- sTimer.stopTimer();
+ mTimer.stopTimer();
std::string filename = picker.getFirstFile();
while(!filename.empty())
@@ -949,7 +941,7 @@ bool LLLocalBitmapMgr::addUnit()
if (unit->getValid())
{
- sBitmapList.push_back(unit);
+ mBitmapList.push_back(unit);
add_successful = true;
}
else
@@ -968,7 +960,7 @@ bool LLLocalBitmapMgr::addUnit()
filename = picker.getNextFile();
}
- sTimer.startTimer();
+ mTimer.startTimer();
}
return add_successful;
@@ -1007,10 +999,10 @@ bool LLLocalBitmapMgr::checkTextureDimensions(std::string filename)
void LLLocalBitmapMgr::delUnit(LLUUID tracking_id)
{
- if (!sBitmapList.empty())
+ if (!mBitmapList.empty())
{
std::vector to_delete;
- for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+ for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
{ /* finding which ones we want deleted and making a separate list */
LLLocalBitmap* unit = *iter;
if (unit->getTrackingID() == tracking_id)
@@ -1023,7 +1015,7 @@ void LLLocalBitmapMgr::delUnit(LLUUID tracking_id)
del_iter != to_delete.end(); del_iter++)
{ /* iterating over a temporary list, hence preserving the iterator validity while deleting. */
LLLocalBitmap* unit = *del_iter;
- sBitmapList.remove(unit);
+ mBitmapList.remove(unit);
delete unit;
unit = NULL;
}
@@ -1034,7 +1026,7 @@ LLUUID LLLocalBitmapMgr::getWorldID(LLUUID tracking_id)
{
LLUUID world_id = LLUUID::null;
- for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+ for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
{
LLLocalBitmap* unit = *iter;
if (unit->getTrackingID() == tracking_id)
@@ -1050,7 +1042,7 @@ std::string LLLocalBitmapMgr::getFilename(LLUUID tracking_id)
{
std::string filename = "";
- for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+ for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
{
LLLocalBitmap* unit = *iter;
if (unit->getTrackingID() == tracking_id)
@@ -1068,10 +1060,10 @@ void LLLocalBitmapMgr::feedScrollList(LLScrollListCtrl* ctrl)
{
ctrl->clearRows();
- if (!sBitmapList.empty())
+ if (!mBitmapList.empty())
{
- for (local_list_iter iter = sBitmapList.begin();
- iter != sBitmapList.end(); iter++)
+ for (local_list_iter iter = mBitmapList.begin();
+ iter != mBitmapList.end(); iter++)
{
LLSD element;
element["columns"][0]["column"] = "unit_name";
@@ -1092,29 +1084,29 @@ void LLLocalBitmapMgr::feedScrollList(LLScrollListCtrl* ctrl)
void LLLocalBitmapMgr::doUpdates()
{
// preventing theoretical overlap in cases with huge number of loaded images.
- sTimer.stopTimer();
- sNeedsRebake = false;
+ mTimer.stopTimer();
+ mNeedsRebake = false;
- for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++)
+ for (local_list_iter iter = mBitmapList.begin(); iter != mBitmapList.end(); iter++)
{
(*iter)->updateSelf();
}
doRebake();
- sTimer.startTimer();
+ mTimer.startTimer();
}
void LLLocalBitmapMgr::setNeedsRebake()
{
- sNeedsRebake = true;
+ mNeedsRebake = true;
}
void LLLocalBitmapMgr::doRebake()
{ /* separated that from doUpdates to insure a rebake can be called separately during deletion */
- if (sNeedsRebake)
+ if (mNeedsRebake)
{
gAgentAvatarp->forceBakeAllTextures(LL_LOCAL_SLAM_FOR_DEBUG);
- sNeedsRebake = false;
+ mNeedsRebake = false;
}
}
diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h
index ee4161fb45..f6cc1e919e 100644
--- a/indra/newview/lllocalbitmaps.h
+++ b/indra/newview/lllocalbitmaps.h
@@ -110,31 +110,28 @@ class LLLocalBitmapTimer : public LLEventTimer
};
-class LLLocalBitmapMgr
+class LLLocalBitmapMgr : public LLSingleton
{
- public:
- LLLocalBitmapMgr();
- ~LLLocalBitmapMgr();
+ LLSINGLETON(LLLocalBitmapMgr);
+ ~LLLocalBitmapMgr();
+public:
+ bool addUnit();
+ void delUnit(LLUUID tracking_id);
+ bool checkTextureDimensions(std::string filename);
- public:
- static void cleanupClass();
- static bool addUnit();
- static void delUnit(LLUUID tracking_id);
- static bool checkTextureDimensions(std::string filename);
+ LLUUID getWorldID(LLUUID tracking_id);
+ std::string getFilename(LLUUID tracking_id);
- static LLUUID getWorldID(LLUUID tracking_id);
- static std::string getFilename(LLUUID tracking_id);
-
- static void feedScrollList(LLScrollListCtrl* ctrl);
- static void doUpdates();
- static void setNeedsRebake();
- static void doRebake();
-
- private:
- static std::list sBitmapList;
- static LLLocalBitmapTimer sTimer;
- static bool sNeedsRebake;
- typedef std::list::iterator local_list_iter;
+ void feedScrollList(LLScrollListCtrl* ctrl);
+ void doUpdates();
+ void setNeedsRebake();
+ void doRebake();
+
+private:
+ std::list mBitmapList;
+ LLLocalBitmapTimer mTimer;
+ bool mNeedsRebake;
+ typedef std::list::iterator local_list_iter;
};
#endif
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 11bc1425f9..42b5ff3890 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -666,7 +666,7 @@ void LLLocationInputCtrl::onAgentParcelChange()
void LLLocationInputCtrl::onMaturityButtonClicked()
{
- LLUI::sHelpImpl->showTopic(mMaturityHelpTopic);
+ LLUI::getInstance()->mHelpImpl->showTopic(mMaturityHelpTopic);
}
void LLLocationInputCtrl::onRegionBoundaryCrossed()
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 1bdeddbcfe..453bf17b11 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -209,11 +209,24 @@ LLLogChatTimeScanner::LLLogChatTimeScanner()
mTimeStream.imbue(std::locale(mTimeStream.getloc(), new time_input_facet(DATE_FORMAT)));
}
-LLLogChat::save_history_signal_t * LLLogChat::sSaveHistorySignal = NULL;
+LLLogChat::LLLogChat()
+: mSaveHistorySignal(NULL) // only needed in preferences
+{
+ mHistoryThreadsMutex = new LLMutex();
+}
-std::map LLLogChat::sLoadHistoryThreads;
-std::map LLLogChat::sDeleteHistoryThreads;
-LLMutex* LLLogChat::sHistoryThreadsMutex = NULL;
+LLLogChat::~LLLogChat()
+{
+ delete mHistoryThreadsMutex;
+ mHistoryThreadsMutex = NULL;
+
+ if (mSaveHistorySignal)
+ {
+ mSaveHistorySignal->disconnect_all_slots();
+ delete mSaveHistorySignal;
+ mSaveHistorySignal = NULL;
+ }
+}
//static
@@ -338,10 +351,7 @@ void LLLogChat::saveHistory(const std::string& filename,
file.close();
- if (NULL != sSaveHistorySignal)
- {
- (*sSaveHistorySignal)();
- }
+ LLLogChat::getInstance()->triggerHistorySignal();
}
// static
@@ -416,13 +426,12 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list& m
fclose(fptr);
}
-// static
bool LLLogChat::historyThreadsFinished(LLUUID session_id)
{
LLMutexLock lock(historyThreadsMutex());
bool finished = true;
- std::map::iterator it = sLoadHistoryThreads.find(session_id);
- if (it != sLoadHistoryThreads.end())
+ std::map::iterator it = mLoadHistoryThreads.find(session_id);
+ if (it != mLoadHistoryThreads.end())
{
finished = it->second->isFinished();
}
@@ -430,95 +439,93 @@ bool LLLogChat::historyThreadsFinished(LLUUID session_id)
{
return false;
}
- std::map::iterator dit = sDeleteHistoryThreads.find(session_id);
- if (dit != sDeleteHistoryThreads.end())
+ std::map::iterator dit = mDeleteHistoryThreads.find(session_id);
+ if (dit != mDeleteHistoryThreads.end())
{
finished = finished && dit->second->isFinished();
}
return finished;
}
-// static
LLLoadHistoryThread* LLLogChat::getLoadHistoryThread(LLUUID session_id)
{
LLMutexLock lock(historyThreadsMutex());
- std::map::iterator it = sLoadHistoryThreads.find(session_id);
- if (it != sLoadHistoryThreads.end())
+ std::map::iterator it = mLoadHistoryThreads.find(session_id);
+ if (it != mLoadHistoryThreads.end())
{
return it->second;
}
return NULL;
}
-// static
LLDeleteHistoryThread* LLLogChat::getDeleteHistoryThread(LLUUID session_id)
{
LLMutexLock lock(historyThreadsMutex());
- std::map::iterator it = sDeleteHistoryThreads.find(session_id);
- if (it != sDeleteHistoryThreads.end())
+ std::map::iterator it = mDeleteHistoryThreads.find(session_id);
+ if (it != mDeleteHistoryThreads.end())
{
return it->second;
}
return NULL;
}
-// static
bool LLLogChat::addLoadHistoryThread(LLUUID& session_id, LLLoadHistoryThread* lthread)
{
LLMutexLock lock(historyThreadsMutex());
- std::map::const_iterator it = sLoadHistoryThreads.find(session_id);
- if (it != sLoadHistoryThreads.end())
+ std::map::const_iterator it = mLoadHistoryThreads.find(session_id);
+ if (it != mLoadHistoryThreads.end())
{
return false;
}
- sLoadHistoryThreads[session_id] = lthread;
+ mLoadHistoryThreads[session_id] = lthread;
return true;
}
-// static
bool LLLogChat::addDeleteHistoryThread(LLUUID& session_id, LLDeleteHistoryThread* dthread)
{
LLMutexLock lock(historyThreadsMutex());
- std::map::const_iterator it = sDeleteHistoryThreads.find(session_id);
- if (it != sDeleteHistoryThreads.end())
+ std::map::const_iterator it = mDeleteHistoryThreads.find(session_id);
+ if (it != mDeleteHistoryThreads.end())
{
return false;
}
- sDeleteHistoryThreads[session_id] = dthread;
+ mDeleteHistoryThreads[session_id] = dthread;
return true;
}
-// static
void LLLogChat::cleanupHistoryThreads()
{
LLMutexLock lock(historyThreadsMutex());
std::vector uuids;
- std::map::iterator lit = sLoadHistoryThreads.begin();
- for (; lit != sLoadHistoryThreads.end(); lit++)
+ std::map::iterator lit = mLoadHistoryThreads.begin();
+ for (; lit != mLoadHistoryThreads.end(); lit++)
{
- if (lit->second->isFinished() && sDeleteHistoryThreads[lit->first]->isFinished())
+ if (lit->second->isFinished() && mDeleteHistoryThreads[lit->first]->isFinished())
{
delete lit->second;
- delete sDeleteHistoryThreads[lit->first];
+ delete mDeleteHistoryThreads[lit->first];
uuids.push_back(lit->first);
}
}
std::vector