Fix plugin removal issues

This commit is contained in:
Adam Honse
2025-03-06 11:36:10 -06:00
parent 3ce3447b65
commit 84af91da9e
2 changed files with 10 additions and 26 deletions

View File

@@ -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();

View File

@@ -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)