Add a page to the Options window.
Path relative to the package directory, for example
"ui/settings.slint".
The page's identity and place:
id (unique in this plugin, 1–64 letters, digits, ., - or _),
category, title (shown in the tree, 1–24 characters) and order
(an integer within ±1,000,000, default 0; smaller first).
Unique in this plugin: 1–64 letters, digits, ., - or _.
Where the page appears in the tree.
The page's name in the tree, 1–24 characters.
Optionalorder?: numberAn integer within ±1,000,000, smaller first (default 0).
A SettingsPage owned by this scope.
The SDK finds the component and the global from the file's
export component and export global lines; the file must export one
of each. In the next microtask it registers the page with every property
bound or set so far; ready reports the result.
Within a category, pages are sorted by order, then by plugin id and
page id.
invalid (throws) A bad id, category, title or order, or
this plugin already has a page with this id.
Error without a code (throws) The file does not export exactly
one component and one global. A file that cannot be read throws Node's
file system error (code ENOENT and so on).
An "My plugin" page appears under Plugins, or the reason it could not
be added is logged. page returns at once; the player compiles the
page on its own, and ready rejects (for example with ui-prepare
and the compiler's diagnostics) when it refuses it.
const page = plugin.settings.page("ui/advanced.slint", {
id: "advanced",
category: "plugins",
title: "My plugin",
order: 10, // after pages with a smaller order in the category
});
page.ready.catch((error: PluginError) => console.error(error.message));
Open the Options window at one of this plugin's pages, or bring it to the front.
OptionalpageId: string
The id of one of this plugin's pages.
Resolves once the window is shown.
Without pageId it shows the page that is selected; when the window
first opens, that is the page the user saw last (the player remembers
it), else the first one.
ui (rejects) The window could not be built (for example a page
wrote a property its file does not declare).
The button in the plugin's window opens the Options window at the
plugin's Blur page, or brings it to the front. show takes the id the
page was registered with and rejects with invalid for any other.
const controls = plugin.windows.create("ui/window.slint");
controls.on("openOptions", () => plugin.settings.show("blur"));
Add pages to the player's Options window.
plugin.settings.Remarks
Use a settings page for preferences that change rarely. The player owns the Options window (640×480 by default, at least 600×420, resizable): a category tree on the left, the selected page on the right, a Close button at the bottom. The standard close keys close it, and command key bindings do not fire while it has focus. Opening it does not affect playback.
A page file exports one component and one global, like a panel: the global (the bridge) declares the properties and callbacks, the component lays the page out and reads them. Pages are 440 logical pixels wide; the window scrolls a taller page.
Example: Add a page that edits a stored setting
Options ▸ Playback ▸ Resume shows the plugin's Resume switch.
pageregisters the page with the Options window (compiled by the player on its own),bindsends the stored value, and the page's callback saves the user's change.See
SettingsPage, Add settings and translations
Since
1.0.0