From cbe4cac78cf48cb9144dc2f6c194585cff87a1ce Mon Sep 17 00:00:00 2001
From: Rider Linden <rider@lindenlab.com>
Date: Tue, 6 Mar 2018 14:58:39 -0800
Subject: Settings type inventory objects and upload the assests.

---
 indra/llappearance/llwearabletype.cpp             |   8 +-
 indra/llappearance/llwearabletype.h               |  13 +--
 indra/llinventory/CMakeLists.txt                  |   2 +
 indra/llinventory/llinventorydefines.h            |  11 +--
 indra/llinventory/llinventorysettings.cpp         | 110 ++++++++++++++++++++++
 indra/llinventory/llinventorysettings.h           |  24 +++--
 indra/llinventory/llinventorytype.cpp             |   1 -
 indra/llinventory/llinventorytype.h               |   2 +
 indra/llinventory/llinvtranslationbrdg.h          |  41 ++++++++
 indra/llinventory/llsettingsbase.h                |   2 +-
 indra/llinventory/llsettingsdaycycle.cpp          |   2 +
 indra/llinventory/llsettingsdaycycle.h            |   2 +-
 indra/llinventory/llsettingssky.h                 |   2 +-
 indra/llinventory/llsettingswater.h               |   2 +-
 indra/newview/llappviewer.cpp                     |   4 +-
 indra/newview/llfloaterbuy.cpp                    |   2 +-
 indra/newview/llfloaterbuycontents.cpp            |   2 +-
 indra/newview/llinventorybridge.cpp               |  50 ++++++++++
 indra/newview/llinventorybridge.h                 |  22 +++++
 indra/newview/llinventoryicon.cpp                 |  15 ++-
 indra/newview/llinventoryicon.h                   |   1 +
 indra/newview/llsettingsvo.cpp                    |  11 ++-
 indra/newview/llviewerinventory.cpp               |   2 +-
 indra/newview/llviewerinventory.h                 |   2 +-
 indra/newview/llviewerregion.cpp                  |   2 -
 indra/newview/llviewertexteditor.cpp              |   4 +-
 indra/newview/skins/default/textures/textures.xml |   6 ++
 27 files changed, 297 insertions(+), 48 deletions(-)
 create mode 100644 indra/llinventory/llinventorysettings.cpp
 create mode 100644 indra/llinventory/llinvtranslationbrdg.h

(limited to 'indra')

diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp
index 207e0c4011..85d3caecce 100644
--- a/indra/llappearance/llwearabletype.cpp
+++ b/indra/llappearance/llwearabletype.cpp
@@ -29,17 +29,17 @@
 #include "llinventorytype.h"
 #include "llinventorydefines.h"
 
-static LLTranslationBridge* sTrans = NULL;
+static LLTranslationBridge::ptr_t sTrans = NULL;
 
 // static
-void LLWearableType::initClass(LLTranslationBridge* trans)
+void LLWearableType::initClass(LLTranslationBridge::ptr_t &trans)
 {
 	sTrans = trans;
 }
 
 void LLWearableType::cleanupClass()
 {
-	delete sTrans;
+	sTrans.reset();
 }
 
 struct WearableEntry : public LLDictionaryEntry
