From dbd37a6d58a7a01b5d4ab5266774edacb12ab46f Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Tue, 3 May 2011 16:16:53 +0200 Subject: [PATCH] Added messageboxes for game execution errors --- apps/launcher/maindialog.cpp | 41 ++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 903cbe4573..dcef48c982 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -173,17 +173,46 @@ void MainDialog::play() #endif QProcess process; + QFileInfo info(file); if (!file.exists()) { - // TODO: Throw error! - qDebug() << "Could not start process"; + QMessageBox msgBox; + msgBox.setWindowTitle("Error starting OpenMW"); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
Could not find OpenMW

\ + The OpenMW application is not found.
\ + Please make sure OpenMW is installed and try again.
")); + msgBox.exec(); + return; } - if(!process.startDetached(game)) { - // TODO: Throw error!; - qDebug() << "Could not start process"; - qDebug() << "reason was:" << process.errorString(); + if (!info.isExecutable()) { + QMessageBox msgBox; + msgBox.setWindowTitle("Error starting OpenMW"); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
Could not start OpenMW

\ + The OpenMW application is not executable.
\ + Please make sure you have the right permissions and try again.
")); + msgBox.exec(); + + return; + } + + if (!process.startDetached(game)) { + QMessageBox msgBox; + msgBox.setWindowTitle("Error starting OpenMW"); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
Could not start OpenMW

\ + An error occurred while starting OpenMW.

\ + Press \"Show Details...\" for more information.
")); + msgBox.setDetailedText(process.errorString()); + msgBox.exec(); + + return; } else { close(); }