|
|
@ -30,183 +30,127 @@ namespace boost
|
|
|
|
} /* namespace boost */
|
|
|
|
} /* namespace boost */
|
|
|
|
#endif /* (BOOST_VERSION <= 104600) */
|
|
|
|
#endif /* (BOOST_VERSION <= 104600) */
|
|
|
|
|
|
|
|
|
|
|
|
CSMSettings::UserSettings *CSMSettings::UserSettings::mUserSettingsInstance = 0;
|
|
|
|
CSMSettings::UserSettings *CSMSettings::UserSettings::sUserSettingsInstance = 0;
|
|
|
|
|
|
|
|
|
|
|
|
CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& configurationManager)
|
|
|
|
CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& configurationManager)
|
|
|
|
: mCfgMgr (configurationManager)
|
|
|
|
: mCfgMgr (configurationManager)
|
|
|
|
, mSettingDefinitions(NULL)
|
|
|
|
, mSettingDefinitions(NULL)
|
|
|
|
, mSettingCfgDefinitions(NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert(!mUserSettingsInstance);
|
|
|
|
assert(!sUserSettingsInstance);
|
|
|
|
mUserSettingsInstance = this;
|
|
|
|
sUserSettingsInstance = this;
|
|
|
|
|
|
|
|
|
|
|
|
buildSettingModelDefaults();
|
|
|
|
buildSettingModelDefaults();
|
|
|
|
|
|
|
|
|
|
|
|
// for overriding opencs.ini settings with those from settings.cfg
|
|
|
|
|
|
|
|
mSettingCfgDefinitions = new QSettings(QSettings::IniFormat, QSettings::UserScope, "", QString(), this);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|
|
|
void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString section;
|
|
|
|
QString section;
|
|
|
|
|
|
|
|
|
|
|
|
section = "Objects";
|
|
|
|
declareSection ("3d-render", "3D Rendering");
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Setting *numLights = createSetting (Type_SpinBox, section, "num_lights");
|
|
|
|
Setting *shaders = createSetting (Type_CheckBox, "shaders", "Enable Shaders");
|
|
|
|
numLights->setDefaultValue(8);
|
|
|
|
shaders->setDefaultValue ("true");
|
|
|
|
numLights->setEditorSetting(true);
|
|
|
|
|
|
|
|
numLights->setColumnSpan (1);
|
|
|
|
Setting *farClipDist = createSetting (Type_DoubleSpinBox, "far-clip-distance", "Far clipping distance");
|
|
|
|
numLights->setMinimum (0);
|
|
|
|
farClipDist->setDefaultValue (300000);
|
|
|
|
numLights->setMaximum (100); // FIXME: not sure what the max value should be
|
|
|
|
farClipDist->setRange (0, 1000000);
|
|
|
|
numLights->setWidgetWidth (10);
|
|
|
|
farClipDist->setToolTip ("The maximum distance objects are still rendered at.");
|
|
|
|
numLights->setViewLocation(1, 2);
|
|
|
|
|
|
|
|
|
|
|
|
QString defaultValue = "None";
|
|
|
|
Setting *shaders = createSetting (Type_CheckBox, section, "shaders");
|
|
|
|
Setting *antialiasing = createSetting (Type_ComboBox, "antialiasing", "Antialiasing");
|
|
|
|
shaders->setDeclaredValues(QStringList() << "true" << "false");
|
|
|
|
antialiasing->setDeclaredValues (QStringList()
|
|
|
|
shaders->setDefaultValue("true");
|
|
|
|
<< defaultValue << "MSAA 2" << "MSAA 4" << "MSAA 8" << "MSAA 16");
|
|
|
|
shaders->setEditorSetting(true);
|
|
|
|
antialiasing->setDefaultValue (defaultValue);
|
|
|
|
shaders->setSpecialValueText("Enable Shaders");
|
|
|
|
|
|
|
|
shaders->setWidgetWidth(25);
|
|
|
|
|
|
|
|
shaders->setColumnSpan (3);
|
|
|
|
|
|
|
|
shaders->setStyleSheet ("QGroupBox { border: 0px; }");
|
|
|
|
|
|
|
|
shaders->setViewLocation(2, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
section = "Scene";
|
|
|
|
declareSection ("3d-render-adv", "3D Rendering (Advanced)");
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Setting *fastFactor = createSetting (Type_SpinBox, section, "fast factor");
|
|
|
|
Setting *numLights = createSetting (Type_SpinBox, "num_lights",
|
|
|
|
fastFactor->setDefaultValue(4);
|
|
|
|
"Number of lights per pass");
|
|
|
|
fastFactor->setEditorSetting(true);
|
|
|
|
numLights->setDefaultValue (8);
|
|
|
|
fastFactor->setColumnSpan (1);
|
|
|
|
numLights->setRange (1, 100);
|
|
|
|
fastFactor->setMinimum (1);
|
|
|
|
|
|
|
|
fastFactor->setSpecialValueText ("1"); // FIXME: workaround
|
|
|
|
|
|
|
|
fastFactor->setMaximum (100); // FIXME: not sure what the max value should be
|
|
|
|
|
|
|
|
fastFactor->setWidgetWidth (10);
|
|
|
|
|
|
|
|
fastFactor->setViewLocation(1, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting *farClipDist = createSetting (Type_DoubleSpinBox, section, "far clip distance");
|
|
|
|
|
|
|
|
farClipDist->setDefaultValue(300000);
|
|
|
|
|
|
|
|
farClipDist->setEditorSetting(true);
|
|
|
|
|
|
|
|
farClipDist->setColumnSpan (1);
|
|
|
|
|
|
|
|
farClipDist->setMinimum (0);
|
|
|
|
|
|
|
|
farClipDist->setMaximum (1000000); // FIXME: not sure what the max value should be
|
|
|
|
|
|
|
|
farClipDist->setWidgetWidth (10);
|
|
|
|
|
|
|
|
farClipDist->setViewLocation(2, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting *timerStart = createSetting (Type_SpinBox, section, "timer start");
|
|
|
|
|
|
|
|
timerStart->setDefaultValue(20);
|
|
|
|
|
|
|
|
timerStart->setEditorSetting(true);
|
|
|
|
|
|
|
|
timerStart->setColumnSpan (1);
|
|
|
|
|
|
|
|
timerStart->setMinimum (0);
|
|
|
|
|
|
|
|
timerStart->setMaximum (100); // FIXME: not sure what the max value should be
|
|
|
|
|
|
|
|
timerStart->setWidgetWidth (10);
|
|
|
|
|
|
|
|
timerStart->setViewLocation(3, 2);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
section = "SubView";
|
|
|
|
declareSection ("scene-input", "Scene Input");
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Setting *maxSubView = createSetting (Type_SpinBox, section, "max subviews");
|
|
|
|
Setting *timer = createSetting (Type_SpinBox, "timer", "Input responsiveness");
|
|
|
|
maxSubView->setDefaultValue(256);
|
|
|
|
timer->setDefaultValue (20);
|
|
|
|
maxSubView->setEditorSetting(true);
|
|
|
|
timer->setRange (1, 100);
|
|
|
|
maxSubView->setColumnSpan (1);
|
|
|
|
timer->setToolTip ("The time between two checks for user input in milliseconds.<p>"
|
|
|
|
maxSubView->setMinimum (1);
|
|
|
|
"Lower value result in higher responsiveness.");
|
|
|
|
maxSubView->setSpecialValueText ("1");
|
|
|
|
|
|
|
|
maxSubView->setMaximum (256); // FIXME: not sure what the max value should be
|
|
|
|
Setting *fastFactor = createSetting (Type_SpinBox, "fast-factor",
|
|
|
|
maxSubView->setWidgetWidth (10);
|
|
|
|
"Fast movement factor");
|
|
|
|
maxSubView->setViewLocation(1, 2);
|
|
|
|
fastFactor->setDefaultValue (4);
|
|
|
|
|
|
|
|
fastFactor->setRange (1, 100);
|
|
|
|
Setting *minWidth = createSetting (Type_SpinBox, section, "minimum width");
|
|
|
|
fastFactor->setToolTip (
|
|
|
|
minWidth->setDefaultValue(325);
|
|
|
|
"Factor by which movement is speed up while the shift key is held down.");
|
|
|
|
minWidth->setEditorSetting(true);
|
|
|
|
|
|
|
|
minWidth->setColumnSpan (1);
|
|
|
|
|
|
|
|
minWidth->setMinimum (50);
|
|
|
|
|
|
|
|
minWidth->setSpecialValueText ("50");
|
|
|
|
|
|
|
|
minWidth->setMaximum (10000); // FIXME: not sure what the max value should be
|
|
|
|
|
|
|
|
minWidth->setWidgetWidth (10);
|
|
|
|
|
|
|
|
minWidth->setViewLocation(2, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting *reuse = createSetting (Type_CheckBox, section, "reuse");
|
|
|
|
|
|
|
|
reuse->setDeclaredValues(QStringList() << "true" << "false");
|
|
|
|
|
|
|
|
reuse->setDefaultValue("true");
|
|
|
|
|
|
|
|
reuse->setEditorSetting(true);
|
|
|
|
|
|
|
|
reuse->setSpecialValueText("Reuse SubView");
|
|
|
|
|
|
|
|
reuse->setWidgetWidth(25);
|
|
|
|
|
|
|
|
reuse->setColumnSpan (3);
|
|
|
|
|
|
|
|
reuse->setStyleSheet ("QGroupBox { border: 0px; }");
|
|
|
|
|
|
|
|
reuse->setViewLocation(3, 2);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
section = "Window Size";
|
|
|
|
declareSection ("window", "Window");
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Setting *width = createSetting (Type_LineEdit, section, "Width");
|
|
|
|
Setting *preDefined = createSetting (Type_ComboBox, "pre-defined",
|
|
|
|
Setting *height = createSetting (Type_LineEdit, section, "Height");
|
|
|
|
"Default window size");
|
|
|
|
|
|
|
|
preDefined->setEditorSetting (false);
|
|
|
|
width->setWidgetWidth (5);
|
|
|
|
preDefined->setDeclaredValues (
|
|
|
|
height->setWidgetWidth (8);
|
|
|
|
QStringList() << "640 x 480" << "800 x 600" << "1024 x 768" << "1440 x 900");
|
|
|
|
|
|
|
|
|
|
|
|
width->setDefaultValues (QStringList() << "1024");
|
|
|
|
|
|
|
|
height->setDefaultValues (QStringList() << "768");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
width->setEditorSetting (true);
|
|
|
|
|
|
|
|
height->setEditorSetting (true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
height->setViewLocation (2,2);
|
|
|
|
|
|
|
|
width->setViewLocation (2,1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
*Create the proxy setting for predefined values
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
Setting *preDefined = createSetting (Type_ComboBox, section,
|
|
|
|
|
|
|
|
"Pre-Defined");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preDefined->setDeclaredValues (QStringList() << "640 x 480"
|
|
|
|
|
|
|
|
<< "800 x 600" << "1024 x 768" << "1440 x 900");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preDefined->setViewLocation (1, 1);
|
|
|
|
preDefined->setViewLocation (1, 1);
|
|
|
|
preDefined->setWidgetWidth (10);
|
|
|
|
|
|
|
|
preDefined->setColumnSpan (2);
|
|
|
|
preDefined->setColumnSpan (2);
|
|
|
|
|
|
|
|
preDefined->setToolTip ("Newly opened top-level windows will open with this size "
|
|
|
|
|
|
|
|
"(picked from a list of pre-defined values)");
|
|
|
|
|
|
|
|
|
|
|
|
preDefined->addProxy (width,
|
|
|
|
Setting *width = createSetting (Type_LineEdit, "default-width",
|
|
|
|
QStringList() << "640" << "800" << "1024" << "1440"
|
|
|
|
"Default window width");
|
|
|
|
);
|
|
|
|
width->setDefaultValues (QStringList() << "1024");
|
|
|
|
|
|
|
|
width->setViewLocation (2, 1);
|
|
|
|
|
|
|
|
width->setColumnSpan (1);
|
|
|
|
|
|
|
|
width->setToolTip ("Newly opened top-level windows will open with this width.");
|
|
|
|
|
|
|
|
preDefined->addProxy (width, QStringList() << "640" << "800" << "1024" << "1440");
|
|
|
|
|
|
|
|
|
|
|
|
preDefined->addProxy (height,
|
|
|
|
Setting *height = createSetting (Type_LineEdit, "default-height",
|
|
|
|
QStringList() << "480" << "600" << "768" << "900"
|
|
|
|
"Default window height");
|
|
|
|
);
|
|
|
|
height->setDefaultValues (QStringList() << "768");
|
|
|
|
|
|
|
|
height->setViewLocation (2, 2);
|
|
|
|
|
|
|
|
height->setColumnSpan (1);
|
|
|
|
|
|
|
|
height->setToolTip ("Newly opened top-level windows will open with this height.");
|
|
|
|
|
|
|
|
preDefined->addProxy (height, QStringList() << "480" << "600" << "768" << "900");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting *reuse = createSetting (Type_CheckBox, "reuse", "Reuse Subviews");
|
|
|
|
|
|
|
|
reuse->setDefaultValue ("true");
|
|
|
|
|
|
|
|
reuse->setToolTip ("When a new subview is requested and a matching subview already "
|
|
|
|
|
|
|
|
" exist, do not open a new subview and use the existing one instead.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting *maxSubView = createSetting (Type_SpinBox, "max-subviews",
|
|
|
|
|
|
|
|
"Maximum number of subviews per top-level window");
|
|
|
|
|
|
|
|
maxSubView->setDefaultValue (256);
|
|
|
|
|
|
|
|
maxSubView->setRange (1, 256);
|
|
|
|
|
|
|
|
maxSubView->setToolTip ("If the maximum number is reached and a new subview is opened "
|
|
|
|
|
|
|
|
"it will be placed into a new top-level window.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting *minWidth = createSetting (Type_SpinBox, "minimum-width",
|
|
|
|
|
|
|
|
"Minimum subview width");
|
|
|
|
|
|
|
|
minWidth->setDefaultValue (325);
|
|
|
|
|
|
|
|
minWidth->setRange (50, 10000);
|
|
|
|
|
|
|
|
minWidth->setToolTip ("Minimum width of subviews.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
section = "Display Format";
|
|
|
|
declareSection ("records", "Records");
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString defaultValue = "Icon and Text";
|
|
|
|
QString defaultValue = "Icon and Text";
|
|
|
|
|
|
|
|
QStringList values = QStringList() << defaultValue << "Icon Only" << "Text Only";
|
|
|
|
|
|
|
|
|
|
|
|
QStringList values = QStringList()
|
|
|
|
Setting *rsd = createSetting (Type_RadioButton, "status-format",
|
|
|
|
<< defaultValue << "Icon Only" << "Text Only";
|
|
|
|
"Modification status display format");
|
|
|
|
|
|
|
|
rsd->setDefaultValue (defaultValue);
|
|
|
|
Setting *rsd = createSetting (Type_RadioButton,
|
|
|
|
|
|
|
|
section, "Record Status Display");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Setting *ritd = createSetting (Type_RadioButton,
|
|
|
|
|
|
|
|
section, "Referenceable ID Type Display");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rsd->setDeclaredValues (values);
|
|
|
|
rsd->setDeclaredValues (values);
|
|
|
|
ritd->setDeclaredValues (values);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rsd->setEditorSetting (true);
|
|
|
|
Setting *ritd = createSetting (Type_RadioButton, "type-format",
|
|
|
|
ritd->setEditorSetting (true);
|
|
|
|
"ID type display format");
|
|
|
|
|
|
|
|
ritd->setDefaultValue (defaultValue);
|
|
|
|
|
|
|
|
ritd->setDeclaredValues (values);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
section = "Video";
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QString defaultValue = "None";
|
|
|
|
|
|
|
|
QStringList values = QStringList()
|
|
|
|
|
|
|
|
<< defaultValue << "MSAA 2" << "MSAA 4" << "MSAA 8" << "MSAA 16";
|
|
|
|
|
|
|
|
Setting *antialiasing = createSetting (Type_SpinBox, section, "antialiasing");
|
|
|
|
|
|
|
|
antialiasing->setDeclaredValues (values);
|
|
|
|
|
|
|
|
antialiasing->setEditorSetting (true);
|
|
|
|
|
|
|
|
antialiasing->setWidgetWidth(15);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
section = "Proxy Selection Test";
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/******************************************************************
|
|
|
|
/******************************************************************
|
|
|
|
* There are three types of values:
|
|
|
|
* There are three types of values:
|
|
|
@ -382,7 +326,7 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|
|
|
|
|
|
|
|
|
|
|
CSMSettings::UserSettings::~UserSettings()
|
|
|
|
CSMSettings::UserSettings::~UserSettings()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mUserSettingsInstance = 0;
|
|
|
|
sUserSettingsInstance = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
|
|
|
void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
|
|
@ -411,13 +355,9 @@ void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
|
|
|
|
|
|
|
|
|
|
|
mSettingDefinitions = new QSettings
|
|
|
|
mSettingDefinitions = new QSettings
|
|
|
|
(QSettings::IniFormat, QSettings::UserScope, "opencs", QString(), this);
|
|
|
|
(QSettings::IniFormat, QSettings::UserScope, "opencs", QString(), this);
|
|
|
|
|
|
|
|
|
|
|
|
// check if override entry exists (default: disabled)
|
|
|
|
|
|
|
|
if(!mSettingDefinitions->childGroups().contains("Video", Qt::CaseInsensitive))
|
|
|
|
|
|
|
|
mSettingDefinitions->setValue("Video/use settings.cfg", "false");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if the key is not found create one with a defaut value
|
|
|
|
// if the key is not found create one with a default value
|
|
|
|
QString CSMSettings::UserSettings::setting(const QString &viewKey, const QString &value)
|
|
|
|
QString CSMSettings::UserSettings::setting(const QString &viewKey, const QString &value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(mSettingDefinitions->contains(viewKey))
|
|
|
|
if(mSettingDefinitions->contains(viewKey))
|
|
|
@ -451,23 +391,10 @@ QString CSMSettings::UserSettings::settingValue (const QString &settingKey)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QStringList defs;
|
|
|
|
QStringList defs;
|
|
|
|
|
|
|
|
|
|
|
|
// check if video settings are overriden
|
|
|
|
if (!mSettingDefinitions->contains (settingKey))
|
|
|
|
if(settingKey.contains(QRegExp("^Video\\b", Qt::CaseInsensitive)) &&
|
|
|
|
return QString();
|
|
|
|
mSettingDefinitions->value("Video/use settings.cfg") == "true" &&
|
|
|
|
|
|
|
|
settingKey.contains(QRegExp("^Video/\\brender|antialiasing|vsync|fullscreen\\b", Qt::CaseInsensitive)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!mSettingCfgDefinitions->contains (settingKey))
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
defs = mSettingCfgDefinitions->value (settingKey).toStringList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!mSettingDefinitions->contains (settingKey))
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defs = mSettingDefinitions->value (settingKey).toStringList();
|
|
|
|
defs = mSettingDefinitions->value (settingKey).toStringList();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (defs.isEmpty())
|
|
|
|
if (defs.isEmpty())
|
|
|
|
return QString();
|
|
|
|
return QString();
|
|
|
@ -477,8 +404,8 @@ QString CSMSettings::UserSettings::settingValue (const QString &settingKey)
|
|
|
|
|
|
|
|
|
|
|
|
CSMSettings::UserSettings& CSMSettings::UserSettings::instance()
|
|
|
|
CSMSettings::UserSettings& CSMSettings::UserSettings::instance()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert(mUserSettingsInstance);
|
|
|
|
assert(sUserSettingsInstance);
|
|
|
|
return *mUserSettingsInstance;
|
|
|
|
return *sUserSettingsInstance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CSMSettings::UserSettings::updateUserSetting(const QString &settingKey,
|
|
|
|
void CSMSettings::UserSettings::updateUserSetting(const QString &settingKey,
|
|
|
@ -486,11 +413,11 @@ void CSMSettings::UserSettings::updateUserSetting(const QString &settingKey,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mSettingDefinitions->setValue (settingKey ,list);
|
|
|
|
mSettingDefinitions->setValue (settingKey ,list);
|
|
|
|
|
|
|
|
|
|
|
|
if(settingKey == "Objects/num_lights" && !list.empty())
|
|
|
|
if(settingKey == "3d-render-adv/num_lights" && !list.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sh::Factory::getInstance ().setGlobalSetting ("num_lights", list.at(0).toStdString());
|
|
|
|
sh::Factory::getInstance ().setGlobalSetting ("num_lights", list.at(0).toStdString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(settingKey == "Objects/shaders" && !list.empty())
|
|
|
|
else if(settingKey == "3d-render/shaders" && !list.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sh::Factory::getInstance ().setShadersEnabled (list.at(0).toStdString() == "true" ? true : false);
|
|
|
|
sh::Factory::getInstance ().setShadersEnabled (list.at(0).toStdString() == "true" ? true : false);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -539,24 +466,57 @@ CSMSettings::SettingPageMap CSMSettings::UserSettings::settingPageMap() const
|
|
|
|
SettingPageMap pageMap;
|
|
|
|
SettingPageMap pageMap;
|
|
|
|
|
|
|
|
|
|
|
|
foreach (Setting *setting, mSettings)
|
|
|
|
foreach (Setting *setting, mSettings)
|
|
|
|
pageMap[setting->page()].append (setting);
|
|
|
|
{
|
|
|
|
|
|
|
|
SettingPageMap::iterator iter = pageMap.find (setting->page());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (iter==pageMap.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QPair<QString, QList <Setting *> > value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::map<QString, QString>::const_iterator iter2 =
|
|
|
|
|
|
|
|
mSectionLabels.find (setting->page());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
value.first = iter2!=mSectionLabels.end() ? iter2->second : "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iter = pageMap.insert (setting->page(), value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iter->second.append (setting);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pageMap;
|
|
|
|
return pageMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSMSettings::Setting *CSMSettings::UserSettings::createSetting
|
|
|
|
CSMSettings::Setting *CSMSettings::UserSettings::createSetting
|
|
|
|
(CSMSettings::SettingType typ, const QString &page, const QString &name)
|
|
|
|
(CSMSettings::SettingType type, const QString &name, const QString& label)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//get list of all settings for the current setting name
|
|
|
|
Setting *setting = new Setting (type, name, mSection, label);
|
|
|
|
if (findSetting (page, name))
|
|
|
|
|
|
|
|
{
|
|
|
|
// set useful defaults
|
|
|
|
qWarning() << "Duplicate declaration encountered: "
|
|
|
|
int row = 1;
|
|
|
|
<< (name + '/' + page);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
if (!mSettings.empty())
|
|
|
|
}
|
|
|
|
row = mSettings.back()->viewRow()+1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setting->setViewLocation (row, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setting->setColumnSpan (3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int width = 10;
|
|
|
|
|
|
|
|
|
|
|
|
Setting *setting = new Setting (typ, name, page);
|
|
|
|
if (type==Type_CheckBox)
|
|
|
|
|
|
|
|
width = 40;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setting->setWidgetWidth (width);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type==Type_CheckBox)
|
|
|
|
|
|
|
|
setting->setStyleSheet ("QGroupBox { border: 0px; }");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type==Type_CheckBox)
|
|
|
|
|
|
|
|
setting->setDeclaredValues(QStringList() << "true" << "false");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type==Type_CheckBox)
|
|
|
|
|
|
|
|
setting->setSpecialValueText (setting->getLabel());
|
|
|
|
|
|
|
|
|
|
|
|
//add declaration to the model
|
|
|
|
//add declaration to the model
|
|
|
|
mSettings.append (setting);
|
|
|
|
mSettings.append (setting);
|
|
|
@ -564,6 +524,12 @@ CSMSettings::Setting *CSMSettings::UserSettings::createSetting
|
|
|
|
return setting;
|
|
|
|
return setting;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CSMSettings::UserSettings::declareSection (const QString& page, const QString& label)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mSection = page;
|
|
|
|
|
|
|
|
mSectionLabels[page] = label;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QStringList CSMSettings::UserSettings::definitions (const QString &viewKey) const
|
|
|
|
QStringList CSMSettings::UserSettings::definitions (const QString &viewKey) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mSettingDefinitions->contains (viewKey))
|
|
|
|
if (mSettingDefinitions->contains (viewKey))
|
|
|
|