diff --git a/VirtualMachine.pro.user b/VirtualMachine.pro.user index a0e660b..729529d 100644 --- a/VirtualMachine.pro.user +++ b/VirtualMachine.pro.user @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> -<!-- Written by QtCreator 7.0.1, 2023-08-09T22:56:49. --> +<!-- Written by QtCreator 7.0.1, 2023-11-07T18:52:43. --> <qtcreator> <data> <variable>EnvironmentId</variable> @@ -8,7 +8,7 @@ </data> <data> <variable>ProjectExplorer.Project.ActiveTarget</variable> - <value type="int">0</value> + <value type="int">1</value> </data> <data> <variable>ProjectExplorer.Project.EditorSettings</variable> @@ -96,7 +96,8 @@ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/gfdgd_xi/Desktop/building/deep-wine-runner/VM-source</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/gfdgd_xi/Desktop/building/deep-wine-runner/VM-source</value> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> @@ -161,14 +162,179 @@ <value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> - <value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source</value> + <value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/gfdgd_xi/Desktop/building/deep-wine-runner/VM-source</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.Target.1</variable> + <valuemap type="QVariantMap"> + <value type="QString" key="DeviceType">Desktop</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{b17c65ba-6912-41bf-b5c1-4c7446f6c967}</value> + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> + <value type="int" key="EnableQmlDebugging">0</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Debug</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Debug</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Release</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Release</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="int" key="QtQuickCompiler">0</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> + <value type="int" key="EnableQmlDebugging">0</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Profile</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Profile</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> + <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> + <value type="int" key="QtQuickCompiler">0</value> + <value type="int" key="SeparateDebugInfo">0</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/> + <value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> + </valuemap> + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> + <value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> + <valuelist type="QVariantList" key="CustomOutputParsers"/> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/VirtualMachine.pro</value> + <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/VirtualMachine.pro</value> + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> + <value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value> + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> + <value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/gfdgd_xi/Desktop/deep-wine-runner/build-VirtualMachine-unknown-Debug</value> </valuemap> <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> </valuemap> </data> <data> <variable>ProjectExplorer.Project.TargetCount</variable> - <value type="int">1</value> + <value type="int">2</value> </data> <data> <variable>ProjectExplorer.Project.Updater.FileVersion</variable> diff --git a/mainwindow.cpp b/mainwindow.cpp index 987fa07..92f98d8 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -21,6 +21,8 @@ #include <QDesktopServices> #include <QMessageBox> #include <iostream> +#include <QIODevice> +#include <QInputDialog> #include "qemusetting.h" MainWindow::MainWindow(QWidget *parent) : @@ -129,7 +131,9 @@ void MainWindow::ShowCPUMessage(){ QString::number(memory * 100 / memoryAll) + "% " + QString::number(memory / 1024) + "MB/" + QString::number(memoryAll / 1024) + "MB" + " 开机时间: " + QString::number(dd) + "天 " + QString::number(hh) + ":" + QString::number(MM) + ":" + QString::number(ss); //qDebug() << cpuAll << " " << cpuFree; - ui->CPUValue->showMessage(info, 5000); + if(!stopShowTime){ + ui->CPUValue->showMessage(info, 5000); + } m_cpuAll = cpuAll; m_cpuFree = cpuFree; } @@ -212,6 +216,8 @@ void MainWindow::on_install_clicked() } buildvbox(ui->isoPath->text(), ui->systemVersion->currentIndex(), ui->vmChooser->currentIndex()); ui->tabWidget->setCurrentIndex(1); + stopShowTime = 1; + ui->CPUValue->showMessage("提示:目前已经尝试开启虚拟机,如果在一段时间后依旧还没看到虚拟机窗口开启,请在菜单栏查看虚拟机日志", 10000); return; } @@ -329,3 +335,16 @@ void MainWindow::on_kvmTest_clicked() } + +void MainWindow::on_actionVMLog_triggered() +{ + QFile file("/tmp/windows-virtual-machine-installer-for-wine-runner-install.log"); + if(!file.exists()){ + QMessageBox::information(this, "提示", "没有日志文件"); + return; + } + file.open(QIODevice::ReadOnly); + QInputDialog::getMultiLineText(this, "日志", "虚拟机日志",file.readAll()); + file.close(); +} + diff --git a/mainwindow.h b/mainwindow.h index 5ca13b9..2c655cb 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -46,7 +46,10 @@ private slots: void on_kvmTest_clicked(); + void on_actionVMLog_triggered(); + private: + bool stopShowTime = 0; Ui::MainWindow *ui; long m_cpuAll; long m_cpuFree; diff --git a/mainwindow.ui b/mainwindow.ui index 8e0acad..5afd79d 100755 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -439,6 +439,23 @@ p, li { white-space: pre-wrap; } <string/> </property> </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1058</width> + <height>36</height> + </rect> + </property> + <widget class="QMenu" name="menuVM"> + <property name="title"> + <string>虚拟机</string> + </property> + <addaction name="actionVMLog"/> + </widget> + <addaction name="menuVM"/> + </widget> <action name="action"> <property name="text"> <string>退出</string> @@ -459,6 +476,11 @@ p, li { white-space: pre-wrap; } <string>导出</string> </property> </action> + <action name="actionVMLog"> + <property name="text"> + <string>虚拟机日志</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources/> diff --git a/qemu.cpp b/qemu.cpp index b81a20e..5c1e5a6 100644 --- a/qemu.cpp +++ b/qemu.cpp @@ -76,9 +76,9 @@ int qemu::SetRemoteConnectSetting(int port){ int qemu::Start(bool unShown){ qDebug() << commandOption; if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "x86_64"){ - return system(("kvm -cpu host " + commandOption + " &").toLatin1()); + return system(("kvm -cpu host " + commandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1()); } - return system(("qemu-system-x86_64 -nic model=rtl8139 " + commandOption + " &").toLatin1()); + return system(("qemu-system-x86_64 -nic model=rtl8139 " + commandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1()); } int qemu::Stop(){ system("killall qemu-system-x86_64 -9"); diff --git a/vbox.cpp b/vbox.cpp index 0cdb953..006d13b 100644 --- a/vbox.cpp +++ b/vbox.cpp @@ -61,9 +61,9 @@ int vbox::SetRemoteConnectSetting(int port){ } int vbox::Start(bool unShown){ if(unShown){ - return system(("\"" + managerPath + "\"").toLatin1()); + return system(("\"" + managerPath + "\" > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1").toLatin1()); } - return system(("\"" + managerPath + "\" startvm \"" + name + "\"").toLatin1()); + return system(("\"" + managerPath + "\" startvm \"" + name + "\" > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1").toLatin1()); } int vbox::Stop(){ return system(("\"" + managerPath + "\" controlvm \"" + name + "\" poweroff").toLatin1());