Plugin preferences

I’ll list in this thread development questions about using preferences in plugins.

  1. Is it possible to dynamically change the content of lists in the plugin preferences?
    For instance, load a list of items from another file.
    Or to change the content of a list depending on user selection on other widgets? For instance, suppose that we have a list of servers that the user must select. Based on the server selected, the content of another list must change.

Hello,

The list preference was not conceived to be dinamically changed. And the plugin preferences code in daemon miss the mechanics to handle it.

If you have a good solution, please submit a patch for review!

  1. What is the role of the category key in the preferences.json and accountpreferences.json files as it is not documented?
    It seems to create tabs when displaying the plugin preferences.
    image

  2. Is it possible to create exclusive choices in preferences?
    For instance, in the previous screen shot, is it possible to have the user either select Watermark image or Watermark text, but not both?
    The "type": "Switch" seems to only be used to enable or disable another group of widgets with the "dependsOn" key.

  1. When a plugin has account specific preferences, the developer must define a PluginPreferenceHandler class to access the account’s preference values with method getPreferences(const std::string& accountId, const std::string& key), but how do you access global preference values?

Hello,

  1. A plugin can have two preferences files, preferences.json and accountpreferences.json. In the client, each has its own widget. When a plugin preferences file has more than one category in it, the preferences widget will be divided in tabs.

  2. Watermark tex and Watermark image are not exclusive. They are categories of preferences. There we grouped all preferences that may modify the watermark image in one category and what can modify the text in another. By default both text and image are enabled. If you try to use the plugin, you may notice that enable watermark image and enable watermark text will allow to display, or not a image/text on each the stream selected. As for the dependsOn It is more a UI related parameter. For instance, there is no sense in changing the text size if the text is disabled in the enable watermark text preference, thus the UI blocks it.

Both global and per account preferences should be accessible through the PluginPreferenceHandler by using default or a valid account id as parameter.

I used Watermark text and Watermark image as an example to illustrate the question. In the context of my plugin, the user can select a server from a predefined list of servers, or exclusive enter her own server parameters into entry fields. But she can’t select both options at the same time. I would like to offer such exclusive option, like a radio button to select one option between multiple options.
Can such an exclusive choice behaviour be programmed with the plugin preferences available? Or should I need to place a type=Switch preference before each group of settings and let the user select the group she wants to use?

  1. Can a global validation mechanism occur when preferences are set?
    To take again my current plugin preferences where the user has to select between multiple exclusive groups of options, is there a callback that allow me to validate that the preferences that the user set are valid?