Show incompatible plugins in the Plugins settings page with a note that it is incompatible, allow it to be removed

This commit is contained in:
Adam Honse
2023-09-26 23:41:33 -05:00
parent c6408eb752
commit 41b7dc3102
4 changed files with 192 additions and 126 deletions

View File

@@ -197,13 +197,15 @@ void PluginManager::AddPlugin(const filesystem::path& path)
\*-----------------------------------------------------*/
OpenRGBPluginEntry entry;
entry.info = info;
entry.plugin = plugin;
entry.loader = loader;
entry.loaded = false;
entry.path = path_string;
entry.enabled = enabled;
entry.widget = nullptr;
entry.info = info;
entry.plugin = plugin;
entry.loader = loader;
entry.loaded = false;
entry.path = path_string;
entry.enabled = enabled;
entry.widget = nullptr;
entry.incompatible = false;
entry.api_version = plugin->GetPluginAPIVersion();
loader->unload();
@@ -216,6 +218,35 @@ void PluginManager::AddPlugin(const filesystem::path& path)
}
else
{
/*-----------------------------------------------------*\
| Fill in a plugin information object with text showing |
| the plugin is incompatible |
\*-----------------------------------------------------*/
OpenRGBPluginInfo info;
info.Name = "Incompatible Plugin";
info.Description = "This plugin is not compatible with this version of OpenRGB.";
/*-----------------------------------------------------*\
| Add the plugin to the PluginManager active plugins |
| but mark it as incompatible |
\*-----------------------------------------------------*/
OpenRGBPluginEntry entry;
entry.info = info;
entry.plugin = plugin;
entry.loader = loader;
entry.loaded = false;
entry.path = path_string;
entry.enabled = false;
entry.widget = nullptr;
entry.incompatible = true;
entry.api_version = plugin->GetPluginAPIVersion();
loader->unload();
PluginManager::ActivePlugins.push_back(entry);
loader->unload();
LOG_WARNING("[PluginManager] Plugin %s has an incompatible API version", path.c_str());
}
@@ -288,6 +319,14 @@ void PluginManager::LoadPlugin(const filesystem::path& path)
return;
}
/*---------------------------------------------------------------------*\
| If the plugin is in the list but is incompatible, return |
\*---------------------------------------------------------------------*/
if(ActivePlugins[plugin_idx].incompatible)
{
return;
}
/*---------------------------------------------------------------------*\
| If the selected plugin is in the list but not loaded, load it |
\*---------------------------------------------------------------------*/