From b1f1d563b1c1f9ca51aecc06c6c9f373ee85192f Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 14 Oct 2024 15:04:53 +0200 Subject: [PATCH] Android: Require manual close after installation is complete When there were some issues during installation, marked with red lines, it could happen that the user haven't got a chance to read them, as the dialog was automatically closed after the installation was done. To fix it, hide Cancel button on installation finish, show Close button instead and prolong the visibility of the dialog until the Close button is pressed. Task-number: QTCREATORBUG-31812 Change-Id: I63287150b293d3ea1a696a7925bfaa1983e00ae0 Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidsdkmanager.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index 1cba998f1aa..ebf28506c17 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -8,6 +8,7 @@ #include +#include #include #include @@ -77,6 +78,7 @@ public: emit answerClicked(true); }); connect(m_dialogButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + connect(m_dialogButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); // GUI tuning setModal(true); @@ -100,6 +102,10 @@ public: m_outputTextEdit->ensureCursorVisible(); } void setProgress(int value) { m_progressBar->setValue(value); } + void setDone() + { + m_dialogButtonBox->setStandardButtons(QDialogButtonBox::Close); + } signals: void answerClicked(bool accepted); @@ -546,12 +552,20 @@ void AndroidSdkManagerPrivate::runDialogRecipe(const Storage &dia const auto onCancelSetup = [dialogStorage] { return std::make_pair(dialogStorage->m_dialog.get(), &QDialog::rejected); }; + const auto onAcceptSetup = [dialogStorage] { + return std::make_pair(dialogStorage->m_dialog.get(), &QDialog::accepted); + }; + const auto onError = [dialogStorage] { dialogStorage->m_dialog->setDone(); }; const Group root { dialogStorage, Group { - licensesRecipe, - Sync([dialogStorage] { dialogStorage->m_dialog->setQuestionVisible(false); }), - continuationRecipe + If (!Group { + licensesRecipe, + Sync([dialogStorage] { dialogStorage->m_dialog->setQuestionVisible(false); }), + continuationRecipe + }) >> Then { + Sync(onError).withAccept(onAcceptSetup) + } }.withCancel(onCancelSetup) }; m_taskTreeRunner.start(root, {}, [this](DoneWith) {