Search guides and the APICtrl K
  1. API reference
  2. Hosting plugins

gfx/plugin_list.h

PluginListComponent: the table a host shows of the plugins it knows about.

#include <sonore/gfx/plugin_list.h>
On this page

Design notes

What it is a view of

A PluginCache, which already is the list: what scans found, what was blacklisted after killing a scan, saved to a text file a person can read. This component owns none of that. It draws the cache as a table -- name, format, category, manufacturer -- and its buttons are the cache's own operations: scan, remove, forget a blacklisting. Every change is written back to the cache file straight away when it has one, because a list that only remembered its edits until the host crashed would be remembering them for the one event the cache exists to survive.

Scanning, in this process

The reference can scan in a child process. This SDK does not start child processes from a plugin host library (see the feature map's ChildProcessCoordinator row), so a scan here is the in-process one with the dead man's switch: plugin_cache.h writes the path being scanned to disk before opening it, and a host that died inside a plugin's code finds the mark on its next start and blacklists that file. Blacklisted files are listed below the plugins, so a user can see what was set aside and give it another chance.

Sorting belongs to the rows

TableListBox reports a header click and leaves the order to its owner, which is this: the rows are a permutation of the cache's list, re-sorted whenever the list changes, so a scan that adds forty plugins does not throw away the column the user was sorting by.

Types 1

class PluginListComponent : public Widget

A host's table of known plugins, over a PluginCache, with Scan and Remove buttons -- the reference's PluginListComponent, scanning in-process. The file comment says what it is a view of and how a crashing scan is survived.

The cache is REFERENCED and must outlive the component; with a cache path, every change is saved to it at once. A scan runs on the calling thread and opens each new or changed plugin file there, so the Scan button blocks the message thread for as long as those take to load. Call refresh() after changing the cache from anywhere else. Message thread only.

↑↓ to move↵ to openEvery public name in the headers, and every guide