@@ -172,6 +172,6 @@ BOOL LLWearableType::getAllowMultiwear(LLWearableType::EType type)
 // static
 LLWearableType::EType LLWearableType::inventoryFlagsToWearableType(U32 flags)
 {
-    return  (LLWearableType::EType)(flags & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
+    return  (LLWearableType::EType)(flags & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK);
 }
 
diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h
index 519d5b92a2..74eb904c8d 100644
--- a/indra/llappearance/llwearabletype.h
+++ b/indra/llappearance/llwearabletype.h
@@ -31,16 +31,7 @@
 #include "lldictionary.h"
 #include "llinventorytype.h"
 #include "llsingleton.h"
-
-class LLTranslationBridge
-{
-public:
-	// clang needs this to be happy
-	virtual ~LLTranslationBridge() {}
-
-	virtual std::string getString(const std::string &xml_desc) = 0;
-};
-
+#include "llinvtranslationbrdg.h"
 
 class LLWearableType
 {
@@ -69,7 +60,7 @@ public:
 		WT_NONE		  = -1,
 	};
 
-	static void			initClass(LLTranslationBridge* trans); // initializes static members
+	static void			initClass(LLTranslationBridge::ptr_t &trans); // initializes static members
 	static void			cleanupClass(); // initializes static members
 
 	static const std::string& 			getTypeName(EType type);
diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt
index 2d40dd6443..f1bc28427d 100644
--- a/indra/llinventory/CMakeLists.txt
+++ b/indra/llinventory/CMakeLists.txt
@@ -23,6 +23,7 @@ set(llinventory_SOURCE_FILES
     llfoldertype.cpp
     llinventory.cpp
     llinventorydefines.cpp
+    llinventorysettings.cpp
     llinventorytype.cpp
     lllandmark.cpp
     llnotecard.cpp
@@ -47,6 +48,7 @@ set(llinventory_HEADER_FILES
     llinventorydefines.h
     llinventorysettings.h
     llinventorytype.h
+    llinvtranslationbrdg.h
     lllandmark.h
     llnotecard.h
     llparcel.h
diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h
index b420e98ecb..54562673f3 100644
--- a/indra/llinventory/llinventorydefines.h
+++ b/indra/llinventory/llinventorydefines.h
@@ -81,13 +81,10 @@ public:
 		II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS			= 0x200000,
 			// Whether a returned object is composed of multiple items.
 
-		II_FLAGS_WEARABLES_MASK = 0xff,
-			// Wearables use the low order byte of flags to store the
-			// LLWearableType::EType enumeration found in newview/llwearable.h
-			// 
-        II_FLAGS_SETTINGS_MASK                      = 0x0000ff,
-            // Settings (like wearables) use the low order byte of flags to store 
-            // the settings type 
+		II_FLAGS_SUBTYPE_MASK                       = 0x0000ff,
+			// Some items like Wearables and settings use the low order byte 
+			// of flags to store the sub type of the inventory item.
+			// see LLWearableType::EType enumeration found in newview/llwearable.h
 
 		II_FLAGS_PERM_OVERWRITE_MASK = 				(II_FLAGS_OBJECT_SLAM_PERM |
 													 II_FLAGS_OBJECT_SLAM_SALE |
diff --git a/indra/llinventory/llinventorysettings.cpp b/indra/llinventory/llinventorysettings.cpp
new file mode 100644
index 0000000000..0928e35e95
--- /dev/null
+++ b/indra/llinventory/llinventorysettings.cpp
@@ -0,0 +1,110 @@
+/**
+* @file llinventorysettings.cpp
+* @author optional
+* @brief A base class for asset based settings groups.
+*
+* $LicenseInfo:2011&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2017, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* $/LicenseInfo$
+*/
+
+#include "linden_common.h"
+#include "llinventorysettings.h"
+#include "llinventorytype.h"
+#include "llinventorydefines.h"
+#include "lldictionary.h"
+#include "llsingleton.h"
+#include "llinvtranslationbrdg.h"
+
+//=========================================================================
+namespace {
+    LLTranslationBridge::ptr_t sTranslator;
+}
+
+//=========================================================================
+struct SettingsEntry : public LLDictionaryEntry
+{
+    SettingsEntry(const std::string &name,
+        const std::string& default_new_name,
+        LLInventoryType::EIconName iconName) :
+        LLDictionaryEntry(name),
+        mDefaultNewName(default_new_name),
+        mLabel(name),
+        mIconName(iconName)
+    {
+        std::string transdname = sTranslator->getString(mLabel);
+        if (!transdname.empty())
+        {
+            mLabel = transdname;
+        }
+    }
+
+    std::string mLabel;
+    std::string mDefaultNewName; //keep mLabel for backward compatibility
+    LLInventoryType::EIconName mIconName;
+};
+
+class LLSettingsDictionary : public LLSingleton<LLSettingsDictionary>,
+    public LLDictionary<LLSettingsType::type_e, SettingsEntry>
+{
+    LLSINGLETON(LLSettingsDictionary);
+
+    void initSingleton() override;
+};
+
+LLSettingsDictionary::LLSettingsDictionary() 
+{
+}
+
+void LLSettingsDictionary::initSingleton()
+{
+    addEntry(LLSettingsType::ST_SKY,        new SettingsEntry("sky",        "New Sky",      LLInventoryType::ICONNAME_SETTINGS_SKY));
+    addEntry(LLSettingsType::ST_WATER,      new SettingsEntry("water",      "New Water",    LLInventoryType::ICONNAME_SETTINGS_WATER));
+    addEntry(LLSettingsType::ST_DAYCYCLE,   new SettingsEntry("day",        "New Day",      LLInventoryType::ICONNAME_SETTINGS_DAY));
+    addEntry(LLSettingsType::ST_NONE,       new SettingsEntry("none",       "New Settings", LLInventoryType::ICONNAME_SETTINGS));
+    addEntry(LLSettingsType::ST_INVALID,    new SettingsEntry("invalid",    "New Settings", LLInventoryType::ICONNAME_SETTINGS));
+}
+
+//=========================================================================
+
+LLSettingsType::type_e LLSettingsType::fromInventoryFlags(U32 flags)
+{
+    return  (LLSettingsType::type_e)(flags & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK);
+}
+
+
+LLInventoryType::EIconName LLSettingsType::getIconName(LLSettingsType::type_e type)
+{
+    const SettingsEntry *entry = LLSettingsDictionary::instance().lookup(type);
+    if (!entry) 
+        return getIconName(ST_INVALID);
+    return entry->mIconName;
+}
+
+
+void LLSettingsType::initClass(LLTranslationBridge::ptr_t &trans)
+{
+    sTranslator = trans;
+}
+
+void LLSettingsType::cleanupClass()
+{
+    sTranslator.reset();
+}
diff --git a/indra/llinventory/llinventorysettings.h b/indra/llinventory/llinventorysettings.h
index 0d15542fec..fb08190ea9 100644
--- a/indra/llinventory/llinventorysettings.h
+++ b/indra/llinventory/llinventorysettings.h
@@ -28,15 +28,27 @@
 #ifndef LL_INVENTORY_SETTINGS_H
 #define LL_INVENTORY_SETTINGS_H
 
+#include "llinventorytype.h"
+#include "llinvtranslationbrdg.h"
 
-enum class LLSettingsType
+class LLSettingsType
 {
-    ST_SKY = 0,
-    ST_WATER = 1,
-    ST_DAYCYCLE = 2,
+public:
+    enum type_e
+    {
+        ST_SKY = 0,
+        ST_WATER = 1,
+        ST_DAYCYCLE = 2,
 
-    ST_INVALID = 255,
-    ST_NONE = -1
+        ST_INVALID = 255,
+        ST_NONE = -1
+    };
+
+    static type_e fromInventoryFlags(U32 flags);
+    static LLInventoryType::EIconName getIconName(type_e type);
+
+    static void initClass(LLTranslationBridge::ptr_t &trans);
+    static void cleanupClass();
 };
 
 
diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp
index 20c0a12d9e..2b6b53556d 100644
--- a/indra/llinventory/llinventorytype.cpp
+++ b/indra/llinventory/llinventorytype.cpp
@@ -203,7 +203,6 @@ bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type)
 	{
 		case IT_CALLINGCARD:
 		case IT_LANDMARK:
-        case IT_SETTINGS:
 			return true;
 		default:
 			return false;
diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
index a45bcc364e..86486373b5 100644
--- a/indra/llinventory/llinventorytype.h
+++ b/indra/llinventory/llinventorytype.h
@@ -111,8 +111,10 @@ public:
 		ICONNAME_LINKFOLDER,
 		ICONNAME_MESH,
 
+        ICONNAME_SETTINGS,
         ICONNAME_SETTINGS_SKY,
         ICONNAME_SETTINGS_WATER,
+        ICONNAME_SETTINGS_DAY,
 
 		ICONNAME_INVALID,
 		ICONNAME_COUNT,
diff --git a/indra/llinventory/llinvtranslationbrdg.h b/indra/llinventory/llinvtranslationbrdg.h
new file mode 100644
index 0000000000..fbd887030a
--- /dev/null
+++ b/indra/llinventory/llinvtranslationbrdg.h
@@ -0,0 +1,41 @@
+/**
+* @file llinvtranslationbrdg.h
+* @brief Translation adapter for inventory.
+*
+* $LicenseInfo:firstyear=2002&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2010, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* $/LicenseInfo$
+*/
+
+#ifndef LL_TRANSLATIONBRDG_H
+#define LL_TRANSLATIONBRDG_H
+
+class LLTranslationBridge
+{
+public:
+    typedef std::shared_ptr<LLTranslationBridge>    ptr_t;
+
+    // clang needs this to be happy
+    virtual ~LLTranslationBridge() {}
+
+    virtual std::string getString(const std::string &xml_desc) = 0;
+};
+
+#endif
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index c7ed9e9e21..62a88cde73 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -68,7 +68,7 @@ public:
     //---------------------------------------------------------------------
     virtual std::string getSettingType() const = 0;
 
-    virtual LLSettingsType getSettingTypeValue() const = 0;
+    virtual LLSettingsType::type_e getSettingTypeValue() const = 0;
 
     //---------------------------------------------------------------------
     // Settings status 
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 18add703cb..f236398ccd 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -127,6 +127,8 @@ LLSD LLSettingsDay::getSettings() const
     if (mSettings.has(SETTING_ID))
         settings[SETTING_ID] = mSettings[SETTING_ID];
 
+    settings[SETTING_TYPE] = getSettingType();
+
     std::map<std::string, LLSettingsBase::ptr_t> in_use;
 
     LLSD tracks(LLSD::emptyArray());
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index 2d0fa4a840..da572572c4 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -72,7 +72,7 @@ public:
 
     virtual ptr_t               buildClone() = 0;
     virtual LLSD                getSettings() const override;
-    virtual LLSettingsType      getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; }
+    virtual LLSettingsType::type_e  getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; }
 
 
     //---------------------------------------------------------------------
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 3c6dbdb76d..8b2118fd84 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -73,7 +73,7 @@ public:
 
     //---------------------------------------------------------------------
     virtual std::string getSettingType() const override { return std::string("sky"); }
-    virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_SKY; }
+    virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_SKY; }
 
 
     // Settings status 
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index d4152acfa1..92190fa7b1 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -58,7 +58,7 @@ public:
 
     //---------------------------------------------------------------------
     virtual std::string     getSettingType() const override { return std::string("water"); }
