Add Plugins tab to settings for installing, enabling, disabling, and removing plugins

* Rework Plugin Manager so that plugins can be loaded after initialization
* Use a callback function to add plugin tabs to the dialog
* Install button lets you choose plugin file, copies it to plugins directory, and immediately loads it
* Remove button deletes selected plugin file from plugins directory - need to add a means to unload it first
This commit is contained in:
Adam Honse 2021-08-23 21:39:27 -05:00
parent a28badafb9
commit a20405a6ef
11 changed files with 557 additions and 70 deletions

View file

@ -11,10 +11,29 @@
#include <string>
#include <iostream>
typedef struct
{
OpenRGBPluginInterface* plugin;
std::string path;
bool enabled;
} OpenRGBPluginEntry;
typedef void (*AddPluginTabCallback)(void *, OpenRGBPluginInterface* plugin);
class PluginManager
{
public:
std::vector<OpenRGBPluginInterface*> ActivePlugins;
PluginManager(bool dark_theme);
void ScanAndLoadPlugins(bool dark_theme);
void RegisterAddPluginTabCallback(AddPluginTabCallback new_callback, void * new_callback_arg);
void ScanAndLoadPlugins();
void LoadPlugin(std::string path);
std::vector<OpenRGBPluginEntry> ActivePlugins;
private:
bool dark_theme;
std::vector<AddPluginTabCallback> AddPluginTabCallbacks;
std::vector<void *> AddPluginTabCallbackArgs;
};