From f71247ea542805819b82640759e1f44fd0599e7f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 26 Nov 2014 18:03:36 -0500 Subject: STORM-2082 Code now fills combobox --- indra/newview/llfloaterpreference.cpp | 11 ++++++++++- indra/newview/llpresetsmanager.cpp | 19 ++++++++++++------- indra/newview/llpresetsmanager.h | 6 ++++-- 3 files changed, 26 insertions(+), 10 deletions(-) (limited to 'indra/newview') 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 preset_names; + LLPresetsManager::getInstance()->getPresetNames(preset_names); + + for (std::list::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 +#include class LLPresetsManager : public LLSingleton { @@ -35,7 +36,8 @@ public: typedef std::list preset_name_list_t; typedef boost::signals2::signal 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(); -- cgit v1.2.3