diff options
author | Yasser Grimes <yasser.grimes@qt.io> | 2022-10-18 12:12:44 +0300 |
---|---|---|
committer | Yasser Grimes <yasser.grimes@qt.io> | 2022-10-19 12:24:13 +0000 |
commit | 2d5512f2c4ef187a548b34077ba51fffe0f15460 (patch) | |
tree | 5c712affdcc718eca6bb55ba9552a2b6e6816535 | |
parent | 029f926bcfcbb01757b53bf67410ffcbbbe28569 (diff) |
McuSupport: Indicate the usage of QtCreator9+ for QtMCUs 2.3 and abovev8.0.2
Starting from QtMCUs 2.3 legacy code is not used in McuSupport plugin
and the refactored code is used instead.
Trying to use 2.3 in older versions of QtCreator will result is using
incomplete refactored code causing errors when generating kits.
This commit will indicate to the user to choose the correct version of
QtCreator for newer QtMCUs releases.
Task-number: QTCREATORBUG-28286
Change-Id: Ib3934ef50f9cee81f1fac8a36674473fc2169ef5
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
Reviewed-by: Sivert Krøvel <sivert.krovel@qt.io>
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/plugins/mcusupport/mcupackage.cpp | 17 | ||||
-rw-r--r-- | src/plugins/mcusupport/mcupackage.h | 3 | ||||
-rw-r--r-- | src/plugins/mcusupport/mcusupportsdk.cpp | 25 |
3 files changed, 36 insertions, 9 deletions
diff --git a/src/plugins/mcusupport/mcupackage.cpp b/src/plugins/mcusupport/mcupackage.cpp index 35c87fe2ba..99e35b4ea1 100644 --- a/src/plugins/mcusupport/mcupackage.cpp +++ b/src/plugins/mcusupport/mcupackage.cpp @@ -160,6 +160,8 @@ McuPackage::Status McuPackage::status() const bool McuPackage::isValidStatus() const { + if (m_isQtMCUsPackage) + return m_status == Status::ValidPackage; return m_status == Status::ValidPackage || m_status == Status::ValidPackageMismatchedVersion; } @@ -170,7 +172,10 @@ void McuPackage::updateStatusUi() m_infoLabel->setType(InfoLabel::Ok); break; case Status::ValidPackageMismatchedVersion: - m_infoLabel->setType(InfoLabel::Warning); + if (m_isQtMCUsPackage) + m_infoLabel->setType(InfoLabel::NotOk); + else + m_infoLabel->setType(InfoLabel::Warning); break; default: m_infoLabel->setType(InfoLabel::NotOk); @@ -204,6 +209,11 @@ QString McuPackage::statusText() const .arg(displayPackagePath, displayDetectedPath); break; case Status::ValidPackageMismatchedVersion: { + if (m_isQtMCUsPackage) { + response = "Kits will not generate correctly. Use QtCreator 9 and above for QtMCUs " + "2.3 and later"; + break; + } const QString versionWarning = m_versions.size() == 1 ? tr("but only version %1 is supported").arg(m_versions.first()) @@ -273,6 +283,11 @@ QWidget *McuPackage::widget() return widget; } +void McuPackage::setIsQtMCUsPackage(bool isQtMCUsPackage) +{ + m_isQtMCUsPackage = isQtMCUsPackage; +}; + McuToolChainPackage::McuToolChainPackage(const SettingsHandler::Ptr &settingsHandler, const QString &label, const FilePath &defaultPath, diff --git a/src/plugins/mcusupport/mcupackage.h b/src/plugins/mcusupport/mcupackage.h index 7316fbea15..2067cacce4 100644 --- a/src/plugins/mcusupport/mcupackage.h +++ b/src/plugins/mcusupport/mcupackage.h @@ -90,6 +90,8 @@ public: QWidget *widget() override; + void setIsQtMCUsPackage(bool isQtMCUsPackage); + private: void updatePath(); void updateStatusUi(); @@ -113,6 +115,7 @@ private: const QString m_environmentVariableName; const QString m_downloadUrl; const bool m_addToSystemPath; + bool m_isQtMCUsPackage = false; Status m_status = Status::InvalidPath; }; diff --git a/src/plugins/mcusupport/mcusupportsdk.cpp b/src/plugins/mcusupport/mcusupportsdk.cpp index b0d8a36cfd..fbdd2f38bb 100644 --- a/src/plugins/mcusupport/mcusupportsdk.cpp +++ b/src/plugins/mcusupport/mcusupportsdk.cpp @@ -37,6 +37,7 @@ #include "mcutargetfactory.h" #include "mcutargetfactorylegacy.h" +#include <app/app_version.h> #include <baremetal/baremetalconstants.h> #include <coreplugin/icore.h> #include <projectexplorer/toolchain.h> @@ -79,14 +80,22 @@ static FilePath findInProgramFiles(const QString &folder) McuPackagePtr createQtForMCUsPackage(const SettingsHandler::Ptr &settingsHandler) { - return McuPackagePtr{ - new McuPackage(settingsHandler, - McuPackage::tr("Qt for MCUs SDK"), - FileUtils::homePath(), // defaultPath - FilePath("bin/qmltocpp").withExecutableSuffix(), // detectionPath - Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK, // settingsKey - QStringLiteral("Qul_ROOT"), // cmakeVarName - QStringLiteral("Qul_DIR"))}; // envVarName + auto package = new McuPackage(settingsHandler, + McuPackage::tr("Qt for MCUs SDK"), + FileUtils::homePath(), // defaultPath + FilePath("bin/qmltocpp").withExecutableSuffix(), // detectionPath + Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK, // settingsKey + QStringLiteral("Qul_ROOT"), // cmakeVarName + QStringLiteral("Qul_DIR"), // envVarName + {}, // download rul + new McuPackagePathVersionDetector(R"(\d.\d)") // version detector + ); + + if (IDE_VERSION_MAJOR < 9) + package->setVersions({"2.0", "2.1", "2.2"}); + package->setIsQtMCUsPackage(true); + + return McuPackagePtr{package}; } static McuPackageVersionDetector *generatePackageVersionDetector(const QString &envVar) |