Android: Turn SDK manager from QTabWidget into QGroupBox

Since the AVD manager moved into the "Devices" option page, the SDK
manager tab was left alone in the QTabWidget. One single tab looks
strange and uses more space than needed.

This change turns the SDK manager area into a QGroupBox, which is
consistent with the rest of the Android Options page. This patch also
adjusts the margins and spacings of the SDK manager widget to fit to the
rest of the options page.

Change-Id: Id1ed38862e8f9e984f53cdfb59492e30902162a7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Alessandro Portale
2021-12-06 00:02:09 +01:00
parent a50cf058d1
commit 5e77303b57
3 changed files with 33 additions and 39 deletions

View File

@@ -48,10 +48,7 @@
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>4</number>
</property>
<item row="2" column="0" colspan="4">
<item row="1" column="0" colspan="2">
<widget class="QTreeView" name="packagesView">
<property name="indentation">
<number>20</number>
@@ -61,7 +58,7 @@
</attribute>
</widget>
</item>
<item row="2" column="4">
<item row="1" column="2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="updateInstalledButton">
@@ -195,10 +192,10 @@
</item>
</layout>
</item>
<item row="1" column="1">
<item row="0" column="0">
<widget class="Utils::FancyLineEdit" name="searchField"/>
</item>
<item row="1" column="2">
<item row="0" column="1">
<widget class="QCheckBox" name="expandCheck">
<property name="text">
<string>Expand All</string>
@@ -209,6 +206,18 @@
</widget>
<widget class="QWidget" name="outputStack">
<layout class="QGridLayout" name="gridLayout_2">
<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 row="3" column="2">
<widget class="QPushButton" name="cancelButton">
<property name="text">

View File

@@ -291,16 +291,14 @@ AndroidSettingsWidget::AndroidSettingsWidget()
{
m_ui.setupUi(this);
m_sdkManagerWidget = new AndroidSdkManagerWidget(m_androidConfig, &m_sdkManager,
m_ui.sdkManagerTab);
auto sdkMangerLayout = new QVBoxLayout(m_ui.sdkManagerTab);
sdkMangerLayout->setContentsMargins(0, 0, 0, 0);
m_ui.sdkManagerGroupBox);
auto sdkMangerLayout = new QVBoxLayout(m_ui.sdkManagerGroupBox);
sdkMangerLayout->addWidget(m_sdkManagerWidget);
connect(m_sdkManagerWidget, &AndroidSdkManagerWidget::updatingSdk, [this] {
// Disable the top level UI to keep the user from unintentionally interrupting operations
m_ui.androidSettingsGroupBox->setEnabled(false);
m_ui.androidOpenSSLSettingsGroupBox->setEnabled(false);
m_ui.CreateKitCheckBox->setEnabled(false);
m_ui.managerTabWidget->tabBar()->setEnabled(false);
m_androidSummary->setState(DetailsWidget::Collapsed);
m_androidProgress->hide();
});
@@ -308,13 +306,12 @@ AndroidSettingsWidget::AndroidSettingsWidget()
m_ui.androidSettingsGroupBox->setEnabled(true);
m_ui.androidOpenSSLSettingsGroupBox->setEnabled(true);
m_ui.CreateKitCheckBox->setEnabled(true);
m_ui.managerTabWidget->tabBar()->setEnabled(true);
});
connect(m_sdkManagerWidget, &AndroidSdkManagerWidget::licenseWorkflowStarted, [this] {
QObject *parentWidget = parent();
while (parentWidget) {
if (auto scrollArea = qobject_cast<QScrollArea *>(parentWidget)) {
scrollArea->ensureWidgetVisible(m_ui.managerTabWidget);
scrollArea->ensureWidgetVisible(m_ui.sdkManagerGroupBox);
break;
}
parentWidget = parentWidget->parent();
@@ -530,7 +527,6 @@ void AndroidSettingsWidget::validateSdk()
auto userInput = QMessageBox::information(this, tr("Missing Android SDK Packages"),
message, QMessageBox::Yes | QMessageBox::No);
if (userInput == QMessageBox::Yes) {
m_ui.managerTabWidget->setCurrentWidget(m_ui.sdkManagerTab);
m_sdkManagerWidget->installEssentials();
}
}
@@ -651,7 +647,7 @@ void AndroidSettingsWidget::updateUI()
const bool androidSetupOk = m_androidSummary->allRowsOk();
const bool openSslOk = m_openSslSummary->allRowsOk();
m_ui.sdkManagerTab->setEnabled(sdkToolsOk);
m_ui.sdkManagerGroupBox->setEnabled(sdkToolsOk);
const QListWidgetItem *currentItem = m_ui.ndkListWidget->currentItem();
const FilePath currentNdk = FilePath::fromString(currentItem ? currentItem->text() : "");

View File

@@ -175,6 +175,16 @@
</property>
</widget>
</item>
<item row="7" column="0" colspan="7">
<widget class="QCheckBox" name="CreateKitCheckBox">
<property name="text">
<string>Automatically create kits for Android tool chains</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -224,31 +234,10 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="CreateKitCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatically create kits for Android tool chains</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="managerTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="sdkManagerTab">
<attribute name="title">
<widget class="QGroupBox" name="sdkManagerGroupBox">
<property name="title">
<string>SDK Manager</string>
</attribute>
</widget>
</property>
</widget>
</item>
</layout>