Merge pull request #5976 from lemondrops/manager-3

Manager: show a message box if a VM crashes
This commit is contained in:
Miran Grča
2025-08-17 14:21:49 +02:00
committed by GitHub
27 changed files with 89 additions and 86 deletions

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr "Nebylo možné otevřít konfigurační soubor %1 pro zápis"
msgid "Error adding system" msgid "Error adding system"
msgstr "Chyba při přidávání systému" msgstr "Chyba při přidávání systému"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Abnormální ukončení programu při vytváření nového systému: kód ukončení %1, stav ukončení %2.\n\nSystém nebude přidán."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Odstranění adresáře se nezdařilo" msgstr "Odstranění adresáře se nezdařilo"

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr "No fué posible abrir el archivo de configuración en %1 para escribir"
msgid "Error adding system" msgid "Error adding system"
msgstr "Error al añadir el sistema" msgstr "Error al añadir el sistema"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Terminación abnormal del programa al crear el nuevo sistema: código de salida %1, estado de salida %2.\n\nEl sistema no será añadido."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Error al remover el directório" msgstr "Error al remover el directório"
@@ -2925,6 +2922,9 @@ msgstr "Actualización de 86Box"
msgid "Release notes:" msgid "Release notes:"
msgstr "Notas de versión:" msgstr "Notas de versión:"
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "Terminación inesperada de la máquina virtual" msgstr "Terminación inesperada de la máquina virtual"

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr "Impossibile aprire il file di configurazione in %1 per la scrittura"
msgid "Error adding system" msgid "Error adding system"
msgstr "Errore durante l'aggiunta del sistema" msgstr "Errore durante l'aggiunta del sistema"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Il programma è stato terminato in modo anomalo durante la creazione del nuovo sistema: codice di uscita %1, stato di uscita %2.\n\nIl sistema non verrà aggiunto."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Rimozione directory non riuscita" msgstr "Rimozione directory non riuscita"
@@ -2925,6 +2922,9 @@ msgstr "Aggiornamento di 86Box"
msgid "Release notes:" msgid "Release notes:"
msgstr "Note di rilascio:" msgstr "Note di rilascio:"
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "Arresto anomalo della macchina virtuale" msgstr "Arresto anomalo della macchina virtuale"
@@ -2932,7 +2932,7 @@ msgid "The virtual machine \"%1\"'s process has unexpectedly terminated with exi
msgstr "Il processo della macchina virtuale \"%1\" è terminato inaspettatamente con il codice di uscita %2." msgstr "Il processo della macchina virtuale \"%1\" è terminato inaspettatamente con il codice di uscita %2."
msgid "The system will not be added." msgid "The system will not be added."
msgstr "Il sistema non sarà aggiunto." msgstr "Il sistema non verrà aggiunto."
#~ msgid "HD Controller:" #~ msgid "HD Controller:"
#~ msgstr "Controller HD:" #~ msgstr "Controller HD:"

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr "Openen van configuratiebestand %1 voor wegschrijven niet mogelijk"
msgid "Error adding system" msgid "Error adding system"
msgstr "Fout bij toevoegen van systeem" msgstr "Fout bij toevoegen van systeem"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Onverwachte beëindiging van programma tijdens het aanmaken van nieuw systeem: afsluitcode %1, afsluitstatus %2.\n\nHet systeem wordt niet toegevoegd."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Verwijderen map mislukt" msgstr "Verwijderen map mislukt"
@@ -2925,6 +2922,9 @@ msgstr "86Box Update"
msgid "Release notes:" msgid "Release notes:"
msgstr "Release-opmerkingen:" msgstr "Release-opmerkingen:"
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""
@@ -2932,7 +2932,7 @@ msgid "The virtual machine \"%1\"'s process has unexpectedly terminated with exi
msgstr "" msgstr ""
msgid "The system will not be added." msgid "The system will not be added."
msgstr "" msgstr "Het systeem wordt niet toegevoegd."
#~ msgid "HD Controller:" #~ msgid "HD Controller:"
#~ msgstr "HD-controller:" #~ msgstr "HD-controller:"

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr "Impossível abrir o arquivo de configuração %1 para escrita"
msgid "Error adding system" msgid "Error adding system"
msgstr "Erro adicionando sistema" msgstr "Erro adicionando sistema"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Término anormal do programa ao criar novo sistema: código de saída %1, estado de saída %2.\n\nO sistema não será adicionado."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Falha ao remover diretório" msgstr "Falha ao remover diretório"
@@ -2925,6 +2922,9 @@ msgstr "Atualização do 86Box"
msgid "Release notes:" msgid "Release notes:"
msgstr "Notas de lançamento:" msgstr "Notas de lançamento:"
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "Falha da máquina virtual" msgstr "Falha da máquina virtual"

View File

