GUI: Show error message when the viewer application cannot be started.

This commit is contained in:
Kimmo Varis 2009-06-08 16:47:53 +03:00
parent dfb18efed3
commit 7ac73e0d25
1 changed files with 14 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#include <QSignalMapper>
#include <QProcess>
#include <QDir>
#include <QMessageBox>
ResultsTree::ResultsTree(QSettings &settings, ApplicationList &list) :
mSettings(settings),
@ -398,7 +399,19 @@ void ResultsTree::StartApplication(QStandardItem *target, int application)
program.replace("(message)", data["message"].toString(), Qt::CaseInsensitive);
program.replace("(severity)", data["severity"].toString(), Qt::CaseInsensitive);
QProcess::startDetached(program);
bool success = QProcess::startDetached(program);
if (!success)
{
QString app = mApplications.GetApplicationName(application);
QString text = tr("Could not start ") + app + "\n\n";
text += tr("Please check the application path and parameters are correct.");
QMessageBox msgbox(this);
msgbox.setWindowTitle("Cppcheck");
msgbox.setText(text);
msgbox.setIcon(QMessageBox::Critical);
msgbox.exec();
}
}
}