mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Fixed default value not being set for spinbox. Changed the default value of max subviews to 256. Simplified the call signature to get settings & set an initial value. Fixed missing settings for num_lights.
This commit is contained in:
parent
8e71f092c5
commit
a25cffc242
@ -265,7 +265,7 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
|
|||||||
#else
|
#else
|
||||||
"OpenGL Rendering Subsystem";
|
"OpenGL Rendering Subsystem";
|
||||||
#endif
|
#endif
|
||||||
std::string renderSystem = mUserSettings.setting("Video/render system", QStringList() << renderer.c_str()).toStdString();
|
std::string renderSystem = mUserSettings.setting("Video/render system", renderer.c_str()).toStdString();
|
||||||
|
|
||||||
Ogre::Root::getSingleton().setRenderSystem(Ogre::Root::getSingleton().getRenderSystemByName(renderSystem));
|
Ogre::Root::getSingleton().setRenderSystem(Ogre::Root::getSingleton().getRenderSystemByName(renderSystem));
|
||||||
|
|
||||||
@ -331,27 +331,27 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
|
|||||||
|
|
||||||
factory->loadAllFiles();
|
factory->loadAllFiles();
|
||||||
|
|
||||||
bool shaders = mUserSettings.setting("Objects/shaders", (QStringList() << QString("true"))) == "true" ? true : false;
|
bool shaders = mUserSettings.setting("Objects/shaders", QString("true")) == "true" ? true : false;
|
||||||
sh::Factory::getInstance ().setShadersEnabled (shaders);
|
sh::Factory::getInstance ().setShadersEnabled (shaders);
|
||||||
|
|
||||||
std::string fog = mUserSettings.setting("Shader/fog", (QStringList() << QString("true"))).toStdString();
|
std::string fog = mUserSettings.setting("Shader/fog", QString("true")).toStdString();
|
||||||
sh::Factory::getInstance().setGlobalSetting ("fog", fog);
|
sh::Factory::getInstance().setGlobalSetting ("fog", fog);
|
||||||
|
|
||||||
|
|
||||||
std::string shadows = mUserSettings.setting("Shader/shadows", (QStringList() << QString("false"))).toStdString();
|
std::string shadows = mUserSettings.setting("Shader/shadows", QString("false")).toStdString();
|
||||||
sh::Factory::getInstance().setGlobalSetting ("shadows", shadows);
|
sh::Factory::getInstance().setGlobalSetting ("shadows", shadows);
|
||||||
|
|
||||||
std::string shadows_pssm = mUserSettings.setting("Shader/shadows_pssm", (QStringList() << QString("false"))).toStdString();
|
std::string shadows_pssm = mUserSettings.setting("Shader/shadows_pssm", QString("false")).toStdString();
|
||||||
sh::Factory::getInstance().setGlobalSetting ("shadows_pssm", shadows_pssm);
|
sh::Factory::getInstance().setGlobalSetting ("shadows_pssm", shadows_pssm);
|
||||||
|
|
||||||
std::string render_refraction = mUserSettings.setting("Shader/render_refraction", (QStringList() << QString("false"))).toStdString();
|
std::string render_refraction = mUserSettings.setting("Shader/render_refraction", QString("false")).toStdString();
|
||||||
sh::Factory::getInstance ().setGlobalSetting ("render_refraction", render_refraction);
|
sh::Factory::getInstance ().setGlobalSetting ("render_refraction", render_refraction);
|
||||||
|
|
||||||
// internal setting - may be switched on or off by the use of shader configurations
|
// 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 ("viewproj_fix", "false");
|
||||||
|
|
||||||
sh::Factory::getInstance ().setGlobalSetting ("num_lights",
|
std::string num_lights = mUserSettings.setting("Objects/num_lights", QString("8")).toStdString();
|
||||||
mUserSettings.settingValue("Objects/num_lights").toStdString());
|
sh::Factory::getInstance ().setGlobalSetting ("num_lights", num_lights);
|
||||||
|
|
||||||
/// \todo add more configurable shiny settings
|
/// \todo add more configurable shiny settings
|
||||||
|
|
||||||
|
@ -50,11 +50,11 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
|
|
||||||
section = "Objects";
|
section = "Objects";
|
||||||
{
|
{
|
||||||
Setting *numLights = createSetting (Type_SpinBox, section, "num lights");
|
Setting *numLights = createSetting (Type_SpinBox, section, "num_lights");
|
||||||
numLights->setDefaultValue(8);
|
numLights->setDefaultValue(8);
|
||||||
numLights->setEditorSetting(true);
|
numLights->setEditorSetting(true);
|
||||||
numLights->setColumnSpan (1);
|
numLights->setColumnSpan (1);
|
||||||
numLights->setMinimum (0);
|
numLights->setMinimum (2);
|
||||||
numLights->setMaximum (100); // FIXME: not sure what the max value should be
|
numLights->setMaximum (100); // FIXME: not sure what the max value should be
|
||||||
numLights->setWidgetWidth (10);
|
numLights->setWidgetWidth (10);
|
||||||
numLights->setViewLocation(1, 2);
|
numLights->setViewLocation(1, 2);
|
||||||
@ -74,19 +74,16 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
{
|
{
|
||||||
Setting *fastFactor = createSetting (Type_SpinBox, section, "fast factor");
|
Setting *fastFactor = createSetting (Type_SpinBox, section, "fast factor");
|
||||||
fastFactor->setDefaultValue(4);
|
fastFactor->setDefaultValue(4);
|
||||||
fastFactor->setEditorSetting(false);
|
fastFactor->setEditorSetting(true);
|
||||||
fastFactor->setColumnSpan (1);
|
fastFactor->setColumnSpan (1);
|
||||||
// FIXME: setMinimum or setSpecialValueText appears to be broken, possibly due
|
fastFactor->setMinimum (1);
|
||||||
// to there being an empty string default for special value text.
|
|
||||||
//fastFactor->setMinimum (1);
|
|
||||||
fastFactor->setSpecialValueText("1"); // workaround for above
|
|
||||||
fastFactor->setMaximum (100); // FIXME: not sure what the max value should be
|
fastFactor->setMaximum (100); // FIXME: not sure what the max value should be
|
||||||
fastFactor->setWidgetWidth (10);
|
fastFactor->setWidgetWidth (10);
|
||||||
fastFactor->setViewLocation(1, 2);
|
fastFactor->setViewLocation(1, 2);
|
||||||
|
|
||||||
Setting *farClipDist = createSetting (Type_SpinBox, section, "far clip distance");
|
Setting *farClipDist = createSetting (Type_SpinBox, section, "far clip distance");
|
||||||
farClipDist->setDefaultValue(300000);
|
farClipDist->setDefaultValue(300000);
|
||||||
farClipDist->setEditorSetting(false);
|
farClipDist->setEditorSetting(true);
|
||||||
farClipDist->setColumnSpan (1);
|
farClipDist->setColumnSpan (1);
|
||||||
farClipDist->setMinimum (0);
|
farClipDist->setMinimum (0);
|
||||||
farClipDist->setMaximum (1000000); // FIXME: not sure what the max value should be
|
farClipDist->setMaximum (1000000); // FIXME: not sure what the max value should be
|
||||||
@ -95,7 +92,7 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
|
|
||||||
Setting *timerStart = createSetting (Type_SpinBox, section, "timer start");
|
Setting *timerStart = createSetting (Type_SpinBox, section, "timer start");
|
||||||
timerStart->setDefaultValue(20);
|
timerStart->setDefaultValue(20);
|
||||||
timerStart->setEditorSetting(false);
|
timerStart->setEditorSetting(true);
|
||||||
timerStart->setColumnSpan (1);
|
timerStart->setColumnSpan (1);
|
||||||
timerStart->setMinimum (0);
|
timerStart->setMinimum (0);
|
||||||
timerStart->setMaximum (100); // FIXME: not sure what the max value should be
|
timerStart->setMaximum (100); // FIXME: not sure what the max value should be
|
||||||
@ -106,12 +103,11 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
section = "SubView";
|
section = "SubView";
|
||||||
{
|
{
|
||||||
Setting *maxSubView = createSetting (Type_SpinBox, section, "max subviews");
|
Setting *maxSubView = createSetting (Type_SpinBox, section, "max subviews");
|
||||||
maxSubView->setDefaultValue(3);
|
maxSubView->setDefaultValue(256);
|
||||||
maxSubView->setEditorSetting(false);
|
maxSubView->setEditorSetting(false);
|
||||||
maxSubView->setColumnSpan (1);
|
maxSubView->setColumnSpan (1);
|
||||||
//maxSubView->setMinimum (1);
|
maxSubView->setMinimum (1);
|
||||||
maxSubView->setSpecialValueText("1"); // workaround for setMinimum
|
maxSubView->setMaximum (256); // FIXME: not sure what the max value should be
|
||||||
maxSubView->setMaximum (100); // FIXME: not sure what the max value should be
|
|
||||||
maxSubView->setWidgetWidth (10);
|
maxSubView->setWidgetWidth (10);
|
||||||
maxSubView->setViewLocation(1, 2);
|
maxSubView->setViewLocation(1, 2);
|
||||||
|
|
||||||
@ -119,8 +115,7 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
minWidth->setDefaultValue(325);
|
minWidth->setDefaultValue(325);
|
||||||
minWidth->setEditorSetting(false);
|
minWidth->setEditorSetting(false);
|
||||||
minWidth->setColumnSpan (1);
|
minWidth->setColumnSpan (1);
|
||||||
//minWidth->setMinimum (50);
|
minWidth->setMinimum (50);
|
||||||
minWidth->setSpecialValueText("50"); // workaround for setMinimum
|
|
||||||
minWidth->setMaximum (10000); // FIXME: not sure what the max value should be
|
minWidth->setMaximum (10000); // FIXME: not sure what the max value should be
|
||||||
minWidth->setWidgetWidth (10);
|
minWidth->setWidgetWidth (10);
|
||||||
minWidth->setViewLocation(2, 2);
|
minWidth->setViewLocation(2, 2);
|
||||||
@ -128,7 +123,7 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
Setting *reuse = createSetting (Type_CheckBox, section, "reuse");
|
Setting *reuse = createSetting (Type_CheckBox, section, "reuse");
|
||||||
reuse->setDeclaredValues(QStringList() << "true" << "false");
|
reuse->setDeclaredValues(QStringList() << "true" << "false");
|
||||||
reuse->setDefaultValue("true");
|
reuse->setDefaultValue("true");
|
||||||
reuse->setEditorSetting(true);
|
reuse->setEditorSetting(false);
|
||||||
reuse->setSpecialValueText("Reuse SubView");
|
reuse->setSpecialValueText("Reuse SubView");
|
||||||
reuse->setWidgetWidth(25);
|
reuse->setWidgetWidth(25);
|
||||||
reuse->setColumnSpan (3);
|
reuse->setColumnSpan (3);
|
||||||
@ -147,8 +142,8 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
width->setDefaultValues (QStringList() << "1024");
|
width->setDefaultValues (QStringList() << "1024");
|
||||||
height->setDefaultValues (QStringList() << "768");
|
height->setDefaultValues (QStringList() << "768");
|
||||||
|
|
||||||
width->setEditorSetting (true);
|
width->setEditorSetting (false);
|
||||||
height->setEditorSetting (true);
|
height->setEditorSetting (false);
|
||||||
|
|
||||||
height->setViewLocation (2,2);
|
height->setViewLocation (2,2);
|
||||||
width->setViewLocation (2,1);
|
width->setViewLocation (2,1);
|
||||||
@ -191,8 +186,8 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
rsd->setDeclaredValues (values);
|
rsd->setDeclaredValues (values);
|
||||||
ritd->setDeclaredValues (values);
|
ritd->setDeclaredValues (values);
|
||||||
|
|
||||||
rsd->setEditorSetting (true);
|
rsd->setEditorSetting (false);
|
||||||
ritd->setEditorSetting (true);
|
ritd->setEditorSetting (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
section = "Proxy Selection Test";
|
section = "Proxy Selection Test";
|
||||||
@ -407,14 +402,14 @@ void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if the key is not found create one with a defaut value
|
// if the key is not found create one with a defaut value
|
||||||
QString CSMSettings::UserSettings::setting(const QString &viewKey, const QStringList &list)
|
QString CSMSettings::UserSettings::setting(const QString &viewKey, const QString &value)
|
||||||
{
|
{
|
||||||
if(mSettingDefinitions->contains(viewKey))
|
if(mSettingDefinitions->contains(viewKey))
|
||||||
return settingValue(viewKey);
|
return settingValue(viewKey);
|
||||||
else if(!list.empty())
|
else if(value != QString())
|
||||||
{
|
{
|
||||||
mSettingDefinitions->setValue (viewKey, list);
|
mSettingDefinitions->setValue (viewKey, QStringList() << value);
|
||||||
return list.at(0);
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -77,7 +77,7 @@ namespace CSMSettings {
|
|||||||
///Save any unsaved changes in the QSettings object
|
///Save any unsaved changes in the QSettings object
|
||||||
void saveDefinitions() const;
|
void saveDefinitions() const;
|
||||||
|
|
||||||
QString setting(const QString &viewKey, const QStringList &list = QStringList());
|
QString setting(const QString &viewKey, const QString &value = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|||||||
|
|
||||||
// User setting to reuse sub views (on a per top level view basis)
|
// User setting to reuse sub views (on a per top level view basis)
|
||||||
bool reuse =
|
bool reuse =
|
||||||
userSettings.setting("SubView/reuse", (QStringList() << QString("true"))) == "true" ? true : false;
|
userSettings.setting("SubView/reuse", QString("true")) == "true" ? true : false;
|
||||||
if(reuse)
|
if(reuse)
|
||||||
{
|
{
|
||||||
foreach(SubView *sb, mSubViews)
|
foreach(SubView *sb, mSubViews)
|
||||||
@ -475,8 +475,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|||||||
//
|
//
|
||||||
// If the sub view limit setting is one, the sub view title bar is hidden and the
|
// If the sub view limit setting is one, the sub view title bar is hidden and the
|
||||||
// text in the main title bar is adjusted accordingly
|
// text in the main title bar is adjusted accordingly
|
||||||
int maxSubView =
|
int maxSubView = userSettings.setting("SubView/max subviews", QString("256")).toInt();
|
||||||
userSettings.setting("SubView/max subviews", (QStringList() << QString("3"))).toInt();
|
|
||||||
if(mSubViews.size() >= maxSubView) // create a new top level view
|
if(mSubViews.size() >= maxSubView) // create a new top level view
|
||||||
{
|
{
|
||||||
mViewManager.addView(mDocument, id, hint);
|
mViewManager.addView(mDocument, id, hint);
|
||||||
@ -499,8 +498,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|||||||
if (!hint.empty())
|
if (!hint.empty())
|
||||||
view->useHint (hint);
|
view->useHint (hint);
|
||||||
|
|
||||||
int minWidth =
|
int minWidth = userSettings.setting("SubView/minimum width", QString("325")).toInt();
|
||||||
userSettings.setting("SubView/minimum width", (QStringList() << QString("325"))).toInt();
|
|
||||||
view->setMinimumWidth(minWidth);
|
view->setMinimumWidth(minWidth);
|
||||||
|
|
||||||
view->setStatusBar (mShowStatusBar->isChecked());
|
view->setStatusBar (mShowStatusBar->isChecked());
|
||||||
|
@ -48,10 +48,10 @@ namespace CSVRender
|
|||||||
|
|
||||||
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
||||||
|
|
||||||
int farClipDist = userSettings.setting("Scene/far clip distance", (QStringList() << QString("300000"))).toInt();
|
int farClipDist = userSettings.setting("Scene/far clip distance", QString("300000")).toInt();
|
||||||
mCamera->setFarClipDistance (farClipDist);
|
mCamera->setFarClipDistance (farClipDist);
|
||||||
|
|
||||||
mFastFactor = userSettings.setting("Scene/fast factor", (QStringList() << QString("4"))).toInt();
|
mFastFactor = userSettings.setting("Scene/fast factor", QString("4")).toInt();
|
||||||
|
|
||||||
mCamera->roll (Ogre::Degree (90));
|
mCamera->roll (Ogre::Degree (90));
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace CSVRender
|
|||||||
|
|
||||||
connect (timer, SIGNAL (timeout()), this, SLOT (update()));
|
connect (timer, SIGNAL (timeout()), this, SLOT (update()));
|
||||||
|
|
||||||
int timerStart = userSettings.setting("Scene/timer start", (QStringList() << QString("20"))).toInt();
|
int timerStart = userSettings.setting("Scene/timer start", QString("20")).toInt();
|
||||||
timer->start (timerStart);
|
timer->start (timerStart);
|
||||||
|
|
||||||
/// \todo make shortcut configurable
|
/// \todo make shortcut configurable
|
||||||
|
@ -129,6 +129,8 @@ void CSVSettings::RangeView::buildSpinBox (CSMSettings::Setting *setting)
|
|||||||
mRangeWidget->setProperty ("wrapping", setting->wrapping());
|
mRangeWidget->setProperty ("wrapping", setting->wrapping());
|
||||||
dynamic_cast<QAbstractSpinBox *> (mRangeWidget)->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
dynamic_cast<QAbstractSpinBox *> (mRangeWidget)->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
|
|
||||||
|
if(setting->type() == CSMSettings::Type_SpinBox)
|
||||||
|
dynamic_cast<QSpinBox *> (mRangeWidget)->setValue (setting->defaultValues().at(0).toInt()); // FIXME: can there be more than one?
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVSettings::RangeView::slotUpdateView (int value)
|
void CSVSettings::RangeView::slotUpdateView (int value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user