ToolSettings

new ToolSettings(tool)

This module manages a few settings and gives you easy functions to store your settings in the localStorage.
Parameters:
Name Type Description
tool TTVTool

Members

readonly autoRecoverMessages :Boolean

Loads and returns weither or not to auto recover deleted messages.

readonly highlights :Array

Loads and returns an array of configured highlight objects.

readonly language :String

Loads and returns the selected application language.
Creates and returns a settings menu. This always creates a new MenuItem. If you want access to the items in the application menu use getMenuItemById of the ToolUI.

readonly showLocalizedNames :Boolean

Loads and returns weither or not localized names should be displayed.

Methods

addHighlight()

Opens the dialog to add a new highlight.

getBoolean(name, defaultValue)

Load a boolean from the localStorage.
Parameters:
Name Type Description
name String Name of the localStorage value
defaultValue Boolean The default value you want returned if storage value was not found

getJSON(name, defaultValue)

Gets a object from the localStorage.
Parameters:
Name Type Description
name String Name of the localStorage value
defaultValue Object The default value you want returned if storage value was not found

getString(name, defaultValue)

Gets a string from the localStorage.
Parameters:
Name Type Description
name String Name of the localStorage value
defaultValue String The default value you want returned if storage value was not found

setBoolean(name, value)

Sets a boolean to the localStorage.
Parameters:
Name Type Description
name String Name of the localStorage value
value Boolean The value you want to set

setJSON(name, value)

Sets a JSON object to the localStorage.
Parameters:
Name Type Description
name String Name of the localStorage value
value Object The value you want to set

setLanguage(lang)

Sets the application language to lang. Please don't use this without explicit user interaction.
Parameters:
Name Type Description
lang String The short i18n languge description. Currently only en and de are really supported.

setString(name, value)

Sets a string to the localStroage.
Parameters:
Name Type Description
name String Name of the localStorage value
value String The value you want to set