diff options
| author | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-06-10 18:42:16 +0300 | 
|---|---|---|
| committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-06-10 18:42:16 +0300 | 
| commit | 3e81c9bcc9f364dfa1dfcfd0d52139fd9c7f12c0 (patch) | |
| tree | 901ee55f6ee7d98f8c0013ad369b4b443a537b91 | |
| parent | 0d1cc56eb128755ce9e63d8cdf852b0e3b6f4fb1 (diff) | |
STORM-1254 WIP Refresh the presets list in the Delete Preset floater when user preference change.
This is needed to disable removal of the [new] current preset.
| -rw-r--r-- | indra/newview/llfloaterdeleteenvpreset.cpp | 43 | ||||
| -rw-r--r-- | indra/newview/llfloaterdeleteenvpreset.h | 1 | 
2 files changed, 28 insertions, 16 deletions
diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index ef50ace357..c72a044e79 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -63,6 +63,10 @@ BOOL LLFloaterDeleteEnvPreset::postBuild()  	getChild<LLButton>("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this));  	getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this)); +	// Listen to user preferences change, in which case we need to rebuild the presets list +	// to disable the [new] current preset. +	LLEnvManagerNew::instance().setPreferencesChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populatePresetsList, this)); +  	// Listen to presets addition/removal.  	LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateDayCyclesList, this));  	LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterDeleteEnvPreset::populateSkyPresetsList, this)); @@ -85,22 +89,7 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key)  	getChild<LLUICtrl>("label")->setValue(combo_label);  	// Populate the combobox. -	if (param == "water") -	{ -		populateWaterPresetsList(); -	} -	else if (param == "sky") -	{ -		populateSkyPresetsList(); -	} -	else if (param == "day_cycle") -	{ -		populateDayCyclesList(); -	} -	else -	{ -		llwarns << "Unrecognized key" << llendl; -	} +	populatePresetsList();  }  void LLFloaterDeleteEnvPreset::onBtnDelete() @@ -169,6 +158,28 @@ void LLFloaterDeleteEnvPreset::onBtnCancel()  	closeFloater();  } +void LLFloaterDeleteEnvPreset::populatePresetsList() +{ +	std::string param = mKey.asString(); + +	if (param == "water") +	{ +		populateWaterPresetsList(); +	} +	else if (param == "sky") +	{ +		populateSkyPresetsList(); +	} +	else if (param == "day_cycle") +	{ +		populateDayCyclesList(); +	} +	else +	{ +		llwarns << "Unrecognized key" << llendl; +	} +} +  void LLFloaterDeleteEnvPreset::populateWaterPresetsList()  {  	if (mKey.asString() != "water") return; diff --git a/indra/newview/llfloaterdeleteenvpreset.h b/indra/newview/llfloaterdeleteenvpreset.h index 567962dc84..1211505273 100644 --- a/indra/newview/llfloaterdeleteenvpreset.h +++ b/indra/newview/llfloaterdeleteenvpreset.h @@ -45,6 +45,7 @@ public:  	void onBtnCancel();  private: +	void populatePresetsList();  	void populateWaterPresetsList();  	void populateSkyPresetsList();  	void populateDayCyclesList();  | 
