From 4812a9a8724958363b21c4dae3c1251df0222bb1 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sun, 12 Nov 2023 11:13:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=99=9A=E6=8B=9F=E6=9C=BA=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BC=BA=E5=88=B6=E5=85=B3=E9=97=AD=20Virtua?= =?UTF-8?q?lBox/Qemu=EF=BC=8C=E5=B9=B6=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=AF=B9?= =?UTF-8?q?=20Windows=207=20=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC=E7=9A=84?= =?UTF-8?q?=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VM-source/mainwindow.cpp | 30 ++++++++++++++++++++++++++++++ VM-source/mainwindow.h | 4 ++++ VM-source/mainwindow.ui | 13 +++++++++++++ 3 files changed, 47 insertions(+) diff --git a/VM-source/mainwindow.cpp b/VM-source/mainwindow.cpp index 856cb82..42540c6 100755 --- a/VM-source/mainwindow.cpp +++ b/VM-source/mainwindow.cpp @@ -24,6 +24,8 @@ #include #include #include "qemusetting.h" +#include "vbox.h" +#include "qemu.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -205,6 +207,20 @@ void MainWindow::on_install_clicked() archFile.write("amd64"); archFile.close(); switch (ui->systemVersion->currentIndex()) { + case 0: + if(!QFile::exists(QCoreApplication::applicationDirPath() + "/Windows7X86Auto.iso")){ + if(QMessageBox::question(this, "提示", "似乎无法找到 Windows7X86Auto.iso,是否继续创建虚拟机?\n缺少该文件可能会导致虚拟机无法正常启动,尝试重新安装 Wine 运行器再试试?") == QMessageBox::No){ + return; + } + } + break; + case 1: + if(!QFile::exists(QCoreApplication::applicationDirPath() + "/Windows7X64Auto.iso")){ + if(QMessageBox::question(this, "提示", "似乎无法找到 Windows7X64Auto.iso,是否继续创建虚拟机?\n缺少该文件可能会导致虚拟机无法正常启动,尝试重新安装 Wine 运行器再试试?") == QMessageBox::No){ + return; + } + } + break; case 3: if(!QFile::exists("/usr/share/qemu/OVMF.fd") && !QFile::exists(QCoreApplication::applicationDirPath() + "/OVMF.fd") && ui->vmChooser->currentIndex() == 0){ if(QMessageBox::question(this, "提示", "似乎无法找到 UEFI 固件,是否继续创建虚拟机?\nQemu 固件可以在“安装 Qemu”处安装") == QMessageBox::No){ @@ -419,3 +435,17 @@ void MainWindow::on_actionVMInstallLog_triggered() file.close(); } + +void MainWindow::on_action_StopVirtualBox_triggered() +{ + vbox vmControl(""); + vmControl.Stop(); +} + + +void MainWindow::on_action_StopQemu_triggered() +{ + qemu vmControl(""); + vmControl.Stop(); +} + diff --git a/VM-source/mainwindow.h b/VM-source/mainwindow.h index 6e81c05..07df683 100755 --- a/VM-source/mainwindow.h +++ b/VM-source/mainwindow.h @@ -54,6 +54,10 @@ private slots: void on_actionVMInstallLog_triggered(); + void on_action_StopVirtualBox_triggered(); + + void on_action_StopQemu_triggered(); + private: bool stopShowTime = 0; Ui::MainWindow *ui; diff --git a/VM-source/mainwindow.ui b/VM-source/mainwindow.ui index df76980..add4cd3 100755 --- a/VM-source/mainwindow.ui +++ b/VM-source/mainwindow.ui @@ -466,6 +466,9 @@ p, li { white-space: pre-wrap; } + + + @@ -504,6 +507,16 @@ p, li { white-space: pre-wrap; } 虚拟机测试(X86、Qemu) + + + 强制停止 VirtualBox + + + + + 强制停止 Qemu + +