STORM-2082 Remove ugly list of control names. Instead, obtain the list from the View data

Remove a few remants used by the old hardware floater
master
Jonathan Yap 2014-12-14 19:17:52 -05:00
parent c655ae00a1
commit 8f5ddebf0a
3 changed files with 46 additions and 47 deletions

View File

@ -340,7 +340,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this));
mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this));
mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this));
mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this));
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this));
mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));
@ -788,6 +787,42 @@ void LLFloaterPreference::setHardwareDefaults()
LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT);
}
void LLFloaterPreference::getControlNames(std::vector<std::string>& names)
{
LLView* view = findChild<LLView>("display");
if (view)
{
std::list<LLView*> stack;
stack.push_back(view);
while(!stack.empty())
{
// Process view on top of the stack
LLView* curview = stack.front();
stack.pop_front();
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
{
LLControlVariable* control = ctrl->getControlVariable();
if (control)
{
std::string control_name = control->getName();
if (std::find(names.begin(), names.end(), control_name) == names.end())
{
names.push_back(control_name);
}
}
}
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
stack.push_back(*iter);
}
}
}
}
//virtual
void LLFloaterPreference::onClose(bool app_quitting)
{
@ -799,11 +834,6 @@ void LLFloaterPreference::onClose(bool app_quitting)
}
}
void LLFloaterPreference::onOpenHardwareSettings()
{
LLFloater* floater = LLFloaterReg::showInstance("prefs_hardware_settings");
addDependentFloater(floater, FALSE);
}
// static
void LLFloaterPreference::onBtnOK()
{

View File

@ -93,6 +93,7 @@ public:
void saveAvatarProperties( void );
void selectPrivacyPanel();
void selectChatPanel();
void getControlNames(std::vector<std::string>& names);
protected:
void onBtnOK();
@ -110,7 +111,6 @@ protected:
// if the custom settings box is clicked
void onChangeCustom();
void updateMeterText(LLUICtrl* ctrl);
void onOpenHardwareSettings();
// callback for defaults
void setHardwareDefaults();
void setRecommended();

View File

@ -36,6 +36,8 @@
#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h"
#include "llfloaterpreference.h"
#include "llfloaterreg.h"
LLPresetsManager::LLPresetsManager()
{
@ -137,51 +139,18 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, const std::st
llassert(!name.empty());
std::vector<std::string> name_list;
// This ugliness is the current list of all the control variables in the graphics and hardware
// preferences floaters or the settings for camera views.
// Additions or subtractions to the control variables in the floaters must also be reflected here.
if(PRESETS_GRAPHIC == subdirectory)
{
gSavedSettings.setString("PresetGraphicActive", name);
name_list = boost::assign::list_of
("RenderQualityPerformance")
("RenderFarClip")
("RenderMaxPartCount")
("RenderGlowResolutionPow")
("RenderTerrainDetail")
("RenderAvatarLODFactor")
("RenderAvatarMaxVisible")
("RenderUseImpostors")
("RenderTerrainLODFactor")
("RenderTreeLODFactor")
("RenderVolumeLODFactor")
("RenderFlexTimeFactor")
("RenderTransparentWater")
("RenderObjectBump")
("RenderLocalLights")
("VertexShaderEnable")
("RenderAvatarVP")
("RenderAvatarCloth")
("RenderReflectionDetail")
("WindLightUseAtmosShaders")
("WLSkyDetail")
("RenderDeferred")
("RenderDeferredSSAO")
("RenderDepthOfField")
("RenderShadowDetail")
("RenderAutoMuteRenderWeightLimit")
("RenderAnisotropic")
("RenderFSAASamples")
("RenderGamma")
("RenderVBOEnable")
("RenderCompressTextures")
("TextureMemory")
("RenderFogRatio")
("PresetGraphicActive");
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->getControlNames(name_list);
name_list.push_back("PresetGraphicActive");
}
}
if(PRESETS_CAMERA == subdirectory)
{