From 6a44167c9ae17bec21e49a9eb9ee540b2eeba445 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sat, 15 Apr 2023 19:14:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EQEMU=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VM-source/Makefile | 51 ++++++++--- VM-source/VirtualMachine.pro | 9 +- VM-source/mainwindow.cpp | 13 +++ VM-source/mainwindow.h | 4 + VM-source/mainwindow.ui | 11 ++- VM-source/qemusetting.cpp | 38 +++++++++ VM-source/qemusetting.h | 31 +++++++ VM-source/qemusetting.ui | 161 +++++++++++++++++++++++++++++++++++ 8 files changed, 298 insertions(+), 20 deletions(-) create mode 100644 VM-source/qemusetting.cpp create mode 100644 VM-source/qemusetting.h create mode 100644 VM-source/qemusetting.ui diff --git a/VM-source/Makefile b/VM-source/Makefile index 5275064..cd0e303 100755 --- a/VM-source/Makefile +++ b/VM-source/Makefile @@ -58,9 +58,11 @@ SOURCES = main.cpp \ vbox.cpp \ command.cpp \ infoutils.cpp \ - qemu.cpp qrc_图标.cpp \ + qemu.cpp \ + qemusetting.cpp qrc_图标.cpp \ moc_mainwindow.cpp \ - moc_infoutils.cpp + moc_infoutils.cpp \ + moc_qemusetting.cpp OBJECTS = main.o \ mainwindow.o \ buildvbox.o \ @@ -68,9 +70,11 @@ OBJECTS = main.o \ command.o \ infoutils.o \ qemu.o \ + qemusetting.o \ qrc_图标.o \ moc_mainwindow.o \ - moc_infoutils.o + moc_infoutils.o \ + moc_qemusetting.o DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \ /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \ @@ -245,13 +249,15 @@ DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ vbox.h \ command.h \ infoutils.h \ - qemu.h main.cpp \ + qemu.h \ + qemusetting.h main.cpp \ mainwindow.cpp \ buildvbox.cpp \ vbox.cpp \ command.cpp \ infoutils.cpp \ - qemu.cpp + qemu.cpp \ + qemusetting.cpp QMAKE_TARGET = VirtualMachine DESTDIR = TARGET = VirtualMachine @@ -260,7 +266,7 @@ TARGET = VirtualMachine first: all ####### Build rules -VirtualMachine: ui_mainwindow.h $(OBJECTS) +VirtualMachine: ui_mainwindow.h ui_qemusetting.h $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) Makefile: VirtualMachine.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \ @@ -622,9 +628,9 @@ distdir: FORCE $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ $(COPY_FILE) --parents 图标.qrc $(DISTDIR)/ $(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/ - $(COPY_FILE) --parents mainwindow.h buildvbox.h vbox.h command.h infoutils.h qemu.h $(DISTDIR)/ - $(COPY_FILE) --parents main.cpp mainwindow.cpp buildvbox.cpp vbox.cpp command.cpp infoutils.cpp qemu.cpp $(DISTDIR)/ - $(COPY_FILE) --parents mainwindow.ui $(DISTDIR)/ + $(COPY_FILE) --parents mainwindow.h buildvbox.h vbox.h command.h infoutils.h qemu.h qemusetting.h $(DISTDIR)/ + $(COPY_FILE) --parents main.cpp mainwindow.cpp buildvbox.cpp vbox.cpp command.cpp infoutils.cpp qemu.cpp qemusetting.cpp $(DISTDIR)/ + $(COPY_FILE) --parents mainwindow.ui qemusetting.ui $(DISTDIR)/ $(COPY_FILE) --parents zh_CN.ts en_US.ts $(DISTDIR)/ @@ -679,9 +685,9 @@ compiler_moc_predefs_clean: moc_predefs.h: /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp g++ -pipe -O2 -std=gnu++11 -Wall -Wextra -dM -E -o moc_predefs.h /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp -compiler_moc_header_make_all: moc_mainwindow.cpp moc_infoutils.cpp +compiler_moc_header_make_all: moc_mainwindow.cpp moc_infoutils.cpp moc_qemusetting.cpp compiler_moc_header_clean: - -$(DEL_FILE) moc_mainwindow.cpp moc_infoutils.cpp + -$(DEL_FILE) moc_mainwindow.cpp moc_infoutils.cpp moc_qemusetting.cpp moc_mainwindow.cpp: mainwindow.h \ moc_predefs.h \ /usr/lib/qt5/bin/moc @@ -692,17 +698,26 @@ moc_infoutils.cpp: infoutils.h \ /usr/lib/qt5/bin/moc /usr/lib/qt5/bin/moc $(DEFINES) --include /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gnu/c++/8 -I/usr/include/c++/8/backward -I/usr/lib/gcc/x86_64-linux-gnu/8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include infoutils.h -o moc_infoutils.cpp +moc_qemusetting.cpp: qemusetting.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/moc_predefs.h -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gnu/c++/8 -I/usr/include/c++/8/backward -I/usr/lib/gcc/x86_64-linux-gnu/8/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include qemusetting.h -o moc_qemusetting.cpp + compiler_moc_objc_header_make_all: compiler_moc_objc_header_clean: compiler_moc_source_make_all: compiler_moc_source_clean: -compiler_uic_make_all: ui_mainwindow.h +compiler_uic_make_all: ui_mainwindow.h ui_qemusetting.h compiler_uic_clean: - -$(DEL_FILE) ui_mainwindow.h + -$(DEL_FILE) ui_mainwindow.h ui_qemusetting.h ui_mainwindow.h: mainwindow.ui \ /usr/lib/qt5/bin/uic /usr/lib/qt5/bin/uic mainwindow.ui -o ui_mainwindow.h +ui_qemusetting.h: qemusetting.ui \ + /usr/lib/qt5/bin/uic + /usr/lib/qt5/bin/uic qemusetting.ui -o ui_qemusetting.h + compiler_yacc_decl_make_all: compiler_yacc_decl_clean: compiler_yacc_impl_make_all: @@ -719,7 +734,8 @@ main.o: main.cpp mainwindow.h mainwindow.o: mainwindow.cpp mainwindow.h \ ui_mainwindow.h \ buildvbox.h \ - infoutils.h + infoutils.h \ + qemusetting.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp buildvbox.o: buildvbox.cpp buildvbox.h \ @@ -742,6 +758,10 @@ qemu.o: qemu.cpp qemu.h \ command.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qemu.o qemu.cpp +qemusetting.o: qemusetting.cpp qemusetting.h \ + ui_qemusetting.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qemusetting.o qemusetting.cpp + qrc_图标.o: qrc_图标.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_图标.o qrc_图标.cpp @@ -751,6 +771,9 @@ moc_mainwindow.o: moc_mainwindow.cpp moc_infoutils.o: moc_infoutils.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_infoutils.o moc_infoutils.cpp +moc_qemusetting.o: moc_qemusetting.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_qemusetting.o moc_qemusetting.cpp + ####### Install install_target: first FORCE diff --git a/VM-source/VirtualMachine.pro b/VM-source/VirtualMachine.pro index ef8f173..0526e3a 100755 --- a/VM-source/VirtualMachine.pro +++ b/VM-source/VirtualMachine.pro @@ -34,7 +34,8 @@ SOURCES += \ vbox.cpp \ command.cpp \ infoutils.cpp \ - qemu.cpp + qemu.cpp \ + qemusetting.cpp HEADERS += \ mainwindow.h \ @@ -42,10 +43,12 @@ HEADERS += \ vbox.h \ command.h \ infoutils.h \ - qemu.h + qemu.h \ + qemusetting.h FORMS += \ - mainwindow.ui + mainwindow.ui \ + qemusetting.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/VM-source/mainwindow.cpp b/VM-source/mainwindow.cpp index 08d54f4..0628e00 100755 --- a/VM-source/mainwindow.cpp +++ b/VM-source/mainwindow.cpp @@ -20,6 +20,7 @@ #include #include #include +#include "qemusetting.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -188,3 +189,15 @@ void MainWindow::on_getQemu_clicked() { system(("python3 '" + QCoreApplication::applicationDirPath() + "/../RunCommandWithTerminal.py' '" + QCoreApplication::applicationDirPath() + "/../QemuSystemInstall.sh'").toLatin1()); } + +void MainWindow::on_vmChooser_currentIndexChanged(int index) +{ + ui->qemuSetting->setDisabled(index); +} + +void MainWindow::on_qemuSetting_clicked() +{ + QemuSetting show; + show.show(); + show.exec(); +} diff --git a/VM-source/mainwindow.h b/VM-source/mainwindow.h index 13d3dfe..0d8bbcd 100755 --- a/VM-source/mainwindow.h +++ b/VM-source/mainwindow.h @@ -30,6 +30,10 @@ private slots: void on_getQemu_clicked(); + void on_vmChooser_currentIndexChanged(int index); + + void on_qemuSetting_clicked(); + private: Ui::MainWindow *ui; long m_cpuAll; diff --git a/VM-source/mainwindow.ui b/VM-source/mainwindow.ui index d4f9037..50991b1 100755 --- a/VM-source/mainwindow.ui +++ b/VM-source/mainwindow.ui @@ -74,9 +74,6 @@ Windows 7 32 位(支持自动安装) - - - Windows 7 32 位(支持自动安装) @@ -145,6 +142,13 @@ + + + + Qemu虚拟机设置 + + + @@ -209,6 +213,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">其实本质上跑完安装程序就没有然后了,顶多如果想要运行舒服一点点,可以安装加强功能,直接拉到最底下看就可以了,<span style=" font-weight:600; font-style:italic; text-decoration: underline;">只限使用 VirtualBox</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; font-style:italic; text-decoration: underline;">如果你是用非 X86 PC,那暂时只能使用 qemu(没 kvm),且跨架构的性能损失很大,推荐使用 Windows XP 而非 Windows 7</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">如果爱折腾的话,下面的都看看也无所谓的,想看往下翻就可以了</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; text-decoration: underline;">(这里的帮助更新可能不会那么及时,更详细/新的帮助可以看:https://gitee.com/gfdgd-xi/deep-wine-runner/wikis 或 https://gitee.com/gfdgd-xi/wine-runner-wiki)</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(如果鼠标被锁定到里面了按下键盘右边的“Ctrl”键就可以了,<span style=" font-weight:600; font-style:italic; text-decoration: underline;">qemu则是 Ctrl+Alt+G</span> )</p> <hr /> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> diff --git a/VM-source/qemusetting.cpp b/VM-source/qemusetting.cpp new file mode 100644 index 0000000..0e3383c --- /dev/null +++ b/VM-source/qemusetting.cpp @@ -0,0 +1,38 @@ +#include "qemusetting.h" +#include "ui_qemusetting.h" +#include +#include +#include + +QemuSetting::QemuSetting(QWidget *parent) : + QDialog(parent), + ui(new Ui::QemuSetting) +{ + ui->setupUi(this); +} + +QemuSetting::~QemuSetting() +{ + delete ui; +} + +void QemuSetting::on_buttonBox_accepted() +{ + QMessageBox::information(NULL, "", ""); + acceptDrops(); +} + +void QemuSetting::on_save_clicked() +{ + +} + +void QemuSetting::on_cancel_clicked() +{ + accept(); +} + +void QemuSetting::on_getrunner_clicked() +{ + QDesktopServices::openUrl(QUrl("https://gitee.com/gfdgd-xi/deep-wine-runner/")); +} diff --git a/VM-source/qemusetting.h b/VM-source/qemusetting.h new file mode 100644 index 0000000..d7809c0 --- /dev/null +++ b/VM-source/qemusetting.h @@ -0,0 +1,31 @@ +#ifndef QEMUSETTING_H +#define QEMUSETTING_H + +#include + +namespace Ui { +class QemuSetting; +} + +class QemuSetting : public QDialog +{ + Q_OBJECT + +public: + explicit QemuSetting(QWidget *parent = nullptr); + ~QemuSetting(); + +private slots: + void on_buttonBox_accepted(); + + void on_save_clicked(); + + void on_cancel_clicked(); + + void on_getrunner_clicked(); + +private: + Ui::QemuSetting *ui; +}; + +#endif // QEMUSETTING_H diff --git a/VM-source/qemusetting.ui b/VM-source/qemusetting.ui new file mode 100644 index 0000000..c4b72fd --- /dev/null +++ b/VM-source/qemusetting.ui @@ -0,0 +1,161 @@ + + + QemuSetting + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + VNC服务端口: + + + + + + + <h3>远程服务</h3> + + + + + + + 内存大小(MB): + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 开启 rdp 服务映射 + + + + + + + 开启VNC服务 + + + + + + + + + + <h3>基础设置</h3> + + + + + + + 开启 kvm 加速 + + + + + + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + 保存 + + + + + + + + 0 + 0 + + + + 取消 + + + + + + + 获取 +Wine +运行器 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + +