forked from qt-creator/qt-creator
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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user