Android: handle more potential fails for when cloning

Fixes: QTCREATORBUG-24200
Change-Id: I3f54f0610a70654c3711e7dc3bfd5f22863b2cd2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2020-06-24 14:25:17 +03:00
committed by Alessandro Portale
parent cb5b0cffb3
commit 998c07dcbe

View File

@@ -809,22 +809,42 @@ void AndroidSettingsWidget::downloadOpenSslRepo(const bool silent)
connect(openSslProgressDialog, &QProgressDialog::canceled, gitCloner, &QtcProcess::kill); connect(openSslProgressDialog, &QProgressDialog::canceled, gitCloner, &QtcProcess::kill);
gitCloner->start(); auto failDialog = [=](const QString &msgSuffix = {}) {
openSslProgressDialog->show(); QMessageBox msgBox;
msgBox.setText(tr("OpenSSL prebuilt libraries cloning failed. ") + msgSuffix
+ tr("Opening OpenSSL URL for manual download."));
msgBox.addButton(tr("OK"), QMessageBox::YesRole);
QAbstractButton *openButton = msgBox.addButton(tr("Open download URL"), QMessageBox::ActionRole);
msgBox.exec();
connect(gitCloner, QOverload<int, QtcProcess::ExitStatus>::of(&QtcProcess::finished), if (msgBox.clickedButton() == openButton)
QDesktopServices::openUrl(QUrl::fromUserInput(openSslRepo));
openButton->deleteLater();
};
connect(gitCloner,
QOverload<int, QtcProcess::ExitStatus>::of(&QtcProcess::finished),
[=](int exitCode, QProcess::ExitStatus exitStatus) { [=](int exitCode, QProcess::ExitStatus exitStatus) {
openSslProgressDialog->close(); openSslProgressDialog->close();
validateOpenSsl(); validateOpenSsl();
if (!openSslProgressDialog->wasCanceled() || if (!openSslProgressDialog->wasCanceled()
(exitStatus == QtcProcess::NormalExit && exitCode != 0)) { || (exitStatus == QtcProcess::NormalExit && exitCode != 0)) {
QMessageBox::information(this, openSslCloneTitle, failDialog();
tr("OpenSSL prebuilt libraries cloning failed. "
"Opening OpenSSL URL for manual download."));
QDesktopServices::openUrl(QUrl::fromUserInput(openSslRepo));
} }
}); });
connect(gitCloner, &QtcProcess::errorOccurred, this, [=](QProcess::ProcessError error) {
openSslProgressDialog->close();
if (error == QProcess::FailedToStart) {
failDialog(tr("The git tool might not be installed properly on your system. "));
} else {
failDialog();
}
});
openSslProgressDialog->show();
gitCloner->start();
} }
void AndroidSettingsWidget::addAVD() void AndroidSettingsWidget::addAVD()