From faad83d5a37448b472af2efa76b7193c83f2c1f1 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 24 Mar 2020 06:54:15 +0100 Subject: [PATCH] Android: Make sure that to be accepted licenses are visible to the user If Qt Creator is not run in fullscreen or the user's resolution is too small it is possible, that the licenses which have to be accepted are not visible when the according message box is shown. In these cases we scroll down to the SDK manager so that it's obvious that the licenses have to be accepted there and no additional message box will be shown. Task-number: QTBUG-79664 Change-Id: Ic24bd8c4457a43011b4035b659063dd45b321bcc Reviewed-by: Assam Boudjelthia Reviewed-by: Leena Miettinen Reviewed-by: Christian Stenger --- .../android/androidsdkmanagerwidget.cpp | 3 + src/plugins/android/androidsdkmanagerwidget.h | 1 + src/plugins/android/androidsettingswidget.cpp | 11 +- src/plugins/android/androidsettingswidget.ui | 821 +++++++++--------- 4 files changed, 446 insertions(+), 390 deletions(-) diff --git a/src/plugins/android/androidsdkmanagerwidget.cpp b/src/plugins/android/androidsdkmanagerwidget.cpp index 84dfe948d93..cb489716a9c 100644 --- a/src/plugins/android/androidsdkmanagerwidget.cpp +++ b/src/plugins/android/androidsdkmanagerwidget.cpp @@ -446,6 +446,9 @@ void AndroidSdkManagerWidget::switchView(AndroidSdkManagerWidget::View view) else emit updatingSdk(); + if (m_currentView == LicenseWorkflow) + emit licenseWorkflowStarted(); + m_ui->operationProgress->setValue(0); m_ui->viewStack->setCurrentWidget(m_currentView == PackageListing ? m_ui->packagesStack : m_ui->outputStack); diff --git a/src/plugins/android/androidsdkmanagerwidget.h b/src/plugins/android/androidsdkmanagerwidget.h index 7ef83d31f43..eadb61e7eb3 100644 --- a/src/plugins/android/androidsdkmanagerwidget.h +++ b/src/plugins/android/androidsdkmanagerwidget.h @@ -86,6 +86,7 @@ public: signals: void updatingSdk(); void updatingSdkFinished(); + void licenseWorkflowStarted(); private: void onApplyButton(); diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 251b621bf3a..7308bba88c1 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -425,6 +425,9 @@ AndroidSettingsWidget::AndroidSettingsWidget() m_ui->SDKLocationPathChooser->setEnabled(true); m_ui->managerTabWidget->tabBar()->setEnabled(true); }); + connect(m_sdkManagerWidget, &AndroidSdkManagerWidget::licenseWorkflowStarted, [this]() { + m_ui->scrollArea->ensureWidgetVisible(m_ui->managerTabWidget); + }); QMap javaValidationPoints; javaValidationPoints[JavaPathExistsRow] = tr("JDK path exists."); @@ -997,7 +1000,13 @@ AndroidSettingsPage::AndroidSettingsPage() setId(Constants::ANDROID_SETTINGS_ID); setDisplayName(AndroidSettingsWidget::tr("Android")); setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY); - setWidgetCreator([] { return new AndroidSettingsWidget; }); + setWidgetCreator([] { + auto widget = new AndroidSettingsWidget; + QPalette pal = widget->palette(); + pal.setColor(QPalette::Window, Utils::creatorTheme()->color(Utils::Theme::BackgroundColorNormal)); + widget->setPalette(pal); + return widget; + }); } } // namespace Internal diff --git a/src/plugins/android/androidsettingswidget.ui b/src/plugins/android/androidsettingswidget.ui index 1bd69e556ae..56eba59b99d 100644 --- a/src/plugins/android/androidsettingswidget.ui +++ b/src/plugins/android/androidsettingswidget.ui @@ -27,267 +27,32 @@ 4 - - - - 0 - 0 - + + + QFrame::NoFrame - - Java Settings + + QFrame::Plain - - - - - - 0 - 0 - - - - - - - - Open JDK download URL in the system's browser. - - - - - - - - 0 - 0 - - - - JDK location: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - - - - - Android Settings - - - - - - - 0 - 0 - - - - Android SDK location: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Automatically download Android SDK Tools to selected location. - - - - - - - - - - Open Android SDK download URL in the system's browser. - - - - - - - Open Android NDK download URL in the system's browser. - - - - - - - - - - - - - - - - Android NDK list: - - - - - - - QAbstractScrollArea::AdjustToContents - - - QListView::Adjust - - - 0 - - - false - - - - - - - - - true - - - - 0 - 0 - - - - Add the selected custom NDK. The toolchains and debuggers will be created automatically. - - - Add... - - - - - - - false - - - - 0 - 0 - - - - Remove the selected NDK if it has been added manually. - - - Remove - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - Android OpenSSL settings - - - - - - - 0 - 0 - - - - OpenSSL .pri location: - - - - - - - Select the path of the prebuilt OpenSSL binaries. - - - - - - - Automatically download OpenSSL prebuilt libraries. If the automatic download fails, the download URL will be opened in the system's browser for manual download. - - - - - - - - - - - - - - - - - 0 - 0 - - - - Automatically create kits for Android tool chains - - - true - - - - - - + 0 - - - AVD Manager - - + + true + + + + + 0 + 0 + 1123 + 818 + + + + false + + 0 @@ -301,155 +66,433 @@ 0 - + + + + 0 + 0 + + + + Java Settings + + + + + + + 0 + 0 + + + + + + + + Open JDK download URL in the system's browser. + + + + + + + + 0 + 0 + + + + JDK location: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + + + + + + + Android Settings + + + + + + + 0 + 0 + + + + Android SDK location: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Automatically download Android SDK Tools to selected location. + + + + + + + + + + Open Android SDK download URL in the system's browser. + + + + + + + Open Android NDK download URL in the system's browser. + + + + + + + + + + + + + + + + Android NDK list: + + + + + + + QAbstractScrollArea::AdjustToContents + + + QListView::Adjust + + + 0 + + + false + + + + + + + + + true + + + + 0 + 0 + + + + Add the selected custom NDK. The toolchains and debuggers will be created automatically. + + + Add... + + + + + + + false + + + + 0 + 0 + + + + Remove the selected NDK if it has been added manually. + + + Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Android OpenSSL settings + + + + + + + 0 + 0 + + + + OpenSSL .pri location: + + + + + + + Select the path of the prebuilt OpenSSL binaries. + + + + + + + Automatically download OpenSSL prebuilt libraries. If the automatic download fails, the download URL will be opened in the system's browser for manual download. + + + + + + + + + + + + + + - + 0 0 - - QAbstractItemView::SingleSelection + + Automatically create kits for Android tool chains - - QAbstractItemView::SelectRows + + true - - Qt::ElideMiddle - - - false - - - false - - - - - - System/data partition size: + + + 0 + + + + AVD Manager + + + + 0 - - - - - - - 0 - 0 - + + 0 - - Mb + + 0 - - 99999 + + 0 - - 1024 - - - - - - - false - - - - 0 - 0 - - - - Start... - - - - - - - Refresh List - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 8 - - - - - - - - - 0 - 0 - - - - Add... - - - - - - - false - - - - 0 - 0 - - - - Remove - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Native AVD Manager... - - - - + + + + + 0 + 0 + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + Qt::ElideMiddle + + + false + + + false + + + + + + + + + System/data partition size: + + + + + + + + 0 + 0 + + + + Mb + + + 99999 + + + 1024 + + + + + + + false + + + + 0 + 0 + + + + Start... + + + + + + + Refresh List + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 0 + 8 + + + + + + + + + 0 + 0 + + + + Add... + + + + + + + false + + + + 0 + 0 + + + + Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Native AVD Manager... + + + + + + + + + + SDK Manager + + + - - - SDK Manager - -