From 134fff9f179ead75ced30795190b18b1a0a0e038 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Tue, 7 Nov 2023 19:34:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=99=9A=E6=8B=9F=E6=9C=BA?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E5=92=8C=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=88=E4=B8=8D=E4=BD=BF=E7=94=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=99=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StartVM.sh | 6 +++--- VM-source/VirtualMachine.pro.user | 8 ++++---- VM-source/mainwindow.cpp | 15 ++++++++++++++- VM-source/mainwindow.h | 2 ++ VM-source/mainwindow.ui | 12 +++++++++--- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/StartVM.sh b/StartVM.sh index 035a4f3..fa52bc7 100755 --- a/StartVM.sh +++ b/StartVM.sh @@ -10,7 +10,7 @@ VBoxManage showvminfo Windows if [[ 0 == $? ]]; then # 检测到虚拟机存在,启动虚拟机 - VBoxManage startvm Windows + VBoxManage startvm Windows > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 exit fi # 检查是否有 QEMU @@ -45,11 +45,11 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then use=$(echo "scale=4; $MemTotal / 3" | bc) if [[ `arch` == "x86_64" ]]; then echo X86 架构,使用 kvm 加速 - kvm -cpu host --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI + kvm -cpu host --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 exit fi echo 非 X86 架构,不使用 kvm 加速 - qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI + qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 exit fi zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用" diff --git a/VM-source/VirtualMachine.pro.user b/VM-source/VirtualMachine.pro.user index 729529d..711dcc6 100644 --- a/VM-source/VirtualMachine.pro.user +++ b/VM-source/VirtualMachine.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -179,8 +179,8 @@ 0 0 - /home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Debug - /home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Debug + /home/gfdgd_xi/Desktop/build-VirtualMachine-unknown-Debug + /home/gfdgd_xi/Desktop/build-VirtualMachine-unknown-Debug true @@ -327,7 +327,7 @@ true false true - /home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Debug + /home/gfdgd_xi/Desktop/build-VirtualMachine-unknown-Debug 1 diff --git a/VM-source/mainwindow.cpp b/VM-source/mainwindow.cpp index 92f98d8..cbfa737 100755 --- a/VM-source/mainwindow.cpp +++ b/VM-source/mainwindow.cpp @@ -344,7 +344,20 @@ void MainWindow::on_actionVMLog_triggered() return; } file.open(QIODevice::ReadOnly); - QInputDialog::getMultiLineText(this, "日志", "虚拟机日志",file.readAll()); + QInputDialog::getMultiLineText(this, "安装日志", "虚拟机安装日志",file.readAll()); + file.close(); +} + + +void MainWindow::on_actionVMRunlLog_triggered() +{ + QFile file("/tmp/windows-virtual-machine-installer-for-wine-runner-run.log"); + if(!file.exists()){ + QMessageBox::information(this, "提示", "没有日志文件"); + return; + } + file.open(QIODevice::ReadOnly); + QInputDialog::getMultiLineText(this, "运行日志", "虚拟机运行日志",file.readAll()); file.close(); } diff --git a/VM-source/mainwindow.h b/VM-source/mainwindow.h index 2c655cb..7198e90 100755 --- a/VM-source/mainwindow.h +++ b/VM-source/mainwindow.h @@ -48,6 +48,8 @@ private slots: void on_actionVMLog_triggered(); + void on_actionVMRunlLog_triggered(); + private: bool stopShowTime = 0; Ui::MainWindow *ui; diff --git a/VM-source/mainwindow.ui b/VM-source/mainwindow.ui index 5afd79d..bf92d85 100755 --- a/VM-source/mainwindow.ui +++ b/VM-source/mainwindow.ui @@ -452,7 +452,8 @@ p, li { white-space: pre-wrap; } 虚拟机 - + + @@ -476,9 +477,14 @@ p, li { white-space: pre-wrap; } 导出 - + - 虚拟机日志 + 虚拟机安装日志 + + + + + 虚拟机运行日志