McuSupport: Make hardcoded target list "semi data-driven"

This change pushes the hard-coded list a bit towards a "data-driven"
approach. That way, the planned switch to the .json files based apporach
(see UL-2012) becomes less of a change.

Some target entries are added to match the current target list in Qt
for MCUs packages.

If we don't manage to get the .json-based target listing in place, this
could even serve as fall-back.

Task-number: UL-2012
Change-Id: If39e5d581ac19468b6f52ed221ec2d39bfab9f80
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Alessandro Portale
2020-03-18 03:17:35 +01:00
parent ff6dd4dc2e
commit 7675296fcf
5 changed files with 92 additions and 40 deletions

View File

@@ -334,16 +334,22 @@ McuSupportOptions::McuSupportOptions(QObject *parent)
: QObject(parent)
, qtForMCUsSdkPackage(Sdk::createQtForMCUsPackage())
{
Sdk::hardcodedTargetsAndPackages(qtForMCUsSdkPackage, &packages, &mcuTargets);
packages.append(qtForMCUsSdkPackage);
for (auto package : packages)
connect(package, &McuPackage::changed, [this](){
emit changed();
});
connect(qtForMCUsSdkPackage, &McuPackage::changed,
this, &McuSupportOptions::populatePackagesAndTargets);
}
McuSupportOptions::~McuSupportOptions()
{
deletePackagesAndTargets();
delete qtForMCUsSdkPackage;
}
void McuSupportOptions::populatePackagesAndTargets()
{
setQulDir(Utils::FilePath::fromUserInput(qtForMCUsSdkPackage->path()));
}
void McuSupportOptions::deletePackagesAndTargets()
{
qDeleteAll(packages);
packages.clear();
@@ -351,6 +357,19 @@ McuSupportOptions::~McuSupportOptions()
mcuTargets.clear();
}
void McuSupportOptions::setQulDir(const Utils::FilePath &dir)
{
deletePackagesAndTargets();
Sdk::hardcodedTargetsAndPackages(dir, &packages, &mcuTargets);
//packages.append(qtForMCUsSdkPackage);
for (auto package : packages) {
connect(package, &McuPackage::changed, [this](){
emit changed();
});
}
emit changed();
}
static bool mcuTargetIsDesktop(const McuTarget* mcuTarget)
{
return mcuTarget->qulPlatform() == "Qt";