GUI: Show error message when UltraGrid exits with non-zero exit code

This commit is contained in:
Martin Piatka
2019-09-16 11:26:34 +02:00
parent 5dd8bd9916
commit f0cf9e5147
2 changed files with 19 additions and 0 deletions

View File

@@ -248,6 +248,7 @@ void UltragridWindow::connectSignals(){
connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(outputAvailable()));
connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(outputAvailable()));
connect(&process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState)));
connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
connect(ui.arguments, SIGNAL(textChanged(const QString &)), this, SLOT(editArgs(const QString &)));
connect(ui.editCheckBox, SIGNAL(toggled(bool)), this, SLOT(setArgs()));
@@ -370,6 +371,23 @@ void UltragridWindow::processStateChanged(QProcess::ProcessState s){
}
}
void UltragridWindow::processFinished(int code, QProcess::ExitStatus status){
if(status == QProcess::CrashExit || code != 0){
QMessageBox msgBox(this);
msgBox.setIcon(QMessageBox::Critical);
msgBox.setWindowTitle("UltraGrid error!");
msgBox.setText("Ultragrid has exited with an error! If you need help, please send an email "
"to ultragrid-dev@cesnet.cz with log attached.");
QPushButton *showLogBtn = msgBox.addButton(tr("Show log"), QMessageBox::ActionRole);
QPushButton *dissmissBtn = msgBox.addButton(tr("Dismiss"), QMessageBox::RejectRole);
msgBox.exec();
if(msgBox.clickedButton() == showLogBtn){
showLog();
}
}
}
QString UltragridWindow::findUltragridExecutable() {
QStringList args = QCoreApplication::arguments();
int index = args.indexOf("--with-uv");

View File

@@ -68,6 +68,7 @@ public slots:
private slots:
void setStartBtnText(QProcess::ProcessState);
void processStateChanged(QProcess::ProcessState);
void processFinished(int, QProcess::ExitStatus);
void enablePreview(bool);
void schedulePreview();