新增虚拟机logo显示

This commit is contained in:
gfdgd xi 2024-06-01 09:55:22 +08:00
parent 3966cd0b70
commit 1bf5eab4e0
6 changed files with 237 additions and 8 deletions

BIN
VM-source/boot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

198
VM-source/boot.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -109,28 +109,39 @@ int qemu::StartArmhf()
{
qDebug() << commandOption;
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "aarch64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
return system(("qemu-system-arm -display vnc=:5 -display gtk --enable-kvm -cpu host -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
return system(("qemu-system-arm --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk --enable-kvm -cpu host -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
}
return system(("qemu-system-arm --boot d -display vnc=:5 -display gtk -cpu max -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
return system(("qemu-system-arm --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk -cpu max -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
}
int qemu::StartAarch64()
{
QString bootScreenLogo = "";
// 判断 boot 文件是否存在
if(QFile::exists(QCoreApplication::applicationDirPath() + "/boot.jpg")) {
bootScreenLogo = QCoreApplication::applicationDirPath() + "/boot.jpg";
}
else {
// 写入 logo
QFile::copy(":/boot.jpg", "/tmp/deep-wine-runner-boot.jpg");
bootScreenLogo = "/tmp/deep-wine-runner-boot.jpg";
}
qDebug() << commandOption;
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "aarch64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
return system(("qemu-system-aarch64 --boot d -display vnc=:5 -display gtk --enable-kvm -cpu host -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
return system(("qemu-system-aarch64 --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk --enable-kvm -cpu host -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
}
return system(("qemu-system-aarch64 --boot d -display vnc=:5 -display gtk -cpu max -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
return system(("qemu-system-aarch64 --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk -cpu max -M virt " + commandOption + " -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
}
int qemu::StartLoong64()
{
return 1;
}
int qemu::Start(bool unShown)
{
QString newCommandOption = commandOption;
qDebug() << GetBootLogoPath();
if(isUEFI) {
newCommandOption += " -vga none -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 ";
}
@ -139,10 +150,9 @@ int qemu::Start(bool unShown)
}
qDebug() << commandOption;
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "x86_64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
qDebug() << ("qemu-system-x86_64 --boot d -display vnc=:5 -display gtk --enable-kvm -cpu host " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &");
return system(("qemu-system-x86_64 --boot d -display vnc=:5 -display gtk --enable-kvm -cpu host " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
return system(("qemu-system-x86_64 --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk --enable-kvm -cpu host " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
}
return system(("qemu-system-x86_64 --boot d -display vnc=:5 -display gtk -nic model=rtl8139 " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
return system(("qemu-system-x86_64 --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk -nic model=rtl8139 " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
}
int qemu::Stop()
{
@ -277,3 +287,21 @@ int qemu::AddDiskSpace(QString path, double data)
{
return system(("qemu-img resize '" + path + "' +" + QString::number(data) + "G").toUtf8());
}
QString qemu::GetBootLogoPath()
{
QString bootScreenLogo = "";
// 判断 boot 文件是否存在
if(QFile::exists(QCoreApplication::applicationDirPath() + "/boot.jpg")) {
bootScreenLogo = QCoreApplication::applicationDirPath() + "/boot.jpg";
}
else {
// 写入 logo
if(QFile::exists("/tmp/deep-wine-runner-boot.jpg")) {
QFile::remove("/tmp/deep-wine-runner-boot.jpg");
}
QFile::copy(":/boot.jpg", "/tmp/deep-wine-runner-boot.jpg");
bootScreenLogo = "/tmp/deep-wine-runner-boot.jpg";
}
return bootScreenLogo;
}

View File

@ -53,6 +53,7 @@ public:
private:
QString commandOption = "";
bool isUEFI = false;
QString GetBootLogoPath();
};

View File

@ -5,6 +5,8 @@
<file>LANG/virtualmachine-en_US.qm</file>
<file>LANG/virtualmachine-en_US.ts</file>
<file>application-vnd.oasis.opendocument.text.svg</file>
<file>boot.jpg</file>
<file>boot.svg</file>
</qresource>
<qresource prefix="/picture">
<file>截图_VirtualBox Machine_20220712142929.png</file>

BIN
VM/boot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB