mirror of https://github.com/stella-emu/stella.git
Improve variable/method naming in Settings class.
This commit is contained in:
parent
032b08cca1
commit
d5180ba649
|
@ -31,163 +31,163 @@
|
||||||
Settings::Settings()
|
Settings::Settings()
|
||||||
{
|
{
|
||||||
// Video-related options
|
// Video-related options
|
||||||
setInternal("video", "");
|
setPermanent("video", "");
|
||||||
setInternal("speed", "1.0");
|
setPermanent("speed", "1.0");
|
||||||
setInternal("vsync", "true");
|
setPermanent("vsync", "true");
|
||||||
setInternal("fullscreen", "false");
|
setPermanent("fullscreen", "false");
|
||||||
setInternal("center", "false");
|
setPermanent("center", "false");
|
||||||
setInternal("palette", "standard");
|
setPermanent("palette", "standard");
|
||||||
setInternal("uimessages", "true");
|
setPermanent("uimessages", "true");
|
||||||
|
|
||||||
// TIA specific options
|
// TIA specific options
|
||||||
setInternal("tia.zoom", "3");
|
setPermanent("tia.zoom", "3");
|
||||||
setInternal("tia.inter", "false");
|
setPermanent("tia.inter", "false");
|
||||||
setInternal("tia.aspectn", "91");
|
setPermanent("tia.aspectn", "91");
|
||||||
setInternal("tia.aspectp", "109");
|
setPermanent("tia.aspectp", "109");
|
||||||
setInternal("tia.fsfill", "false");
|
setPermanent("tia.fsfill", "false");
|
||||||
setInternal("tia.dbgcolors", "roygpb");
|
setPermanent("tia.dbgcolors", "roygpb");
|
||||||
|
|
||||||
// TV filtering options
|
// TV filtering options
|
||||||
setInternal("tv.filter", "0");
|
setPermanent("tv.filter", "0");
|
||||||
setInternal("tv.phosphor", "byrom");
|
setPermanent("tv.phosphor", "byrom");
|
||||||
setInternal("tv.phosblend", "50");
|
setPermanent("tv.phosblend", "50");
|
||||||
setInternal("tv.scanlines", "25");
|
setPermanent("tv.scanlines", "25");
|
||||||
setInternal("tv.scaninter", "true");
|
setPermanent("tv.scaninter", "true");
|
||||||
// TV options when using 'custom' mode
|
// TV options when using 'custom' mode
|
||||||
setInternal("tv.contrast", "0.0");
|
setPermanent("tv.contrast", "0.0");
|
||||||
setInternal("tv.brightness", "0.0");
|
setPermanent("tv.brightness", "0.0");
|
||||||
setInternal("tv.hue", "0.0");
|
setPermanent("tv.hue", "0.0");
|
||||||
setInternal("tv.saturation", "0.0");
|
setPermanent("tv.saturation", "0.0");
|
||||||
setInternal("tv.gamma", "0.0");
|
setPermanent("tv.gamma", "0.0");
|
||||||
setInternal("tv.sharpness", "0.0");
|
setPermanent("tv.sharpness", "0.0");
|
||||||
setInternal("tv.resolution", "0.0");
|
setPermanent("tv.resolution", "0.0");
|
||||||
setInternal("tv.artifacts", "0.0");
|
setPermanent("tv.artifacts", "0.0");
|
||||||
setInternal("tv.fringing", "0.0");
|
setPermanent("tv.fringing", "0.0");
|
||||||
setInternal("tv.bleed", "0.0");
|
setPermanent("tv.bleed", "0.0");
|
||||||
|
|
||||||
// Sound options
|
// Sound options
|
||||||
setInternal(AudioSettings::SETTING_ENABLED, AudioSettings::DEFAULT_ENABLED);
|
setPermanent(AudioSettings::SETTING_ENABLED, AudioSettings::DEFAULT_ENABLED);
|
||||||
setInternal(AudioSettings::SETTING_VOLUME, AudioSettings::DEFAULT_VOLUME);
|
setPermanent(AudioSettings::SETTING_VOLUME, AudioSettings::DEFAULT_VOLUME);
|
||||||
setInternal(AudioSettings::SETTING_STEREO, AudioSettings::DEFAULT_STEREO);
|
setPermanent(AudioSettings::SETTING_STEREO, AudioSettings::DEFAULT_STEREO);
|
||||||
setInternal(AudioSettings::SETTING_PRESET, static_cast<int>(AudioSettings::DEFAULT_PRESET));
|
setPermanent(AudioSettings::SETTING_PRESET, static_cast<int>(AudioSettings::DEFAULT_PRESET));
|
||||||
setInternal(AudioSettings::SETTING_SAMPLE_RATE, AudioSettings::DEFAULT_SAMPLE_RATE);
|
setPermanent(AudioSettings::SETTING_SAMPLE_RATE, AudioSettings::DEFAULT_SAMPLE_RATE);
|
||||||
setInternal(AudioSettings::SETTING_FRAGMENT_SIZE, AudioSettings::DEFAULT_FRAGMENT_SIZE);
|
setPermanent(AudioSettings::SETTING_FRAGMENT_SIZE, AudioSettings::DEFAULT_FRAGMENT_SIZE);
|
||||||
setInternal(AudioSettings::SETTING_BUFFER_SIZE, AudioSettings::DEFAULT_BUFFER_SIZE);
|
setPermanent(AudioSettings::SETTING_BUFFER_SIZE, AudioSettings::DEFAULT_BUFFER_SIZE);
|
||||||
setInternal(AudioSettings::SETTING_HEADROOM, AudioSettings::DEFAULT_HEADROOM);
|
setPermanent(AudioSettings::SETTING_HEADROOM, AudioSettings::DEFAULT_HEADROOM);
|
||||||
setInternal(AudioSettings::SETTING_RESAMPLING_QUALITY, static_cast<int>(AudioSettings::DEFAULT_RESAMPLING_QUALITY));
|
setPermanent(AudioSettings::SETTING_RESAMPLING_QUALITY, static_cast<int>(AudioSettings::DEFAULT_RESAMPLING_QUALITY));
|
||||||
|
|
||||||
// Input event options
|
// Input event options
|
||||||
setInternal("keymap", "");
|
setPermanent("keymap", "");
|
||||||
setInternal("joymap", "");
|
setPermanent("joymap", "");
|
||||||
setInternal("combomap", "");
|
setPermanent("combomap", "");
|
||||||
setInternal("joydeadzone", "13");
|
setPermanent("joydeadzone", "13");
|
||||||
setInternal("joyallow4", "false");
|
setPermanent("joyallow4", "false");
|
||||||
setInternal("usemouse", "analog");
|
setPermanent("usemouse", "analog");
|
||||||
setInternal("grabmouse", "true");
|
setPermanent("grabmouse", "true");
|
||||||
setInternal("cursor", "2");
|
setPermanent("cursor", "2");
|
||||||
setInternal("dsense", "10");
|
setPermanent("dsense", "10");
|
||||||
setInternal("msense", "10");
|
setPermanent("msense", "10");
|
||||||
setInternal("tsense", "10");
|
setPermanent("tsense", "10");
|
||||||
setInternal("saport", "lr");
|
setPermanent("saport", "lr");
|
||||||
setInternal("ctrlcombo", "true");
|
setPermanent("ctrlcombo", "true");
|
||||||
|
|
||||||
// Snapshot options
|
// Snapshot options
|
||||||
setInternal("snapsavedir", "");
|
setPermanent("snapsavedir", "");
|
||||||
setInternal("snaploaddir", "");
|
setPermanent("snaploaddir", "");
|
||||||
setInternal("snapname", "int");
|
setPermanent("snapname", "int");
|
||||||
setInternal("sssingle", "false");
|
setPermanent("sssingle", "false");
|
||||||
setInternal("ss1x", "false");
|
setPermanent("ss1x", "false");
|
||||||
setInternal("ssinterval", "2");
|
setPermanent("ssinterval", "2");
|
||||||
|
|
||||||
// Config files and paths
|
// Config files and paths
|
||||||
setInternal("romdir", "");
|
setPermanent("romdir", "");
|
||||||
|
|
||||||
// ROM browser options
|
// ROM browser options
|
||||||
setInternal("exitlauncher", "false");
|
setPermanent("exitlauncher", "false");
|
||||||
setInternal("launcherres", GUI::Size(900, 600));
|
setPermanent("launcherres", GUI::Size(900, 600));
|
||||||
setInternal("launcherfont", "medium");
|
setPermanent("launcherfont", "medium");
|
||||||
setInternal("launcherroms", "true");
|
setPermanent("launcherroms", "true");
|
||||||
setInternal("romviewer", "1");
|
setPermanent("romviewer", "1");
|
||||||
setInternal("lastrom", "");
|
setPermanent("lastrom", "");
|
||||||
|
|
||||||
// UI-related options
|
// UI-related options
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
setInternal("dbg.res",
|
setPermanent("dbg.res",
|
||||||
GUI::Size(DebuggerDialog::kMediumFontMinW,
|
GUI::Size(DebuggerDialog::kMediumFontMinW,
|
||||||
DebuggerDialog::kMediumFontMinH));
|
DebuggerDialog::kMediumFontMinH));
|
||||||
#endif
|
#endif
|
||||||
setInternal("uipalette", "standard");
|
setPermanent("uipalette", "standard");
|
||||||
setInternal("listdelay", "300");
|
setPermanent("listdelay", "300");
|
||||||
setInternal("mwheel", "4");
|
setPermanent("mwheel", "4");
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
setInternal("autoslot", "false");
|
setPermanent("autoslot", "false");
|
||||||
setInternal("loglevel", "1");
|
setPermanent("loglevel", "1");
|
||||||
setInternal("logtoconsole", "0");
|
setPermanent("logtoconsole", "0");
|
||||||
setInternal("avoxport", "");
|
setPermanent("avoxport", "");
|
||||||
setInternal("fastscbios", "true");
|
setPermanent("fastscbios", "true");
|
||||||
setInternal("threads", "false");
|
setPermanent("threads", "false");
|
||||||
setExternal("romloadcount", "0");
|
setTemporary("romloadcount", "0");
|
||||||
setExternal("maxres", "");
|
setTemporary("maxres", "");
|
||||||
|
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
// Debugger/disassembly options
|
// Debugger/disassembly options
|
||||||
setInternal("dbg.fontsize", "medium");
|
setPermanent("dbg.fontsize", "medium");
|
||||||
setInternal("dbg.fontstyle", "0");
|
setPermanent("dbg.fontstyle", "0");
|
||||||
setInternal("dbg.uhex", "false");
|
setPermanent("dbg.uhex", "false");
|
||||||
setInternal("dbg.ghostreadstrap", "true");
|
setPermanent("dbg.ghostreadstrap", "true");
|
||||||
setInternal("dis.resolve", "true");
|
setPermanent("dis.resolve", "true");
|
||||||
setInternal("dis.gfxformat", "2");
|
setPermanent("dis.gfxformat", "2");
|
||||||
setInternal("dis.showaddr", "true");
|
setPermanent("dis.showaddr", "true");
|
||||||
setInternal("dis.relocate", "false");
|
setPermanent("dis.relocate", "false");
|
||||||
setInternal("dev.rwportbreak", "true");
|
setPermanent("dev.rwportbreak", "true");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Player settings
|
// Player settings
|
||||||
setInternal("plr.stats", "false");
|
setPermanent("plr.stats", "false");
|
||||||
setInternal("plr.bankrandom", "false");
|
setPermanent("plr.bankrandom", "false");
|
||||||
setInternal("plr.ramrandom", "true");
|
setPermanent("plr.ramrandom", "true");
|
||||||
setInternal("plr.cpurandom", "AXYP");
|
setPermanent("plr.cpurandom", "AXYP");
|
||||||
setInternal("plr.colorloss", "false");
|
setPermanent("plr.colorloss", "false");
|
||||||
setInternal("plr.tv.jitter", "true");
|
setPermanent("plr.tv.jitter", "true");
|
||||||
setInternal("plr.tv.jitter_recovery", "10");
|
setPermanent("plr.tv.jitter_recovery", "10");
|
||||||
setInternal("plr.debugcolors", "false");
|
setPermanent("plr.debugcolors", "false");
|
||||||
setInternal("plr.console", "2600"); // 7800
|
setPermanent("plr.console", "2600"); // 7800
|
||||||
setInternal("plr.timemachine", true);
|
setPermanent("plr.timemachine", true);
|
||||||
setInternal("plr.tm.size", 200);
|
setPermanent("plr.tm.size", 200);
|
||||||
setInternal("plr.tm.uncompressed", 60);
|
setPermanent("plr.tm.uncompressed", 60);
|
||||||
setInternal("plr.tm.interval", "30f"); // = 0.5 seconds
|
setPermanent("plr.tm.interval", "30f"); // = 0.5 seconds
|
||||||
setInternal("plr.tm.horizon", "10m"); // = ~10 minutes
|
setPermanent("plr.tm.horizon", "10m"); // = ~10 minutes
|
||||||
setInternal("plr.eepromaccess", "false");
|
setPermanent("plr.eepromaccess", "false");
|
||||||
|
|
||||||
// Developer settings
|
// Developer settings
|
||||||
setInternal("dev.settings", "false");
|
setPermanent("dev.settings", "false");
|
||||||
setInternal("dev.stats", "true");
|
setPermanent("dev.stats", "true");
|
||||||
setInternal("dev.bankrandom", "true");
|
setPermanent("dev.bankrandom", "true");
|
||||||
setInternal("dev.ramrandom", "true");
|
setPermanent("dev.ramrandom", "true");
|
||||||
setInternal("dev.cpurandom", "SAXYP");
|
setPermanent("dev.cpurandom", "SAXYP");
|
||||||
setInternal("dev.colorloss", "true");
|
setPermanent("dev.colorloss", "true");
|
||||||
setInternal("dev.tv.jitter", "true");
|
setPermanent("dev.tv.jitter", "true");
|
||||||
setInternal("dev.tv.jitter_recovery", "2");
|
setPermanent("dev.tv.jitter_recovery", "2");
|
||||||
setInternal("dev.debugcolors", "false");
|
setPermanent("dev.debugcolors", "false");
|
||||||
setInternal("dev.tiadriven", "true");
|
setPermanent("dev.tiadriven", "true");
|
||||||
setInternal("dev.console", "2600"); // 7800
|
setPermanent("dev.console", "2600"); // 7800
|
||||||
setInternal("dev.tia.type", "standard");
|
setPermanent("dev.tia.type", "standard");
|
||||||
setInternal("dev.tia.plinvphase", "true");
|
setPermanent("dev.tia.plinvphase", "true");
|
||||||
setInternal("dev.tia.msinvphase", "true");
|
setPermanent("dev.tia.msinvphase", "true");
|
||||||
setInternal("dev.tia.blinvphase", "true");
|
setPermanent("dev.tia.blinvphase", "true");
|
||||||
setInternal("dev.tia.delaypfbits", "true");
|
setPermanent("dev.tia.delaypfbits", "true");
|
||||||
setInternal("dev.tia.delaypfcolor", "true");
|
setPermanent("dev.tia.delaypfcolor", "true");
|
||||||
setInternal("dev.tia.delayplswap", "true");
|
setPermanent("dev.tia.delayplswap", "true");
|
||||||
setInternal("dev.tia.delayblswap", "true");
|
setPermanent("dev.tia.delayblswap", "true");
|
||||||
setInternal("dev.timemachine", true);
|
setPermanent("dev.timemachine", true);
|
||||||
setInternal("dev.tm.size", 1000);
|
setPermanent("dev.tm.size", 1000);
|
||||||
setInternal("dev.tm.uncompressed", 600);
|
setPermanent("dev.tm.uncompressed", 600);
|
||||||
setInternal("dev.tm.interval", "1f"); // = 1 frame
|
setPermanent("dev.tm.interval", "1f"); // = 1 frame
|
||||||
setInternal("dev.tm.horizon", "30s"); // = ~30 seconds
|
setPermanent("dev.tm.horizon", "30s"); // = ~30 seconds
|
||||||
// Thumb ARM emulation options
|
// Thumb ARM emulation options
|
||||||
setInternal("dev.thumb.trapfatal", "true");
|
setPermanent("dev.thumb.trapfatal", "true");
|
||||||
setInternal("dev.eepromaccess", "true");
|
setPermanent("dev.eepromaccess", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -580,13 +580,13 @@ void Settings::usage() const
|
||||||
const Variant& Settings::value(const string& key) const
|
const Variant& Settings::value(const string& key) const
|
||||||
{
|
{
|
||||||
// Try to find the named setting and answer its value
|
// Try to find the named setting and answer its value
|
||||||
auto it = myInternalSettings.find(key);
|
auto it = myPermanentSettings.find(key);
|
||||||
if(it != myInternalSettings.end())
|
if(it != myPermanentSettings.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
it = myExternalSettings.find(key);
|
it = myTemporarySettings.find(key);
|
||||||
if(it != myExternalSettings.end())
|
if(it != myTemporarySettings.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return EmptyVariant;
|
return EmptyVariant;
|
||||||
|
@ -595,11 +595,11 @@ const Variant& Settings::value(const string& key) const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Settings::setValue(const string& key, const Variant& value)
|
void Settings::setValue(const string& key, const Variant& value)
|
||||||
{
|
{
|
||||||
auto it = myInternalSettings.find(key);
|
auto it = myPermanentSettings.find(key);
|
||||||
if(it != myInternalSettings.end())
|
if(it != myPermanentSettings.end())
|
||||||
it->second = value;
|
it->second = value;
|
||||||
else
|
else
|
||||||
myExternalSettings[key] = value;
|
myTemporarySettings[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -663,20 +663,20 @@ bool Settings::saveConfigFile(const string& cfgfile) const
|
||||||
<< ";" << endl;
|
<< ";" << endl;
|
||||||
|
|
||||||
// Write out each of the key and value pairs
|
// Write out each of the key and value pairs
|
||||||
for(const auto& s: myInternalSettings)
|
for(const auto& s: myPermanentSettings)
|
||||||
out << s.first << " = " << s.second << endl;
|
out << s.first << " = " << s.second << endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Settings::setInternal(const string& key, const Variant& value)
|
void Settings::setPermanent(const string& key, const Variant& value)
|
||||||
{
|
{
|
||||||
myInternalSettings[key] = value;
|
myPermanentSettings[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Settings::setExternal(const string& key, const Variant& value)
|
void Settings::setTemporary(const string& key, const Variant& value)
|
||||||
{
|
{
|
||||||
myExternalSettings[key] = value;
|
myTemporarySettings[key] = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,15 @@
|
||||||
This class provides an interface for accessing all configurable options,
|
This class provides an interface for accessing all configurable options,
|
||||||
both from the settings file and from the commandline.
|
both from the settings file and from the commandline.
|
||||||
|
|
||||||
Note that options can be configured as 'internal' or 'external'. Internal
|
Note that options can be configured as 'permanent' or 'temporary'.
|
||||||
options are ones that the app registers with the system, and always saves
|
Permanent options are ones that the app registers with the system, and
|
||||||
when the app exits. External options are those that may be set for
|
always saves when the app exits. Temporary options are those that are
|
||||||
temporary use; they are used (when appropriate), but never saved to the
|
used when appropriate, but never saved to the settings file.
|
||||||
settings file.
|
|
||||||
|
|
||||||
Each c'tor (both in the base class and in any derived classes) are
|
Each c'tor (both in the base class and in any derived classes) are
|
||||||
responsible for registering all options as either internal or external.
|
responsible for registering all options as either permanent or temporary.
|
||||||
If an option isn't registered as internal, it will be considered external
|
If an option isn't registered as permanent, it will be considered
|
||||||
and will not be saved.
|
temporary and will not be saved.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +76,7 @@ class Settings
|
||||||
Get the value assigned to the specified key.
|
Get the value assigned to the specified key.
|
||||||
|
|
||||||
@param key The key of the setting to lookup
|
@param key The key of the setting to lookup
|
||||||
@return The (variant) value of the setting
|
@return The value of the setting; EmptyVariant if none exists
|
||||||
*/
|
*/
|
||||||
const Variant& value(const string& key) const;
|
const Variant& value(const string& key) const;
|
||||||
|
|
||||||
|
@ -85,7 +84,7 @@ class Settings
|
||||||
Set the value associated with the specified key.
|
Set the value associated with the specified key.
|
||||||
|
|
||||||
@param key The key of the setting
|
@param key The key of the setting
|
||||||
@param value The (variant) value to assign to the key
|
@param value The value to assign to the key
|
||||||
*/
|
*/
|
||||||
void setValue(const string& key, const Variant& value);
|
void setValue(const string& key, const Variant& value);
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ class Settings
|
||||||
Convenience methods to return specific types.
|
Convenience methods to return specific types.
|
||||||
|
|
||||||
@param key The key of the setting to lookup
|
@param key The key of the setting to lookup
|
||||||
@return The specific type value of the value
|
@return The specific type value of the variant
|
||||||
*/
|
*/
|
||||||
int getInt(const string& key) const { return value(key).toInt(); }
|
int getInt(const string& key) const { return value(key).toInt(); }
|
||||||
float getFloat(const string& key) const { return value(key).toFloat(); }
|
float getFloat(const string& key) const { return value(key).toFloat(); }
|
||||||
|
@ -108,8 +107,8 @@ class Settings
|
||||||
appropriate 'value'. Elsewhere, any derived classes should call 'setValue',
|
appropriate 'value'. Elsewhere, any derived classes should call 'setValue',
|
||||||
and let it decide where the key/value pair will be saved.
|
and let it decide where the key/value pair will be saved.
|
||||||
*/
|
*/
|
||||||
void setInternal(const string& key, const Variant& value);
|
void setPermanent(const string& key, const Variant& value);
|
||||||
void setExternal(const string& key, const Variant& value);
|
void setTemporary(const string& key, const Variant& value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This method will be called to load the settings from the
|
This method will be called to load the settings from the
|
||||||
|
@ -141,10 +140,11 @@ class Settings
|
||||||
str.substr(first, str.find_last_not_of(' ')-first+1);
|
str.substr(first, str.find_last_not_of(' ')-first+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME - Rework so that these aren't needed; hence no commenting added
|
||||||
const Options& getInternalSettings() const
|
const Options& getInternalSettings() const
|
||||||
{ return myInternalSettings; }
|
{ return myPermanentSettings; }
|
||||||
const Options& getExternalSettings() const
|
const Options& getExternalSettings() const
|
||||||
{ return myExternalSettings; }
|
{ return myTemporarySettings; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -156,11 +156,11 @@ class Settings
|
||||||
private:
|
private:
|
||||||
// Holds key/value pairs that are necessary for Stella to
|
// Holds key/value pairs that are necessary for Stella to
|
||||||
// function and must be saved on each program exit.
|
// function and must be saved on each program exit.
|
||||||
Options myInternalSettings;
|
Options myPermanentSettings;
|
||||||
|
|
||||||
// Holds auxiliary key/value pairs that shouldn't be saved on
|
// Holds auxiliary key/value pairs that shouldn't be saved on
|
||||||
// program exit.
|
// program exit.
|
||||||
Options myExternalSettings;
|
Options myTemporarySettings;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
// TODO - Fix this code so that we don't need access to getPermanentSettings()
|
||||||
|
// The code should parse the plist file and call setValue on each
|
||||||
|
// option; it shouldn't need to query the base class for which options
|
||||||
|
// are valid.
|
||||||
|
|
||||||
#include "SettingsMACOS.hxx"
|
#include "SettingsMACOS.hxx"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -36,7 +41,7 @@ bool SettingsMACOS::loadConfigFile(const string&)
|
||||||
char cvalue[4096];
|
char cvalue[4096];
|
||||||
|
|
||||||
// Read key/value pairs from the plist file
|
// Read key/value pairs from the plist file
|
||||||
for(const auto& s: getInternalSettings())
|
for(const auto& s: getPermanentSettings())
|
||||||
{
|
{
|
||||||
prefsGetString(s.first.c_str(), cvalue, 4090);
|
prefsGetString(s.first.c_str(), cvalue, 4090);
|
||||||
if(cvalue[0] != 0)
|
if(cvalue[0] != 0)
|
||||||
|
@ -49,7 +54,7 @@ bool SettingsMACOS::loadConfigFile(const string&)
|
||||||
bool SettingsMACOS::saveConfigFile(const string&) const
|
bool SettingsMACOS::saveConfigFile(const string&) const
|
||||||
{
|
{
|
||||||
// Write out each of the key and value pairs
|
// Write out each of the key and value pairs
|
||||||
for(const auto& s: getInternalSettings())
|
for(const auto& s: getPermanentSettings())
|
||||||
prefsSetString(s.first.c_str(), s.second.toCString());
|
prefsSetString(s.first.c_str(), s.second.toCString());
|
||||||
|
|
||||||
prefsSave();
|
prefsSave();
|
||||||
|
|
Loading…
Reference in New Issue