* 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
39 lines
889 B
C++
39 lines
889 B
C++
#pragma once
|
|
|
|
#include "OpenRGBPluginInterface.h"
|
|
#include "ResourceManager.h"
|
|
|
|
#include <QPluginLoader>
|
|
#include <QLabel>
|
|
#include <QtPlugin>
|
|
#include <QDir>
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
|
|
typedef struct
|
|
{
|
|
OpenRGBPluginInterface* plugin;
|
|
std::string path;
|
|
bool enabled;
|
|
} OpenRGBPluginEntry;
|
|
|
|
typedef void (*AddPluginTabCallback)(void *, OpenRGBPluginInterface* plugin);
|
|
|
|
class PluginManager
|
|
{
|
|
public:
|
|
PluginManager(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;
|
|
};
|