summaryrefslogtreecommitdiff
path: root/indra/newview/llwaterparammanager.cpp
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-09 16:38:51 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-09 16:38:51 +0300
commit173b9d11c41d32c52c4cd64c23e0a5b0f3ef09fc (patch)
tree28284995c0e607d13071411c7fd7e0c1b2d6e180 /indra/newview/llwaterparammanager.cpp
parent58e8ee5f9169818894f34bf1bfdd4efe46482e37 (diff)
STORM-1254 WIP Implemented created and editing local water presets.
Diffstat (limited to 'indra/newview/llwaterparammanager.cpp')
-rw-r--r--indra/newview/llwaterparammanager.cpp45
1 files changed, 34 insertions, 11 deletions
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 5df807f740..d1e0c4c109 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -387,6 +387,7 @@ bool LLWaterParamManager::addParamSet(const std::string& name, LLWaterParamSet&
if(mIt == mParamList.end())
{
mParamList[name] = param;
+ mPresetListChangeSignal();
return true;
}
@@ -395,17 +396,9 @@ bool LLWaterParamManager::addParamSet(const std::string& name, LLWaterParamSet&
BOOL LLWaterParamManager::addParamSet(const std::string& name, LLSD const & param)
{
- // add a new one if not one there already
- std::map<std::string, LLWaterParamSet>::const_iterator finder = mParamList.find(name);
- if(finder == mParamList.end())
- {
- mParamList[name].setAll(param);
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ LLWaterParamSet param_set;
+ param_set.setAll(param);
+ return addParamSet(name, param_set);
}
bool LLWaterParamManager::getParamSet(const std::string& name, LLWaterParamSet& param)
@@ -422,6 +415,12 @@ bool LLWaterParamManager::getParamSet(const std::string& name, LLWaterParamSet&
return false;
}
+bool LLWaterParamManager::hasParamSet(const std::string& name)
+{
+ LLWaterParamSet dummy;
+ return getParamSet(name, dummy);
+}
+
bool LLWaterParamManager::setParamSet(const std::string& name, LLWaterParamSet& param)
{
mParamList[name] = param;
@@ -465,9 +464,21 @@ bool LLWaterParamManager::removeParamSet(const std::string& name, bool delete_fr
gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml");
}
+ mPresetListChangeSignal();
return true;
}
+bool LLWaterParamManager::isSystemPreset(const std::string& preset_name)
+{
+ // *TODO: file system access is excessive here.
+ return gDirUtilp->fileExists(getSysDir() + LLURI::escape(preset_name) + ".xml");
+}
+
+boost::signals2::connection LLWaterParamManager::setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb)
+{
+ return mPresetListChangeSignal.connect(cb);
+}
+
F32 LLWaterParamManager::getFogDensity(void)
{
bool err;
@@ -493,3 +504,15 @@ void LLWaterParamManager::initSingleton()
loadAllPresets(LLStringUtil::null);
applyUserPrefs(false);
}
+
+// static
+std::string LLWaterParamManager::getSysDir()
+{
+ return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "");
+}
+
+// static
+std::string LLWaterParamManager::getUserDir()
+{
+ return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "windlight/water", "");
+}