From 4d94f959f80836fbad475a18be6dc0083bc1dbb8 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 20 Jul 2020 19:07:28 +0200 Subject: Android: Fix initial validating with clean settings and default paths Relying on the PathChooser::rawPathChanged handlers to initially validate default paths with clean settings does not work (I think) because of a mix of interdependent (via m_androidConfig) synchronous and asynchronous validations. Let's assign the initial values for jdk, sdk and openssl also to m_androidConfig, so that everything works on the first run. Task-number: QTCREATORBUG-24372 Change-Id: Id6945d7bf81949a1f90cd20f9b3bd4e14a5bbe07 Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidsettingswidget.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/plugins/android') diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 7587b4ea465..c446a0ed132 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -404,24 +404,20 @@ AndroidSettingsWidget::AndroidSettingsWidget() connect(m_ui.OpenJDKLocationPathChooser, &PathChooser::rawPathChanged, this, &AndroidSettingsWidget::validateJdk); - FilePath currentJdkPath = m_androidConfig.openJDKLocation(); - if (currentJdkPath.isEmpty()) - currentJdkPath = AndroidConfig::getJdkPath(); - m_ui.OpenJDKLocationPathChooser->setFilePath(currentJdkPath); + if (m_androidConfig.openJDKLocation().isEmpty()) + m_androidConfig.setOpenJDKLocation(AndroidConfig::getJdkPath()); + m_ui.OpenJDKLocationPathChooser->setFilePath(m_androidConfig.openJDKLocation()); m_ui.OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path")); - FilePath currentSDKPath = m_androidConfig.sdkLocation(); - if (currentSDKPath.isEmpty()) - currentSDKPath = AndroidConfig::defaultSdkPath(); - - m_ui.SDKLocationPathChooser->setFilePath(currentSDKPath); + if (m_androidConfig.sdkLocation().isEmpty()) + m_androidConfig.setSdkLocation(AndroidConfig::defaultSdkPath()); + m_ui.SDKLocationPathChooser->setFilePath(m_androidConfig.sdkLocation()); m_ui.SDKLocationPathChooser->setPromptDialogTitle(tr("Select Android SDK Folder")); m_ui.openSslPathChooser->setPromptDialogTitle(tr("Select OpenSSL Include Project File")); - FilePath currentOpenSslPath = m_androidConfig.openSslLocation(); - if (currentOpenSslPath.isEmpty()) - currentOpenSslPath = currentSDKPath.pathAppended("android_openssl"); - m_ui.openSslPathChooser->setFilePath(currentOpenSslPath); + if (m_androidConfig.openSslLocation().isEmpty()) + m_androidConfig.setOpenSslLocation(m_androidConfig.sdkLocation() / ("android_openssl")); + m_ui.openSslPathChooser->setFilePath(m_androidConfig.openSslLocation()); m_ui.DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize()); m_ui.CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation()); -- cgit v1.2.3