diff options
author | Jonathan Yap <jhwelch@gmail.com> | 2014-11-26 18:03:36 -0500 |
---|---|---|
committer | Jonathan Yap <jhwelch@gmail.com> | 2014-11-26 18:03:36 -0500 |
commit | f71247ea542805819b82640759e1f44fd0599e7f (patch) | |
tree | eba9a1311c584acb6e860862bd0b955dd3f4cdee /indra/newview | |
parent | 78060b7fd2688b113917b58dea25b072779ac4f6 (diff) |
STORM-2082 Code now fills combobox
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterpreference.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llpresetsmanager.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llpresetsmanager.h | 6 |
3 files changed, 26 insertions, 10 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index cea17aeef4..39f37f4e50 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2117,9 +2117,18 @@ BOOL LLPanelPreferenceGraphics::postBuild() graphic_preset->setLabel(getString("graphic_preset_combo_label")); std::string presets_dir = LLPresetsManager::getGraphicPresetsDir(); + if (!presets_dir.empty()) { - LLPresetsManager::getInstance()->getPresetsFromDir(presets_dir); + LLPresetsManager::getInstance()->loadPresetsFromDir(presets_dir); + std::list<std::string> preset_names; + LLPresetsManager::getInstance()->getPresetNames(preset_names); + + for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) + { + const std::string& name = *it; + graphic_preset->add(name, LLSD().with(0, name)); + } } else { LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 6ebb111be1..d97e9312e2 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -53,12 +53,12 @@ std::string LLPresetsManager::getUserDir(const std::string& subdirectory) if (!gDirUtilp->fileExists(presets_path)) { LLFile::mkdir(presets_path); + } - full_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR, subdirectory); - if (!gDirUtilp->fileExists(full_path)) - { - LLFile::mkdir(full_path); - } + full_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR, subdirectory); + if (!gDirUtilp->fileExists(full_path)) + { + LLFile::mkdir(full_path); } return full_path; @@ -69,7 +69,13 @@ std::string LLPresetsManager::getGraphicPresetsDir() return getUserDir(GRAPHIC_DIR); } -void LLPresetsManager::getPresetsFromDir(const std::string& dir) +void LLPresetsManager::getPresetNames(preset_name_list_t& presets) const +{ + presets = mPresetNames; + +} + +void LLPresetsManager::loadPresetsFromDir(const std::string& dir) { LL_INFOS("AppInit") << "Loading presets from " << dir << LL_ENDL; @@ -87,7 +93,6 @@ void LLPresetsManager::getPresetsFromDir(const std::string& dir) std::string path = gDirUtilp->add(dir, file); std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); mPresetNames.push_back(name); -llwarns << "DBG " << name << llendl; } } diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 2d6dd4fd1b..b9a79a7736 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -28,6 +28,7 @@ #define LL_PRESETSMANAGER_H #include <list> +#include <map> class LLPresetsManager : public LLSingleton<LLPresetsManager> { @@ -35,7 +36,8 @@ public: typedef std::list<std::string> preset_name_list_t; typedef boost::signals2::signal<void()> preset_list_signal_t; - void getPresetsFromDir(const std::string& dir); + void getPresetNames(preset_name_list_t& presets) const; + void loadPresetsFromDir(const std::string& dir); void savePreset(const std::string & name); static std::string getGraphicPresetsDir(); bool removeParamSet(const std::string& name, bool delete_from_disk); @@ -45,7 +47,7 @@ public: preset_name_list_t mPresetNames; -private: +//protected: LLPresetsManager(); ~LLPresetsManager(); |