|
|
|
|
@ -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 |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
QListWidgetItem* item = ui->PluginsList->takeItem(cur_row);
|
|
|
|
|
|
|
|
|
|
ui->PluginsList->removeItemWidget(item);
|
|
|
|
|
delete item;
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Command plugin manager to unload and remove the plugin|
|
|
|
|
|
| Mark plugin to be removed on next restart |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
plugin_manager->RemovePlugin(entries[cur_row]->ui->PathValue->text().toStdString());
|
|
|
|
|
plugin_settings["plugins_remove"][plugin_settings["plugins_remove"].size()] = entries[cur_row]->ui->PathValue->text().toStdString();
|
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------*\
|
|
|
|
|
| Delete the plugin file and refresh the GUI |
|
|
|
|
|
\*-----------------------------------------------------*/
|
|
|
|
|
filesystem::remove(entries[cur_row]->ui->PathValue->text().toStdString());
|
|
|
|
|
ResourceManager::get()->GetSettingsManager()->SetSettings("Plugins", plugin_settings);
|
|
|
|
|
ResourceManager::get()->GetSettingsManager()->SaveSettings();
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|