forked from qt-creator/qt-creator
McuSupport: Make all member fields of McuTarget const
In proactive, the color depth was never changed after setCMakeOptions was called. This change makes it clear that it is also not intended to be changed: a board does not suddenly change color depth, and for a new board configuration a new target is created. Change-Id: Ie5b99726d833efcdf129655b8e70120a033914e6 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
committed by
piotr.mucko
parent
52e3f2cd5f
commit
93fc6b5c3c
@@ -267,14 +267,17 @@ QVariant McuToolChainPackage::debuggerId() const
|
||||
}
|
||||
|
||||
McuTarget::McuTarget(const QVersionNumber &qulVersion,
|
||||
const Platform &platform, OS os,
|
||||
const Platform &platform,
|
||||
OS os,
|
||||
const QVector<McuPackage *> &packages,
|
||||
const McuToolChainPackage *toolChainPackage)
|
||||
const McuToolChainPackage *toolChainPackage,
|
||||
int colorDepth)
|
||||
: m_qulVersion(qulVersion)
|
||||
, m_platform(platform)
|
||||
, m_os(os)
|
||||
, m_packages(packages)
|
||||
, m_toolChainPackage(toolChainPackage)
|
||||
, m_colorDepth(colorDepth)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -335,11 +338,6 @@ int McuTarget::colorDepth() const
|
||||
return m_colorDepth;
|
||||
}
|
||||
|
||||
void McuTarget::setColorDepth(int colorDepth)
|
||||
{
|
||||
m_colorDepth = colorDepth;
|
||||
}
|
||||
|
||||
void McuSdkRepository::deletePackagesAndTargets()
|
||||
{
|
||||
qDeleteAll(packages);
|
||||
@@ -665,7 +663,7 @@ static void setKitCMakeOptions(Kit *k, const McuTarget* mcuTarget, const FilePat
|
||||
if (mcuTarget->qulVersion() <= QVersionNumber{1,3} // OS variable was removed in Qul 1.4
|
||||
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
||||
config.append(CMakeConfigItem("OS", "FreeRTOS"));
|
||||
if (mcuTarget->colorDepth() >= 0)
|
||||
if (mcuTarget->colorDepth() != McuTarget::UnspecifiedColorDepth)
|
||||
config.append(CMakeConfigItem("QUL_COLOR_DEPTH",
|
||||
QString::number(mcuTarget->colorDepth()).toLatin1()));
|
||||
if (kitNeedsQtVersion())
|
||||
@@ -700,7 +698,7 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
||||
const QString compilerName = tcPkg && !tcPkg->isDesktopToolchain()
|
||||
? QString::fromLatin1(" (%1)").arg(tcPkg->toolChainName().toUpper())
|
||||
: "";
|
||||
const QString colorDepth = mcuTarget->colorDepth() > 0
|
||||
const QString colorDepth = mcuTarget->colorDepth() != McuTarget::UnspecifiedColorDepth
|
||||
? QString::fromLatin1(" %1bpp").arg(mcuTarget->colorDepth())
|
||||
: "";
|
||||
const QString targetName = mcuTarget->platform().displayName.isEmpty()
|
||||
|
@@ -1,6 +1,7 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2021 The Qt Company Ltd.
|
||||
** Copyright (C) 2021
|
||||
** The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
@@ -69,16 +70,20 @@ public:
|
||||
QString vendor;
|
||||
};
|
||||
|
||||
McuTarget(const QVersionNumber &qulVersion, const Platform &platform, OS os,
|
||||
enum { UnspecifiedColorDepth = -1 };
|
||||
|
||||
McuTarget(const QVersionNumber &qulVersion,
|
||||
const Platform &platform,
|
||||
OS os,
|
||||
const QVector<McuPackage *> &packages,
|
||||
const McuToolChainPackage *toolChainPackage);
|
||||
const McuToolChainPackage *toolChainPackage,
|
||||
int colorDepth = UnspecifiedColorDepth);
|
||||
|
||||
const QVersionNumber &qulVersion() const;
|
||||
const QVector<McuPackage *> &packages() const;
|
||||
const McuToolChainPackage *toolChainPackage() const;
|
||||
const Platform &platform() const;
|
||||
OS os() const;
|
||||
void setColorDepth(int colorDepth);
|
||||
int colorDepth() const;
|
||||
bool isValid() const;
|
||||
void printPackageProblems() const;
|
||||
@@ -86,10 +91,10 @@ public:
|
||||
private:
|
||||
const QVersionNumber m_qulVersion;
|
||||
const Platform m_platform;
|
||||
const OS m_os = OS::BareMetal;
|
||||
const OS m_os;
|
||||
const QVector<McuPackage*> m_packages;
|
||||
const McuToolChainPackage *m_toolChainPackage;
|
||||
int m_colorDepth = -1;
|
||||
const int m_colorDepth;
|
||||
};
|
||||
|
||||
class McuSdkRepository
|
||||
|
@@ -512,9 +512,13 @@ protected:
|
||||
|
||||
const auto platform = McuTarget::Platform{ desc.platform.id, desc.platform.name, desc.platform.vendor };
|
||||
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||
platform, os, required3rdPartyPkgs, tcPkg);
|
||||
if (desc.platform.colorDepths.count() > 1)
|
||||
mcuTarget->setColorDepth(colorDepth);
|
||||
platform,
|
||||
os,
|
||||
required3rdPartyPkgs,
|
||||
tcPkg,
|
||||
desc.platform.colorDepths.count() > 1
|
||||
? colorDepth
|
||||
: McuTarget::UnspecifiedColorDepth);
|
||||
mcuTargets.append(mcuTarget);
|
||||
}
|
||||
}
|
||||
@@ -586,10 +590,13 @@ protected:
|
||||
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOS.envVar));
|
||||
}
|
||||
|
||||
const auto platform = McuTarget::Platform{ desc.platform.id, desc.platform.name, desc.platform.vendor };
|
||||
const McuTarget::Platform platform({ desc.platform.id, desc.platform.name, desc.platform.vendor });
|
||||
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||
platform, os, required3rdPartyPkgs, tcPkg);
|
||||
mcuTarget->setColorDepth(colorDepth);
|
||||
platform,
|
||||
os,
|
||||
required3rdPartyPkgs,
|
||||
tcPkg,
|
||||
colorDepth);
|
||||
mcuTargets.append(mcuTarget);
|
||||
}
|
||||
return mcuTargets;
|
||||
|
Reference in New Issue
Block a user