Make failed external commands reset

This commit is contained in:
ArsenArsen 2017-12-20 01:19:07 +01:00
parent 567135d0ec
commit f09bfe37d4
No known key found for this signature in database
GPG Key ID: 683D2F43B0CA4BD2
2 changed files with 7 additions and 1 deletions

View File

@ -85,7 +85,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se
#endif
ui->fpsMax->setValue(settings::settings().value("recording/framerate", 30).toInt());
ui->focusedCapture->setText(settings::settings().value("command/activeCommand", "").toString());
ui->fullscreenCapture->setText(settings::settings().value("command/fullscreenCommand", 0).toString());
ui->fullscreenCapture->setText(settings::settings().value("command/fullscreenCommand", "").toString());
}
void SettingsDialog::setScheme(QString scheme) {

View File

@ -148,6 +148,9 @@ void utils::externalScreenshot(std::function<void(QPixmap)> callback) {
}
QFile(tempPath).remove();
});
QObject::connect(process, &QProcess::errorOccurred, [](QProcess::ProcessError err) {
if (err == QProcess::FailedToStart) settings::settings().remove("command/fullscreenCommand");
});
process->start(args.takeFirst(), args);
}
@ -177,5 +180,8 @@ void utils::externalScreenshotActive(std::function<void(QPixmap)> callback) {
}
QFile(tempPath).remove();
});
QObject::connect(process, &QProcess::errorOccurred, [](QProcess::ProcessError err) {
if (err == QProcess::FailedToStart) settings::settings().remove("command/activeCommand");
});
process->start(args.takeFirst(), args);
}