"Wipe NVRAM" option

This commit is contained in:
Cacodemon345
2025-08-10 15:16:17 +06:00
parent c8434e9424
commit 10d95e856b

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] {