-    virtual LLSettingsType  getSettingTypeValue() const override { return LLSettingsType::ST_WATER; }
+    virtual LLSettingsType::type_e  getSettingTypeValue() const override { return LLSettingsType::ST_WATER; }
 
     // Settings status 
     virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 32aad191d3..f42c8e5c47 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -764,7 +764,9 @@ bool LLAppViewer::init()
 
 	// initialize LLWearableType translation bridge.
 	// Memory will be cleaned up in ::cleanupClass()
-	LLWearableType::initClass(new LLUITranslationBridge());
+    LLTranslationBridge::ptr_t trans = std::make_shared<LLUITranslationBridge>();
+	LLWearableType::initClass(trans);
+    LLSettingsType::initClass(trans);
 
 	// initialize SSE options
 	LLVector4a::initClass();
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index 5a9cdbba44..4d3ebcda1e 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -241,7 +241,7 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
 		BOOL item_is_multi = FALSE;
 		if (( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
 			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
-			&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK))
+            && !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK))
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 4607b4ac41..440ec06c4e 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -216,7 +216,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 		BOOL item_is_multi = FALSE;
 		if ((inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
 			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
-			&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK))
+            && !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK))
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 904bc29929..9da987daff 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1410,6 +1410,14 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			//LL_WARNS() << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << LL_ENDL;
 			break;
 
