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/androidsettingswidget.cpp') diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 7587b4ea46..c446a0ed13 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.1 From 35ead659c747276631f9ba20134b9d863041c3bf Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Wed, 22 Jul 2020 13:03:21 +0300 Subject: Android: fix settings widget palelette in dark mode Change-Id: I2ef4f0d510bbbe732c790134b39a9ea5cb0af2fc Reviewed-by: Alessandro Portale --- src/plugins/android/androidsettingswidget.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/plugins/android/androidsettingswidget.cpp') diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index c446a0ed13..5bc2431c73 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -844,13 +844,7 @@ AndroidSettingsPage::AndroidSettingsPage() setId(Constants::ANDROID_SETTINGS_ID); setDisplayName(AndroidSettingsWidget::tr("Android")); setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY); - setWidgetCreator([] { - auto widget = new AndroidSettingsWidget; - QPalette pal = widget->palette(); - pal.setColor(QPalette::Window, Utils::creatorTheme()->color(Theme::BackgroundColorNormal)); - widget->setPalette(pal); - return widget; - }); + setWidgetCreator([] { return new AndroidSettingsWidget; }); } } // namespace Internal -- cgit v1.2.1 From ee1b8c2f16d66c85633839baee81333117098eba Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Wed, 22 Jul 2020 13:14:55 +0300 Subject: Android: move tooltip from ui to widget class and shorten long phrases Change-Id: I15bd9f54e7d4dbc3fae62b331172d6bc8e74e7ad Reviewed-by: Alessandro Portale --- src/plugins/android/androidsettingswidget.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/plugins/android/androidsettingswidget.cpp') diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 5bc2431c73..0dff745c9c 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -429,13 +429,22 @@ AndroidSettingsWidget::AndroidSettingsWidget() m_ui.downloadSDKToolButton->setIcon(downloadIcon); m_ui.downloadNDKToolButton->setIcon(downloadIcon); m_ui.downloadOpenJDKToolButton->setIcon(downloadIcon); - m_ui.sdkToolsAutoDownloadButton->setToolTip(tr( - "Automatically download Android SDK Tools to selected location.\n\n" - "If the selected path contains no valid SDK Tools, the SDK Tools package " - "is downloaded from %1, and extracted to the selected path.\n" - "After the SDK Tools are properly set up, you are prompted to install " - "any essential packages required for Qt to build for Android.") - .arg(m_androidConfig.sdkToolsUrl().toString())); + m_ui.sdkToolsAutoDownloadButton->setToolTip( + tr("Automatically download Android SDK Tools to selected location.\n\n" + "If the selected path contains no valid SDK Tools, the SDK Tools package is downloaded\n" + "from %1,\n" + "and extracted to the selected path.\n" + "After the SDK Tools are properly set up, you are prompted to install any essential\n" + "packages required for Qt to build for Android.") + .arg(m_androidConfig.sdkToolsUrl().toString())); + + m_ui.downloadOpenSSLPrebuiltLibs->setToolTip( + tr("Automatically download OpenSSL prebuilt libraries.\n\n" + "These libraries can be shipped with your application if any SSL operations\n" + "are performed. Find the checkbox under \"Projects > Build > Build Steps >\n" + "Build Android APK > Additional Libraries\".\n" + "If the automatic download fails, Qt Creator proposes to open the download URL\n" + "in the system's browser for manual download.")); connect(m_ui.SDKLocationPathChooser, &PathChooser::rawPathChanged, this, &AndroidSettingsWidget::onSdkPathChanged); -- cgit v1.2.1 From 8a8453e55d3bef1dae9212f7e957852b93ade00a Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 23 Jul 2020 09:52:03 +0200 Subject: Android: Set more columns in AVD table to ResizeToContents Give the columns with potentailly more content some space. Change-Id: I4c213f97df077801e3b11ef09519973a61c58c4f Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidsettingswidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/android/androidsettingswidget.cpp') diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 0dff745c9c..f2f6b0208f 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -423,7 +423,9 @@ AndroidSettingsWidget::AndroidSettingsWidget() m_ui.CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation()); m_ui.AVDTableView->setModel(&m_AVDModel); m_ui.AVDTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - m_ui.AVDTableView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); + for (int column : {1, 2, 5}) + m_ui.AVDTableView->horizontalHeader()->setSectionResizeMode( + column, QHeaderView::ResizeToContents); const QIcon downloadIcon = Icons::ONLINE.icon(); m_ui.downloadSDKToolButton->setIcon(downloadIcon); -- cgit v1.2.1 From e0915b7eff32bc80d26dc9531b91e30c4384f102 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 22 Jul 2020 17:46:58 +0200 Subject: Android: Fix rendering of settings background in dark mode This amends faad83d5a37448b472af2efa76b7193c83f2c1f1 by undoing the insertion of a QScrollArea + QWidget under the whole form. The reason for adding this was to be able to scroll down to the license agreements. Since Core::SettingsDialog already puts the settings widget into a QScrollArea, we have two of those and one is superfluous. When using a dark theme (e.g. flat-dark), this extra QScrollArea introduces wrong background color. Also, it complicates the already quite blown androidsettingswidget.ui This change removes the QSrollArea + QWidget while keeping the feature of scrolling to the license text. This is achieved by searching through the parent chain for a QScrollArea and using the first found one for scrolling. Task-number: QTCREATORBUG-24379 Change-Id: I2bdae9367eb06b68fa47badf2556eb1ec7ebcafb Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidsettingswidget.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins/android/androidsettingswidget.cpp') diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index f2f6b0208f..7c7bed2d92 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -367,7 +368,14 @@ AndroidSettingsWidget::AndroidSettingsWidget() m_ui.managerTabWidget->tabBar()->setEnabled(true); }); connect(m_sdkManagerWidget, &AndroidSdkManagerWidget::licenseWorkflowStarted, [this] { - m_ui.scrollArea->ensureWidgetVisible(m_ui.managerTabWidget); + QObject *parentWidget = parent(); + while (parentWidget) { + if (auto scrollArea = qobject_cast(parentWidget)) { + scrollArea->ensureWidgetVisible(m_ui.managerTabWidget); + break; + } + parentWidget = parentWidget->parent(); + }; }); QMap javaValidationPoints; -- cgit v1.2.1 From 88be337b0d1dd6fc4abc71ff8ee10b9f230691a6 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Tue, 28 Jul 2020 11:37:56 +0300 Subject: Android: change openssl error dialog Ok to Cancel Change-Id: Ib2be438e330c969a2ddb46db35c8f11e5cf94e9e Reviewed-by: Robert Loehning Reviewed-by: Alessandro Portale --- src/plugins/android/androidsettingswidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/android/androidsettingswidget.cpp') diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 7c7bed2d92..560b167d9e 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -714,7 +714,7 @@ void AndroidSettingsWidget::downloadOpenSslRepo(const bool silent) QMessageBox msgBox; msgBox.setText(tr("OpenSSL prebuilt libraries cloning failed. ") + msgSuffix + tr("Opening OpenSSL URL for manual download.")); - msgBox.addButton(tr("OK"), QMessageBox::YesRole); + msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole); QAbstractButton *openButton = msgBox.addButton(tr("Open Download URL"), QMessageBox::ActionRole); msgBox.exec(); -- cgit v1.2.1