diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatercamera.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloatercamerapresets.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llfloatersavecamerapreset.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llpanelpresetscamerapulldown.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llpanelpresetspulldown.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llpresetsmanager.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llpresetsmanager.h | 4 |
7 files changed, 54 insertions, 47 deletions
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index cf25e35f63..cc02862868 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -585,7 +585,7 @@ void LLFloaterCamera::fromFreeToPresets() void LLFloaterCamera::populatePresetCombo() { - LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, EDefaultOptions::DEFAULT_VIEWS_HIDE); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, EDefaultOptions::DEFAULT_HIDE); std::string active_preset_name = gSavedSettings.getString("PresetCameraActive"); if (active_preset_name.empty()) { diff --git a/indra/newview/llfloatercamerapresets.cpp b/indra/newview/llfloatercamerapresets.cpp index 75660e590a..300c945a85 100644 --- a/indra/newview/llfloatercamerapresets.cpp +++ b/indra/newview/llfloatercamerapresets.cpp @@ -55,13 +55,10 @@ void LLFloaterCameraPresets::populateList() mPresetList->clear(); LLPresetsManager* presetsMgr = LLPresetsManager::getInstance(); - std::string presets_dir = presetsMgr->getPresetsDir(PRESETS_CAMERA); std::list<std::string> preset_names; - presetsMgr->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_VIEWS_HIDE); - preset_names.push_back(PRESETS_FRONT_VIEW); - preset_names.push_back(PRESETS_REAR_VIEW); - preset_names.push_back(PRESETS_SIDE_VIEW); + presetsMgr->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_BOTTOM); + for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) { const std::string& name = *it; diff --git a/indra/newview/llfloatersavecamerapreset.cpp b/indra/newview/llfloatersavecamerapreset.cpp index bbc4b5e354..34aefdf1c1 100644 --- a/indra/newview/llfloatersavecamerapreset.cpp +++ b/indra/newview/llfloatersavecamerapreset.cpp @@ -84,7 +84,7 @@ void LLFloaterSaveCameraPreset::onOpen(const LLSD& key) index = key["index"].asInteger(); } - LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_HIDE); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM); mSaveRadioGroup->setSelectedIndex(index); onPresetNameEdited(); @@ -110,8 +110,7 @@ void LLFloaterSaveCameraPreset::onBtnSave() if (is_saving_new) { std::list<std::string> preset_names; - std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, preset_names, DEFAULT_HIDE); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_HIDE); if (std::find(preset_names.begin(), preset_names.end(), name) != preset_names.end()) { LLSD args; @@ -133,7 +132,7 @@ void LLFloaterSaveCameraPreset::onBtnSave() void LLFloaterSaveCameraPreset::onPresetsListChange() { - LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_HIDE); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, DEFAULT_BOTTOM); } void LLFloaterSaveCameraPreset::onBtnCancel() diff --git a/indra/newview/llpanelpresetscamerapulldown.cpp b/indra/newview/llpanelpresetscamerapulldown.cpp index ae3d182f09..fdf73e069e 100644 --- a/indra/newview/llpanelpresetscamerapulldown.cpp +++ b/indra/newview/llpanelpresetscamerapulldown.cpp @@ -79,8 +79,7 @@ BOOL LLPanelPresetsCameraPulldown::postBuild() void LLPanelPresetsCameraPulldown::populatePanel() { - std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_CAMERA); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_CAMERA, mPresetNames, DEFAULT_BOTTOM); LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_camera_list"); diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 0bbf1781a5..332fd9969d 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -72,8 +72,7 @@ BOOL LLPanelPresetsPulldown::postBuild() void LLPanelPresetsPulldown::populatePanel() { - std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(PRESETS_GRAPHIC, mPresetNames, DEFAULT_TOP); LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list"); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index eaf139b106..b1a94be68c 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -141,8 +141,12 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) return dest_path; } -void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option) +void LLPresetsManager::loadPresetNamesFromDir(const std::string& subdirectory, preset_name_list_t& presets, EDefaultOptions default_option) { + bool IS_CAMERA = (PRESETS_CAMERA == subdirectory); + bool IS_GRAPHIC = (PRESETS_GRAPHIC == subdirectory); + + std::string dir = LLPresetsManager::getInstance()->getPresetsDir(subdirectory); LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL; mPresetNames.clear(); @@ -160,25 +164,31 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam std::string name = LLURI::unescape(gDirUtilp->getBaseFileName(path, /*strip_exten = */ true)); LL_DEBUGS() << " Found preset '" << name << "'" << LL_ENDL; - if (isTemplateCameraPreset(name)) - { - continue; - } - if (default_option == DEFAULT_VIEWS_HIDE) + if (IS_CAMERA) { - if (isDefaultCameraPreset(name)) + if (isTemplateCameraPreset(name)) { continue; } - } - if (PRESETS_DEFAULT != name) - { + if ((default_option == DEFAULT_HIDE) || (default_option == DEFAULT_BOTTOM)) + { + if (isDefaultCameraPreset(name)) + { + continue; + } + } mPresetNames.push_back(name); } - else + if (IS_GRAPHIC) { - switch (default_option) + if (PRESETS_DEFAULT != name) { + mPresetNames.push_back(name); + } + else + { + switch (default_option) + { case DEFAULT_SHOW: mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT)); break; @@ -190,11 +200,20 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam case DEFAULT_HIDE: default: break; + } } } } } + if (IS_CAMERA && (default_option == DEFAULT_BOTTOM)) + { + mPresetNames.sort(); + mPresetNames.push_back(PRESETS_FRONT_VIEW); + mPresetNames.push_back(PRESETS_REAR_VIEW); + mPresetNames.push_back(PRESETS_SIDE_VIEW); + } + presets = mPresetNames; } @@ -410,30 +429,24 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, combo->clearRows(); combo->setEnabled(TRUE); - std::string presets_dir = getPresetsDir(subdirectory); + std::list<std::string> preset_names; + loadPresetNamesFromDir(subdirectory, preset_names, default_option); - if (!presets_dir.empty()) + if (preset_names.begin() != preset_names.end()) { - std::list<std::string> preset_names; - loadPresetNamesFromDir(presets_dir, preset_names, default_option); - - std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); - - if (preset_names.begin() != preset_names.end()) - { - for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) - { - const std::string& name = *it; - combo->add(name, name); - } - } - else + for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) { - combo->setLabel(LLTrans::getString("preset_combo_label")); - combo->setEnabled(PRESETS_CAMERA != subdirectory); - sts = false; + const std::string& name = *it; + combo->add(name, name); } } + else + { + combo->setLabel(LLTrans::getString("preset_combo_label")); + combo->setEnabled(PRESETS_CAMERA != subdirectory); + sts = false; + } + return sts; } diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index d9ca178dd7..d5b384ceb9 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -48,7 +48,7 @@ enum EDefaultOptions { DEFAULT_SHOW, DEFAULT_TOP, - DEFAULT_VIEWS_HIDE, + DEFAULT_BOTTOM, DEFAULT_HIDE // Do not display "Default" in a list }; @@ -68,7 +68,7 @@ public: void triggerChangeSignal(); static std::string getPresetsDir(const std::string& subdirectory); bool setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option); - void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option); + void loadPresetNamesFromDir(const std::string& subdirectory, preset_name_list_t& presets, EDefaultOptions default_option); bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false); void loadPreset(const std::string& subdirectory, std::string name); bool deletePreset(const std::string& subdirectory, std::string name); |