From b5781e602886684922c115a96c3f663bf9c2f246 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Thu, 4 Mar 2021 17:07:49 +0100 Subject: [PATCH] McuSupport: Improvements with version detection Task-number: QTCREATORBUG-25261 Change-Id: I1b378eb4a4d132b64e4c36e0a0cdafd402570785 Reviewed-by: Leena Miettinen Reviewed-by: Alessandro Portale --- doc/qtcreator/src/mcu/creator-mcu-dev.qdoc | 23 +++++++++++++++++++ src/plugins/mcusupport/mcusupportoptions.cpp | 17 ++++++++------ src/plugins/mcusupport/mcusupportsdk.cpp | 5 ++-- .../mcusupport/mcusupportversiondetection.h | 15 ++++++++---- 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc b/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc index ff5b2d8c37d..6287543b729 100644 --- a/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc +++ b/doc/qtcreator/src/mcu/creator-mcu-dev.qdoc @@ -195,4 +195,27 @@ \li Select \uicontrol Run to specify run settings. Usually, you can use the default settings. \endlist + + \section1 Supported Qt for MCUs SDKs + + Since version 4.12.4, \QC supports version 1.3 and later of the Qt for MCUs SDK. + For older versions refer to the following table. + + \table + \header + \li \QC version + \li Qt for MCUs SDK version + \row + \li 4.12.4 or later + \li 1.3 or later + \row + \li 4.12.2 or 4.12.3 + \li 1.2 + \row + \li 4.12.0 or 4.12.1 + \li 1.1 + \row + \li 4.11.x + \li 1.0 + \endtable */ diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index a40158b2bec..a6c046dacce 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -276,15 +276,18 @@ void McuPackage::updateStatus() void McuPackage::updateStatusUi() { - m_infoLabel->setType(validStatus() ? InfoLabel::Ok : InfoLabel::NotOk); + switch (m_status) { + case ValidPackage: m_infoLabel->setType(InfoLabel::Ok); break; + case ValidPackageMismatchedVersion: m_infoLabel->setType(InfoLabel::Warning); break; + default: m_infoLabel->setType(InfoLabel::NotOk); break; + } m_infoLabel->setText(statusText()); } QString McuPackage::statusText() const { const QString displayPackagePath = FilePath::fromString(m_path).toUserOutput(); - const QString displayVersions = m_versions.isEmpty() ? "" : - QString(" (%1)").arg(QStringList(m_versions.toList()).join(" / ")); + const QString displayVersions = QStringList(m_versions.toList()).join(" or "); const QString displayRequiredPath = QString("%1 %2").arg( FilePath::fromString(m_detectionPath).toUserOutput(), displayVersions); @@ -305,10 +308,10 @@ QString McuPackage::statusText() const break; case ValidPackageMismatchedVersion: { const QString versionWarning = m_versions.size() == 1 ? - tr("version %1 is recommended").arg(m_versions.first()) : - tr("versions %1 are recommended").arg(displayVersions); - response = tr("Path %1 is valid, %2 was found, but %3.") - .arg(displayPackagePath, displayDetectedPath, versionWarning); + tr("but only version %1 is supported").arg(m_versions.first()) : + tr("but only versions %1 are supported").arg(displayVersions); + response = tr("Path %1 is valid, %2 was found, %3.") + .arg(displayPackagePath, displayDetectedPath, versionWarning); break; } case ValidPathInvalidPackage: diff --git a/src/plugins/mcusupport/mcusupportsdk.cpp b/src/plugins/mcusupport/mcusupportsdk.cpp index 0f424adec53..1a6789f91ee 100644 --- a/src/plugins/mcusupport/mcusupportsdk.cpp +++ b/src/plugins/mcusupport/mcusupportsdk.cpp @@ -609,6 +609,7 @@ static McuTargetDescription parseDescriptionJson(const QByteArray &data) }; } +// https://doc.qt.io/qtcreator/creator-developing-mcu.html#supported-qt-for-mcus-sdks const QHash oldSdkQtcRequiredVersion = { {{"1.0"}, {"4.11.x"}}, {{"1.1"}, {"4.12.0 or 4.12.1"}}, @@ -622,8 +623,8 @@ bool checkDeprecatedSdkError(const Utils::FilePath &qulDir, QString &message) if (oldSdkQtcRequiredVersion.contains(sdkDetectedVersion)) { message = McuTarget::tr("Qt for MCUs SDK version %1 detected, " - "only supported by QtCreator version %2. " - "SDK version %3 or greater required." + "only supported by Qt Creator version %2. " + "This version of Qt Creator requires Qt for MCUs %3 or greater." ).arg(sdkDetectedVersion, oldSdkQtcRequiredVersion.value(sdkDetectedVersion), McuSupportOptions::minimalQulVersion().toString()); diff --git a/src/plugins/mcusupport/mcusupportversiondetection.h b/src/plugins/mcusupport/mcusupportversiondetection.h index 0ab01d8b06e..b32406f013c 100644 --- a/src/plugins/mcusupport/mcusupportversiondetection.h +++ b/src/plugins/mcusupport/mcusupportversiondetection.h @@ -31,7 +31,8 @@ namespace McuSupport { namespace Internal { -class McuPackageVersionDetector : public QObject { +class McuPackageVersionDetector : public QObject +{ Q_OBJECT public: McuPackageVersionDetector(); @@ -40,7 +41,8 @@ public: }; // Get version from the output of an executable -class McuPackageExecutableVersionDetector : public McuPackageVersionDetector { +class McuPackageExecutableVersionDetector : public McuPackageVersionDetector +{ public: McuPackageExecutableVersionDetector(const QString &detectionPath, const QStringList &detectionArgs, @@ -53,7 +55,8 @@ private: }; // Get version through parsing an XML file -class McuPackageXmlVersionDetector : public McuPackageVersionDetector { +class McuPackageXmlVersionDetector : public McuPackageVersionDetector +{ public: McuPackageXmlVersionDetector(const QString &filePattern, const QString &elementName, @@ -68,7 +71,8 @@ private: }; // Get version from the filename of a given file/dir in the package directory -class McuPackageDirectoryVersionDetector : public McuPackageVersionDetector { +class McuPackageDirectoryVersionDetector : public McuPackageVersionDetector +{ public: McuPackageDirectoryVersionDetector(const QString &filePattern, const QString &versionRegExp, const bool isFile); QString parseVersion(const QString &packagePath) const; @@ -79,7 +83,8 @@ private: }; // Get version from the path of the package itself -class McuPackagePathVersionDetector : public McuPackageVersionDetector { +class McuPackagePathVersionDetector : public McuPackageVersionDetector +{ public: McuPackagePathVersionDetector(const QString &versionRegExp); QString parseVersion(const QString &packagePath) const;