移除虚拟机PY部分

This commit is contained in:
2023-03-04 11:48:45 +08:00
parent 12620e400e
commit acb4d94ba7
12 changed files with 46 additions and 939 deletions

View File

@@ -6,6 +6,8 @@
#include <QMessageBox>
#include <QCoreApplication>
#include <infoutils.h>
// 懒得用 QThread 了(要继承)
#include <thread>
using namespace std;
// 清屏
@@ -36,6 +38,10 @@ QString buildvbox::GetNet(){
return "";
}
int buildvbox::Download(QString url, QString path, QString fileName){
return system(("aria2c -x 16 -s 16 -c " + url + " -d " + path + " -o " + fileName).toUtf8());
}
buildvbox::buildvbox(QString isoPath, int id){
/*QDir vboxPath(QDir::homePath() + "/VirtualBox VMs/Windows");
if(vboxPath.exists()){
@@ -45,6 +51,15 @@ buildvbox::buildvbox(QString isoPath, int id){
return;
}*/
QString programPath = QCoreApplication::applicationDirPath();
/*if(!QFile::exists(programPath + "/a.iso")){
std::thread([=](){
while(1){
qDebug() << "a";
}
}).detach();
}*/
QString net = GetNet();
qDebug() << "使用网卡:" << net << endl;
//vbox *box = new vbox("Window");
@@ -59,17 +74,24 @@ buildvbox::buildvbox(QString isoPath, int id){
vm.Create("WindowsNT_64");
}
vm.CreateDiskControl();
//vm.CreateDiskControl("storage_controller_2");
vm.CreateDisk(QDir::homePath() + "/VirtualBox VMs/Windows/Windows.vdi", 131072);
vm.MountDisk(QDir::homePath() + "/VirtualBox VMs/Windows/Windows.vdi");
vm.MountISO(isoPath);
vm.MountISO(isoPath, "storage_controller_1", 0, 1);
switch (id) {
case 0:
vm.MountISO(programPath + "/Windows7X86Auto.iso", "storage_controller_1", 1);
vm.MountISO(programPath + "/Windows7X86Auto.iso", "storage_controller_1", 1, 0);
break;
case 1:
vm.MountISO(programPath + "/Windows7X64Auto.iso", "storage_controller_1", 1);
vm.MountISO(programPath + "/Windows7X64Auto.iso", "storage_controller_1", 1, 0);
break;
}
// 判断 VirtualBox Guest ISO 是否存在
// 在的话直接挂载
if(QFile::exists("/usr/share/virtualbox/VBoxGuestAdditions.iso")){
vm.MountISO("/usr/share/virtualbox/VBoxGuestAdditions.iso", "storage_controller_1", 1, 1);
}
vm.SetCPU(1);
long memory = 0;
long memoryAll = 0;