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 <assam.boudjelthia@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Oliver Wolff
2020-03-24 06:54:15 +01:00
parent 68b6b0dd4d
commit faad83d5a3
4 changed files with 446 additions and 390 deletions

View File

@@ -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);

View File

@@ -86,6 +86,7 @@ public:
signals:
void updatingSdk();
void updatingSdkFinished();
void licenseWorkflowStarted();
private:
void onApplyButton();

View File

@@ -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<int, QString> 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

View File

@@ -26,6 +26,45 @@
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1123</width>
<height>818</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="javaSettingsGroup">
<property name="minimumSize">
@@ -454,6 +493,10 @@
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>