diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-05-25 13:02:52 +0300 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-05-25 13:02:52 +0300 |
commit | 74b8ca575ff7f0cfcfd443e03885542bc5b10c46 (patch) | |
tree | 9cca9879c10d797845981ab08530c0c3bddbe992 /indra/newview | |
parent | 55460b49585ceea5d6388204c7f3bd74ed4f4827 (diff) |
SL-19770 allow changing current preset from My Camera Presets list
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatercamerapresets.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llfloatercamerapresets.h | 3 |
2 files changed, 20 insertions, 1 deletions
diff --git a/indra/newview/llfloatercamerapresets.cpp b/indra/newview/llfloatercamerapresets.cpp index 300c945a85..a1cbffd094 100644 --- a/indra/newview/llfloatercamerapresets.cpp +++ b/indra/newview/llfloatercamerapresets.cpp @@ -24,6 +24,7 @@ */ #include "llviewerprecompiledheaders.h" +#include "llfloatercamera.h" #include "llfloatercamerapresets.h" #include "llfloaterreg.h" #include "llnotificationsutil.h" @@ -40,7 +41,8 @@ LLFloaterCameraPresets::~LLFloaterCameraPresets() BOOL LLFloaterCameraPresets::postBuild() { mPresetList = getChild<LLFlatListView>("preset_list"); - + mPresetList->setCommitCallback(boost::bind(&LLFloaterCameraPresets::onSelectionChange, this)); + mPresetList->setCommitOnSelectionChange(true); LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCameraPresets::populateList, this)); return TRUE; @@ -58,6 +60,7 @@ void LLFloaterCameraPresets::populateList() std::list<std::string> preset_names; presetsMgr->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_BOTTOM); + std::string active_preset = gSavedSettings.getString("PresetCameraActive"); for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) { @@ -66,6 +69,19 @@ void LLFloaterCameraPresets::populateList() LLCameraPresetFlatItem* item = new LLCameraPresetFlatItem(name, is_default); item->postBuild(); mPresetList->addItem(item); + if(name == active_preset) + { + mPresetList->selectItem(item); + } + } +} + +void LLFloaterCameraPresets::onSelectionChange() +{ + LLCameraPresetFlatItem* selected_preset = dynamic_cast<LLCameraPresetFlatItem*>(mPresetList->getSelectedItem()); + if(selected_preset) + { + LLFloaterCamera::switchToPreset(selected_preset->getPresetName()); } } diff --git a/indra/newview/llfloatercamerapresets.h b/indra/newview/llfloatercamerapresets.h index 66430fa399..4430a4209e 100644 --- a/indra/newview/llfloatercamerapresets.h +++ b/indra/newview/llfloatercamerapresets.h @@ -38,6 +38,7 @@ class LLFloaterCameraPresets : public LLFloater virtual void onOpen(const LLSD& key); void populateList(); + void onSelectionChange(); private: LLFloaterCameraPresets(const LLSD& key); @@ -58,6 +59,8 @@ public: virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); + std::string getPresetName() { return mPresetName; } + private: void onDeleteBtnClick(); void onResetBtnClick(); |