forked from qt-creator/qt-creator
Android: Add channel and include_obsolete UI filters to SDK Manager
Allow to filter channels and obsolete packages from the UI. Change-Id: Ifcaa2a1c3421a15e60f92b7a9b86cc9ab3554885 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -150,6 +150,49 @@ AndroidSdkManagerWidget::AndroidSdkManagerWidget(AndroidConfig &config,
|
|||||||
m_sdkManager->acceptSdkLicense(false);
|
m_sdkManager->acceptSdkLicense(false);
|
||||||
m_ui->sdkLicensebuttonBox->setEnabled(false); // Wait for next license to enable controls
|
m_ui->sdkLicensebuttonBox->setEnabled(false); // Wait for next license to enable controls
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(m_ui->oboleteCheckBox, &QCheckBox::stateChanged, [this](int state) {
|
||||||
|
const QString obsoleteArg = "--include_obsolete";
|
||||||
|
QStringList args = m_androidConfig.sdkManagerToolArgs();
|
||||||
|
if (state == Qt::Checked && !args.contains(obsoleteArg)) {
|
||||||
|
args.append(obsoleteArg);
|
||||||
|
m_androidConfig.setSdkManagerToolArgs(args);
|
||||||
|
} else if (state == Qt::Unchecked && args.contains(obsoleteArg)) {
|
||||||
|
args.removeAll(obsoleteArg);
|
||||||
|
m_androidConfig.setSdkManagerToolArgs(args);
|
||||||
|
}
|
||||||
|
m_sdkManager->reloadPackages(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_ui->channelCheckbox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
[this](int index) {
|
||||||
|
QStringList args = m_androidConfig.sdkManagerToolArgs();
|
||||||
|
QString existingArg;
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
const QString arg = "--channel=" + QString::number(i);
|
||||||
|
if (args.contains(arg)) {
|
||||||
|
existingArg = arg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index == 0 && !existingArg.isEmpty()) {
|
||||||
|
args.removeAll(existingArg);
|
||||||
|
m_androidConfig.setSdkManagerToolArgs(args);
|
||||||
|
} else if (index > 0) {
|
||||||
|
// Add 1 to account for Stable (second item) being channel 0
|
||||||
|
const QString channelArg = "--channel=" + QString::number(index - 1);
|
||||||
|
if (existingArg != channelArg) {
|
||||||
|
if (!existingArg.isEmpty()) {
|
||||||
|
args.removeAll(existingArg);
|
||||||
|
m_androidConfig.setSdkManagerToolArgs(args);
|
||||||
|
}
|
||||||
|
args.append(channelArg);
|
||||||
|
m_androidConfig.setSdkManagerToolArgs(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_sdkManager->reloadPackages(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidSdkManagerWidget::~AndroidSdkManagerWidget()
|
AndroidSdkManagerWidget::~AndroidSdkManagerWidget()
|
||||||
|
@@ -93,6 +93,72 @@
|
|||||||
<string>Show Packages</string>
|
<string>Show Packages</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="channelLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="ChannelLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Channel:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="channelCheckbox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Default</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stable</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Beta</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Dev</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Canary</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="oboleteCheckBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Include obsolete</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="showAvailableRadio">
|
<widget class="QRadioButton" name="showAvailableRadio">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Reference in New Issue
Block a user