kemu: search system paths for QEMU binaries instead of using maintained list

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-01-30 03:01:47 +02:00
parent 00d9ca8cb4
commit 70594f8bec

View file

@ -66,36 +66,18 @@ KEmuMainWindow::KEmuMainWindow(QWidget *parent, Qt::WindowFlags flags)
connect(m_kemuui->startStopButton, SIGNAL(clicked()), this, SLOT(startStopMachine()));
connect(m_kemuui->machinesList, SIGNAL(removed(QString)), this, SLOT(removeMachine(QString)));
static const QStringList qemuBins = QStringList() << "qemu-system-aarch64"
<< "qemu-system-alpha"
<< "qemu-system-arm"
<< "qemu-system-cris"
<< "qemu-system-i386"
<< "qemu-system-lm32"
<< "qemu-system-m68k"
<< "qemu-system-microblaze"
<< "qemu-system-microblazeel"
<< "qemu-system-mips"
<< "qemu-system-mips64"
<< "qemu-system-mips64el"
<< "qemu-system-mipsel"
<< "qemu-system-moxie"
<< "qemu-system-or32"
<< "qemu-system-ppc"
<< "qemu-system-ppc64"
<< "qemu-system-ppcemb"
<< "qemu-system-s390x"
<< "qemu-system-sh4"
<< "qemu-system-sh4eb"
<< "qemu-system-sparc"
<< "qemu-system-sparc64"
<< "qemu-system-tricore"
<< "qemu-system-unicore32"
<< "qemu-system-x86_64"
<< "qemu-system-xtensa"
<< "qemu-system-xtensaeb";
foreach (const QString bin, qemuBins) {
if(!KStandardDirs::findExe(bin).isEmpty()) {
QStringList addedbins;
foreach (const QString path, KStandardDirs::systemPaths()) {
const QString trimmedpath = path.trimmed();
if (trimmedpath.isEmpty()) {
continue;
}
QDir pathdir(trimmedpath);
foreach(const QString bin, pathdir.entryList()) {
if (!bin.startsWith("qemu-system-") || addedbins.contains(bin)) {
continue;
}
addedbins.append(bin);
m_installed = true;
m_kemuui->systemComboBox->addItem(bin);
}