diff --git a/PluginManager.cpp b/PluginManager.cpp
index 389fe323..fe1d88cd 100644
--- a/PluginManager.cpp
+++ b/PluginManager.cpp
@@ -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 |
\*---------------------------------------------------------------------*/
diff --git a/PluginManager.h b/PluginManager.h
index 6c12990c..2ee2790a 100644
--- a/PluginManager.h
+++ b/PluginManager.h
@@ -21,6 +21,8 @@ typedef struct
QMenu* traymenu;
std::string path;
bool enabled;
+ bool incompatible;
+ int api_version;
} OpenRGBPluginEntry;
typedef void (*AddPluginCallback)(void *, OpenRGBPluginEntry* plugin);
diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.ui b/qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.ui
index 14fbc656..24de9d6f 100644
--- a/qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.ui
+++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.ui
@@ -20,66 +20,6 @@
- -
-
-
- Version:
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Path Value
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Description Value
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Name:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Description:
-
-
-
-
@@ -87,65 +27,7 @@
- -
-
-
-
- 0
- 0
-
-
-
- Name Value
-
-
-
- -
-
-
- Version Value
-
-
-
- -
-
-
- Commit Value
-
-
-
- -
-
-
- Path:
-
-
-
- -
-
-
- Enabled
-
-
-
- -
-
-
- Commit:
-
-
-
- -
-
-
- URL Value
-
-
- true
-
-
-
- -
+
-
@@ -173,6 +55,138 @@
+ -
+
+
+ URL Value
+
+
+ true
+
+
+
+ -
+
+
+ Enabled
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Description:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Name Value
+
+
+
+ -
+
+
+ Path Value
+
+
+
+ -
+
+
+ Version Value
+
+
+
+ -
+
+
+ Commit Value
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Name:
+
+
+
+ -
+
+
+ Path:
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Version:
+
+
+
+ -
+
+
+ Commit:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Description Value
+
+
+
+ -
+
+
+ API Version:
+
+
+
+ -
+
+
+ API Version Value
+
+
+
diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp
index 4c982a37..8297ec68 100644
--- a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp
+++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp
@@ -56,6 +56,17 @@ void Ui::OpenRGBPluginsPage::RefreshList()
entry->ui->VersionValue->setText(QString::fromStdString(plugin_manager->ActivePlugins[plugin_idx].info.Version));
entry->ui->CommitValue->setText(QString::fromStdString(plugin_manager->ActivePlugins[plugin_idx].info.Commit));
entry->ui->URLValue->setText(QString::fromStdString(plugin_manager->ActivePlugins[plugin_idx].info.URL));
+ entry->ui->APIVersionValue->setText(QString::number(plugin_manager->ActivePlugins[plugin_idx].api_version));
+
+ /*---------------------------------------------------------*\
+ | If the plugin is incompatible, highlight the API version |
+ | in red and disable the enable checkbox |
+ \*---------------------------------------------------------*/
+ if(plugin_manager->ActivePlugins[plugin_idx].incompatible)
+ {
+ entry->ui->APIVersionValue->setStyleSheet("QLabel { color : red; }");
+ entry->ui->EnabledCheckBox->setEnabled(false);
+ }
/*---------------------------------------------------------*\
| Fill in plugin icon |