+        case LLAssetType::AT_SETTINGS:
+            if (inv_type != LLInventoryType::IT_SETTINGS)
+            {
+                LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL;
+            }
+            new_listener = new LLSettingsBridge(inventory, root, uuid, LLSettingsType::fromInventoryFlags(flags));
+            break;
+
 		default:
 			LL_INFOS() << "Unhandled asset type (llassetstorage.h): "
 					<< (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << LL_ENDL;
@@ -6837,6 +6845,48 @@ void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	hide_context_entries(menu, items, disabled_items);
 }
 
+// +=================================================+
+// |        LLSettingsBridge                             |
+// +=================================================+
+
+LLSettingsBridge::LLSettingsBridge(LLInventoryPanel* inventory,
+        LLFolderView* root,
+        const LLUUID& uuid,
+        LLSettingsType::type_e settings_type):
+    LLItemBridge(inventory, root, uuid),
+    mSettingsType(settings_type)
+{
+}
+
+LLUIImagePtr LLSettingsBridge::getIcon() const
+{
+    return LLInventoryIcon::getIcon(LLAssetType::AT_SETTINGS, LLInventoryType::IT_SETTINGS, mSettingsType, FALSE);
+}
+
+void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action)
+{
+    LLItemBridge::performAction(model, action);
+}
+
+void LLSettingsBridge::openItem()
+{
+    LLItemBridge::openItem();
+}
+
+void LLSettingsBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+    LLItemBridge::buildContextMenu(menu, flags);
+}
+
+std::string LLSettingsBridge::getLabelSuffix() const
+{
+    return LLItemBridge::getLabelSuffix();
+}
+
+BOOL LLSettingsBridge::renameItem(const std::string& new_name)
+{
+    return LLItemBridge::renameItem(new_name);
+}
 
 // +=================================================+
 // |        LLLinkBridge                             |
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index fd532c609c..dbffa1e2ef 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -38,6 +38,7 @@
 #include "lltooldraganddrop.h"
 #include "lllandmarklist.h"
 #include "llfolderviewitem.h"
