2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2019 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2019-08-14 11:48:13 +02:00
|
|
|
|
2022-02-15 11:18:56 +01:00
|
|
|
#include "mcusupportoptionspage.h"
|
2022-02-22 14:06:18 +01:00
|
|
|
#include "mcukitmanager.h"
|
2022-02-01 14:30:35 +01:00
|
|
|
#include "mcupackage.h"
|
2019-08-14 11:48:13 +02:00
|
|
|
#include "mcusupportconstants.h"
|
2019-10-22 14:33:31 +02:00
|
|
|
#include "mcusupportoptions.h"
|
2020-12-04 16:32:34 +01:00
|
|
|
#include "mcusupportsdk.h"
|
2022-02-22 14:06:18 +01:00
|
|
|
#include "mcutarget.h"
|
2022-04-22 11:41:33 +02:00
|
|
|
#include "settingshandler.h"
|
2019-08-14 11:48:13 +02:00
|
|
|
|
2019-11-29 00:07:04 +01:00
|
|
|
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
|
|
|
|
#include <cmakeprojectmanager/cmaketoolmanager.h>
|
2019-08-14 11:48:13 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2019-11-13 18:37:27 +01:00
|
|
|
#include <projectexplorer/kitmanager.h>
|
2019-08-14 11:48:13 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <utils/algorithm.h>
|
2019-12-11 21:17:53 +01:00
|
|
|
#include <utils/infolabel.h>
|
2019-08-14 11:48:13 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
#include <utils/utilsicons.h>
|
|
|
|
|
|
2020-10-16 15:10:17 +02:00
|
|
|
#include <QCheckBox>
|
2019-08-14 11:48:13 +02:00
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QGroupBox>
|
2022-02-15 11:18:56 +01:00
|
|
|
#include <QHBoxLayout>
|
2019-08-14 11:48:13 +02:00
|
|
|
#include <QLabel>
|
2020-04-23 23:30:40 +02:00
|
|
|
#include <QPushButton>
|
2019-08-14 11:48:13 +02:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
2022-03-28 16:42:51 +02:00
|
|
|
namespace McuSupport::Internal {
|
2019-08-14 11:48:13 +02:00
|
|
|
|
2020-01-07 17:42:57 +01:00
|
|
|
class McuSupportOptionsWidget : public Core::IOptionsPageWidget
|
2019-08-14 11:48:13 +02:00
|
|
|
{
|
2020-01-16 18:18:20 +01:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(McuSupport::Internal::McuSupportOptionsWidget)
|
|
|
|
|
|
2019-08-14 11:48:13 +02:00
|
|
|
public:
|
2022-04-22 11:41:33 +02:00
|
|
|
McuSupportOptionsWidget(McuSupportOptions &, const SettingsHandler::Ptr &);
|
2019-08-14 11:48:13 +02:00
|
|
|
|
|
|
|
|
void updateStatus();
|
2019-11-15 08:38:55 +01:00
|
|
|
void showMcuTargetPackages();
|
2022-09-22 19:29:02 +02:00
|
|
|
[[nodiscard]] McuTargetPtr currentMcuTarget() const;
|
2019-08-14 11:48:13 +02:00
|
|
|
|
|
|
|
|
private:
|
2020-01-07 17:42:57 +01:00
|
|
|
void apply() final;
|
|
|
|
|
|
2020-03-18 03:17:35 +01:00
|
|
|
void populateMcuTargetsComboBox();
|
2020-01-07 17:42:57 +01:00
|
|
|
void showEvent(QShowEvent *event) final;
|
|
|
|
|
|
2019-08-14 11:48:13 +02:00
|
|
|
QString m_armGccPath;
|
2022-04-22 11:41:33 +02:00
|
|
|
McuSupportOptions &m_options;
|
|
|
|
|
SettingsHandler::Ptr m_settingsHandler;
|
2022-03-28 16:42:51 +02:00
|
|
|
QMap<McuPackagePtr, QWidget *> m_packageWidgets;
|
|
|
|
|
QMap<McuTargetPtr, QWidget *> m_mcuTargetPacketWidgets;
|
2019-08-14 11:48:13 +02:00
|
|
|
QFormLayout *m_packagesLayout = nullptr;
|
2020-03-04 19:59:50 +01:00
|
|
|
QGroupBox *m_qtForMCUsSdkGroupBox = nullptr;
|
|
|
|
|
QGroupBox *m_packagesGroupBox = nullptr;
|
|
|
|
|
QGroupBox *m_mcuTargetsGroupBox = nullptr;
|
|
|
|
|
QComboBox *m_mcuTargetsComboBox = nullptr;
|
|
|
|
|
QGroupBox *m_kitCreationGroupBox = nullptr;
|
2020-10-16 15:10:17 +02:00
|
|
|
QCheckBox *m_kitAutomaticCreationCheckBox = nullptr;
|
2020-03-04 19:59:50 +01:00
|
|
|
Utils::InfoLabel *m_kitCreationInfoLabel = nullptr;
|
2020-03-10 06:58:37 +01:00
|
|
|
Utils::InfoLabel *m_statusInfoLabel = nullptr;
|
2020-12-04 16:32:34 +01:00
|
|
|
Utils::InfoLabel *m_mcuTargetsInfoLabel = nullptr;
|
2020-04-23 23:30:40 +02:00
|
|
|
QPushButton *m_kitCreationPushButton = nullptr;
|
2021-03-31 16:47:22 +02:00
|
|
|
QPushButton *m_kitUpdatePushButton = nullptr;
|
2019-08-14 11:48:13 +02:00
|
|
|
};
|
|
|
|
|
|
2022-04-22 11:41:33 +02:00
|
|
|
McuSupportOptionsWidget::McuSupportOptionsWidget(McuSupportOptions &options,
|
|
|
|
|
const SettingsHandler::Ptr &settingsHandler)
|
|
|
|
|
: m_options{options}
|
|
|
|
|
, m_settingsHandler(settingsHandler)
|
2019-08-14 11:48:13 +02:00
|
|
|
{
|
2022-09-22 19:29:02 +02:00
|
|
|
auto *mainLayout = new QVBoxLayout(this);
|
2019-08-14 11:48:13 +02:00
|
|
|
|
2020-03-10 06:58:37 +01:00
|
|
|
{
|
|
|
|
|
m_statusInfoLabel = new Utils::InfoLabel;
|
|
|
|
|
m_statusInfoLabel->setElideMode(Qt::ElideNone);
|
|
|
|
|
m_statusInfoLabel->setOpenExternalLinks(false);
|
|
|
|
|
mainLayout->addWidget(m_statusInfoLabel);
|
2020-06-02 09:10:40 +02:00
|
|
|
connect(m_statusInfoLabel, &QLabel::linkActivated, this, [] {
|
2022-07-07 20:44:24 +02:00
|
|
|
Core::ICore::showOptionsDialog(CMakeProjectManager::Constants::Settings::TOOLS_ID);
|
2020-03-10 06:58:37 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2022-10-17 07:37:13 +02:00
|
|
|
m_qtForMCUsSdkGroupBox = new QGroupBox(tr("Qt for MCUs SDK"));
|
2020-03-10 06:58:37 +01:00
|
|
|
m_qtForMCUsSdkGroupBox->setFlat(true);
|
2022-09-22 19:29:02 +02:00
|
|
|
auto *layout = new QVBoxLayout(m_qtForMCUsSdkGroupBox);
|
2020-03-10 06:58:37 +01:00
|
|
|
layout->addWidget(m_options.qtForMCUsSdkPackage->widget());
|
|
|
|
|
mainLayout->addWidget(m_qtForMCUsSdkGroupBox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2022-10-17 07:37:13 +02:00
|
|
|
m_mcuTargetsGroupBox = new QGroupBox(
|
|
|
|
|
tr("Targets supported by the %1").arg(m_qtForMCUsSdkGroupBox->title()));
|
2020-03-10 06:58:37 +01:00
|
|
|
m_mcuTargetsGroupBox->setFlat(true);
|
|
|
|
|
mainLayout->addWidget(m_mcuTargetsGroupBox);
|
|
|
|
|
m_mcuTargetsComboBox = new QComboBox;
|
2022-09-22 19:29:02 +02:00
|
|
|
auto *layout = new QVBoxLayout(m_mcuTargetsGroupBox);
|
2020-03-10 06:58:37 +01:00
|
|
|
layout->addWidget(m_mcuTargetsComboBox);
|
2022-02-15 11:18:56 +01:00
|
|
|
connect(m_mcuTargetsComboBox,
|
|
|
|
|
&QComboBox::currentTextChanged,
|
|
|
|
|
this,
|
|
|
|
|
&McuSupportOptionsWidget::showMcuTargetPackages);
|
2022-03-28 16:42:51 +02:00
|
|
|
connect(m_options.qtForMCUsSdkPackage.get(),
|
2022-02-15 11:18:56 +01:00
|
|
|
&McuAbstractPackage::changed,
|
|
|
|
|
this,
|
|
|
|
|
&McuSupportOptionsWidget::populateMcuTargetsComboBox);
|
2020-03-10 06:58:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
m_packagesGroupBox = new QGroupBox(tr("Requirements"));
|
|
|
|
|
m_packagesGroupBox->setFlat(true);
|
|
|
|
|
mainLayout->addWidget(m_packagesGroupBox);
|
|
|
|
|
m_packagesLayout = new QFormLayout;
|
|
|
|
|
m_packagesGroupBox->setLayout(m_packagesLayout);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-04 16:32:34 +01:00
|
|
|
{
|
|
|
|
|
m_mcuTargetsInfoLabel = new Utils::InfoLabel;
|
|
|
|
|
mainLayout->addWidget(m_mcuTargetsInfoLabel);
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-16 15:10:17 +02:00
|
|
|
{
|
2022-02-15 11:18:56 +01:00
|
|
|
m_kitAutomaticCreationCheckBox = new QCheckBox(
|
|
|
|
|
tr("Automatically create kits for all available targets on start"));
|
|
|
|
|
connect(m_kitAutomaticCreationCheckBox, &QCheckBox::stateChanged, this, [this](int state) {
|
2022-03-09 17:29:07 +01:00
|
|
|
m_options.setAutomaticKitCreationEnabled(state == Qt::CheckState::Checked);
|
2020-10-16 15:10:17 +02:00
|
|
|
});
|
|
|
|
|
mainLayout->addWidget(m_kitAutomaticCreationCheckBox);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 06:58:37 +01:00
|
|
|
{
|
|
|
|
|
m_kitCreationGroupBox = new QGroupBox(tr("Create a Kit"));
|
|
|
|
|
m_kitCreationGroupBox->setFlat(true);
|
|
|
|
|
mainLayout->addWidget(m_kitCreationGroupBox);
|
|
|
|
|
m_kitCreationInfoLabel = new Utils::InfoLabel;
|
2022-09-22 19:29:02 +02:00
|
|
|
auto *vLayout = new QHBoxLayout(m_kitCreationGroupBox);
|
2020-04-23 23:30:40 +02:00
|
|
|
vLayout->addWidget(m_kitCreationInfoLabel);
|
|
|
|
|
m_kitCreationPushButton = new QPushButton(tr("Create Kit"));
|
|
|
|
|
m_kitCreationPushButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
|
|
|
|
connect(m_kitCreationPushButton, &QPushButton::clicked, this, [this] {
|
2022-03-28 16:42:51 +02:00
|
|
|
McuKitManager::newKit(currentMcuTarget().get(), m_options.qtForMCUsSdkPackage);
|
2022-04-22 11:41:33 +02:00
|
|
|
m_options.registerQchFiles();
|
2020-04-23 23:30:40 +02:00
|
|
|
updateStatus();
|
|
|
|
|
});
|
2021-03-31 16:47:22 +02:00
|
|
|
m_kitUpdatePushButton = new QPushButton(tr("Update Kit"));
|
|
|
|
|
m_kitUpdatePushButton->setSizePolicy(m_kitCreationPushButton->sizePolicy());
|
|
|
|
|
connect(m_kitUpdatePushButton, &QPushButton::clicked, this, [this] {
|
2022-09-22 19:29:02 +02:00
|
|
|
for (auto *kit : McuKitManager::upgradeableKits(currentMcuTarget().get(),
|
|
|
|
|
m_options.qtForMCUsSdkPackage))
|
2022-03-09 17:29:07 +01:00
|
|
|
McuKitManager::upgradeKitInPlace(kit,
|
2022-03-28 16:42:51 +02:00
|
|
|
currentMcuTarget().get(),
|
2022-03-09 17:29:07 +01:00
|
|
|
m_options.qtForMCUsSdkPackage);
|
2020-04-23 23:30:40 +02:00
|
|
|
updateStatus();
|
|
|
|
|
});
|
|
|
|
|
vLayout->addWidget(m_kitCreationPushButton);
|
2021-03-31 16:47:22 +02:00
|
|
|
vLayout->addWidget(m_kitUpdatePushButton);
|
2020-03-10 06:58:37 +01:00
|
|
|
}
|
2019-12-11 21:17:53 +01:00
|
|
|
|
2020-03-04 19:59:50 +01:00
|
|
|
mainLayout->addStretch();
|
2019-08-14 11:48:13 +02:00
|
|
|
|
2022-02-14 18:01:04 +01:00
|
|
|
connect(&m_options,
|
|
|
|
|
&McuSupportOptions::packagesChanged,
|
|
|
|
|
this,
|
|
|
|
|
&McuSupportOptionsWidget::updateStatus);
|
2019-08-14 11:48:13 +02:00
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
showMcuTargetPackages();
|
2019-08-14 11:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void McuSupportOptionsWidget::updateStatus()
|
|
|
|
|
{
|
2022-03-28 16:42:51 +02:00
|
|
|
const McuTargetPtr mcuTarget = currentMcuTarget();
|
2019-11-13 18:37:27 +01:00
|
|
|
|
2020-03-10 06:58:37 +01:00
|
|
|
const bool cMakeAvailable = !CMakeProjectManager::CMakeToolManager::cmakeTools().isEmpty();
|
|
|
|
|
|
|
|
|
|
// Page elements
|
|
|
|
|
{
|
|
|
|
|
m_qtForMCUsSdkGroupBox->setVisible(cMakeAvailable);
|
2022-02-21 15:24:46 +01:00
|
|
|
const bool valid = cMakeAvailable && m_options.qtForMCUsSdkPackage->isValidStatus();
|
2020-12-04 16:32:34 +01:00
|
|
|
const bool ready = valid && mcuTarget;
|
2020-03-10 06:58:37 +01:00
|
|
|
m_mcuTargetsGroupBox->setVisible(ready);
|
|
|
|
|
m_packagesGroupBox->setVisible(ready && !mcuTarget->packages().isEmpty());
|
|
|
|
|
m_kitCreationGroupBox->setVisible(ready);
|
2021-09-29 17:23:11 +02:00
|
|
|
m_mcuTargetsInfoLabel->setVisible(valid && m_options.sdkRepository.mcuTargets.isEmpty());
|
2020-12-04 16:32:34 +01:00
|
|
|
if (m_mcuTargetsInfoLabel->isVisible()) {
|
|
|
|
|
m_mcuTargetsInfoLabel->setType(Utils::InfoLabel::NotOk);
|
2021-09-30 18:30:02 +02:00
|
|
|
const Utils::FilePath sdkPath = m_options.qtForMCUsSdkPackage->basePath();
|
2021-03-01 11:07:44 +01:00
|
|
|
QString deprecationMessage;
|
2022-06-17 17:15:17 +02:00
|
|
|
if (checkDeprecatedSdkError(sdkPath, deprecationMessage))
|
2021-03-01 11:07:44 +01:00
|
|
|
m_mcuTargetsInfoLabel->setText(deprecationMessage);
|
|
|
|
|
else
|
|
|
|
|
m_mcuTargetsInfoLabel->setText(tr("No valid kit descriptions found at %1.")
|
2022-06-17 17:15:17 +02:00
|
|
|
.arg(kitsPath(sdkPath).toUserOutput()));
|
2020-12-04 16:32:34 +01:00
|
|
|
}
|
2020-03-10 06:58:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Kit creation status
|
2020-03-18 03:17:35 +01:00
|
|
|
if (mcuTarget) {
|
2020-03-10 06:58:37 +01:00
|
|
|
const bool mcuTargetValid = mcuTarget->isValid();
|
2020-04-23 23:30:40 +02:00
|
|
|
m_kitCreationPushButton->setVisible(mcuTargetValid);
|
2021-03-31 16:47:22 +02:00
|
|
|
m_kitUpdatePushButton->setVisible(mcuTargetValid);
|
2020-04-23 23:30:40 +02:00
|
|
|
if (mcuTargetValid) {
|
2022-03-28 16:42:51 +02:00
|
|
|
const bool hasMatchingKits = !McuKitManager::matchingKits(mcuTarget.get(),
|
|
|
|
|
m_options.qtForMCUsSdkPackage)
|
|
|
|
|
.isEmpty();
|
2022-03-09 17:29:07 +01:00
|
|
|
const bool hasUpgradeableKits
|
|
|
|
|
= !hasMatchingKits
|
2022-03-28 16:42:51 +02:00
|
|
|
&& !McuKitManager::upgradeableKits(mcuTarget.get(), m_options.qtForMCUsSdkPackage)
|
2022-03-09 17:29:07 +01:00
|
|
|
.isEmpty();
|
2021-03-31 16:47:22 +02:00
|
|
|
|
|
|
|
|
m_kitCreationPushButton->setEnabled(!hasMatchingKits);
|
|
|
|
|
m_kitUpdatePushButton->setEnabled(hasUpgradeableKits);
|
|
|
|
|
|
2022-02-15 11:18:56 +01:00
|
|
|
m_kitCreationInfoLabel->setType(!hasMatchingKits ? Utils::InfoLabel::Information
|
|
|
|
|
: Utils::InfoLabel::Ok);
|
2021-03-31 16:47:22 +02:00
|
|
|
|
|
|
|
|
m_kitCreationInfoLabel->setText(
|
2022-02-15 11:18:56 +01:00
|
|
|
hasMatchingKits
|
|
|
|
|
? tr("A kit for the selected target and SDK version already exists.")
|
|
|
|
|
: hasUpgradeableKits ? tr("Kits for a different SDK version exist.")
|
|
|
|
|
: tr("A kit for the selected target can be created."));
|
2020-04-23 23:30:40 +02:00
|
|
|
} else {
|
|
|
|
|
m_kitCreationInfoLabel->setType(Utils::InfoLabel::NotOk);
|
|
|
|
|
m_kitCreationInfoLabel->setText("Provide the package paths in order to create a kit "
|
|
|
|
|
"for your target.");
|
|
|
|
|
}
|
2020-03-10 06:58:37 +01:00
|
|
|
}
|
|
|
|
|
|
2020-10-16 15:10:17 +02:00
|
|
|
// Automatic Kit creation
|
2022-02-21 13:41:57 +01:00
|
|
|
m_kitAutomaticCreationCheckBox->setChecked(m_options.automaticKitCreationEnabled());
|
2020-10-16 15:10:17 +02:00
|
|
|
|
2020-03-10 06:58:37 +01:00
|
|
|
// Status label in the bottom
|
|
|
|
|
{
|
|
|
|
|
m_statusInfoLabel->setVisible(!cMakeAvailable);
|
|
|
|
|
if (m_statusInfoLabel->isVisible()) {
|
|
|
|
|
m_statusInfoLabel->setType(Utils::InfoLabel::NotOk);
|
|
|
|
|
m_statusInfoLabel->setText("No CMake tool was detected. Add a CMake tool in the "
|
|
|
|
|
"<a href=\"cmake\">CMake options</a> and press Apply.");
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-14 11:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
void McuSupportOptionsWidget::showMcuTargetPackages()
|
2019-08-14 11:48:13 +02:00
|
|
|
{
|
2022-03-28 16:42:51 +02:00
|
|
|
McuTargetPtr mcuTarget = currentMcuTarget();
|
2019-11-15 08:38:55 +01:00
|
|
|
if (!mcuTarget)
|
2019-11-13 18:37:27 +01:00
|
|
|
return;
|
|
|
|
|
|
2019-08-14 11:48:13 +02:00
|
|
|
while (m_packagesLayout->rowCount() > 0) {
|
|
|
|
|
QFormLayout::TakeRowResult row = m_packagesLayout->takeRow(0);
|
|
|
|
|
row.labelItem->widget()->hide();
|
|
|
|
|
row.fieldItem->widget()->hide();
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-07 14:46:06 +02:00
|
|
|
for (const auto &package : std::as_const(m_options.sdkRepository.packages)) {
|
2022-04-26 21:27:07 +02:00
|
|
|
if (!mcuTarget->packages().contains(package) || package->label().isEmpty())
|
2019-08-14 11:48:13 +02:00
|
|
|
continue;
|
2022-10-12 18:23:20 +03:00
|
|
|
QWidget *packageWidget = package->widget();
|
2019-08-14 11:48:13 +02:00
|
|
|
m_packagesLayout->addRow(package->label(), packageWidget);
|
|
|
|
|
packageWidget->show();
|
|
|
|
|
}
|
2019-11-13 18:37:27 +01:00
|
|
|
|
|
|
|
|
updateStatus();
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 16:42:51 +02:00
|
|
|
McuTargetPtr McuSupportOptionsWidget::currentMcuTarget() const
|
2019-11-13 18:37:27 +01:00
|
|
|
{
|
2020-03-04 19:59:50 +01:00
|
|
|
const int mcuTargetIndex = m_mcuTargetsComboBox->currentIndex();
|
2022-03-28 16:42:51 +02:00
|
|
|
McuTargetPtr target{nullptr};
|
|
|
|
|
if (mcuTargetIndex != -1 && !m_options.sdkRepository.mcuTargets.isEmpty())
|
|
|
|
|
target = m_options.sdkRepository.mcuTargets.at(mcuTargetIndex);
|
|
|
|
|
|
|
|
|
|
return target;
|
2019-08-14 11:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-29 00:07:04 +01:00
|
|
|
void McuSupportOptionsWidget::showEvent(QShowEvent *event)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(event)
|
2020-03-18 03:17:35 +01:00
|
|
|
populateMcuTargetsComboBox();
|
2019-11-29 00:07:04 +01:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 17:42:57 +01:00
|
|
|
void McuSupportOptionsWidget::apply()
|
2019-08-14 11:48:13 +02:00
|
|
|
{
|
2021-04-08 17:14:55 +02:00
|
|
|
bool pathsChanged = false;
|
|
|
|
|
|
2022-05-03 15:01:42 +02:00
|
|
|
m_settingsHandler->setAutomaticKitCreation(m_options.automaticKitCreationEnabled());
|
2021-04-08 17:14:55 +02:00
|
|
|
pathsChanged |= m_options.qtForMCUsSdkPackage->writeToSettings();
|
2022-10-07 14:46:06 +02:00
|
|
|
for (const auto &package : std::as_const(m_options.sdkRepository.packages))
|
2021-04-08 17:14:55 +02:00
|
|
|
pathsChanged |= package->writeToSettings();
|
2021-03-10 16:38:45 +01:00
|
|
|
|
2021-04-08 17:14:55 +02:00
|
|
|
if (pathsChanged) {
|
|
|
|
|
m_options.checkUpgradeableKits();
|
2022-04-22 11:41:33 +02:00
|
|
|
McuKitManager::updatePathsInExistingKits(m_settingsHandler);
|
2021-04-08 17:14:55 +02:00
|
|
|
}
|
2019-08-14 11:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-18 03:17:35 +01:00
|
|
|
void McuSupportOptionsWidget::populateMcuTargetsComboBox()
|
|
|
|
|
{
|
|
|
|
|
m_options.populatePackagesAndTargets();
|
|
|
|
|
m_mcuTargetsComboBox->clear();
|
|
|
|
|
m_mcuTargetsComboBox->addItems(
|
2022-03-28 16:42:51 +02:00
|
|
|
Utils::transform<QStringList>(m_options.sdkRepository.mcuTargets, [](const McuTargetPtr &t) {
|
|
|
|
|
return McuKitManager::generateKitNameFromTarget(t.get());
|
2022-03-09 17:29:07 +01:00
|
|
|
}));
|
2020-03-18 03:17:35 +01:00
|
|
|
updateStatus();
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-22 11:41:33 +02:00
|
|
|
McuSupportOptionsPage::McuSupportOptionsPage(McuSupportOptions &options,
|
|
|
|
|
const SettingsHandler::Ptr &settingsHandler)
|
2019-08-14 11:48:13 +02:00
|
|
|
{
|
2020-06-26 13:59:38 +02:00
|
|
|
setId(Utils::Id(Constants::SETTINGS_ID));
|
2020-01-16 18:18:20 +01:00
|
|
|
setDisplayName(McuSupportOptionsWidget::tr("MCU"));
|
2020-01-07 17:42:57 +01:00
|
|
|
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
2022-04-22 11:41:33 +02:00
|
|
|
setWidgetCreator([&options, &settingsHandler] {
|
|
|
|
|
return new McuSupportOptionsWidget(options, settingsHandler);
|
|
|
|
|
});
|
2019-08-14 11:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-28 16:42:51 +02:00
|
|
|
} // namespace McuSupport::Internal
|