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 <assam.boudjelthia@qt.io>
This commit is contained in:
Alessandro Portale
2020-07-20 19:07:28 +02:00
parent 168adf6cc6
commit 4d94f959f8

View File

@@ -404,24 +404,20 @@ AndroidSettingsWidget::AndroidSettingsWidget()
connect(m_ui.OpenJDKLocationPathChooser, &PathChooser::rawPathChanged, connect(m_ui.OpenJDKLocationPathChooser, &PathChooser::rawPathChanged,
this, &AndroidSettingsWidget::validateJdk); this, &AndroidSettingsWidget::validateJdk);
FilePath currentJdkPath = m_androidConfig.openJDKLocation(); if (m_androidConfig.openJDKLocation().isEmpty())
if (currentJdkPath.isEmpty()) m_androidConfig.setOpenJDKLocation(AndroidConfig::getJdkPath());
currentJdkPath = AndroidConfig::getJdkPath(); m_ui.OpenJDKLocationPathChooser->setFilePath(m_androidConfig.openJDKLocation());
m_ui.OpenJDKLocationPathChooser->setFilePath(currentJdkPath);
m_ui.OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path")); m_ui.OpenJDKLocationPathChooser->setPromptDialogTitle(tr("Select JDK Path"));
FilePath currentSDKPath = m_androidConfig.sdkLocation(); if (m_androidConfig.sdkLocation().isEmpty())
if (currentSDKPath.isEmpty()) m_androidConfig.setSdkLocation(AndroidConfig::defaultSdkPath());
currentSDKPath = AndroidConfig::defaultSdkPath(); m_ui.SDKLocationPathChooser->setFilePath(m_androidConfig.sdkLocation());
m_ui.SDKLocationPathChooser->setFilePath(currentSDKPath);
m_ui.SDKLocationPathChooser->setPromptDialogTitle(tr("Select Android SDK Folder")); m_ui.SDKLocationPathChooser->setPromptDialogTitle(tr("Select Android SDK Folder"));
m_ui.openSslPathChooser->setPromptDialogTitle(tr("Select OpenSSL Include Project File")); m_ui.openSslPathChooser->setPromptDialogTitle(tr("Select OpenSSL Include Project File"));
FilePath currentOpenSslPath = m_androidConfig.openSslLocation(); if (m_androidConfig.openSslLocation().isEmpty())
if (currentOpenSslPath.isEmpty()) m_androidConfig.setOpenSslLocation(m_androidConfig.sdkLocation() / ("android_openssl"));
currentOpenSslPath = currentSDKPath.pathAppended("android_openssl"); m_ui.openSslPathChooser->setFilePath(m_androidConfig.openSslLocation());
m_ui.openSslPathChooser->setFilePath(currentOpenSslPath);
m_ui.DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize()); m_ui.DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize());
m_ui.CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation()); m_ui.CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation());