summaryrefslogtreecommitdiff
path: root/indra/llappearance
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2019-11-13 16:46:27 -0700
committerDave Houlton <euclid@lindenlab.com>2019-11-13 16:46:27 -0700
commitdc1453af9c474c67749aded576c11dff3afdd444 (patch)
treebff4d5bfca6eb036339c30429ef08704d0bb68cb /indra/llappearance
parent3dfdb2f6e8be4fb2a08102847520585dc1d8fd7d (diff)
parent78bdf57ad6610b34389226bf941ba736ca0c2225 (diff)
Merge in from viewer-release 6.3.5
Diffstat (limited to 'indra/llappearance')
-rw-r--r--indra/llappearance/llwearabletype.cpp37
-rw-r--r--indra/llappearance/llwearabletype.h18
2 files changed, 34 insertions, 21 deletions
diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp
index 5b33c829e0..0aa2ff7bd8 100644
--- a/indra/llappearance/llwearabletype.cpp
+++ b/indra/llappearance/llwearabletype.cpp
@@ -29,18 +29,6 @@
#include "llinventorytype.h"
#include "llinventorydefines.h"
-static LLTranslationBridge::ptr_t sTrans = NULL;
-
-// static
-void LLWearableType::initClass(LLTranslationBridge::ptr_t &trans)
-{
- sTrans = trans;
-}
-
-void LLWearableType::cleanupClass()
-{
- sTrans.reset();
-}
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<LLWearableDictionary>,
+class LLWearableDictionary : public LLParamSingleton<LLWearableDictionary>,
public LLDictionary<LLWearableType::EType, WearableEntry>
{
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 17ff3a22a8..b87866286d 100644
--- a/indra/llappearance/llwearabletype.h
+++ b/indra/llappearance/llwearabletype.h
@@ -33,8 +33,12 @@
#include "llsingleton.h"
#include "llinvtranslationbrdg.h"
-class LLWearableType
+class LLWearableType : public LLParamSingleton<LLWearableType>
{
+ LLSINGLETON(LLWearableType, LLTranslationBridge* trans);
+ ~LLWearableType();
+ friend struct WearableEntry;
+ void initSingleton();
public:
enum EType
{
@@ -61,9 +65,8 @@ public:
WT_NONE = -1,
};
- static void initClass(LLTranslationBridge::ptr_t &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);
@@ -72,11 +75,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