@@ -1266,9 +1266,6 @@ msgstr "Não foi possível abrir o ficheiro de configuração em %1 para a escri
msgid "Error adding system" msgid "Error adding system"
msgstr "Error ao adicionar o sistema" msgstr "Error ao adicionar o sistema"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Terminação abnormal do programa em criar o novo sistema: código de saída %1, código de estado %2.\n\nO sistema não será adicionado."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Falha na remoção do directório" msgstr "Falha na remoção do directório"
@@ -2925,6 +2922,9 @@ msgstr "Atualização do 86Box"
msgid "Release notes:" msgid "Release notes:"
msgstr "Notas da versão:" msgstr "Notas da versão:"
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "Falecimento da máquina virtual" msgstr "Falecimento da máquina virtual"

View File

@@ -1266,9 +1266,6 @@ msgstr "Невозможно открыть файл конфигурации в
msgid "Error adding system" msgid "Error adding system"
msgstr "Ошибка добавления системы" msgstr "Ошибка добавления системы"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Аномальное прекращение программы при создании новой системы: выходной код %1, состояние выхода %2.\n\nСистема не будет добавлена."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Сбой при удалении папки" msgstr "Сбой при удалении папки"
@@ -2449,7 +2446,7 @@ msgid "Composite"
msgstr "Композитное видео" msgstr "Композитное видео"
msgid "True color" msgid "True color"
msgstr "" msgstr "True Color"
msgid "Old" msgid "Old"
msgstr "Старый" msgstr "Старый"

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr "Napaka pri odpiranju datoteke z nastavitvami %1 za pisanje"
msgid "Error adding system" msgid "Error adding system"
msgstr "Napaka pri dodajanju sistema" msgstr "Napaka pri dodajanju sistema"
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr "Med ustvarjanjem novega sistema je prišlo do nenavadne prekinitev: izhodna koda %1, izhodni status %2.\n\nSistem ne bo dodan."
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "Napaka pri odstranjevanju imenika" msgstr "Napaka pri odstranjevanju imenika"
@@ -2925,6 +2922,9 @@ msgstr "Posodobitev programa 86Box"
msgid "Release notes:" msgid "Release notes:"
msgstr "Opombe različice:" msgstr "Opombe različice:"
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "Sesutje navidezne naprave" msgstr "Sesutje navidezne naprave"

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2928,6 +2925,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Гц"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr "86Box 更新"
msgid "Release notes:" msgid "Release notes:"
msgstr "发行版说明" msgstr "发行版说明"
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -1266,9 +1266,6 @@ msgstr ""
msgid "Error adding system" msgid "Error adding system"
msgstr "" msgstr ""
msgid "Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added."
msgstr ""
msgid "Remove directory failed" msgid "Remove directory failed"
msgstr "" msgstr ""
@@ -2925,6 +2922,9 @@ msgstr ""
msgid "Release notes:" msgid "Release notes:"
msgstr "" msgstr ""
msgid "%1 Hz"
msgstr "%1 Hz"
msgid "Virtual machine crash" msgid "Virtual machine crash"
msgstr "" msgstr ""

View File