+#include "llsettingsbase.h"
 
 class LLInventoryFilter;
 class LLInventoryPanel;
@@ -136,6 +137,7 @@ public:
 							std::string& tooltip_msg) { return FALSE; }
 	virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
 	virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
+    virtual LLSettingsType::type_e getSettingsType() const { return LLSettingsType::ST_NONE; }
         EInventorySortGroup getSortGroup()  const { return SG_ITEM; }
 	virtual LLInventoryObject* getInventoryObject() const;
 
@@ -605,6 +607,26 @@ protected:
 };
 
 
+class LLSettingsBridge : public LLItemBridge
+{
+public:
+    LLSettingsBridge(LLInventoryPanel* inventory,
+        LLFolderView* root,
+        const LLUUID& uuid,
+        LLSettingsType::type_e settings_type);
+    virtual LLUIImagePtr getIcon() const;
+    virtual void	performAction(LLInventoryModel* model, std::string action);
+    virtual void	openItem();
+    virtual void	buildContextMenu(LLMenuGL& menu, U32 flags);
+    virtual std::string getLabelSuffix() const;
+    virtual BOOL renameItem(const std::string& new_name);
+    virtual LLSettingsType::type_e getSettingsType() const { return mSettingsType; }
+
+
+protected:
+    LLSettingsType::type_e mSettingsType;
+};
+
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInvFVBridgeAction
 //
diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp
index 64b48228f6..106e5fd415 100644
--- a/indra/newview/llinventoryicon.cpp
+++ b/indra/newview/llinventoryicon.cpp
@@ -34,6 +34,7 @@
 #include "llui.h"
 #include "lluiimage.h"
 #include "llwearabletype.h"
