preferences Class Reference

The preferences JavaScript global object. Set or retrieve user preferences saved in the user local data. More...

Public Slots

ColorRGBA getColor (String name, ColorRGBA defaultValue)
 Gets the color from the given preference name. More...
 
void setColor (String name, ColorRGBA color)
 Sets the color for the given preference name. More...
 
double getDouble (String name, double defaultValue)
 Gets the double value from the given preference name. More...
 
void setDouble (String name, double value)
 Sets the double value for the given preference name. More...
 
double getInt (String name, int defaultValue)
 Gets the integer value from the given preference name. More...
 
void setInt (String name, int value)
 Sets the integer value for the given preference name. More...
 
bool getBool (String name, bool defaultValue)
 Gets the boolean value from the given preference name. More...
 
void setBool (String name, bool value)
 Gets the boolean value for the given preference name. More...
 
String getString (String name, String defaultValue)
 Gets the string value from the given preference name. More...
 
void setString (String name, String value)
 Sets the string value for the given preference name. More...
 

Detailed Description

The preferences JavaScript global object. Set or retrieve user preferences saved in the user local data.

The actual name and current value of a preference are in stored in the user configuration file. The file prefs.xml contains a description of all preferences recognized by the application. The keyword to access each predefined preference is also found in that file. Scripts can change or retrieve any existing preference, and may create new preferences.

function toggleAutoSaveLayout()
{
var b;
b = preferences.getBool( "AUTO_SAVE_LAYOUT", false );
MessageLog.trace( "preference to automatically save the layout was " + b );
preferences.setBool( "AUTO_SAVE_LAYOUT", !b );
b = preferences.getBool( "AUTO_SAVE_LAYOUT", false );
MessageLog.trace( "preference for auto save layout is now " + b );
}

Member Function Documentation

◆ getBool

bool preferences::getBool ( String  name,
bool  defaultValue 
)
slot

Gets the boolean value from the given preference name.

Parameters
name: The name of the preference.
defaultValue: The default value of the preference.
Returns
Returns the boolean value of the given preference name.

◆ getColor

ColorRGBA preferences::getColor ( String  name,
ColorRGBA  defaultValue 
)
slot

Gets the color from the given preference name.

Parameters
name: The preference name.
defaultValue: The default value of the preference.
Returns
Returns the color of the given preference name.

◆ getDouble

double preferences::getDouble ( String  name,
double  defaultValue 
)
slot

Gets the double value from the given preference name.

Parameters
name: The preference name.
defaultValue: The default value of the preference.
Returns
Returns the double value of the given preference name.

◆ getInt

double preferences::getInt ( String  name,
int  defaultValue 
)
slot

Gets the integer value from the given preference name.

Parameters
name: The preference name.
defaultValue: The default value of the preference.
Returns
Returns the integer value of the given preference name.

◆ getString

String preferences::getString ( String  name,
String  defaultValue 
)
slot

Gets the string value from the given preference name.

Parameters
name: The name of the preference.
defaultValue: The default value of the preference.
Returns
Returns the string value of the given preference name.

◆ setBool

void preferences::setBool ( String  name,
bool  value 
)
slot

Gets the boolean value for the given preference name.

Parameters
name: The name of the preference.
value: The boolean to set the preference to.

◆ setColor

void preferences::setColor ( String  name,
ColorRGBA  color 
)
slot

Sets the color for the given preference name.

Parameters
name: The preference name.
color: The color to set the preference to.

◆ setDouble

void preferences::setDouble ( String  name,
double  value 
)
slot

Sets the double value for the given preference name.

Parameters
name: The preference name.
value: The double to set the preference to.

◆ setInt

void preferences::setInt ( String  name,
int  value 
)
slot

Sets the integer value for the given preference name.

Parameters
name: The preference name.
value: The integer to set the preference to.

◆ setString

void preferences::setString ( String  name,
String  value 
)
slot

Sets the string value for the given preference name.

Parameters
name: The name of the preference.
value: The string to set the preference to.