forked from qt-creator/qt-creator
McuSupport: Identify existing Kits for MCU Targets via meta data
... instead of just by kit name. Although the Kit name is quite verbose, it is missing some of the information needed to realiably identify Kits for MCU Targets. Use the Kit meta data for that, instead. This adds the color depth to the kit meta data. Change-Id: I39bc9a681a423a4309290b0f47298dbcb83b2e54 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -32,10 +32,12 @@ const char DEVICE_TYPE[] = "McuSupport.DeviceType";
|
|||||||
const char DEVICE_ID[] = "McuSupport.Device";
|
const char DEVICE_ID[] = "McuSupport.Device";
|
||||||
const char RUNCONFIGURATION[] = "McuSupport.RunConfiguration";
|
const char RUNCONFIGURATION[] = "McuSupport.RunConfiguration";
|
||||||
const char SETTINGS_ID[] = "CC.McuSupport.Configuration";
|
const char SETTINGS_ID[] = "CC.McuSupport.Configuration";
|
||||||
|
|
||||||
const char KIT_MCUTARGET_VENDOR_KEY[] = "McuSupport.McuTargetVendor";
|
const char KIT_MCUTARGET_VENDOR_KEY[] = "McuSupport.McuTargetVendor";
|
||||||
const char KIT_MCUTARGET_MODEL_KEY[] = "McuSupport.McuTargetModel";
|
const char KIT_MCUTARGET_MODEL_KEY[] = "McuSupport.McuTargetModel";
|
||||||
const char KIT_MCUTARGET_SDKVERSION_KEY[] = "McuSupport.McuTargetSdkVersion";
|
const char KIT_MCUTARGET_SDKVERSION_KEY[] = "McuSupport.McuTargetSdkVersion";
|
||||||
const char KIT_MCUTARGET_KITVERSION_KEY[] = "McuSupport.McuTargetKitVersion";
|
const char KIT_MCUTARGET_KITVERSION_KEY[] = "McuSupport.McuTargetKitVersion";
|
||||||
|
const char KIT_MCUTARGET_COLORDEPTH_KEY[] = "McuSupport.McuTargetColorDepth";
|
||||||
|
|
||||||
const char SETTINGS_GROUP[] = "McuSupport";
|
const char SETTINGS_GROUP[] = "McuSupport";
|
||||||
const char SETTINGS_KEY_PACKAGE_PREFIX[] = "Package_";
|
const char SETTINGS_KEY_PACKAGE_PREFIX[] = "Package_";
|
||||||
|
@@ -61,7 +61,7 @@
|
|||||||
namespace McuSupport {
|
namespace McuSupport {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static const int KIT_VERSION = 1; // Bumps up whenever details in Kit creation change
|
static const int KIT_VERSION = 2; // Bumps up whenever details in Kit creation change
|
||||||
|
|
||||||
static QString packagePathFromSettings(const QString &settingsKey, const QString &defaultPath = {})
|
static QString packagePathFromSettings(const QString &settingsKey, const QString &defaultPath = {})
|
||||||
{
|
{
|
||||||
@@ -469,17 +469,18 @@ static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k,
|
|||||||
const McuTarget* mcuTarget)
|
const McuTarget* mcuTarget)
|
||||||
{
|
{
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Constants;
|
||||||
|
|
||||||
k->setUnexpandedDisplayName(kitName);
|
k->setUnexpandedDisplayName(kitName);
|
||||||
k->setValue(Constants::KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor());
|
k->setValue(KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor());
|
||||||
k->setValue(Constants::KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
|
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
|
||||||
k->setValue(Constants::KIT_MCUTARGET_SDKVERSION_KEY,
|
k->setValue(KIT_MCUTARGET_COLORDEPTH_KEY, mcuTarget->colorDepth());
|
||||||
McuSupportOptions::supportedQulVersion().toString());
|
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, McuSupportOptions::supportedQulVersion().toString());
|
||||||
k->setValue(Constants::KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION);
|
k->setValue(KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION);
|
||||||
k->setAutoDetected(true);
|
k->setAutoDetected(true);
|
||||||
k->makeSticky();
|
k->makeSticky();
|
||||||
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop)
|
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop)
|
||||||
k->setDeviceTypeForIcon(Constants::DEVICE_TYPE);
|
k->setDeviceTypeForIcon(DEVICE_TYPE);
|
||||||
QSet<Core::Id> irrelevant = {
|
QSet<Core::Id> irrelevant = {
|
||||||
SysRootKitAspect::id(),
|
SysRootKitAspect::id(),
|
||||||
QtSupport::QtKitAspect::id()
|
QtSupport::QtKitAspect::id()
|
||||||
@@ -609,9 +610,17 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
|||||||
QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
|
QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
|
||||||
{
|
{
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
const QString mcuTargetKitName = kitName(mcuTarget);
|
using namespace Constants;
|
||||||
return Utils::filtered(KitManager::kits(), [&mcuTargetKitName](Kit *kit) {
|
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
|
||||||
return kit->isAutoDetected() && kit->unexpandedDisplayName() == mcuTargetKitName;
|
return kit->isAutoDetected()
|
||||||
|
&& kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
|
||||||
|
&& kit->value(KIT_MCUTARGET_SDKVERSION_KEY) ==
|
||||||
|
McuSupportOptions::supportedQulVersion().toString()
|
||||||
|
&& (!mcuTarget || (
|
||||||
|
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor()
|
||||||
|
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform()
|
||||||
|
&& kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth()
|
||||||
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user