+#include "llinventorysettings.h"
 
 struct IconEntry : public LLDictionaryEntry
 {
@@ -92,8 +93,10 @@ LLIconDictionary::LLIconDictionary()
 	addEntry(LLInventoryType::ICONNAME_LINKFOLDER, 				new IconEntry("Inv_LinkFolder"));
 	addEntry(LLInventoryType::ICONNAME_MESH,	 				new IconEntry("Inv_Mesh"));
 
-    addEntry(LLInventoryType::ICONNAME_SETTINGS_SKY,            new IconEntry("Inv_SettingSky"));
-    addEntry(LLInventoryType::ICONNAME_SETTINGS_WATER,          new IconEntry("Inv_SettingWater"));
+    addEntry(LLInventoryType::ICONNAME_SETTINGS_SKY,            new IconEntry("Inv_SettingsSky"));
+    addEntry(LLInventoryType::ICONNAME_SETTINGS_WATER,          new IconEntry("Inv_SettingsWater"));
+    addEntry(LLInventoryType::ICONNAME_SETTINGS_DAY,            new IconEntry("Inv_SettingsDay"));
+    addEntry(LLInventoryType::ICONNAME_SETTINGS,                new IconEntry("Inv_Settings"));
 
 	addEntry(LLInventoryType::ICONNAME_INVALID, 				new IconEntry("Inv_Invalid"));
 
@@ -172,7 +175,7 @@ const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type,
             break;
         case LLAssetType::AT_SETTINGS:
             // TODO: distinguish between Sky and Water settings.
-            idx = LLInventoryType::ICONNAME_SETTINGS_SKY;
+            idx = assignSettingsIcon(misc_flag);
             break;
 		default:
 			break;
@@ -193,3 +196,9 @@ LLInventoryType::EIconName LLInventoryIcon::assignWearableIcon(U32 misc_flag)
 	const LLWearableType::EType wearable_type = LLWearableType::inventoryFlagsToWearableType(misc_flag);
 	return LLWearableType::getIconName(wearable_type);
 }
+
+LLInventoryType::EIconName LLInventoryIcon::assignSettingsIcon(U32 misc_flag)
+{
+    LLSettingsType::type_e settings_type = LLSettingsType::fromInventoryFlags(misc_flag);
+    return LLSettingsType::getIconName(settings_type);
+}
diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h
index bc09e32087..b8637c4e33 100644
--- a/indra/newview/llinventoryicon.h
+++ b/indra/newview/llinventoryicon.h
@@ -48,6 +48,7 @@ public:
 
 protected:
 	static LLInventoryType::EIconName assignWearableIcon(U32 misc_flag);
