Plugins are live! Or well, a tiny bit live at least.
I got bar entries and popouts wired up, and hot reloading! And speaking of hot reloading… Hot reloading is the worst in Qt QML. Since there is only ever a single QML engine, and that engine isn’t even controlled by us, we have to resort to some very interesting ways to reload only the plugins themselves.
Basically, to hot reload, we could just nuke and recreate the QML engine, but that would reload the entire shell, which is quite heavy and loses transient state. So instead, we need to reload plugins separately. To do this, we create QML modules for each plugin and force plugin authors to explicitly import them instead of relying on implicit imports. This way, we control the modules and can create new ones with higher versions to “reload” them.
One “small” issue with this is that the previously generated modules will be leaked as Qt does not provide an API to unregister modules, but that’s a trade off we have to deal with.
There is also so much more to deal with for plugins than I initially thought. We need to keep track of having a plugin repository, each plugin’s structure, having multiple plugins being in a single repository, hot reloading plugins, plugin dependencies (this is gonna be a major pain), installing plugins from both the plugin repository and arbitrary Git URLs, and so much more.
Let’s just hope my brain doesn’t get (more) shredded by this plugin system of mine…