diff --git a/QemuSystemInstall.sh b/QemuSystemInstall.sh index 587d0e2..98d576c 100755 --- a/QemuSystemInstall.sh +++ b/QemuSystemInstall.sh @@ -1,5 +1,6 @@ #!/bin/bash -pkexec apt update -pkexec apt install qemu-system qemu-user qemu-user-static -y +sudo apt update +sudo apt install qemu-system qemu-user qemu-efi -y +sudo apt install qemu-user-static binfmt-support -y echo 安装完成!按回车键退出 read diff --git a/VM-source/VirtualMachine.pro.user b/VM-source/VirtualMachine.pro.user index ed4f247..a0e660b 100644 --- a/VM-source/VirtualMachine.pro.user +++ b/VM-source/VirtualMachine.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -37,6 +37,7 @@ true true 1 + false true false 0 @@ -45,23 +46,49 @@ 0 8 true + false 1 true true true + *.md, *.MD, Makefile false + true ProjectExplorer.Project.PluginSettings + + true + false + true + true + true + true + + + 0 + true true + Builtin.BuildSystem + + true + true + Builtin.DefaultTidyAndClazy + 2 + + + + true + ProjectExplorer.Project.Target.0 + Desktop Qt 5.15.6 in PATH (qt5) Qt 5.15.6 in PATH (qt5) {ab20853c-9d79-473a-820e-8e95c145170e} @@ -73,127 +100,67 @@ true - qmake - QtProjectManager.QMakeBuildStep - false - false - false - false + true - Make - Qt4ProjectManager.MakeStep - - false - - - false 2 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep - - true clean - - false 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false + + false - Release Release Qt4ProjectManager.Qt4BuildConfiguration 0 - true 1 0 Deploy - + Deploy ProjectExplorer.BuildSteps.Deploy 1 - Deploy Configuration - + + false ProjectExplorer.DefaultDeployConfiguration 1 - - false - false - 1000 - + true true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - + 2 - VirtualMachine - Qt4ProjectManager.Qt4RunConfiguration:/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/VirtualMachine.pro - VirtualMachine.pro - - 3768 + /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/VirtualMachine.pro false true true - false false true - /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source 1 @@ -205,10 +172,10 @@ ProjectExplorer.Project.Updater.FileVersion - 20 + 22 Version - 20 + 22 diff --git a/VM-source/VirtualMachine.pro.user.4.9-pre1 b/VM-source/VirtualMachine.pro.user.4.9-pre1 new file mode 100644 index 0000000..ed4f247 --- /dev/null +++ b/VM-source/VirtualMachine.pro.user.4.9-pre1 @@ -0,0 +1,214 @@ + + + + + + EnvironmentId + {4ffd6df9-1365-4837-81b1-582e0e2d1f21} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + true + + + + ProjectExplorer.Project.Target.0 + + Qt 5.15.6 in PATH (qt5) + Qt 5.15.6 in PATH (qt5) + {ab20853c-9d79-473a-820e-8e95c145170e} + 0 + 0 + 0 + + /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 1 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + VirtualMachine + + Qt4ProjectManager.Qt4RunConfiguration:/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/VirtualMachine.pro + VirtualMachine.pro + + 3768 + false + true + true + false + false + true + + /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 20 + + + Version + 20 + + diff --git a/VM-source/buildvbox.cpp b/VM-source/buildvbox.cpp index 05e7230..89202c4 100644 --- a/VM-source/buildvbox.cpp +++ b/VM-source/buildvbox.cpp @@ -114,9 +114,13 @@ buildvbox::buildvbox(QString isoPath, int id, int vm){ case 1: vm.Create("Windows7_64"); break; - default: + case 2: vm.Create("WindowsNT_64"); break; + case 3: + vm.Create("WindowsNT_64"); + vm.EnabledUEFI(true); + break; } vm.CreateDiskControl(); //vm.CreateDiskControl("storage_controller_2"); @@ -180,9 +184,13 @@ buildvbox::buildvbox(QString isoPath, int id, int vm){ case 1: vm.Create("Windows7_64"); break; - default: + case 2: vm.Create("WindowsNT_64"); break; + case 3: + vm.Create("WindowsNT_64"); + vm.EnabledUEFI(true); + break; } QDir dir("/home/gfdgd_xi/Qemu/Windows/"); dir.mkpath("/home/gfdgd_xi/Qemu/Windows/"); diff --git a/VM-source/mainwindow.cpp b/VM-source/mainwindow.cpp index ae2b781..23d72fd 100755 --- a/VM-source/mainwindow.cpp +++ b/VM-source/mainwindow.cpp @@ -177,6 +177,14 @@ void MainWindow::on_install_clicked() } break; } + switch (ui->systemVersion->currentIndex()) { + case 3: + if(QFile::exists("/usr/share/qemu/OVMF.fd")){ + if(QMessageBox::question(this, "提示", "似乎无法找到 UEFI 固件,是否继续创建虚拟机?\nQemu 固件可以在“安装 Qemu”处安装") == QMessageBox::No){ + return; + } + } + } buildvbox(ui->isoPath->text(), ui->systemVersion->currentIndex(), ui->vmChooser->currentIndex()); return; } @@ -188,7 +196,7 @@ void MainWindow::on_getvbox_clicked() void MainWindow::on_getQemu_clicked() { - system(("python3 '" + QCoreApplication::applicationDirPath() + "/../RunCommandWithTerminal.py' '" + QCoreApplication::applicationDirPath() + "/../QemuSystemInstall.sh'").toLatin1()); + system(("python3 '" + QCoreApplication::applicationDirPath() + "/../RunCommandWithTerminal.py' pkexec '" + QCoreApplication::applicationDirPath() + "/../QemuSystemInstall.sh'").toLatin1()); } void MainWindow::on_vmChooser_currentIndexChanged(int index) diff --git a/VM-source/mainwindow.ui b/VM-source/mainwindow.ui index 8899c53..ed51ff9 100755 --- a/VM-source/mainwindow.ui +++ b/VM-source/mainwindow.ui @@ -25,7 +25,7 @@ QTabWidget::Rounded - 2 + 0 @@ -86,7 +86,12 @@ - 其它 Windows 系统(不支持自动安装) + 其它 Windows 系统(不支持自动安装,传统启动) + + + + + 其他 Windows 系统(不支持自动安装,UEFI 启动) diff --git a/VM-source/qemu.cpp b/VM-source/qemu.cpp index e3ee134..aba4d13 100644 --- a/VM-source/qemu.cpp +++ b/VM-source/qemu.cpp @@ -119,6 +119,9 @@ int qemu::SetKeyboardPS2(){ int qemu::OpenUSB(){ return 0; } -int EnabledUEFI(bool status){ - +int qemu::EnabledUEFI(bool status){ + if(status){ + commandOption += "--bios /usr/share/qemu/OVMF.fd "; + } + return 0; } diff --git a/VM-source/qemu.h b/VM-source/qemu.h index fa6773c..f28236c 100644 --- a/VM-source/qemu.h +++ b/VM-source/qemu.h @@ -40,7 +40,7 @@ public: int OpenUSB(); int EnabledUEFI(bool status); private: - QString commandOption; + QString commandOption = ""; };