user settings cleanup

loadfix
Marc Zinnschlag 10 years ago
parent ed44f3ec7d
commit 4b921c3876

@ -331,7 +331,7 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
factory->loadAllFiles();
bool shaders = mUserSettings.setting("Objects/shaders", QString("true")) == "true" ? true : false;
bool shaders = mUserSettings.setting("3d-render/shaders", QString("true")) == "true" ? true : false;
sh::Factory::getInstance ().setShadersEnabled (shaders);
std::string fog = mUserSettings.setting("Shader/fog", QString("true")).toStdString();

@ -46,105 +46,111 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
{
QString section;
declareSection ("Objects", "Objects");
declareSection ("3d-render", "3D Rendering");
{
Setting *numLights = createSetting (Type_SpinBox, "num_lights", "num_lights");
numLights->setDefaultValue(8);
numLights->setRange (0, 100);
Setting *shaders = createSetting (Type_CheckBox, "shaders", "Enable Shaders");
shaders->setDefaultValue("true");
}
shaders->setDefaultValue ("true");
declareSection ("Scene", "Scene");
{
Setting *fastFactor = createSetting (Type_SpinBox, "fast factor", "fast factor");
fastFactor->setDefaultValue(4);
fastFactor->setRange (1, 100);
Setting *farClipDist = createSetting (Type_DoubleSpinBox, "far clip distance", "far clip distance");
farClipDist->setDefaultValue(300000);
Setting *farClipDist = createSetting (Type_DoubleSpinBox, "far-clip-distance", "Far clipping distance");
farClipDist->setDefaultValue (300000);
farClipDist->setRange (0, 1000000);
farClipDist->setToolTip ("The maximum distance objects are still rendered at.");
Setting *timerStart = createSetting (Type_SpinBox, "timer start", "timer start");
timerStart->setDefaultValue(20);
timerStart->setRange (1, 100);
QString defaultValue = "None";
Setting *antialiasing = createSetting (Type_ComboBox, "antialiasing", "Antialiasing");
antialiasing->setDeclaredValues (QStringList()
<< defaultValue << "MSAA 2" << "MSAA 4" << "MSAA 8" << "MSAA 16");
antialiasing->setDefaultValue (defaultValue);
}
declareSection ("SubView", "SubView");
declareSection ("scene-input", "Scene Input");
{
Setting *maxSubView = createSetting (Type_SpinBox, "max subviews", "max subviews");
maxSubView->setDefaultValue(256);
maxSubView->setRange (1, 256);
Setting *minWidth = createSetting (Type_SpinBox, "minimum width", "minimum width");
minWidth->setDefaultValue(325);
minWidth->setRange (50, 10000);
Setting *reuse = createSetting (Type_CheckBox, "reuse", "Reuse SubView");
reuse->setDefaultValue("true");
Setting *timer = createSetting (Type_SpinBox, "timer", "Input responsiveness");
timer->setDefaultValue (20);
timer->setRange (1, 100);
timer->setToolTip ("The time between two checks for user input in milliseconds.<p>"
"Lower value result in higher responsiveness.");
Setting *fastFactor = createSetting (Type_SpinBox, "fast-factor",
"Fast movement factor");
fastFactor->setDefaultValue (4);
fastFactor->setRange (1, 100);
fastFactor->setToolTip (
"Factor by which movement is speed up while the shift key is held down.");
}
declareSection ("Window Size", "Window Size");
declareSection ("window", "Window");
{
Setting *width = createSetting (Type_LineEdit, "Width", "Width");
Setting *height = createSetting (Type_LineEdit, "Height", "Height");
width->setDefaultValues (QStringList() << "1024");
height->setDefaultValues (QStringList() << "768");
height->setViewLocation (2,2);
width->setViewLocation (2,1);
/*
*Create the proxy setting for predefined values
*/
Setting *preDefined = createSetting (Type_ComboBox, "Pre-Defined", "Pre-Defined");
Setting *preDefined = createSetting (Type_ComboBox, "pre-defined",
"Default window size");
preDefined->setEditorSetting (false);
preDefined->setDeclaredValues (QStringList() << "640 x 480"
<< "800 x 600" << "1024 x 768" << "1440 x 900");
preDefined->setDeclaredValues (
QStringList() << "640 x 480" << "800 x 600" << "1024 x 768" << "1440 x 900");
preDefined->setViewLocation (1, 1);
preDefined->setColumnSpan (2);
preDefined->setToolTip ("Newly opened top-level windows will open with this size "
"(picked from a list of pre-defined values)");
Setting *width = createSetting (Type_LineEdit, "default-width",
"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 (width,
QStringList() << "640" << "800" << "1024" << "1440"
);
Setting *height = createSetting (Type_LineEdit, "default-height",
"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.");
preDefined->addProxy (height,
QStringList() << "480" << "600" << "768" << "900"
);
Setting *minWidth = createSetting (Type_SpinBox, "minimum-width",
"Minimum subview width");
minWidth->setDefaultValue (325);
minWidth->setRange (50, 10000);
minWidth->setToolTip ("Minimum width of subviews.");
}
declareSection ("Display Format", "Display Format");
declareSection ("records", "Records");
{
QString defaultValue = "Icon and Text";
QStringList values = QStringList() << defaultValue << "Icon Only" << "Text Only";
QStringList values = QStringList()
<< defaultValue << "Icon Only" << "Text Only";
Setting *rsd = createSetting (Type_RadioButton, "Record Status Display", "Record Status Display");
Setting *ritd = createSetting (Type_RadioButton, "Referenceable ID Type Display", "Referenceable ID Type Display");
Setting *rsd = createSetting (Type_RadioButton, "status-format",
"Modification status display format");
rsd->setDefaultValue (defaultValue);
ritd->setDefaultValue (defaultValue);
rsd->setDeclaredValues (values);
Setting *ritd = createSetting (Type_RadioButton, "type-format",
"ID type display format");
ritd->setDefaultValue (defaultValue);
ritd->setDeclaredValues (values);
}
declareSection ("Video", "Video");
declareSection ("Objects", "Objects");
{
QString defaultValue = "None";
QStringList values = QStringList()
<< defaultValue << "MSAA 2" << "MSAA 4" << "MSAA 8" << "MSAA 16";
Setting *antialiasing = createSetting (Type_SpinBox, "antialiasing", "antialiasing");
antialiasing->setDeclaredValues (values);
Setting *numLights = createSetting (Type_SpinBox, "num_lights", "num_lights");
numLights->setDefaultValue(8);
numLights->setRange (0, 100);
}
{
/******************************************************************
* There are three types of values:
@ -411,7 +417,7 @@ void CSMSettings::UserSettings::updateUserSetting(const QString &settingKey,
{
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);
}
@ -492,19 +498,9 @@ CSMSettings::Setting *CSMSettings::UserSettings::createSetting
if (!mSettings.empty())
row = mSettings.back()->viewRow()+1;
int column = 2;
if (type==Type_CheckBox)
column = 1;
setting->setViewLocation (row, column);
int span = 1;
if (type==Type_CheckBox)
span = 3;
setting->setViewLocation (row, 1);
setting->setColumnSpan (span);
setting->setColumnSpan (3);
int width = 10;

@ -369,10 +369,10 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to
mViewTotal (totalViews)
{
QString width = CSMSettings::UserSettings::instance().settingValue
("Window Size/Width");
("window/default-width");
QString height = CSMSettings::UserSettings::instance().settingValue
("Window Size/Height");
("window/default-height");
// trick to get the window decorations and their sizes
show();
@ -459,7 +459,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)
bool reuse =
userSettings.setting("SubView/reuse", QString("true")) == "true" ? true : false;
userSettings.setting ("window/reuse", QString("true")) == "true" ? true : false;
if(reuse)
{
foreach(SubView *sb, mSubViews)
@ -478,7 +478,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
// text in the main title bar is adjusted accordingly
int maxSubView = userSettings.setting("SubView/max subviews", QString("256")).toInt();
int maxSubView = userSettings.setting("window/max-subviews", QString("256")).toInt();
if(mSubViews.size() >= maxSubView) // create a new top level view
{
mViewManager.addView(mDocument, id, hint);
@ -501,7 +501,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
if (!hint.empty())
view->useHint (hint);
int minWidth = userSettings.setting("SubView/minimum width", QString("325")).toInt();
int minWidth = userSettings.setting ("window/minimum-width", QString("325")).toInt();
view->setMinimumWidth(minWidth);
view->setStatusBar (mShowStatusBar->isChecked());

@ -50,10 +50,10 @@ namespace CSVRender
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
float farClipDist = userSettings.setting("Scene/far clip distance", QString("300000")).toFloat();
float farClipDist = userSettings.setting("3d-render/far-clip-distance", QString("300000")).toFloat();
mCamera->setFarClipDistance (farClipDist);
mFastFactor = userSettings.setting("Scene/fast factor", QString("4")).toInt();
mFastFactor = userSettings.setting("scene-input/fast-factor", QString("4")).toInt();
mCamera->roll (Ogre::Degree (90));
@ -63,7 +63,7 @@ namespace CSVRender
connect (timer, SIGNAL (timeout()), this, SLOT (update()));
int timerStart = userSettings.setting("Scene/timer start", QString("20")).toInt();
int timerStart = userSettings.setting("scene-input/timer", QString("20")).toInt();
timer->start (timerStart);
/// \todo make shortcut configurable
@ -132,7 +132,7 @@ namespace CSVRender
params.insert(std::make_pair("title", windowTitle.str()));
std::string antialiasing =
CSMSettings::UserSettings::instance().settingValue("Video/antialiasing").toStdString();
CSMSettings::UserSettings::instance().settingValue("3d-render/antialiasing").toStdString();
if(antialiasing == "MSAA 16") antialiasing = "16";
else if(antialiasing == "MSAA 8") antialiasing = "8";
else if(antialiasing == "MSAA 4") antialiasing = "4";
@ -409,14 +409,14 @@ namespace CSVRender
if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive)))
flagAsModified();
if(key == "Scene/far clip distance" && !list.empty())
if(key == "3d-render/far-clip-distance" && !list.empty())
{
if(mCamera->getFarClipDistance() != list.at(0).toFloat())
mCamera->setFarClipDistance(list.at(0).toFloat());
}
// minimise unnecessary ogre window creation by updating only when there is a change
if(key == "Video/antialiasing")
if(key == "3d-render/antialiasing")
{
unsigned int aa = mWindow->getFSAA();
unsigned int antialiasing = 0;

@ -5,7 +5,7 @@
CSVWorld::IdTypeDelegate::IdTypeDelegate
(const ValueList &values, const IconList &icons, CSMDoc::Document& document, QObject *parent)
: DataDisplayDelegate (values, icons, document,
"Display Format", "Referenceable ID Type Display",
"records", "type-format",
parent)
{}

@ -11,7 +11,7 @@ CSVWorld::RecordStatusDelegate::RecordStatusDelegate(const ValueList& values,
const IconList & icons,
CSMDoc::Document& document, QObject *parent)
: DataDisplayDelegate (values, icons, document,
"Display Format", "Record Status Display",
"records", "status-format",
parent)
{}

Loading…
Cancel
Save