1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

Fixed spinbox issue with integer entry via keyboard. Removed shader settings as per feedback comments.

This commit is contained in:
cc9cii 2014-09-24 09:33:19 +10:00
parent 67503c93b2
commit 970f3609c9
3 changed files with 30 additions and 62 deletions

View File

@ -314,20 +314,37 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
factory->loadAllFiles();
sh::Factory::getInstance().setGlobalSetting ("fog",
mUserSettings.settingValue("shader/fog").toStdString());
std::string fog("true"); // default if setting does not exist
if(mUserSettings.hasSettingDefinitions("Shader/fog"))
fog = mUserSettings.settingValue("Shader/fog").toStdString();
else
mUserSettings.setDefinitions("Shader/fog", (QStringList() << QString(fog.c_str())));
sh::Factory::getInstance().setGlobalSetting ("fog", fog);
sh::Factory::getInstance().setGlobalSetting ("shadows",
mUserSettings.settingValue("shader/shadows").toStdString());
std::string shadows("false");
if(mUserSettings.hasSettingDefinitions("Shader/shadows"))
shadows = mUserSettings.settingValue("Shader/shadows").toStdString();
else
mUserSettings.setDefinitions("Shader/shadows", (QStringList() << QString(shadows.c_str())));
sh::Factory::getInstance().setGlobalSetting ("shadows", shadows);
sh::Factory::getInstance().setGlobalSetting ("shadows_pssm",
mUserSettings.settingValue("shader/shadows_pssm").toStdString());
std::string shadows_pssm("false");
if(mUserSettings.hasSettingDefinitions("Shader/shadows_pssm"))
shadows_pssm = mUserSettings.settingValue("Shader/shadows_pssm").toStdString();
else
mUserSettings.setDefinitions("Shader/shadows_pssm", (QStringList() << QString(shadows_pssm.c_str())));
sh::Factory::getInstance().setGlobalSetting ("shadows_pssm", shadows_pssm);
sh::Factory::getInstance ().setGlobalSetting ("render_refraction",
mUserSettings.settingValue("shader/render_refraction").toStdString());
sh::Factory::getInstance ().setGlobalSetting ("viewproj_fix",
mUserSettings.settingValue("shader/viewproj_fix").toStdString());
std::string render_refraction("false");
if(mUserSettings.hasSettingDefinitions("Shader/render_refraction"))
render_refraction = mUserSettings.settingValue("Shader/render_refraction").toStdString();
else
mUserSettings.setDefinitions("Shader/render_refraction", (QStringList() << QString(render_refraction.c_str())));
sh::Factory::getInstance ().setGlobalSetting ("render_refraction", render_refraction);
// internal setting - may be switched on or off by the use of shader configurations
sh::Factory::getInstance ().setGlobalSetting ("viewproj_fix", "false");
sh::Factory::getInstance ().setGlobalSetting ("num_lights",
mUserSettings.settingValue("shader/num_lights").toStdString());

View File

@ -59,36 +59,6 @@ void UserSettings::buildSettingModelDefaults()
{
QString section = "Group1";
Setting *fog = createSetting (Type_CheckBox, page, "fog");
fog->setDeclaredValues(QStringList() << "true" << "false");
fog->setDefaultValue("true");
fog->setEditorSetting(true);
fog->setSpecialValueText("Enable Fog");
fog->setWidgetWidth(15);
fog->setColumnSpan (2);
fog->setStyleSheet ("QGroupBox { border: 0px; spacing: 5; }");
fog->setViewLocation(1, 1);
Setting *shadows = createSetting (Type_CheckBox, page, "shadows");
shadows->setDeclaredValues(QStringList() << "true" << "false");
shadows->setDefaultValue("false");
shadows->setEditorSetting(true);
shadows->setSpecialValueText("Enable Shadows");
shadows->setWidgetWidth(15);
shadows->setColumnSpan (2);
shadows->setStyleSheet ("QGroupBox { border: 0px; }");
shadows->setViewLocation(2, 1);
Setting *shadows_pssm = createSetting (Type_CheckBox, page, "shadows_pssm");
shadows_pssm->setDeclaredValues(QStringList() << "true" << "false");
shadows_pssm->setDefaultValue("false");
shadows_pssm->setEditorSetting(true);
shadows_pssm->setSpecialValueText("Enable PSSM Shadows");
shadows_pssm->setWidgetWidth(15);
shadows_pssm->setColumnSpan (2);
shadows_pssm->setStyleSheet ("QGroupBox { border: 0px; spacing: 5; }");
shadows_pssm->setViewLocation(3, 1);
Setting *numLights = createSetting (Type_SpinBox, page, "num lights");
numLights->setDefaultValue(8);
numLights->setEditorSetting(true);
@ -97,34 +67,15 @@ void UserSettings::buildSettingModelDefaults()
numLights->setMaximum (100); // FIXME: not sure what the max value should be
numLights->setWidgetWidth (10);
numLights->setSpecialValueText ("Nothing!"); // text to display when value is 0
numLights->setViewLocation(4, 2);
numLights->setViewLocation(1, 2);
Setting *nlText = createSetting (Type_Undefined, page, "nlText");
nlText->setSpecialValueText("Num Lights"); // hack to place text labels
nlText->setEditorSetting(false);
nlText->setSerializable (false);
nlText->setColumnSpan (1);
nlText->setWidgetWidth (10);
nlText->setViewLocation(4, 1);
nlText->setViewLocation(1, 1);
Setting *renderRefraction = createSetting (Type_CheckBox, page, "renderRefraction");
renderRefraction->setDeclaredValues(QStringList() << "true" << "false");
renderRefraction->setDefaultValue("false");
renderRefraction->setEditorSetting(true);
renderRefraction->setSpecialValueText("Enable Render Refraction");
renderRefraction->setWidgetWidth(20);
renderRefraction->setColumnSpan (2);
renderRefraction->setStyleSheet ("QGroupBox { border: 0px; }");
renderRefraction->setViewLocation(5, 1);
Setting *viewproj_fix = createSetting (Type_CheckBox, page, "viewproj_fix");
viewproj_fix->setDeclaredValues(QStringList() << "true" << "false");
viewproj_fix->setDefaultValue("false");
viewproj_fix->setEditorSetting(true);
viewproj_fix->setSpecialValueText("View Proj Fix");
viewproj_fix->setWidgetWidth(20);
viewproj_fix->setColumnSpan (2);
viewproj_fix->setStyleSheet ("QGroupBox { border: 0px; }");
viewproj_fix->setViewLocation(6, 1);
Setting *simpleWater = createSetting (Type_CheckBox, page, "simple_water");
simpleWater->setDeclaredValues(QStringList() << "true" << "false");

View File

@ -24,7 +24,7 @@ QString CSVSettings::SpinBox::textFromValue(int val) const
int CSVSettings::SpinBox::valueFromText(const QString &text) const
{
if (mValueList.isEmpty())
return -1;
return text.toInt(); // TODO: assumed integer, untested error handling for alpha types
if (mValueList.contains (text))
return mValueList.indexOf(text);