Add-on settings

Description
settings.xml is a XML file that contains the current configuration for the addon and should be placed in the resources direcory. If your addon has configurable items that are set by the user, put them here. This file defines what the user sees when they click on Addon settings for your addon. You don't need to do any coding to utilise this functionality. The format for the settings file is relatively straightforward as can be seen in the following example:

Example code:

You need to supply at least one category element. The label attribute of both categories and settings should be the id of a language string in your language files or the one of the main XBMC language file.

Different types
Setting type and additional attributes can be one in the following table:

Settings can have additional attributes:

Line separators
Line separators add a horizontal separating line between other element. They are purely user-interface elements that do not allow user input and therefore have no meaningful value as a setting.

type="sep"
Shows a horizontal line.

Example code:

type="lsep"
Shows a horizontal line with a text.

Attributes:
 * label="id" (required) - an id from the language file that indicates which text to display.

Example code:

Text input
Text input elements allow a user to input text in various formats. The "label" attribute must contain an id from the language file that indicates which text to display for the input field.

type="text"
Allow a user to enter one line of text.

Attributes:
 * id="string" (required) - the name of the setting.
 * label="id" (required) - an id from the language file that indicates which text to display.
 * option="hidden"|"urlencoded" (optional)
 * if set to "hidden", each characters entered by the user will be obfuscated with an asterisks ("*"), as is usual for entering passwords.
 * if set to "urlencoded", each non-alphanumeric characters entered by the user will be "escaped" using %XX encoding.


 * default="value" (optional) - the default value.

Example code:

The value entered by the user is saved as a string value on disk:

type="ipaddress"
Allow a user to enter an ip address as text.

Attributes:
 * id="string" (required) - the name of the setting.
 * label="id" (required) - an id from the language file that indicates which text to display.
 * default="value" (optional) - the default value.

Example code:

The value entered by the user is saved as a string value on disk:

Numeric input
Numeric input elements allow a user to enter a number. The "label" attribute must contain an id from the language file that indicates which text to display for the input field.

type="number"
Allows the user to enter an integer using up/down buttons.

Attributes:
 * id="string" (required) - the name of the setting.
 * label="id" (required) - an id from the language file that indicates which text to display.
 * default="value" (optional) - the default value.

Example code:

The value entered by the user is saved as a string value on disk:

type="slider"
Allows the user to enter a number using a horizontal sliding bar.

Example:

Attributes:
 * id="string" (required) - the name of the setting.
 * label="id" (required) - an id from the language file that indicates which text to display.
 * range="min[,step],max" (required) - specify the range of valid values.
 * option="int"|"float"|"percent" (required) - specifies whether to allow the user to choose between integers, floating point numbers or a percentage.
 * default="value" (optional) - the default value.

The value entered by the user is saved as a string representation of a floating point value on disk:

Boolean input
Boolean input elements allow a user to switch a setting on or off.

type="bool"
Attributes:
 * id="string" (required) - the name of the setting
 * label="id" (required) - an id from the language file that indicates which text to display.
 * default="true"|"false" (optional) - the default value.

Example code:

The value entered by the user is saved as a string "true" or "false":

Rotary selector
A rotary selector allows the user to selected from a list of predefined values.

type="enum" or "labelenum"
Both element types work the same except that the "enum" type will use the index of the chosen value, wheras the "labelenum" will use the actual value.

Arguments:
 * id="string" (required) - the name of the setting
 * label="id" (required) - an id from the language file that indicates which text to display.
 * 'values="value1[|value2''[...]]" - or -
 * 'lvalues="id1[|id2''[...]]" (required):
 * A list of values or language file ids from which the user can choose.

Example code:


 * Selecting the value "One" will return the int value "0", selecting the value "Two" will return the int value "1", etc.

The value entered by the user is saved as a string. For "enum"-type settings the index of the value is saved, starting at 0 for the first value. For "labelenum"-type settings the value is saved or, in case the lvalues attribute is used, the label translated in the language of the user.

File and folder browsing
File and folder browsing elements allow a user to select a file or folder by browsing the local disks or network. You can specify a media type to show only files of the chosen type to the user. The "label" attribute must contain an id from the language file that indicates which text to display for the input field.

type="file", "audio", "video", "image" or "executable"
Allow the user to browse for and select a file. When using type="audio", "video", "image" or "executable", only files of those types are displayed to the user.

Attributes:
 * id="string" (required) - the name of the setting
 * label="id" (required) - an id from the language file that indicates which text to display.
 * value="value" (optional) - the default value.

Example code:

The full path to the file selected by the user is saved as a string value on disk:

type="folder"
Allow the user to browse for and select a folder.


 * id="string" (required) - the name of the setting
 * label="id" (required) - an id from the language file that indicates which text to display.
 * source="auto"|"images"|... (optional, default="auto") - select a starting folder for the browse dialog.
 * value="value" (optional, default="") - the default value.
 * option="writeable" (optional, default="") - the user can be allowed to create and select new folders by setting this argument.

Example code:

The full path to the folder selected by the user is saved as a string value on disk:

Selection
Selector gives you a control from which you can selected predefined values. Below are some possible applications.

Attributes:
 * mask="" (????????????????)
 * option="" (????????????????)

Execute action
Separator adds a label as separator between other element

Example code:

List of actions that can be used:
 * List of built-in functions

Attributes:
 * option="close" (close the settings dialog before executing the action)