@@ -294,6 +294,7 @@ illegal_chars:
QMessageBox msgbox(QMessageBox::Warning, tr("Warning"), tr("Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?").arg(selected_sysconfig->displayName), QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, parent); QMessageBox msgbox(QMessageBox::Warning, tr("Warning"), tr("Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?").arg(selected_sysconfig->displayName), QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, parent);
msgbox.exec(); msgbox.exec();
if (msgbox.result() == QMessageBox::Yes) { if (msgbox.result() == QMessageBox::Yes) {
disconnect(selected_sysconfig->process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), nullptr, nullptr);
selected_sysconfig->process->kill(); selected_sysconfig->process->kill();
} }
}); });
@@ -585,17 +586,17 @@ VMManagerMain::newMachineWizard()
void void
VMManagerMain::addNewSystem(const QString &name, const QString &dir, const QString &displayName, const QString &configFile) VMManagerMain::addNewSystem(const QString &name, const QString &dir, const QString &displayName, const QString &configFile)
{ {
const auto newSytemDirectory = QDir(QDir::cleanPath(dir + "/" + name)); const auto newSystemDirectory = QDir(QDir::cleanPath(dir + "/" + name));
// qt replaces `/` with native separators // qt replaces `/` with native separators
const auto newSystemConfigFile = QFileInfo(newSytemDirectory.path() + "/" + "86box.cfg"); const auto newSystemConfigFile = QFileInfo(newSystemDirectory.path() + "/" + "86box.cfg");
if (newSystemConfigFile.exists() || newSytemDirectory.exists()) { if (newSystemConfigFile.exists() || newSystemDirectory.exists()) {
QMessageBox::critical(this, tr("Directory in use"), tr("The selected directory is already in use. Please select a different directory.")); QMessageBox::critical(this, tr("Directory in use"), tr("The selected directory is already in use. Please select a different directory."));
return; return;
} }
// Create the directory // Create the directory
const QDir qmkdir; const QDir qmkdir;
if (const bool mkdirResult = qmkdir.mkdir(newSytemDirectory.path()); !mkdirResult) { if (const bool mkdirResult = qmkdir.mkdir(newSystemDirectory.path()); !mkdirResult) {
QMessageBox::critical(this, tr("Create directory failed"), tr("Unable to create the directory for the new system")); QMessageBox::critical(this, tr("Create directory failed"), tr("Unable to create the directory for the new system"));
return; return;
} }
@@ -616,24 +617,30 @@ VMManagerMain::addNewSystem(const QString &name, const QString &dir, const QStri
const auto new_system = new VMManagerSystem(newSystemConfigFile.absoluteFilePath()); const auto new_system = new VMManagerSystem(newSystemConfigFile.absoluteFilePath());
new_system->launchSettings(); new_system->launchSettings();
// Handle this in a closure so we can capture the temporary new_system object // Handle this in a closure so we can capture the temporary new_system object
disconnect(new_system->process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), nullptr, nullptr);
connect(new_system->process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), connect(new_system->process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
[=](const int exitCode, const QProcess::ExitStatus exitStatus) { [=](const int exitCode, const QProcess::ExitStatus exitStatus) {
bool fail = false;
if (exitCode != 0 || exitStatus != QProcess::NormalExit) { if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
qInfo().nospace().noquote() << "Abnormal program termination while creating new system: exit code " << exitCode << ", exit status " << exitStatus; qInfo().nospace().noquote() << "Abnormal program termination while creating new system: exit code " << exitCode << ", exit status " << exitStatus;
qInfo() << "Not adding system due to errors"; qInfo() << "Not adding system due to errors";
QString errMsg = tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(
(!displayName.isEmpty() ? displayName : name), QString::number(exitCode));
QMessageBox::critical(this, tr("Error adding system"), QMessageBox::critical(this, tr("Error adding system"),
tr("Abnormal program termination while creating new system: exit code %1, exit status %2.\n\nThe system will not be added.").arg(QString::number(exitCode), exitStatus)); QString("%1\n\n%2").arg(errMsg, tr("The system will not be added.")));
delete new_system; fail = true;
return;
} }
// Create a new QFileInfo because the info from the old one may be cached // Create a new QFileInfo because the info from the old one may be cached
if (const auto fi = QFileInfo(new_system->config_file.absoluteFilePath()); !fi.exists()) { if (const auto fi = QFileInfo(new_system->config_file.absoluteFilePath()); !fi.exists()) {
// No config file which means the cancel button was pressed in the settings dialog // No config file which means the cancel button was pressed in the settings dialog
// Attempt to clean up the directory that was created // Attempt to clean up the directory that was created
const QDir qrmdir; const QDir qrmdir;
if (const bool result = qrmdir.rmdir(newSytemDirectory.path()); !result) { if (const bool result = qrmdir.rmdir(newSystemDirectory.path()); !result) {
qWarning() << "Error cleaning up the old directory for canceled operation. Continuing anyway."; qWarning() << "Error cleaning up the old directory for canceled operation. Continuing anyway.";
} }
fail = true;
}
if (fail) {
delete new_system; delete new_system;
return; return;
} }

View File

@@ -26,6 +26,7 @@
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QtNetwork> #include <QtNetwork>
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QMessageBox>
#include <QProgressDialog> #include <QProgressDialog>
#include <QWindow> #include <QWindow>
#include "qt_util.hpp" #include "qt_util.hpp"
@@ -445,6 +446,8 @@ VMManagerSystem::launchMainProcess() {
[=](const int exitCode, const QProcess::ExitStatus exitStatus){ [=](const int exitCode, const QProcess::ExitStatus exitStatus){
if (exitCode != 0 || exitStatus != QProcess::NormalExit) { if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
qInfo().nospace().noquote() << "Abnormal program termination while launching main process: exit code " << exitCode << ", exit status " << exitStatus; qInfo().nospace().noquote() << "Abnormal program termination while launching main process: exit code " << exitCode << ", exit status " << exitStatus;
QMessageBox::critical(this, tr("Virtual machine crash"),
tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString::number(exitCode)));
return; return;
} }
}); });
@@ -498,6 +501,8 @@ VMManagerSystem::launchSettings() {
[=](const int exitCode, const QProcess::ExitStatus exitStatus){ [=](const int exitCode, const QProcess::ExitStatus exitStatus){
if (exitCode != 0 || exitStatus != QProcess::NormalExit) { if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
qInfo().nospace().noquote() << "Abnormal program termination while launching settings: exit code " << exitCode << ", exit status " << exitStatus; qInfo().nospace().noquote() << "Abnormal program termination while launching settings: exit code " << exitCode << ", exit status " << exitStatus;
QMessageBox::critical(this, tr("Virtual machine crash"),
tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString::number(exitCode)));
return; return;
} }