mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
startExecutable(): Use QProcess::start() instead of QProcess::startDetached() to fix the missing prompt after quitting vcmiclient or vcmieditor
vcmilauncher is now hidden while the child process is running, since it doesn't get repainted. Fixes #2574
This commit is contained in:
parent
6f5710e809
commit
875a8cc11a
@ -108,19 +108,13 @@ void startEditor(const QStringList & args)
|
|||||||
#ifndef VCMI_MOBILE
|
#ifndef VCMI_MOBILE
|
||||||
void startExecutable(QString name, const QStringList & args)
|
void startExecutable(QString name, const QStringList & args)
|
||||||
{
|
{
|
||||||
|
// Start vcmiclient and vcmieditor with QProcess::start() instead of QProcess::startDetached()
|
||||||
|
// since startDetached() results in a missing terminal prompt after quitting vcmiclient.
|
||||||
|
// QProcess::start() causes the launcher window to freeze while the child process is running, so we hide it in
|
||||||
|
// MainWindow::on_startGameButton_clicked() and MainWindow::on_startEditorButton_clicked()
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
process.start(name, args);
|
||||||
// Start the executable
|
process.waitForFinished(-1);
|
||||||
if(process.startDetached(name, args))
|
qApp->quit();
|
||||||
{
|
|
||||||
qApp->quit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QMessageBox::critical(qApp->activeWindow(),
|
|
||||||
QObject::tr("Error starting executable"),
|
|
||||||
QObject::tr("Failed to start %1\nReason: %2").arg(name, process.errorString())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -196,11 +196,13 @@ MainWindow::~MainWindow()
|
|||||||
|
|
||||||
void MainWindow::on_startGameButton_clicked()
|
void MainWindow::on_startGameButton_clicked()
|
||||||
{
|
{
|
||||||
|
hide();
|
||||||
startGame({});
|
startGame({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_startEditorButton_clicked()
|
void MainWindow::on_startEditorButton_clicked()
|
||||||
{
|
{
|
||||||
|
hide();
|
||||||
startEditor({});
|
startEditor({});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user