From 10d95e856bfe5ea4c8ad1dfecc2b782d4082185a Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 10 Aug 2025 15:16:17 +0600 Subject: [PATCH] "Wipe NVRAM" option --- src/qt/qt_vmmanager_main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 13f626054..b6df263bd 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -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] {