diff --git a/VM-source/Makefile b/VM-source/Makefile index cd0e303..4054298 100755 --- a/VM-source/Makefile +++ b/VM-source/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: VirtualMachine -# Generated by qmake (3.1) (Qt 5.15.6) +# Generated by qmake (3.1) (Qt 5.15.8) # Project: VirtualMachine.pro # Template: app # Command: /usr/lib/qt5/bin/qmake -o Makefile VirtualMachine.pro @@ -151,10 +151,7 @@ DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ - /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcommon.pri \ - /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcore.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkgui.pri \ - /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkwidget.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ @@ -203,6 +200,10 @@ DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandclient.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandclient_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandcompositor.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandcompositor_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webchannel.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webengine.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webenginecore.pri \ @@ -345,10 +346,7 @@ Makefile: VirtualMachine.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qma /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ - /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcommon.pri \ - /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcore.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkgui.pri \ - /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkwidget.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ @@ -397,6 +395,10 @@ Makefile: VirtualMachine.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qma /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandclient.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandclient_private.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandcompositor.pri \ + /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandcompositor_private.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webchannel.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webengine.pri \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webenginecore.pri \ @@ -517,10 +519,7 @@ Makefile: VirtualMachine.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qma /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_designer.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri: -/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcommon.pri: -/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkcore.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkgui.pri: -/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dtkwidget.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_edid_support_private.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_egl_support_private.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri: @@ -569,6 +568,10 @@ Makefile: VirtualMachine.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qma /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uiplugin.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_uitools.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandclient.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandclient_private.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandcompositor.pri: +/usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_waylandcompositor_private.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webchannel.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webengine.pri: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_webenginecore.pri: @@ -759,7 +762,8 @@ qemu.o: qemu.cpp qemu.h \ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qemu.o qemu.cpp qemusetting.o: qemusetting.cpp qemusetting.h \ - ui_qemusetting.h + ui_qemusetting.h \ + infoutils.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qemusetting.o qemusetting.cpp qrc_图标.o: qrc_图标.cpp diff --git a/VM-source/mainwindow.cpp b/VM-source/mainwindow.cpp index a1ce3d2..40ce13b 100755 --- a/VM-source/mainwindow.cpp +++ b/VM-source/mainwindow.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "qemusetting.h" MainWindow::MainWindow(QWidget *parent) : @@ -201,3 +202,35 @@ void MainWindow::on_qemuSetting_clicked() show->show(); } + +void MainWindow::on_addQemuDisk_triggered() +{ + if(QFile::exists(QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){ + if(QMessageBox::question(this, "提示", "磁盘文件已存在,是否覆盖?\n覆盖后将无法恢复!") == QMessageBox::No){ + return; + } + } + QString path = QFileDialog::getOpenFileName(this, "选择 Qemu 镜像", QDir::homePath(), "Qemu镜像(*.qcow2 *.img *.raw *.qcow *.qed *.vdi *.vhdx *.vmdk);;所有文件(*.*)"); + qDebug() << path; + if(path == ""){ + return; + } + QDir dir(QDir::homePath() + "/Qemu/Windows/Windows.qcow2"); + if(!dir.exists()){ + dir.mkpath(QDir::homePath() + "/Qemu/Windows/Windows.qcow2"); + } + if(!QFile::remove(QDir::homePath() + "/Qemu/Windows/Windows.qcow2") | !QFile::copy(path, QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){ + QMessageBox::critical(this, "提示", "添加错误!"); + return; + } + QMessageBox::information(this, "提示", "添加完成!"); +} + +void MainWindow::on_delQemuDisk_triggered() +{ + if(!QFile::exists(QDir::homePath() + "/Qemu/Windows/Windows.qcow2")){ + QMessageBox::information(this, "提示", "不存在磁盘文件,无法导出"); + return; + } + std::system(("xdg-open \"" + QDir::homePath() + "/Qemu/Windows/\"").toUtf8()); +} diff --git a/VM-source/mainwindow.h b/VM-source/mainwindow.h index 7893123..ff179a6 100755 --- a/VM-source/mainwindow.h +++ b/VM-source/mainwindow.h @@ -34,6 +34,10 @@ private slots: void on_qemuSetting_clicked(); + void on_addQemuDisk_triggered(); + + void on_delQemuDisk_triggered(); + private: Ui::MainWindow *ui; long m_cpuAll; diff --git a/VM-source/mainwindow.ui b/VM-source/mainwindow.ui index cbd05e0..82760f3 100755 --- a/VM-source/mainwindow.ui +++ b/VM-source/mainwindow.ui @@ -374,6 +374,24 @@ p, li { white-space: pre-wrap; } + + + + 0 + 0 + 807 + 36 + + + + + Qemu磁盘镜像 + + + + + + 退出 @@ -384,6 +402,16 @@ p, li { white-space: pre-wrap; } 关于 + + + 导入/覆盖 + + + + + 导出 + +