Merge pull request #5924 from Cacodemon345/vmm-nvram-clear

"Wipe NVRAM" option for the manager
This commit is contained in:
Miran Grča
2025-08-10 11:55:23 +02:00
committed by GitHub

View File

@@ -287,6 +287,21 @@ illegal_chars:
});
killIcon.setEnabled(selected_sysconfig->process->state() == QProcess::Running);
QAction clrNvram(tr("&Wipe NVRAM"));
contextMenu.addAction(&clrNvram);
connect(&clrNvram, &QAction::triggered, [this, parent] {
QMessageBox msgbox(QMessageBox::Warning, tr("Warning"), tr("This will delete all NVRAM (and related) files of the virtual machine located in the \"nvr\" subdirectory. You'll have to reconfigure the BIOS (and possibly other devices inside the VM) settings again if applicable.\n\nAre you sure you want to wipe all NVRAM contents of the virtual machine \"%1\"?").arg(selected_sysconfig->displayName), QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, parent);
msgbox.exec();
if (msgbox.result() == QMessageBox::Yes) {
if (QDir(selected_sysconfig->config_dir + "/nvr/").removeRecursively())
QMessageBox::information(this, tr("Success"), tr("Successfully wiped the NVRAM contents of the virtual machine \"%1\"").arg(selected_sysconfig->displayName));
else {
QMessageBox::critical(this, tr("Error"), tr("An error occured trying to wipe the NVRAM contents of the virtual machine \"%1\"").arg(selected_sysconfig->displayName));
}
}
});
clrNvram.setEnabled(selected_sysconfig->process->state() == QProcess::NotRunning);
QAction deleteAction(tr("&Delete"));
contextMenu.addAction(&deleteAction);
connect(&deleteAction, &QAction::triggered, [this, parent] {