Constructors | |
DzAppSettings (String startPath) | |
DzAppSettings () | |
Methods | |
Boolean | getBoolValue (String key, Boolean def=false) |
Color | getColorValue (String key, Color def=Qt::black) |
Number | getFloatValue (String key, Number def=0.0) |
Number | getIntValue (String key, Number def=0) |
String | getStringValue (String key, String def="") |
void | popPath () |
void | pushPath (String path) |
Boolean | removeValue (String key) |
Boolean | setBoolValue (String key, Boolean setting) |
Boolean | setColorValue (String key, Color setting) |
Boolean | setFloatValue (String key, Number setting) |
Boolean | setIntValue (String key, Number setting) |
Boolean | setStringValue (String key, String setting) |
The Application Settings is a class that is used to store and retrieve settings that persist from one execution of the Appliction to the next. On Windows, the settings are saved in the registry. On Mac, these settings are saved via the Carbon Preferences API.
You can create an instance of this class any time you need to read or write persistent settings. This class is a replacement for DzAppSettingsMgr as it is easier and safer to use. Since each instance is separate, the current path of one instance will not affect the rest of the application. It is also not necessary to call popPath() to put this class back into its previous state.
DzAppSettings::DzAppSettings | ( | ) |
Default Constructor - creates a new settings object that starts out at the default application path.
DzAppSettings::DzAppSettings | ( | String | startPath | ) |
Constructor - creates a new settings object that pushes the given path onto the default application path. This is the same as using the default constructor and then calling pushPath() with the given path.
Read a boolean value from the given key.
key | Name of the key to read. | |
def | Default value - this value is returned if the key fails to be read. |
Read a color value from the given key.
key | Name of the key to read. | |
def | Default value - this value is returned if the key fails to be read. |
Read a floating point value from the given key.
key | Name of the key to read. | |
def | Default value - this value is returned if the key fails to be read. |
Read a integer value from the given key.
key | Name of the key to read. | |
def | Default value - this value is returned if the key fails to be read. |
Read a string value from the given key.
key | Name of the key to read. | |
def | Default value - this value is returned if the key fails to be read. |
void DzAppSettings::popPath | ( | ) |
Pops a temporary key path off the top of the stack.
void DzAppSettings::pushPath | ( | String | path | ) |
Sets the current key path temporarily to the given path. popPath() can be called to remove this path.
path | The subdirectory(s) to add to the current key path. |
Removes a key by name
key | Name of the key to remove. |
Write key with a boolean value.
key | Name of the key to write. | |
setting | Value to save for the key. |
Write key with a color value.
key | Name of the key to write. | |
setting | Value to save for the key. |
Write key with a floating point value.
key | Name of the key to write. | |
setting | Value to save for the key. |
Write key with a integer value.
key | Name of the key to write. | |
setting | Value to save for the key. |
Write key with a string value.
key | Name of the key to write. | |
setting | Value to save for the key. |