From 84af91da9ecde17c773f81a7a9edeedfdbf16937 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Thu, 6 Mar 2025 11:36:10 -0600 Subject: [PATCH] Fix plugin removal issues --- PluginManager.cpp | 1 + qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp | 35 +++++--------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/PluginManager.cpp b/PluginManager.cpp index dacbe531..157b6cd5 100644 --- a/PluginManager.cpp +++ b/PluginManager.cpp @@ -310,6 +310,7 @@ void PluginManager::AddPlugin(const filesystem::path& path, bool is_system) entry.widget = nullptr; entry.incompatible = true; entry.api_version = plugin->GetPluginAPIVersion(); + entry.is_system = is_system; loader->unload(); diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp index 44f6fb2a..2cda3740 100644 --- a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp +++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp @@ -236,41 +236,24 @@ void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked() if((plugin_settings["plugins"][plugin_idx]["name"] == entries[cur_row]->ui->NameValue->text().toStdString()) &&(plugin_settings["plugins"][plugin_idx]["description"] == entries[cur_row]->ui->DescriptionValue->text().toStdString())) { - /*-----------------------------------------------------*\ - | Mark plugin to be removed on next restart | - \*-----------------------------------------------------*/ - plugin_settings["plugins_remove"][plugin_settings["plugins_remove"].size()] = entries[cur_row]->ui->PathValue->text().toStdString(); - - ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings); - ResourceManager::get()->GetSettingsManager()->SaveSettings(); - - QMessageBox::information(this, tr("Restart Needed"), tr("The plugin will be fully removed after restarting OpenRGB."), QMessageBox::Ok); - - return; + /*-------------------------------------*\ + | Remove plugin from settings | + \*-------------------------------------*/ + plugin_settings["plugins"].erase(plugin_idx); } } } } /*-----------------------------------------------------*\ - | Remove plugin entry from GUI plugin entries list | + | Mark plugin to be removed on next restart | \*-----------------------------------------------------*/ - QListWidgetItem* item = ui->PluginsList->takeItem(cur_row); + plugin_settings["plugins_remove"][plugin_settings["plugins_remove"].size()] = entries[cur_row]->ui->PathValue->text().toStdString(); - ui->PluginsList->removeItemWidget(item); - delete item; + ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings); + ResourceManager::get()->GetSettingsManager()->SaveSettings(); - /*-----------------------------------------------------*\ - | Command plugin manager to unload and remove the plugin| - \*-----------------------------------------------------*/ - plugin_manager->RemovePlugin(entries[cur_row]->ui->PathValue->text().toStdString()); - - /*-----------------------------------------------------*\ - | Delete the plugin file and refresh the GUI | - \*-----------------------------------------------------*/ - filesystem::remove(entries[cur_row]->ui->PathValue->text().toStdString()); - - RefreshList(); + QMessageBox::information(this, tr("Restart Needed"), tr("The plugin will be fully removed after restarting OpenRGB."), QMessageBox::Ok); } void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry)