mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Fixed default settings logic and cleaned up comments.
This commit is contained in:
parent
e4b836608c
commit
ecb4154ac0
@ -29,54 +29,6 @@ namespace boost
|
|||||||
} /* namespace boost */
|
} /* namespace boost */
|
||||||
#endif /* (BOOST_VERSION <= 104600) */
|
#endif /* (BOOST_VERSION <= 104600) */
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: temporary notes
|
|
||||||
*
|
|
||||||
* - CSVSettings::Dialog::Dialog is the settings window
|
|
||||||
* - provide a hard coded default if not found in config file
|
|
||||||
* - provide tooltips
|
|
||||||
* - save/cancel option (or auto-save?)
|
|
||||||
* - opencs.ini: where all these settings are saved
|
|
||||||
* . error if can't create file (directory permissions) or save file (file permissions)
|
|
||||||
* - settings.cfg: where Graphics default settings come from (read only)
|
|
||||||
* . warning if neither default or user cfg not found or not readable (file permissions)
|
|
||||||
* - openmw.cfg: not used
|
|
||||||
*
|
|
||||||
* - Tabbed view similar to OpenMW or Launcher
|
|
||||||
* . Video Settings
|
|
||||||
* . Display Settngs
|
|
||||||
* . Misc Settings
|
|
||||||
*
|
|
||||||
* - Video settings: tick box for "Use the video settings from OpenMW" (default,
|
|
||||||
* individual settings greyed out)
|
|
||||||
* . CS::Editor::setupGraphics()
|
|
||||||
* . the defaults should be the initial setting when unticked, unless previous user
|
|
||||||
* settings were found
|
|
||||||
* # OpenGL/Direct3D9 Rendering Subsystem
|
|
||||||
* # Vsync
|
|
||||||
* # FSAA (antialiasing)
|
|
||||||
* # GLSL/CG shader language
|
|
||||||
* . other shiny options
|
|
||||||
* . screen number
|
|
||||||
* # full screen / windowed (resolution) <- replace already existing
|
|
||||||
*
|
|
||||||
* - Display Settings
|
|
||||||
* . text only / icon + text <- replace already existing
|
|
||||||
* . limit the number of subviews per top level view
|
|
||||||
* . option to reuse subviews
|
|
||||||
* . v/w/dialoguesubview min width 325
|
|
||||||
* . filter pattern syntax
|
|
||||||
*
|
|
||||||
* - misc
|
|
||||||
* . v/r/scenewidget mFastFactor(4)
|
|
||||||
* . v/r/scenewidget far clip distance
|
|
||||||
* . v/r/scenewidget start timer 20
|
|
||||||
* . v/r/scenewidget shortcut
|
|
||||||
* . v/d/adjusterwidget error
|
|
||||||
* . v/r/navigation factor /= 2
|
|
||||||
* . v/w/table redirect extended action
|
|
||||||
*/
|
|
||||||
|
|
||||||
CSMSettings::UserSettings *CSMSettings::UserSettings::mUserSettingsInstance = 0;
|
CSMSettings::UserSettings *CSMSettings::UserSettings::mUserSettingsInstance = 0;
|
||||||
|
|
||||||
CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& configurationManager)
|
CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& configurationManager)
|
||||||
@ -88,7 +40,7 @@ CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& conf
|
|||||||
mUserSettingsInstance = this;
|
mUserSettingsInstance = this;
|
||||||
|
|
||||||
buildSettingModelDefaults();
|
buildSettingModelDefaults();
|
||||||
mSettingCfgDefinitions = new QSettings(QSettings::IniFormat, QSettings::UserScope, "");
|
mSettingCfgDefinitions = new QSettings(QSettings::IniFormat, QSettings::UserScope, "", QString(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMSettings::UserSettings::buildSettingModelDefaults()
|
void CSMSettings::UserSettings::buildSettingModelDefaults()
|
||||||
@ -328,8 +280,6 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||||||
|
|
||||||
CSMSettings::UserSettings::~UserSettings()
|
CSMSettings::UserSettings::~UserSettings()
|
||||||
{
|
{
|
||||||
delete mSettingDefinitions;
|
|
||||||
delete mSettingCfgDefinitions;
|
|
||||||
mUserSettingsInstance = 0;
|
mUserSettingsInstance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,15 +310,7 @@ 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);
|
||||||
|
|
||||||
// if user setting (opencs.ini) exists
|
// prepare to use the settings from settings.cfg
|
||||||
// if readable, then check whether the option to use settings.cfg video settings should be used is set
|
|
||||||
// use the config settings from settings.cfg
|
|
||||||
// else if video config found
|
|
||||||
// use the config settings from opencs.ini
|
|
||||||
// if any of the config option is not found, use hard coded default in this file
|
|
||||||
//
|
|
||||||
|
|
||||||
// Create the settings manager and load default settings file
|
|
||||||
const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg";
|
const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg";
|
||||||
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/settings-default.cfg";
|
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/settings-default.cfg";
|
||||||
|
|
||||||
@ -391,8 +333,6 @@ void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
|||||||
settings.loadUser(globaldefault);
|
settings.loadUser(globaldefault);
|
||||||
|
|
||||||
std::string renderSystem = settings.getString("render system", "Video");
|
std::string renderSystem = settings.getString("render system", "Video");
|
||||||
std::cout << "user settings: render system " + renderSystem << std::endl; // FIXME: debug
|
|
||||||
|
|
||||||
if(renderSystem == "")
|
if(renderSystem == "")
|
||||||
{
|
{
|
||||||
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
||||||
@ -402,11 +342,15 @@ void CSMSettings::UserSettings::loadSettings (const QString &fileName)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
mSettingCfgDefinitions->setValue("Video/render system", renderSystem.c_str());
|
mSettingCfgDefinitions->setValue("Video/render system", renderSystem.c_str());
|
||||||
// Force shiny language based on render system
|
// force shiny language based on render system
|
||||||
if(renderSystem == "Direct3D9 Rendering Subsystem")
|
if(renderSystem == "Direct3D9 Rendering Subsystem")
|
||||||
mSettingDefinitions->setValue("Shiny/language", "CG");
|
mSettingDefinitions->setValue("Shiny/language", "CG");
|
||||||
else
|
else
|
||||||
mSettingDefinitions->setValue("Shiny/language", "GLSL");
|
mSettingDefinitions->setValue("Shiny/language", "GLSL");
|
||||||
|
|
||||||
|
// check if override entry exists (default: override)
|
||||||
|
if(!mSettingDefinitions->childGroups().contains("Video", Qt::CaseInsensitive))
|
||||||
|
mSettingDefinitions->setValue("Video/use settings.cfg", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSMSettings::UserSettings::hasSettingDefinitions
|
bool CSMSettings::UserSettings::hasSettingDefinitions
|
||||||
@ -432,9 +376,8 @@ QString CSMSettings::UserSettings::settingValue (const QString &settingKey)
|
|||||||
|
|
||||||
// check if video settings are overriden
|
// check if video settings are overriden
|
||||||
if(settingKey.contains(QRegExp("^\\b(Video)", Qt::CaseInsensitive)) &&
|
if(settingKey.contains(QRegExp("^\\b(Video)", Qt::CaseInsensitive)) &&
|
||||||
mSettingDefinitions->value("Video/override settings.cfg") == "true")
|
mSettingDefinitions->value("Video/use settings.cfg") == "true")
|
||||||
{
|
{
|
||||||
std::cout << "user settings: override " << std::endl; // FIXME: debug
|
|
||||||
if (!mSettingCfgDefinitions->contains (settingKey))
|
if (!mSettingCfgDefinitions->contains (settingKey))
|
||||||
return QString();
|
return QString();
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user