+    static LLInventoryType::EIconName assignSettingsIcon(U32 misc_flag);
 };
 #endif // LL_LLINVENTORYICON_H
 
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 14530715df..57dabca2f5 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -1,5 +1,5 @@
 /**
-* @file llsettingsvo.cpp
+* @file llvo.cpp
 * @author Rider Linden
 * @brief Subclasses for viewer specific settings behaviors.
 *
@@ -167,7 +167,7 @@ void LLSettingsVOBase::onSaveNewAssetComplete(const LLUUID& new_asset_id, const
 void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings)
 {
     LLTransactionID tid;
-    LLUUID          parentFolder = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
+    LLUUID          parentFolder; //= gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
     U32             nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner();
 
     tid.generate();
@@ -237,6 +237,9 @@ void LLSettingsVOBase::uploadSettingsAsset(const LLSettingsBase::ptr_t &settings
 
     std::stringstream buffer;
     LLSD settingdata(settings->getSettings());
+
+    LL_WARNS("LAPRAS") << "Sending '" << settingdata << "' for asset." << LL_ENDL;
+
     LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION);
 
     LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(object_id, inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(),
@@ -765,7 +768,6 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n
         return LLSettingsDay::ptr_t();
     }
 
-
     LLSettingsDay::ptr_t dayp = std::make_shared<LLSettingsVODay>(newsettings);
 
 #ifdef VERIFY_LEGACY_CONVERSION
@@ -820,7 +822,8 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID &regio
     LLSD newsettings = LLSDMap
         ( SETTING_NAME, "Region (legacy)" )
         ( SETTING_TRACKS, LLSDArray(watertrack)(skytrack))
-        ( SETTING_FRAMES, frames );
+        ( SETTING_FRAMES, frames )
+        ( SETTING_TYPE, "daycycle" );
 
     LL_WARNS("LAPRAS") << "newsettings=" << newsettings << LL_ENDL;
 
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index d6f48a4c55..f5c08a4b0f 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1166,7 +1166,7 @@ void create_inventory_settings(const LLUUID& agent_id, const LLUUID& session_id,
     const LLUUID& parent, const LLTransactionID& transaction_id,
     const std::string& name,
     const std::string& desc, 
-    LLSettingsType settype,
+    LLSettingsType::type_e settype,
     U32 next_owner_perm,
     LLPointer<LLInventoryCallback> cb)
 {
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index b89ed42829..be100a764a 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -359,7 +359,7 @@ void create_inventory_wearable(const LLUUID& agent_id, const LLUUID& session_id,
 void create_inventory_settings(const LLUUID& agent_id, const LLUUID& session_id,
     const LLUUID& parent, const LLTransactionID& transaction_id,
     const std::string& name, const std::string& desc, 
-    LLSettingsType settype, 
+    LLSettingsType::type_e settype, 
     U32 next_owner_perm, LLPointer<LLInventoryCallback> cb);
 
 
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 1520ef7a2f..fa57b5a9b8 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2895,8 +2895,6 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
 	capabilityNames.append("UpdateGestureTaskInventory");
 	capabilityNames.append("UpdateNotecardAgentInventory");
 	capabilityNames.append("UpdateNotecardTaskInventory");
-    capabilityNames.append("UpdateSettingsAgentInventory");
-    capabilityNames.append("UpdateSettingsTaskInventory");
 	capabilityNames.append("UpdateScriptAgent");
 	capabilityNames.append("UpdateScriptTask");
     capabilityNames.append("UpdateSettingsAgentInventory");
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 7d2d6e25c7..f860e3bbbe 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -540,7 +540,9 @@ LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const
 			case LLAssetType::AT_ANIMATION:		img_name = "Inv_Animation";	break;
 			case LLAssetType::AT_GESTURE:		img_name = "Inv_Gesture";	break;
 			case LLAssetType::AT_MESH:      	img_name = "Inv_Mesh";	    break;
-			default:                        	img_name = "Inv_Invalid";   break; // use the Inv_Invalid icon for undefined object types (see MAINT-3981)
+            case LLAssetType::AT_SETTINGS:      img_name = "Inv_Settings"; break;
+			default:                        	img_name = "Inv_Invalid";  break; // use the Inv_Invalid icon for undefined object types (see MAINT-3981)
+
 		}
 
 		return LLUI::getUIImage(img_name);
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index d757e39366..a16b1a68ad 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -323,6 +323,12 @@ with the same filename but different name
   <texture name="Inv_Underpants" file_name="icons/Inv_Underpants.png" preload="false" />
   <texture name="Inv_Undershirt" file_name="icons/Inv_Undershirt.png" preload="false" />
   <texture name="Inv_Link" file_name="icons/Inv_Link.png" preload="false" />
+
+  <texture name="Inv_Settings" file_name="icons/Inv_Settings.png" preload="false" />
+  <texture name="Inv_SettingsSky" file_name="icons/Inv_SettingsSky.png" preload="false" />
+  <texture name="Inv_SettingsWater" file_name="icons/Inv_SettingsWater.png" preload="false" />
+  <texture name="Inv_SettingsDay" file_name="icons/Inv_SettingsDay.png" preload="false" />
+
   <texture name="Inv_Invalid" file_name="icons/Inv_Invalid.png" preload="false" />
   <texture name="Inv_VersionFolderClosed" file_name="icons/Inv_VersionFolderClosed.png" preload="false" />
   <texture name="Inv_VersionFolderOpen" file_name="icons/Inv_VersionFolderOpen.png" preload="false" />
-- 
cgit v1.2.3