DzAppSettings Class Reference
[Manager Objects]

Provides cross-platform support for persistent application settings. More...

List of all members.

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)


Detailed Description

Provides cross-platform support for persistent application settings.

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

Boolean DzAppSettings::getBoolValue ( String  key,
Boolean  def = false 
)

Read a boolean value from the given key.

Parameters:
key Name of the key to read.
def Default value - this value is returned if the key fails to be read.
Returns:
The value of the requested key
See also:
setBoolValue()

Color DzAppSettings::getColorValue ( String  key,
Color  def = Qt::black 
)

Read a color value from the given key.

Parameters:
key Name of the key to read.
def Default value - this value is returned if the key fails to be read.
Returns:
The value of the requested key
See also:
setColorValue()

Number DzAppSettings::getFloatValue ( String  key,
Number  def = 0.0 
)

Read a floating point value from the given key.

Parameters:
key Name of the key to read.
def Default value - this value is returned if the key fails to be read.
Returns:
The value of the requested key
See also:
setFloatValue()

Number DzAppSettings::getIntValue ( String  key,
Number  def = 0 
)

Read a integer value from the given key.

Parameters:
key Name of the key to read.
def Default value - this value is returned if the key fails to be read.
Returns:
The value of the requested key
See also:
setIntValue()

String DzAppSettings::getStringValue ( String  key,
String  def = "" 
)

Read a string value from the given key.

Parameters:
key Name of the key to read.
def Default value - this value is returned if the key fails to be read.
Returns:
The value of the requested key
See also:
setStringValue()

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.

Parameters:
path The subdirectory(s) to add to the current key path.

Boolean DzAppSettings::removeValue ( String  key  ) 

Removes a key by name

Parameters:
key Name of the key to remove.
Returns:
true if the key/value existed and was successfully removed

Boolean DzAppSettings::setBoolValue ( String  key,
Boolean  setting 
)

Write key with a boolean value.

Parameters:
key Name of the key to write.
setting Value to save for the key.
Returns:
true if the key/value was successfully written
See also:
getBoolValue()

Boolean DzAppSettings::setColorValue ( String  key,
Color  setting 
)

Write key with a color value.

Parameters:
key Name of the key to write.
setting Value to save for the key.
Returns:
true if the key/value was successfully written
See also:
getColorValue()

Boolean DzAppSettings::setFloatValue ( String  key,
Number  setting 
)

Write key with a floating point value.

Parameters:
key Name of the key to write.
setting Value to save for the key.
Returns:
true if the key/value was successfully written
See also:
getFloatValue()

Boolean DzAppSettings::setIntValue ( String  key,
Number  setting 
)

Write key with a integer value.

Parameters:
key Name of the key to write.
setting Value to save for the key.
Returns:
true if the key/value was successfully written
See also:
getIntValue()

Boolean DzAppSettings::setStringValue ( String  key,
String  setting 
)

Write key with a string value.

Parameters:
key Name of the key to write.
setting Value to save for the key.
Returns:
true if the key/value was successfully written
See also:
getStringValue()


Generated on Thu Sep 24 12:21:10 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.