Fix plugin removal issues
This commit is contained in:
parent
3ce3447b65
commit
84af91da9e
2 changed files with 10 additions and 26 deletions
|
|
@ -310,6 +310,7 @@ void PluginManager::AddPlugin(const filesystem::path& path, bool is_system)
|
||||||
entry.widget = nullptr;
|
entry.widget = nullptr;
|
||||||
entry.incompatible = true;
|
entry.incompatible = true;
|
||||||
entry.api_version = plugin->GetPluginAPIVersion();
|
entry.api_version = plugin->GetPluginAPIVersion();
|
||||||
|
entry.is_system = is_system;
|
||||||
|
|
||||||
loader->unload();
|
loader->unload();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,41 +236,24 @@ void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked()
|
||||||
if((plugin_settings["plugins"][plugin_idx]["name"] == entries[cur_row]->ui->NameValue->text().toStdString())
|
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()))
|
&&(plugin_settings["plugins"][plugin_idx]["description"] == entries[cur_row]->ui->DescriptionValue->text().toStdString()))
|
||||||
{
|
{
|
||||||
/*-----------------------------------------------------*\
|
/*-------------------------------------*\
|
||||||
| Mark plugin to be removed on next restart |
|
| Remove plugin from settings |
|
||||||
\*-----------------------------------------------------*/
|
\*-------------------------------------*/
|
||||||
plugin_settings["plugins_remove"][plugin_settings["plugins_remove"].size()] = entries[cur_row]->ui->PathValue->text().toStdString();
|
plugin_settings["plugins"].erase(plugin_idx);
|
||||||
|
|
||||||
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 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);
|
ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings);
|
||||||
delete item;
|
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
QMessageBox::information(this, tr("Restart Needed"), tr("The plugin will be fully removed after restarting OpenRGB."), QMessageBox::Ok);
|
||||||
| 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry)
|
void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue