forked from teamnwah/openmw-tes3coop
Merge branch 'settings'
This commit is contained in:
commit
94ae222f0e
20 changed files with 262 additions and 267 deletions
|
@ -344,7 +344,7 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
|
||||||
|
|
||||||
factory->loadAllFiles();
|
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);
|
sh::Factory::getInstance ().setShadersEnabled (shaders);
|
||||||
|
|
||||||
std::string fog = mUserSettings.setting("Shader/fog", QString("true")).toStdString();
|
std::string fog = mUserSettings.setting("Shader/fog", QString("true")).toStdString();
|
||||||
|
@ -363,7 +363,7 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
|
||||||
// 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");
|
||||||
|
|
||||||
std::string num_lights = mUserSettings.setting("Objects/num_lights", QString("8")).toStdString();
|
std::string num_lights = mUserSettings.setting("3d-render-adv/num_lights", QString("8")).toStdString();
|
||||||
sh::Factory::getInstance ().setGlobalSetting ("num_lights", num_lights);
|
sh::Factory::getInstance ().setGlobalSetting ("num_lights", num_lights);
|
||||||
|
|
||||||
/// \todo add more configurable shiny settings
|
/// \todo add more configurable shiny settings
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#include "support.hpp"
|
#include "support.hpp"
|
||||||
|
|
||||||
CSMSettings::Setting::Setting(SettingType typ, const QString &settingName,
|
CSMSettings::Setting::Setting(SettingType typ, const QString &settingName,
|
||||||
const QString &pageName)
|
const QString &pageName, const QString& label)
|
||||||
: mIsEditorSetting (false)
|
: mIsEditorSetting (true)
|
||||||
{
|
{
|
||||||
buildDefaultSetting();
|
buildDefaultSetting();
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ CSMSettings::Setting::Setting(SettingType typ, const QString &settingName,
|
||||||
setProperty (Property_SettingType, QVariant (settingType).toString());
|
setProperty (Property_SettingType, QVariant (settingType).toString());
|
||||||
setProperty (Property_Page, pageName);
|
setProperty (Property_Page, pageName);
|
||||||
setProperty (Property_Name, settingName);
|
setProperty (Property_Name, settingName);
|
||||||
|
setProperty (Property_Label, label.isEmpty() ? settingName : label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMSettings::Setting::buildDefaultSetting()
|
void CSMSettings::Setting::buildDefaultSetting()
|
||||||
|
@ -290,14 +291,16 @@ CSMSettings::SettingType CSMSettings::Setting::type() const
|
||||||
Property_SettingType).at(0).toInt());
|
Property_SettingType).at(0).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMSettings::Setting::setMaximum (int value)
|
void CSMSettings::Setting::setRange (int min, int max)
|
||||||
{
|
{
|
||||||
setProperty (Property_Maximum, value);
|
setProperty (Property_Minimum, min);
|
||||||
|
setProperty (Property_Maximum, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMSettings::Setting::setMaximum (double value)
|
void CSMSettings::Setting::setRange (double min, double max)
|
||||||
{
|
{
|
||||||
setProperty (Property_Maximum, value);
|
setProperty (Property_Minimum, min);
|
||||||
|
setProperty (Property_Maximum, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSMSettings::Setting::maximum() const
|
QString CSMSettings::Setting::maximum() const
|
||||||
|
@ -305,16 +308,6 @@ QString CSMSettings::Setting::maximum() const
|
||||||
return property (Property_Maximum).at(0);
|
return property (Property_Maximum).at(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMSettings::Setting::setMinimum (int value)
|
|
||||||
{
|
|
||||||
setProperty (Property_Minimum, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSMSettings::Setting::setMinimum (double value)
|
|
||||||
{
|
|
||||||
setProperty (Property_Minimum, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CSMSettings::Setting::minimum() const
|
QString CSMSettings::Setting::minimum() const
|
||||||
{
|
{
|
||||||
return property (Property_Minimum).at(0);
|
return property (Property_Minimum).at(0);
|
||||||
|
@ -372,6 +365,26 @@ bool CSMSettings::Setting::wrapping() const
|
||||||
return (property (Property_Wrapping).at(0) == "true");
|
return (property (Property_Wrapping).at(0) == "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMSettings::Setting::setLabel (const QString& label)
|
||||||
|
{
|
||||||
|
setProperty (Property_Label, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSMSettings::Setting::getLabel() const
|
||||||
|
{
|
||||||
|
return property (Property_Label).at (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMSettings::Setting::setToolTip (const QString& toolTip)
|
||||||
|
{
|
||||||
|
setProperty (Property_ToolTip, toolTip);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CSMSettings::Setting::getToolTip() const
|
||||||
|
{
|
||||||
|
return property (Property_ToolTip).at (0);
|
||||||
|
}
|
||||||
|
|
||||||
void CSMSettings::Setting::setProperty (SettingProperty prop, bool value)
|
void CSMSettings::Setting::setProperty (SettingProperty prop, bool value)
|
||||||
{
|
{
|
||||||
setProperty (prop, QStringList() << QVariant (value).toString());
|
setProperty (prop, QStringList() << QVariant (value).toString());
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace CSMSettings
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit Setting(SettingType typ, const QString &settingName,
|
Setting(SettingType typ, const QString &settingName,
|
||||||
const QString &pageName);
|
const QString &pageName, const QString& label = "");
|
||||||
|
|
||||||
void addProxy (const Setting *setting, const QStringList &vals);
|
void addProxy (const Setting *setting, const QStringList &vals);
|
||||||
void addProxy (const Setting *setting, const QList <QStringList> &list);
|
void addProxy (const Setting *setting, const QList <QStringList> &list);
|
||||||
|
@ -66,12 +66,11 @@ namespace CSMSettings
|
||||||
void setMask (const QString &value);
|
void setMask (const QString &value);
|
||||||
QString mask() const;
|
QString mask() const;
|
||||||
|
|
||||||
void setMaximum (int value);
|
void setRange (int min, int max);
|
||||||
void setMaximum (double value);
|
void setRange (double min, double max);
|
||||||
|
|
||||||
QString maximum() const;
|
QString maximum() const;
|
||||||
|
|
||||||
void setMinimum (int value);
|
|
||||||
void setMinimum (double value);
|
|
||||||
QString minimum() const;
|
QString minimum() const;
|
||||||
|
|
||||||
void setName (const QString &value);
|
void setName (const QString &value);
|
||||||
|
@ -132,6 +131,13 @@ namespace CSMSettings
|
||||||
void setWidgetWidth (int value);
|
void setWidgetWidth (int value);
|
||||||
int widgetWidth() const;
|
int widgetWidth() const;
|
||||||
|
|
||||||
|
/// This is the text the user gets to see.
|
||||||
|
void setLabel (const QString& label);
|
||||||
|
QString getLabel() const;
|
||||||
|
|
||||||
|
void setToolTip (const QString& toolTip);
|
||||||
|
QString getToolTip() const;
|
||||||
|
|
||||||
///returns the specified property value
|
///returns the specified property value
|
||||||
QStringList property (SettingProperty prop) const;
|
QStringList property (SettingProperty prop) const;
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,14 @@ namespace CSMSettings
|
||||||
Property_TicksAbove = 20,
|
Property_TicksAbove = 20,
|
||||||
Property_TicksBelow = 21,
|
Property_TicksBelow = 21,
|
||||||
Property_StyleSheet = 22,
|
Property_StyleSheet = 22,
|
||||||
|
Property_Label = 23,
|
||||||
|
Property_ToolTip = 24,
|
||||||
|
|
||||||
//Stringlists should always be the last items
|
//Stringlists should always be the last items
|
||||||
Property_DefaultValues = 23,
|
Property_DefaultValues = 25,
|
||||||
Property_DeclaredValues = 24,
|
Property_DeclaredValues = 26,
|
||||||
Property_DefinedValues = 25,
|
Property_DefinedValues = 27,
|
||||||
Property_Proxies = 26
|
Property_Proxies = 28
|
||||||
};
|
};
|
||||||
|
|
||||||
///Basic setting widget types.
|
///Basic setting widget types.
|
||||||
|
|
|
@ -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);
|
|
||||||
numLights->setMinimum (0);
|
|
||||||
numLights->setMaximum (100); // FIXME: not sure what the max value should be
|
|
||||||
numLights->setWidgetWidth (10);
|
|
||||||
numLights->setViewLocation(1, 2);
|
|
||||||
|
|
||||||
Setting *shaders = createSetting (Type_CheckBox, section, "shaders");
|
Setting *farClipDist = createSetting (Type_DoubleSpinBox, "far-clip-distance", "Far clipping distance");
|
||||||
shaders->setDeclaredValues(QStringList() << "true" << "false");
|
farClipDist->setDefaultValue (300000);
|
||||||
shaders->setDefaultValue("true");
|
farClipDist->setRange (0, 1000000);
|
||||||
shaders->setEditorSetting(true);
|
farClipDist->setToolTip ("The maximum distance objects are still rendered at.");
|
||||||
shaders->setSpecialValueText("Enable Shaders");
|
|
||||||
shaders->setWidgetWidth(25);
|
QString defaultValue = "None";
|
||||||
shaders->setColumnSpan (3);
|
Setting *antialiasing = createSetting (Type_ComboBox, "antialiasing", "Antialiasing");
|
||||||
shaders->setStyleSheet ("QGroupBox { border: 0px; }");
|
antialiasing->setDeclaredValues (QStringList()
|
||||||
shaders->setViewLocation(2, 1);
|
<< defaultValue << "MSAA 2" << "MSAA 4" << "MSAA 8" << "MSAA 16");
|
||||||
|
antialiasing->setDefaultValue (defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|
||||||
maxSubView->setWidgetWidth (10);
|
|
||||||
maxSubView->setViewLocation(1, 2);
|
|
||||||
|
|
||||||
Setting *minWidth = createSetting (Type_SpinBox, section, "minimum width");
|
Setting *fastFactor = createSetting (Type_SpinBox, "fast-factor",
|
||||||
minWidth->setDefaultValue(325);
|
"Fast movement factor");
|
||||||
minWidth->setEditorSetting(true);
|
fastFactor->setDefaultValue (4);
|
||||||
minWidth->setColumnSpan (1);
|
fastFactor->setRange (1, 100);
|
||||||
minWidth->setMinimum (50);
|
fastFactor->setToolTip (
|
||||||
minWidth->setSpecialValueText ("50");
|
"Factor by which movement is speed up while the shift key is held down.");
|
||||||
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);
|
||||||
|
|
||||||
|
Setting *ritd = createSetting (Type_RadioButton, "type-format",
|
||||||
|
"ID type display format");
|
||||||
|
ritd->setDefaultValue (defaultValue);
|
||||||
ritd->setDeclaredValues (values);
|
ritd->setDeclaredValues (values);
|
||||||
|
|
||||||
rsd->setEditorSetting (true);
|
|
||||||
ritd->setEditorSetting (true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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))
|
|
||||||
{
|
|
||||||
qWarning() << "Duplicate declaration encountered: "
|
|
||||||
<< (name + '/' + page);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Setting *setting = new Setting (typ, name, page);
|
// set useful defaults
|
||||||
|
int row = 1;
|
||||||
|
|
||||||
|
if (!mSettings.empty())
|
||||||
|
row = mSettings.back()->viewRow()+1;
|
||||||
|
|
||||||
|
setting->setViewLocation (row, 1);
|
||||||
|
|
||||||
|
setting->setColumnSpan (3);
|
||||||
|
|
||||||
|
int width = 10;
|
||||||
|
|
||||||
|
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))
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
#ifndef USERSETTINGS_HPP
|
#ifndef USERSETTINGS_HPP
|
||||||
#define USERSETTINGS_HPP
|
#define USERSETTINGS_HPP
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QPair>
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
#include "support.hpp"
|
#include "support.hpp"
|
||||||
|
@ -22,20 +25,20 @@ class QSettings;
|
||||||
namespace CSMSettings {
|
namespace CSMSettings {
|
||||||
|
|
||||||
class Setting;
|
class Setting;
|
||||||
typedef QMap <QString, QList <Setting *> > SettingPageMap;
|
typedef QMap <QString, QPair<QString, QList <Setting *> > > SettingPageMap;
|
||||||
|
|
||||||
class UserSettings: public QObject
|
class UserSettings: public QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
static UserSettings *mUserSettingsInstance;
|
static UserSettings *sUserSettingsInstance;
|
||||||
const Files::ConfigurationManager& mCfgMgr;
|
const Files::ConfigurationManager& mCfgMgr;
|
||||||
|
|
||||||
QSettings *mSettingDefinitions;
|
QSettings *mSettingDefinitions;
|
||||||
QSettings *mSettingCfgDefinitions;
|
|
||||||
QList <Setting *> mSettings;
|
QList <Setting *> mSettings;
|
||||||
|
QString mSection;
|
||||||
|
std::map<QString, QString> mSectionLabels;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -64,7 +67,7 @@ namespace CSMSettings {
|
||||||
void removeSetting
|
void removeSetting
|
||||||
(const QString &pageName, const QString &settingName);
|
(const QString &pageName, const QString &settingName);
|
||||||
|
|
||||||
///Retreive a map of the settings, keyed by page name
|
///Retrieve a map of the settings, keyed by page name
|
||||||
SettingPageMap settingPageMap() const;
|
SettingPageMap settingPageMap() const;
|
||||||
|
|
||||||
///Returns a string list of defined vlaues for the specified setting
|
///Returns a string list of defined vlaues for the specified setting
|
||||||
|
@ -84,8 +87,13 @@ namespace CSMSettings {
|
||||||
void buildSettingModelDefaults();
|
void buildSettingModelDefaults();
|
||||||
|
|
||||||
///add a new setting to the model and return it
|
///add a new setting to the model and return it
|
||||||
Setting *createSetting (CSMSettings::SettingType typ,
|
Setting *createSetting (CSMSettings::SettingType type, const QString &name,
|
||||||
const QString &page, const QString &name);
|
const QString& label);
|
||||||
|
|
||||||
|
/// Set the section for createSetting calls.
|
||||||
|
///
|
||||||
|
/// Sections can be declared multiple times.
|
||||||
|
void declareSection (const QString& page, const QString& label);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
|
@ -369,10 +369,10 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to
|
||||||
mViewTotal (totalViews)
|
mViewTotal (totalViews)
|
||||||
{
|
{
|
||||||
QString width = CSMSettings::UserSettings::instance().settingValue
|
QString width = CSMSettings::UserSettings::instance().settingValue
|
||||||
("Window Size/Width");
|
("window/default-width");
|
||||||
|
|
||||||
QString height = CSMSettings::UserSettings::instance().settingValue
|
QString height = CSMSettings::UserSettings::instance().settingValue
|
||||||
("Window Size/Height");
|
("window/default-height");
|
||||||
|
|
||||||
// trick to get the window decorations and their sizes
|
// trick to get the window decorations and their sizes
|
||||||
show();
|
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)
|
// User setting to reuse sub views (on a per top level view basis)
|
||||||
bool reuse =
|
bool reuse =
|
||||||
userSettings.setting("SubView/reuse", QString("true")) == "true" ? true : false;
|
userSettings.setting ("window/reuse", QString("true")) == "true" ? true : false;
|
||||||
if(reuse)
|
if(reuse)
|
||||||
{
|
{
|
||||||
foreach(SubView *sb, mSubViews)
|
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
|
// 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 = 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
|
if(mSubViews.size() >= maxSubView) // create a new top level view
|
||||||
{
|
{
|
||||||
mViewManager.addView(mDocument, id, hint);
|
mViewManager.addView(mDocument, id, hint);
|
||||||
|
@ -501,7 +501,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 = userSettings.setting("SubView/minimum width", QString("325")).toInt();
|
int minWidth = userSettings.setting ("window/minimum-width", QString("325")).toInt();
|
||||||
view->setMinimumWidth(minWidth);
|
view->setMinimumWidth(minWidth);
|
||||||
|
|
||||||
view->setStatusBar (mShowStatusBar->isChecked());
|
view->setStatusBar (mShowStatusBar->isChecked());
|
||||||
|
|
|
@ -52,10 +52,10 @@ namespace CSVRender
|
||||||
|
|
||||||
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
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);
|
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));
|
mCamera->roll (Ogre::Degree (90));
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ namespace CSVRender
|
||||||
|
|
||||||
connect (timer, SIGNAL (timeout()), this, SLOT (update()));
|
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);
|
timer->start (timerStart);
|
||||||
|
|
||||||
/// \todo make shortcut configurable
|
/// \todo make shortcut configurable
|
||||||
|
@ -137,7 +137,7 @@ namespace CSVRender
|
||||||
params.insert(std::make_pair("title", windowTitle.str()));
|
params.insert(std::make_pair("title", windowTitle.str()));
|
||||||
|
|
||||||
std::string antialiasing =
|
std::string antialiasing =
|
||||||
CSMSettings::UserSettings::instance().settingValue("Video/antialiasing").toStdString();
|
CSMSettings::UserSettings::instance().settingValue("3d-render/antialiasing").toStdString();
|
||||||
if(antialiasing == "MSAA 16") antialiasing = "16";
|
if(antialiasing == "MSAA 16") antialiasing = "16";
|
||||||
else if(antialiasing == "MSAA 8") antialiasing = "8";
|
else if(antialiasing == "MSAA 8") antialiasing = "8";
|
||||||
else if(antialiasing == "MSAA 4") antialiasing = "4";
|
else if(antialiasing == "MSAA 4") antialiasing = "4";
|
||||||
|
@ -440,14 +440,14 @@ namespace CSVRender
|
||||||
if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive)))
|
if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive)))
|
||||||
flagAsModified();
|
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())
|
if(mCamera->getFarClipDistance() != list.at(0).toFloat())
|
||||||
mCamera->setFarClipDistance(list.at(0).toFloat());
|
mCamera->setFarClipDistance(list.at(0).toFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
// minimise unnecessary ogre window creation by updating only when there is a change
|
// 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 aa = mWindow->getFSAA();
|
||||||
unsigned int antialiasing = 0;
|
unsigned int antialiasing = 0;
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
#include "dialog.hpp"
|
#include "dialog.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
#include <QSplitter>
|
||||||
|
|
||||||
#include "../../model/settings/usersettings.hpp"
|
#include "../../model/settings/usersettings.hpp"
|
||||||
|
|
||||||
|
@ -12,8 +15,6 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include <QSplitter>
|
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
@ -26,6 +27,10 @@ CSVSettings::Dialog::Dialog(QMainWindow *parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(QString::fromUtf8 ("User Settings"));
|
setWindowTitle(QString::fromUtf8 ("User Settings"));
|
||||||
|
|
||||||
|
setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
|
setMinimumSize (600, 400);
|
||||||
|
|
||||||
setupDialog();
|
setupDialog();
|
||||||
|
|
||||||
connect (mPageListWidget,
|
connect (mPageListWidget,
|
||||||
|
@ -39,20 +44,14 @@ void CSVSettings::Dialog::slotChangePage
|
||||||
{
|
{
|
||||||
mStackedWidget->changePage
|
mStackedWidget->changePage
|
||||||
(mPageListWidget->row (cur), mPageListWidget->row (prev));
|
(mPageListWidget->row (cur), mPageListWidget->row (prev));
|
||||||
|
|
||||||
layout()->activate();
|
|
||||||
setFixedSize(minimumSizeHint());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVSettings::Dialog::setupDialog()
|
void CSVSettings::Dialog::setupDialog()
|
||||||
{
|
{
|
||||||
//create central widget with it's layout and immediate children
|
QSplitter *centralWidget = new QSplitter (this);
|
||||||
QWidget *centralWidget = new QGroupBox (this);
|
centralWidget->setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
centralWidget->setLayout (new QHBoxLayout());
|
|
||||||
centralWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|
||||||
setCentralWidget (centralWidget);
|
setCentralWidget (centralWidget);
|
||||||
setDockOptions (QMainWindow::AllowNestedDocks);
|
|
||||||
|
|
||||||
buildPageListWidget (centralWidget);
|
buildPageListWidget (centralWidget);
|
||||||
buildStackedWidget (centralWidget);
|
buildStackedWidget (centralWidget);
|
||||||
|
@ -64,37 +63,39 @@ void CSVSettings::Dialog::buildPages()
|
||||||
|
|
||||||
QFontMetrics fm (QApplication::font());
|
QFontMetrics fm (QApplication::font());
|
||||||
|
|
||||||
|
int maxWidth = 1;
|
||||||
|
|
||||||
foreach (Page *page, SettingWindow::pages())
|
foreach (Page *page, SettingWindow::pages())
|
||||||
{
|
{
|
||||||
QString pageName = page->objectName();
|
maxWidth = std::max (maxWidth, fm.width(page->getLabel()));
|
||||||
|
|
||||||
int textWidth = fm.width(pageName);
|
new QListWidgetItem (page->getLabel(), mPageListWidget);
|
||||||
|
|
||||||
new QListWidgetItem (pageName, mPageListWidget);
|
mStackedWidget->addWidget (page);
|
||||||
mPageListWidget->setFixedWidth (textWidth + 50);
|
|
||||||
|
|
||||||
mStackedWidget->addWidget (&dynamic_cast<QWidget &>(*(page)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mPageListWidget->setMaximumWidth (maxWidth + 10);
|
||||||
|
|
||||||
resize (mStackedWidget->sizeHint());
|
resize (mStackedWidget->sizeHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVSettings::Dialog::buildPageListWidget (QWidget *centralWidget)
|
void CSVSettings::Dialog::buildPageListWidget (QSplitter *centralWidget)
|
||||||
{
|
{
|
||||||
mPageListWidget = new QListWidget (centralWidget);
|
mPageListWidget = new QListWidget (centralWidget);
|
||||||
mPageListWidget->setMinimumWidth(50);
|
mPageListWidget->setMinimumWidth(50);
|
||||||
mPageListWidget->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Expanding);
|
mPageListWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
mPageListWidget->setSelectionBehavior (QAbstractItemView::SelectItems);
|
mPageListWidget->setSelectionBehavior (QAbstractItemView::SelectItems);
|
||||||
|
|
||||||
centralWidget->layout()->addWidget(mPageListWidget);
|
centralWidget->addWidget(mPageListWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVSettings::Dialog::buildStackedWidget (QWidget *centralWidget)
|
void CSVSettings::Dialog::buildStackedWidget (QSplitter *centralWidget)
|
||||||
{
|
{
|
||||||
mStackedWidget = new ResizeableStackedWidget (centralWidget);
|
mStackedWidget = new ResizeableStackedWidget (centralWidget);
|
||||||
|
mStackedWidget->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Expanding);
|
||||||
|
|
||||||
centralWidget->layout()->addWidget (mStackedWidget);
|
centralWidget->addWidget (mStackedWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVSettings::Dialog::closeEvent (QCloseEvent *event)
|
void CSVSettings::Dialog::closeEvent (QCloseEvent *event)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
class QStackedWidget;
|
class QStackedWidget;
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
|
class QSplitter;
|
||||||
|
|
||||||
namespace CSVSettings {
|
namespace CSVSettings {
|
||||||
|
|
||||||
|
@ -39,8 +40,8 @@ namespace CSVSettings {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void buildPages();
|
void buildPages();
|
||||||
void buildPageListWidget (QWidget *centralWidget);
|
void buildPageListWidget (QSplitter *centralWidget);
|
||||||
void buildStackedWidget (QWidget *centralWidget);
|
void buildStackedWidget (QSplitter *centralWidget);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ CSVSettings::Frame::Frame (bool isVisible, const QString &title,
|
||||||
{
|
{
|
||||||
// must be Page, not a View
|
// must be Page, not a View
|
||||||
setStyleSheet (sInvisibleBoxStyle);
|
setStyleSheet (sInvisibleBoxStyle);
|
||||||
mLayout->setContentsMargins(10, 15, 10, 15);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setLayout (mLayout);
|
setLayout (mLayout);
|
||||||
|
@ -39,7 +38,7 @@ void CSVSettings::Frame::hideWidgets()
|
||||||
|
|
||||||
QWidget *widg = static_cast <QWidget *> (obj);
|
QWidget *widg = static_cast <QWidget *> (obj);
|
||||||
if (widg->property("sizePolicy").isValid())
|
if (widg->property("sizePolicy").isValid())
|
||||||
widg->setSizePolicy (QSizePolicy::Ignored, QSizePolicy::Ignored);
|
widg->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
}
|
}
|
||||||
|
|
||||||
layout()->activate();
|
layout()->activate();
|
||||||
|
|
|
@ -17,10 +17,9 @@
|
||||||
QMap <CSVSettings::ViewType, CSVSettings::IViewFactory *>
|
QMap <CSVSettings::ViewType, CSVSettings::IViewFactory *>
|
||||||
CSVSettings::Page::mViewFactories;
|
CSVSettings::Page::mViewFactories;
|
||||||
|
|
||||||
CSVSettings::Page::Page(const QString &pageName,
|
CSVSettings::Page::Page (const QString &pageName, QList <CSMSettings::Setting *> settingList,
|
||||||
QList <CSMSettings::Setting *> settingList,
|
SettingWindow *parent, const QString& label)
|
||||||
SettingWindow *parent) :
|
: mParent(parent), mIsEditorPage (false), Frame(false, "", parent), mLabel (label)
|
||||||
mParent(parent), mIsEditorPage (false), Frame(false, "", parent)
|
|
||||||
{
|
{
|
||||||
setObjectName (pageName);
|
setObjectName (pageName);
|
||||||
|
|
||||||
|
@ -104,3 +103,8 @@ void CSVSettings::Page::buildFactories()
|
||||||
mViewFactories[ViewType_List] = new ListViewFactory (this);
|
mViewFactories[ViewType_List] = new ListViewFactory (this);
|
||||||
mViewFactories[ViewType_Range] = new RangeViewFactory (this);
|
mViewFactories[ViewType_Range] = new RangeViewFactory (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CSVSettings::Page::getLabel() const
|
||||||
|
{
|
||||||
|
return mLabel;
|
||||||
|
}
|
||||||
|
|
|
@ -25,11 +25,11 @@ namespace CSVSettings
|
||||||
SettingWindow *mParent;
|
SettingWindow *mParent;
|
||||||
static QMap <ViewType, IViewFactory *> mViewFactories;
|
static QMap <ViewType, IViewFactory *> mViewFactories;
|
||||||
bool mIsEditorPage;
|
bool mIsEditorPage;
|
||||||
|
QString mLabel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Page(const QString &pageName,
|
Page (const QString &pageName, QList <CSMSettings::Setting *> settingList,
|
||||||
QList <CSMSettings::Setting *> settingList,
|
SettingWindow *parent, const QString& label);
|
||||||
SettingWindow *parent);
|
|
||||||
|
|
||||||
///Creates a new view based on the passed setting and adds it to
|
///Creates a new view based on the passed setting and adds it to
|
||||||
///the page.
|
///the page.
|
||||||
|
@ -42,6 +42,8 @@ namespace CSVSettings
|
||||||
///returns the list of views associated with the page
|
///returns the list of views associated with the page
|
||||||
const QList <View *> &views () const { return mViews; }
|
const QList <View *> &views () const { return mViews; }
|
||||||
|
|
||||||
|
QString getLabel() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
///Creates views based on the passed setting list
|
///Creates views based on the passed setting list
|
||||||
|
|
|
@ -126,8 +126,6 @@ void CSVSettings::RangeView::buildSpinBox (CSMSettings::Setting *setting)
|
||||||
mRangeWidget->setProperty ("minimum", setting->minimum());
|
mRangeWidget->setProperty ("minimum", setting->minimum());
|
||||||
mRangeWidget->setProperty ("maximum", setting->maximum());
|
mRangeWidget->setProperty ("maximum", setting->maximum());
|
||||||
mRangeWidget->setProperty ("singleStep", setting->singleStep());
|
mRangeWidget->setProperty ("singleStep", setting->singleStep());
|
||||||
mRangeWidget->setProperty ("specialValueText",
|
|
||||||
setting->specialValueText());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mRangeWidget->setProperty ("prefix", setting->prefix());
|
mRangeWidget->setProperty ("prefix", setting->prefix());
|
||||||
|
|
|
@ -34,7 +34,6 @@ void CSVSettings::ResizeableStackedWidget::changePage
|
||||||
curPage->showWidgets();
|
curPage->showWidgets();
|
||||||
|
|
||||||
layout()->activate();
|
layout()->activate();
|
||||||
setFixedSize(minimumSizeHint());
|
|
||||||
|
|
||||||
setCurrentIndex (current);
|
setCurrentIndex (current);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ void CSVSettings::SettingWindow::createPages()
|
||||||
|
|
||||||
foreach (const QString &pageName, pageMap.keys())
|
foreach (const QString &pageName, pageMap.keys())
|
||||||
{
|
{
|
||||||
QList <CSMSettings::Setting *> pageSettings = pageMap.value (pageName);
|
QList <CSMSettings::Setting *> pageSettings = pageMap.value (pageName).second;
|
||||||
|
|
||||||
mPages.append (new Page (pageName, pageSettings, this));
|
mPages.append (new Page (pageName, pageSettings, this, pageMap.value (pageName).first));
|
||||||
|
|
||||||
for (int i = 0; i < pageSettings.size(); i++)
|
for (int i = 0; i < pageSettings.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,8 +17,11 @@ CSVSettings::View::View(CSMSettings::Setting *setting,
|
||||||
mIsMultiValue (setting->isMultiValue()),
|
mIsMultiValue (setting->isMultiValue()),
|
||||||
mViewKey (setting->page() + '/' + setting->name()),
|
mViewKey (setting->page() + '/' + setting->name()),
|
||||||
mSerializable (setting->serializable()),
|
mSerializable (setting->serializable()),
|
||||||
Frame(true, setting->name(), parent)
|
Frame(true, setting->getLabel(), parent)
|
||||||
{
|
{
|
||||||
|
if (!setting->getToolTip().isEmpty())
|
||||||
|
setToolTip (setting->getToolTip());
|
||||||
|
|
||||||
setObjectName (setting->name());
|
setObjectName (setting->name());
|
||||||
buildView();
|
buildView();
|
||||||
buildModel (setting);
|
buildModel (setting);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
CSVWorld::IdTypeDelegate::IdTypeDelegate
|
CSVWorld::IdTypeDelegate::IdTypeDelegate
|
||||||
(const ValueList &values, const IconList &icons, CSMDoc::Document& document, QObject *parent)
|
(const ValueList &values, const IconList &icons, CSMDoc::Document& document, QObject *parent)
|
||||||
: DataDisplayDelegate (values, icons, document,
|
: DataDisplayDelegate (values, icons, document,
|
||||||
"Display Format", "Referenceable ID Type Display",
|
"records", "type-format",
|
||||||
parent)
|
parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ CSVWorld::RecordStatusDelegate::RecordStatusDelegate(const ValueList& values,
|
||||||
const IconList & icons,
|
const IconList & icons,
|
||||||
CSMDoc::Document& document, QObject *parent)
|
CSMDoc::Document& document, QObject *parent)
|
||||||
: DataDisplayDelegate (values, icons, document,
|
: DataDisplayDelegate (values, icons, document,
|
||||||
"Display Format", "Record Status Display",
|
"records", "status-format",
|
||||||
parent)
|
parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
[Display%20Format]
|
|
||||||
Record%20Status%20Display=Icon Only
|
|
||||||
Referenceable%20ID%20Type%20Display=Text Only
|
|
||||||
|
|
||||||
[Window%20Size]
|
|
||||||
Height=900
|
|
||||||
Width=1440
|
|
Loading…
Reference in a new issue