McuSupport: Indicate the usage of QtCreator9+ for QtMCUs 2.3 and above

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>
This commit is contained in:
Yasser Grimes
2022-10-18 12:12:44 +03:00
parent 029f926bcf
commit 2d5512f2c4
3 changed files with 36 additions and 9 deletions

View File

@@ -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,

View File

@@ -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;
};

View File

@@ -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)