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:
parent
c6408eb752
commit
41b7dc3102
4 changed files with 192 additions and 126 deletions
|
|
@ -197,13 +197,15 @@ void PluginManager::AddPlugin(const filesystem::path& path)
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
OpenRGBPluginEntry entry;
|
OpenRGBPluginEntry entry;
|
||||||
|
|
||||||
entry.info = info;
|
entry.info = info;
|
||||||
entry.plugin = plugin;
|
entry.plugin = plugin;
|
||||||
entry.loader = loader;
|
entry.loader = loader;
|
||||||
entry.loaded = false;
|
entry.loaded = false;
|
||||||
entry.path = path_string;
|
entry.path = path_string;
|
||||||
entry.enabled = enabled;
|
entry.enabled = enabled;
|
||||||
entry.widget = nullptr;
|
entry.widget = nullptr;
|
||||||
|
entry.incompatible = false;
|
||||||
|
entry.api_version = plugin->GetPluginAPIVersion();
|
||||||
|
|
||||||
loader->unload();
|
loader->unload();
|
||||||
|
|
||||||
|
|
@ -216,6 +218,35 @@ void PluginManager::AddPlugin(const filesystem::path& path)
|
||||||
}
|
}
|
||||||
else
|
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();
|
loader->unload();
|
||||||
LOG_WARNING("[PluginManager] Plugin %s has an incompatible API version", path.c_str());
|
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;
|
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 |
|
| If the selected plugin is in the list but not loaded, load it |
|
||||||
\*---------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------*/
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ typedef struct
|
||||||
QMenu* traymenu;
|
QMenu* traymenu;
|
||||||
std::string path;
|
std::string path;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
bool incompatible;
|
||||||
|
int api_version;
|
||||||
} OpenRGBPluginEntry;
|
} OpenRGBPluginEntry;
|
||||||
|
|
||||||
typedef void (*AddPluginCallback)(void *, OpenRGBPluginEntry* plugin);
|
typedef void (*AddPluginCallback)(void *, OpenRGBPluginEntry* plugin);
|
||||||
|
|
|
||||||
|
|
@ -20,66 +20,6 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLabel" name="VersionLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Version:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="2">
|
|
||||||
<widget class="QCheckBox" name="EnabledCheckBox">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QLabel" name="PathValue">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Path Value</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="DescriptionValue">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Description Value</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="NameLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="DescriptionLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Description:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QLabel" name="URLLabel">
|
<widget class="QLabel" name="URLLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -87,65 +27,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="0" rowspan="8">
|
||||||
<widget class="QLabel" name="NameValue">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Name Value</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="2">
|
|
||||||
<widget class="QLabel" name="VersionValue">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Version Value</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="2">
|
|
||||||
<widget class="QLabel" name="CommitValue">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Commit Value</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="PathLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Path:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLabel" name="EnabledLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enabled</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLabel" name="CommitLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Commit:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QLabel" name="URLValue">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">URL Value</string>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" rowspan="7">
|
|
||||||
<widget class="QLabel" name="IconView">
|
<widget class="QLabel" name="IconView">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
|
@ -173,6 +55,138 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
|
<widget class="QLabel" name="URLValue">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">URL Value</string>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QLabel" name="EnabledLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enabled</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="DescriptionLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Description:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="NameValue">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Name Value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="PathValue">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Path Value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QLabel" name="VersionValue">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Version Value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QLabel" name="CommitValue">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Commit Value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="NameLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="PathLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="2">
|
||||||
|
<widget class="QCheckBox" name="EnabledCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="VersionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Version:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLabel" name="CommitLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Commit:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="DescriptionValue">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Description Value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLabel" name="APIVersionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>API Version:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="2">
|
||||||
|
<widget class="QLabel" name="APIVersionValue">
|
||||||
|
<property name="text">
|
||||||
|
<string>API Version Value</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,17 @@ void Ui::OpenRGBPluginsPage::RefreshList()
|
||||||
entry->ui->VersionValue->setText(QString::fromStdString(plugin_manager->ActivePlugins[plugin_idx].info.Version));
|
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->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->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 |
|
| Fill in plugin icon |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue