Merge remote-tracking branch 'origin/4.13' into master

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/mcusupport/mcusupportoptions.cpp

Change-Id: I3fd0d0a6a3ff30bb990da3dc0f78e69f9e1247ef
This commit is contained in:
Eike Ziller
2020-09-23 10:11:44 +02:00
31 changed files with 492 additions and 241 deletions

View File

@@ -27,6 +27,7 @@
#include "../testtreeitem.h"
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <QFileInfo>
@@ -172,10 +173,12 @@ TestResultPtr CatchOutputReader::createDefaultResult() const
result = new CatchResult(id(), m_testCaseInfo.first().name);
result->setDescription(m_testCaseInfo.last().name);
result->setLine(m_testCaseInfo.last().line);
const QString &relativePathFromBuildDir = m_testCaseInfo.last().filename;
if (!relativePathFromBuildDir.isEmpty()) {
const QFileInfo fileInfo(m_buildDir + '/' + relativePathFromBuildDir);
result->setFileName(fileInfo.canonicalFilePath());
const QFileInfo fileInfo(m_testCaseInfo.last().filename);
const Utils::FilePath filePath = Utils::FilePath::fromFileInfo(fileInfo);
if (!filePath.isEmpty()) {
result->setFileName(fileInfo.isAbsolute()
? filePath.toString()
: QFileInfo(m_buildDir + '/' + filePath.toString()).canonicalFilePath());
}
} else {
result = new CatchResult(id(), QString());

View File

@@ -2,11 +2,9 @@
**
** Copyright (C) 2016 Denis Mingulov.
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Denis Mingulov.
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
@@ -16,35 +14,13 @@
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/

View File

@@ -2,11 +2,9 @@
**
** Copyright (C) 2016 Denis Mingulov.
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Denis Mingulov.
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
@@ -16,35 +14,13 @@
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/

View File

@@ -64,7 +64,7 @@ using namespace Utils;
namespace McuSupport {
namespace Internal {
static const int KIT_VERSION = 6; // Bumps up whenever details in Kit creation change
static const int KIT_VERSION = 7; // Bumps up whenever details in Kit creation change
static QString packagePathFromSettings(const QString &settingsKey,
QSettings::Scope scope = QSettings::UserScope,
@@ -234,8 +234,10 @@ void McuPackage::updateStatus()
m_fileChooser->lineEdit()->button(FancyLineEdit::Right)->setEnabled(m_path != m_defaultPath);
}
McuToolChainPackage::McuToolChainPackage(const QString &label, const QString &defaultPath,
const QString &detectionPath, const QString &settingsKey,
McuToolChainPackage::McuToolChainPackage(const QString &label,
const QString &defaultPath,
const QString &detectionPath,
const QString &settingsKey,
McuToolChainPackage::Type type)
: McuPackage(label, defaultPath, detectionPath, settingsKey)
, m_type(type)
@@ -247,13 +249,28 @@ McuToolChainPackage::Type McuToolChainPackage::type() const
return m_type;
}
static ToolChain *desktopToolChain(Id language)
bool McuToolChainPackage::isDesktopToolchain() const
{
return m_type == TypeMSVC || m_type == TypeGCC;
}
static ToolChain *msvcToolChain(Id language)
{
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
const Abi abi = t->targetAbi();
return (abi.os() != Abi::WindowsOS
|| (abi.osFlavor() == Abi::WindowsMsvc2017Flavor
|| abi.osFlavor() == Abi::WindowsMsvc2019Flavor))
return (abi.osFlavor() == Abi::WindowsMsvc2017Flavor || abi.osFlavor() == Abi::WindowsMsvc2019Flavor)
&& abi.architecture() == Abi::X86Architecture
&& abi.wordWidth() == 64
&& t->language() == language;
});
return toolChain;
}
static ToolChain *gccToolChain(Id language)
{
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
const Abi abi = t->targetAbi();
return abi.os() != Abi::WindowsOS
&& abi.architecture() == Abi::X86Architecture
&& abi.wordWidth() == 64
&& t->language() == language;
@@ -288,9 +305,11 @@ static ToolChain *armGccToolChain(const FilePath &path, Id language)
ToolChain *McuToolChainPackage::toolChain(Id language) const
{
ToolChain *tc = nullptr;
if (m_type == TypeDesktop) {
tc = desktopToolChain(language);
} else {
if (m_type == TypeMSVC)
tc = msvcToolChain(language);
else if (m_type == TypeGCC)
tc = gccToolChain(language);
else {
const QLatin1String compilerName(
language == ProjectExplorer::Constants::C_LANGUAGE_ID ? "gcc" : "g++");
const FilePath compiler = FilePath::fromUserInput(
@@ -339,24 +358,18 @@ QVariant McuToolChainPackage::debuggerId() const
return debuggerId;
}
McuTarget::McuTarget(const QVersionNumber &qulVersion, const QString &vendor,
const QString &platform, OS os,
McuTarget::McuTarget(const QVersionNumber &qulVersion,
const Platform &platform, OS os,
const QVector<McuPackage *> &packages,
const McuToolChainPackage *toolChainPackage)
: m_qulVersion(qulVersion)
, m_vendor(vendor)
, m_qulPlatform(platform)
, m_platform(platform)
, m_os(os)
, m_packages(packages)
, m_toolChainPackage(toolChainPackage)
{
}
QString McuTarget::vendor() const
{
return m_vendor;
}
QVector<McuPackage *> McuTarget::packages() const
{
return m_packages;
@@ -372,9 +385,9 @@ McuTarget::OS McuTarget::os() const
return m_os;
}
QString McuTarget::qulPlatform() const
McuTarget::Platform McuTarget::platform() const
{
return m_qulPlatform;
return m_platform;
}
bool McuTarget::isValid() const
@@ -499,15 +512,15 @@ static void setKitProperties(const QString &kitName, Kit *k, const McuTarget *mc
using namespace Constants;
k->setUnexpandedDisplayName(kitName);
k->setValue(KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor());
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
k->setValue(KIT_MCUTARGET_VENDOR_KEY, mcuTarget->platform().vendor);
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->platform().name);
k->setValue(KIT_MCUTARGET_COLORDEPTH_KEY, mcuTarget->colorDepth());
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, mcuTarget->qulVersion().toString());
k->setValue(KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION);
k->setValue(KIT_MCUTARGET_OS_KEY, static_cast<int>(mcuTarget->os()));
k->setAutoDetected(true);
k->makeSticky();
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop)
if (mcuTarget->toolChainPackage()->isDesktopToolchain())
k->setDeviceTypeForIcon(DEVICE_TYPE);
QSet<Id> irrelevant = { SysRootKitAspect::id() };
if (!kitNeedsQtVersion())
@@ -533,7 +546,7 @@ static void setKitDebugger(Kit *k, const McuToolChainPackage *tcPackage)
{
// Qt Creator seems to be smart enough to deduce the right Kit debugger from the ToolChain
// We rely on that at least in the Desktop case.
if (tcPackage->type() == McuToolChainPackage::TypeDesktop
if (tcPackage->isDesktopToolchain()
// No Green Hills debugger, because support for it is missing.
|| tcPackage->type() == McuToolChainPackage::TypeGHS)
return;
@@ -544,7 +557,7 @@ static void setKitDebugger(Kit *k, const McuToolChainPackage *tcPackage)
static void setKitDevice(Kit *k, const McuTarget* mcuTarget)
{
// "Device Type" Desktop is the default. We use that for the Qt for MCUs Desktop Kit
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop)
if (mcuTarget->toolChainPackage()->isDesktopToolchain())
return;
DeviceTypeKitAspect::setDeviceTypeId(k, Constants::DEVICE_TYPE);
@@ -559,7 +572,7 @@ static void setKitEnvironment(Kit *k, const McuTarget *mcuTarget,
// The Desktop version depends on the Qt shared libs in Qul_DIR/bin.
// If CMake's fileApi is avaialble, we can rely on the "Add library search path to PATH"
// feature of the run configuration. Otherwise, we just prepend the path, here.
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop
if (mcuTarget->toolChainPackage()->isDesktopToolchain()
&& !CMakeProjectManager::CMakeToolManager::defaultCMakeTool()->hasFileApi())
pathAdditions.append(QDir::toNativeSeparators(qtForMCUsSdkPackage->path() + "/bin"));
@@ -595,7 +608,7 @@ static void setKitCMakeOptions(Kit *k, const McuTarget* mcuTarget, const QString
config.append(CMakeConfigItem("CMAKE_CXX_COMPILER", "%{Compiler:Executable:Cxx}"));
config.append(CMakeConfigItem("CMAKE_C_COMPILER", "%{Compiler:Executable:C}"));
}
if (mcuTarget->toolChainPackage()->type() != McuToolChainPackage::TypeDesktop)
if (!mcuTarget->toolChainPackage()->isDesktopToolchain())
config.append(CMakeConfigItem(
"CMAKE_TOOLCHAIN_FILE",
(qulDir + "/lib/cmake/Qul/toolchain/"
@@ -603,7 +616,7 @@ static void setKitCMakeOptions(Kit *k, const McuTarget* mcuTarget, const QString
config.append(CMakeConfigItem("QUL_GENERATORS",
(qulDir + "/lib/cmake/Qul/QulGenerators.cmake").toUtf8()));
config.append(CMakeConfigItem("QUL_PLATFORM",
mcuTarget->qulPlatform().toUtf8()));
mcuTarget->platform().name.toUtf8()));
if (mcuTarget->qulVersion() <= QVersionNumber{1,3} // OS variable was removed in Qul 1.4
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
@@ -631,19 +644,16 @@ static void setKitQtVersionOptions(Kit *k)
QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
{
QString os;
if (mcuTarget->qulVersion() <= QVersionNumber{1,3} && mcuTarget->os() == McuTarget::OS::FreeRTOS) {
if (mcuTarget->qulVersion() <= QVersionNumber{1,3} && mcuTarget->os() == McuTarget::OS::FreeRTOS)
// Starting from Qul 1.4 each OS is a separate platform
os = QLatin1String(" FreeRTOS");
}
const QString colorDepth = mcuTarget->colorDepth() > 0
? QString::fromLatin1(" %1bpp").arg(mcuTarget->colorDepth())
: "";
// Hack: Use the platform name in the kit name. Exception for the "Qt" platform: use "Desktop"
const QString targetName =
mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop
? "Desktop"
: mcuTarget->qulPlatform();
const QString targetName = mcuTarget->platform().displayName.isEmpty()
? mcuTarget->platform().name
: mcuTarget->platform().displayName;
return QString::fromLatin1("Qt for MCUs %1.%2 - %3%4%5")
.arg(QString::number(mcuTarget->qulVersion().majorVersion()),
QString::number(mcuTarget->qulVersion().minorVersion()),
@@ -659,8 +669,8 @@ QList<Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
return kit->isAutoDetected()
&& kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
&& (!mcuTarget || (
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor()
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform()
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->platform().vendor
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->platform().name
&& kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth()
&& kit->value(KIT_MCUTARGET_OS_KEY).toInt()
== static_cast<int>(mcuTarget->os())

View File

@@ -110,13 +110,18 @@ public:
TypeIAR,
TypeKEIL,
TypeGHS,
TypeDesktop
TypeMSVC,
TypeGCC
};
McuToolChainPackage(const QString &label, const QString &defaultPath,
const QString &detectionPath, const QString &settingsKey, Type type);
McuToolChainPackage(const QString &label,
const QString &defaultPath,
const QString &detectionPath,
const QString &settingsKey,
Type type);
Type type() const;
bool isDesktopToolchain() const;
ProjectExplorer::ToolChain *toolChain(Utils::Id language) const;
QString cmakeToolChainFileName() const;
QVariant debuggerId() const;
@@ -136,15 +141,20 @@ public:
FreeRTOS
};
McuTarget(const QVersionNumber &qulVersion, const QString &vendor, const QString &platform,
OS os, const QVector<McuPackage *> &packages,
struct Platform {
QString name;
QString displayName;
QString vendor;
};
McuTarget(const QVersionNumber &qulVersion, const Platform &platform, OS os,
const QVector<McuPackage *> &packages,
const McuToolChainPackage *toolChainPackage);
QVersionNumber qulVersion() const;
QString vendor() const;
QVector<McuPackage *> packages() const;
const McuToolChainPackage *toolChainPackage() const;
QString qulPlatform() const;
Platform platform() const;
OS os() const;
void setColorDepth(int colorDepth);
int colorDepth() const;
@@ -152,8 +162,7 @@ public:
private:
const QVersionNumber m_qulVersion;
const QString m_vendor;
const QString m_qulPlatform;
const Platform m_platform;
const OS m_os = OS::BareMetal;
const QVector<McuPackage*> m_packages;
const McuToolChainPackage *m_toolChainPackage;

View File

@@ -68,9 +68,14 @@ McuPackage *createQtForMCUsPackage()
return result;
}
static McuToolChainPackage *createDesktopToolChainPackage()
static McuToolChainPackage *createMsvcToolChainPackage()
{
return new McuToolChainPackage({}, {}, {}, {}, McuToolChainPackage::TypeDesktop);
return new McuToolChainPackage({}, {}, {}, {}, McuToolChainPackage::TypeMSVC);
}
static McuToolChainPackage *createGccToolChainPackage()
{
return new McuToolChainPackage({}, {}, {}, {}, McuToolChainPackage::TypeGCC);
}
static McuToolChainPackage *createArmGccPackage()
@@ -203,8 +208,14 @@ static McuPackage *createMcuXpressoIdePackage()
struct McuTargetDescription
{
enum class TargetType {
MCU,
Desktop
};
QString qulVersion;
QString platform;
QString platformName;
QString platformVendor;
QVector<int> colorDepths;
QString toolchainId;
@@ -213,6 +224,7 @@ struct McuTargetDescription
QString boardSdkDefaultPath;
QString freeRTOSEnvVar;
QString freeRTOSBoardSdkSubDir;
TargetType type;
};
static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
@@ -253,7 +265,7 @@ static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
static McuPackage *createFreeRTOSSourcesPackage(const QString &envVar, const QString &boardSdkDir,
const QString &freeRTOSBoardSdkSubDir)
{
const QString envVarPrefix = envVar.chopped(strlen("_FREERTOS_DIR"));
const QString envVarPrefix = envVar.chopped(int(strlen("_FREERTOS_DIR")));
QString defaultPath;
if (qEnvironmentVariableIsSet(envVar.toLatin1()))
@@ -283,16 +295,16 @@ struct McuTargetFactory
QVector<McuTarget *> createTargets(const McuTargetDescription& description)
{
if (description.toolchainId == "desktop") {
return createDesktopTargets(description);
}
auto qulVersion = QVersionNumber::fromString(description.qulVersion);
if (qulVersion <= QVersionNumber({1,3})) {
if (description.type == McuTargetDescription::TargetType::Desktop)
return createDesktopTargetsLegacy(description);
// There was a platform backends related refactoring in Qul 1.4
// This requires different processing of McuTargetDescriptions
return createMcuTargetsLegacy(description);
}
return createMcuTargets(description);
return createTargetsImpl(description);
}
QVector<McuPackage *> getMcuPackages() const
@@ -305,16 +317,16 @@ struct McuTargetFactory
protected:
// Implementation for Qul version <= 1.3
QVector<McuTarget *> createMcuTargetsLegacy(const McuTargetDescription& desc)
QVector<McuTarget *> createMcuTargetsLegacy(const McuTargetDescription &desc)
{
QVector<McuTarget *> mcuTargets;
auto tcPkg = tcPkgs.value(desc.toolchainId);
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchainId);
for (auto os : {McuTarget::OS::BareMetal, McuTarget::OS::FreeRTOS}) {
for (int colorDepth : desc.colorDepths) {
QVector<McuPackage*> required3rdPartyPkgs = { tcPkg };
if (vendorPkgs.contains(desc.platformVendor)) {
if (vendorPkgs.contains(desc.platformVendor))
required3rdPartyPkgs.push_back(vendorPkgs.value(desc.platformVendor));
}
QString boardSdkDefaultPath;
if (!desc.boardSdkEnvVar.isEmpty()) {
if (!boardSdkPkgs.contains(desc.boardSdkEnvVar)) {
@@ -340,9 +352,9 @@ protected:
}
}
const auto platform = McuTarget::Platform{ desc.platform, desc.platformName, desc.platformVendor };
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
desc.platformVendor, desc.platform, os,
required3rdPartyPkgs, tcPkg);
platform, os, required3rdPartyPkgs, tcPkg);
if (desc.colorDepths.count() > 1)
mcuTarget->setColorDepth(colorDepth);
mcuTargets.append(mcuTarget);
@@ -351,15 +363,39 @@ protected:
return mcuTargets;
}
QVector<McuTarget *> createMcuTargets(const McuTargetDescription& desc)
QVector<McuTarget *> createDesktopTargetsLegacy(const McuTargetDescription& desc)
{
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchainId);
const auto platform = McuTarget::Platform{ desc.platform, desc.platformName, desc.platformVendor };
auto desktopTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
platform, McuTarget::OS::Desktop, {}, tcPkg);
return { desktopTarget };
}
QVector<McuTarget *> createTargetsImpl(const McuTargetDescription& desc)
{
// OS deduction
const auto os = [&] {
if (desc.type == McuTargetDescription::TargetType::Desktop)
return McuTarget::OS::Desktop;
else if (!desc.freeRTOSEnvVar.isEmpty())
return McuTarget::OS::FreeRTOS;
return McuTarget::OS::BareMetal;
}();
QVector<McuTarget *> mcuTargets;
auto tcPkg = tcPkgs.value(desc.toolchainId);
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchainId);
for (int colorDepth : desc.colorDepths) {
QVector<McuPackage*> required3rdPartyPkgs = { tcPkg };
if (vendorPkgs.contains(desc.platformVendor)) {
QVector<McuPackage*> required3rdPartyPkgs;
// Desktop toolchains don't need any additional settings
if (tcPkg && !tcPkg->isDesktopToolchain())
required3rdPartyPkgs.append(tcPkg);
// Add setting specific to platform IDE
if (vendorPkgs.contains(desc.platformVendor))
required3rdPartyPkgs.push_back(vendorPkgs.value(desc.platformVendor));
}
// Board SDK specific settings
QString boardSdkDefaultPath;
if (!desc.boardSdkEnvVar.isEmpty()) {
if (!boardSdkPkgs.contains(desc.boardSdkEnvVar)) {
@@ -371,9 +407,8 @@ protected:
required3rdPartyPkgs.append(boardSdkPkg);
}
auto os = McuTarget::OS::BareMetal;
// Free RTOS specific settings
if (!desc.freeRTOSEnvVar.isEmpty()) {
os = McuTarget::OS::FreeRTOS;
if (!freeRTOSPkgs.contains(desc.freeRTOSEnvVar)) {
freeRTOSPkgs.insert(desc.freeRTOSEnvVar, createFreeRTOSSourcesPackage(
desc.freeRTOSEnvVar, boardSdkDefaultPath,
@@ -382,24 +417,15 @@ protected:
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOSEnvVar));
}
const auto platform = McuTarget::Platform{ desc.platform, desc.platformName, desc.platformVendor };
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
desc.platformVendor, desc.platform, os,
required3rdPartyPkgs, tcPkg);
platform, os, required3rdPartyPkgs, tcPkg);
mcuTarget->setColorDepth(colorDepth);
mcuTargets.append(mcuTarget);
}
return mcuTargets;
}
QVector<McuTarget *> createDesktopTargets(const McuTargetDescription& desc)
{
auto tcPkg = tcPkgs.value(desc.toolchainId);
auto desktopTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
desc.platformVendor, desc.platform,
McuTarget::OS::Desktop, {}, tcPkg);
return { desktopTarget };
}
private:
const QHash<QString, McuToolChainPackage *> &tcPkgs;
const QHash<QString, McuPackage *> &vendorPkgs;
@@ -414,7 +440,8 @@ static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescrip
const QHash<QString, McuToolChainPackage *> tcPkgs = {
{{"armgcc"}, createArmGccPackage()},
{{"greenhills"}, createGhsToolchainPackage()},
{{"desktop"}, createDesktopToolChainPackage()},
{{"msvc"}, createMsvcToolChainPackage()},
{{"gcc"}, createGccToolChainPackage()},
};
const QHash<QString, McuPackage *> vendorPkgs = {
@@ -452,15 +479,14 @@ static McuTargetDescription parseDescriptionJson(const QByteArray &data)
const QJsonObject boardSdk = target.value("boardSdk").toObject();
const QJsonObject freeRTOS = target.value("freeRTOS").toObject();
const QString platform = target.value("platform").toString();
const QVariantList colorDepths = target.value("colorDepths").toArray().toVariantList();
const auto colorDepthsVector = Utils::transform<QVector<int> >(
colorDepths, [&](const QVariant &colorDepth) { return colorDepth.toInt(); });
return {
target.value("qulVersion").toString(),
platform,
target.value("platform").toString(),
target.value("platformName").toString(),
target.value("platformVendor").toString(),
colorDepthsVector,
toolchain.value("id").toString(),
@@ -468,7 +494,8 @@ static McuTargetDescription parseDescriptionJson(const QByteArray &data)
boardSdk.value("name").toString(),
boardSdk.value("defaultPath").toString(),
freeRTOS.value("envVar").toString(),
freeRTOS.value("boardSdkSubDir").toString()
freeRTOS.value("boardSdkSubDir").toString(),
boardSdk.empty() ? McuTargetDescription::TargetType::Desktop : McuTargetDescription::TargetType::MCU
};
}
@@ -487,25 +514,43 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage *> *packa
descriptions.append(desc);
}
// Workaround for missing JSON file for Desktop target:
Utils::FilePath desktopLib;
if (Utils::HostOsInfo::isWindowsHost())
desktopLib = dir / "lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib";
else
desktopLib = dir / "lib/libQulQuickUltralite_QT_32bpp_Linux_Debug.a";
// Workaround for missing JSON file for Desktop target.
// Desktop JSON file is shipped starting from Qul 1.5.
// This whole section could be removed when minimalQulVersion will reach 1.5 or above
{
const bool hasDesktopDescription = Utils::contains(descriptions, [](const McuTargetDescription &desc) {
return desc.type == McuTargetDescription::TargetType::Desktop;
});
if (desktopLib.exists()) {
McuTargetDescription desktopDescription;
desktopDescription.qulVersion = descriptions.empty() ?
McuSupportOptions::minimalQulVersion().toString()
: descriptions.first().qulVersion;
desktopDescription.platform = desktopDescription.platformVendor = "Qt";
desktopDescription.colorDepths = {32};
desktopDescription.toolchainId = "desktop";
descriptions.prepend(desktopDescription);
if (!hasDesktopDescription) {
Utils::FilePath desktopLib;
if (Utils::HostOsInfo::isWindowsHost())
desktopLib = dir / "lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib";
else
desktopLib = dir / "lib/libQulQuickUltralite_QT_32bpp_Linux_Debug.a";
if (desktopLib.exists()) {
McuTargetDescription desktopDescription;
desktopDescription.qulVersion = descriptions.empty() ?
McuSupportOptions::minimalQulVersion().toString()
: descriptions.first().qulVersion;
desktopDescription.platform = "Qt";
desktopDescription.platformName = "Desktop";
desktopDescription.platformVendor = "Qt";
desktopDescription.colorDepths = {32};
desktopDescription.toolchainId = Utils::HostOsInfo::isWindowsHost() ? QString("msvc") : QString("gcc");
desktopDescription.type = McuTargetDescription::TargetType::Desktop;
descriptions.prepend(desktopDescription);
}
}
}
mcuTargets->append(targetsFromDescriptions(descriptions, packages));
// Keep targets sorted lexicographically
std::sort(mcuTargets->begin(), mcuTargets->end(), [] (const McuTarget* lhs, const McuTarget* rhs) {
return McuSupportOptions::kitName(lhs) < McuSupportOptions::kitName(rhs);
});
}
} // namespace Sdk

View File

@@ -736,4 +736,17 @@ void Kit::kitUpdated()
d->m_mustNotify = false;
}
static Id replacementKey() { return "IsReplacementKit"; }
void ProjectExplorer::Kit::makeReplacementKit()
{
setValueSilently(replacementKey(), true);
}
bool Kit::isReplacementKit() const
{
return value(replacementKey()).toBool();
}
} // namespace ProjectExplorer

View File

@@ -132,6 +132,9 @@ public:
void setMutable(Utils::Id id, bool b);
bool isMutable(Utils::Id id) const;
void makeReplacementKit();
bool isReplacementKit() const;
void setIrrelevantAspects(const QSet<Utils::Id> &irrelevant);
QSet<Utils::Id> irrelevantAspects() const;

View File

@@ -235,6 +235,13 @@ void KitManager::restoreKits()
// Delete all loaded autodetected kits that were not rediscovered:
kitsToCheck.clear();
// Remove replacement kits for which the original kit has turned up again.
erase(resultList, [&resultList](const std::unique_ptr<Kit> &k) {
return k->isReplacementKit() && contains(resultList, [&k](const std::unique_ptr<Kit> &other) {
return other->id() == k->id() && other != k;
});
});
static const auto kitMatchesAbiList = [](const Kit *kit, const Abis &abis) {
const QList<ToolChain *> toolchains = ToolChainKitAspect::toolChains(kit);
for (const ToolChain * const tc : toolchains) {

View File

@@ -776,6 +776,7 @@ void Project::createTargetFromMap(const QVariantMap &map, int index)
Utils::transform(KitManager::kits(), &Kit::unexpandedDisplayName));
kit->setUnexpandedDisplayName(tempKitName);
DeviceTypeKitAspect::setDeviceTypeId(kit, deviceTypeId);
kit->makeReplacementKit();
kit->setup();
}, id);
TaskHub::addTask(BuildSystemTask(Task::Warning, tr("Project \"%1\" was configured for "

View File

@@ -405,8 +405,10 @@ public:
static bool isListViewInBaseState(const SelectionContext &selectionState)
{
return selectionState.isInBaseState() && selectionState.singleNodeIsSelected()
&& selectionState.currentSingleSelectedNode().metaInfo().isSubclassOf(
"QtQuick.ListView");
&& (selectionState.currentSingleSelectedNode().metaInfo().isSubclassOf(
"QtQuick.ListView")
|| selectionState.currentSingleSelectedNode().metaInfo().isSubclassOf(
"QtQuick.GridView"));
}
bool isEnabled(const SelectionContext &) const override { return true; }

View File

@@ -303,7 +303,7 @@ void ConnectionModel::addConnection()
ModelNode newNode = connectionView()->createModelNode("QtQuick.Connections",
nodeMetaInfo.majorVersion(),
nodeMetaInfo.minorVersion());
QString source = "print(\"clicked\")";
QString source = "console.log(\"clicked\")";
if (connectionView()->selectedModelNodes().count() == 1) {
ModelNode selectedNode = connectionView()->selectedModelNodes().constFirst();

View File

@@ -132,7 +132,7 @@ void StatesEditorWidget::toggleStatesViewExpanded()
void StatesEditorWidget::showEvent(QShowEvent *event)
{
Q_UNUSED(event)
QQuickWidget::showEvent(event);
update();
}

View File

@@ -95,6 +95,13 @@ TimelineEditorDelegate::TimelineEditorDelegate(QWidget *parent)
setItemEditorFactory(factory);
}
QSpinBox *createSpinBox(QWidget *parent)
{
auto spinBox = new QSpinBox(parent);
spinBox->setRange(-10000, 10000);
return spinBox;
}
QWidget *TimelineEditorDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
@@ -102,7 +109,7 @@ QWidget *TimelineEditorDelegate::createEditor(QWidget *parent,
QWidget *widget = nullptr;
if (index.column() == TimelineSettingsModel::FixedFrameRow)
widget = new QSpinBox(parent);
widget = createSpinBox(parent);
else
widget = QStyledItemDelegate::createEditor(parent, option, index);

View File

@@ -66,12 +66,12 @@ private:
void printProcessOutput(QProcess *process, const QString &connectionName);
void closeSocketsAndKillProcesses();
private:
std::unique_ptr<QLocalServer> m_localServer;
protected:
std::vector<Connection> m_connections;
quint32 m_writeCommandCounter = 0;
private:
std::unique_ptr<QLocalServer> m_localServer;
};
} // namespace QmlDesigner

View File

@@ -125,8 +125,11 @@ ProjectFileSelectionsWidget::ProjectFileSelectionsWidget(const QString &projectS
const auto settingsDisabledFiles = project->namedSettings(m_projectSettingsKey).toStringList();
if (auto rootProjectNode = project->rootProjectNode()) {
rootProjectNode->forEachNode([this, settingsDisabledFiles, model](ProjectExplorer::FileNode *fileNode) {
if (fileNode->fileType() == m_fileType) {
auto rootPath = rootProjectNode->filePath();
rootProjectNode->forEachNode([this, settingsDisabledFiles, model, rootPath](ProjectExplorer::FileNode *fileNode) {
if (fileNode->fileType() == m_fileType
&& !fileNode->filePath().relativeChildPath(rootPath).startsWith("imports/")) {
bool isDisabled = settingsDisabledFiles.contains(fileNode->filePath().toString());
model->rootItem()->appendChild(new ProjectFileItem(fileNode->filePath(), isDisabled));
}

View File

@@ -104,21 +104,17 @@ QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent)
const QString projectSettingsKey = "QmlPreview.DisabledDebugTranslationFiles";
const ProjectExplorer::FileType filterFileType = ProjectExplorer::FileType::QML;
auto checkableProjectFileView = new ProjectFileSelectionsWidget(projectSettingsKey, filterFileType);
checkableProjectFileView->setVisible(false);
connect(checkableProjectFileView, &ProjectFileSelectionsWidget::selectionChanged, this, &QmlDebugTranslationWidget::setFiles);
m_checkableProjectFileView = new ProjectFileSelectionsWidget(projectSettingsKey, filterFileType);
m_checkableProjectFileView->setVisible(false);
connect(m_checkableProjectFileView, &ProjectFileSelectionsWidget::selectionChanged, this, &QmlDebugTranslationWidget::setFiles);
m_multipleFileButton = new QRadioButton(tr("multiple files"));
// TODO: fix multiple files issues, because it have some issues disable it for now
m_multipleFileButton->setDisabled(true);
buttonGroup->addButton(m_multipleFileButton);
connect(m_multipleFileButton, &QAbstractButton::toggled, [checkableProjectFileView, this](bool checked) {
checkableProjectFileView->setVisible(checked);
setFiles(checkableProjectFileView->checkedFiles());
});
connect(m_multipleFileButton, &QAbstractButton::toggled, m_checkableProjectFileView, &QWidget::setVisible);
connect(m_multipleFileButton, &QAbstractButton::toggled, this, &QmlDebugTranslationWidget::updateFiles);
mainLayout->addWidget(m_singleFileButton);
mainLayout->addWidget(m_multipleFileButton);
mainLayout->addWidget(checkableProjectFileView);
mainLayout->addWidget(m_checkableProjectFileView);
// language checkboxes are add in updateAvailableTranslations method
m_selectLanguageLayout = new QHBoxLayout;
@@ -226,7 +222,7 @@ void QmlDebugTranslationWidget::updateCurrentEditor(const Core::IEditor *editor)
else
m_currentFilePath.clear();
m_singleFileButton->setText(singleFileButtonText(m_currentFilePath.toString()));
updateFiles();
}
void QmlDebugTranslationWidget::updateStartupProjectTranslations()
@@ -253,6 +249,7 @@ void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Proje
tr("Current language is \'<b>%1</b>\' can be changed in the 'Translation' tab.")
.arg(multiLanguageAspect->currentLocale())));
m_testLanguages.clear();
m_testLanguages.append(multiLanguageAspect->currentLocale());
} else {
m_selectLanguageLayout->addWidget(new QLabel(tr("Select which language should be tested:")));
QString errorMessage;
@@ -272,6 +269,14 @@ void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Proje
}
}
void QmlDebugTranslationWidget::updateFiles()
{
if (m_multipleFileButton->isChecked())
setFiles(m_checkableProjectFileView->checkedFiles());
else
setFiles({m_currentFilePath});
}
void QmlDebugTranslationWidget::setFiles(const Utils::FilePaths &filePathes)
{
m_selectedFilePaths = filePathes;
@@ -305,14 +310,9 @@ void QmlDebugTranslationWidget::runTest()
});
}
};
if (m_multipleFileButton->isChecked()) {
for (auto filePath : m_selectedFilePaths) {
testLanguages(timerCounter++, filePath.toString());
}
} else {
testLanguages(timerCounter, QString());
for (auto filePath : m_selectedFilePaths) {
testLanguages(timerCounter++, filePath.toString());
}
});
connect(runControl, &ProjectExplorer::RunControl::stopped, [this]() {
m_runTestButton->setChecked(false);

View File

@@ -49,6 +49,8 @@ class RunControl;
namespace QmlPreview {
class ProjectFileSelectionsWidget;
class QMLPREVIEW_EXPORT QmlDebugTranslationWidget : public QWidget
{
Q_OBJECT
@@ -62,6 +64,7 @@ public:
private:
void updateCurrentEditor(const Core::IEditor *editor);
void updateCurrentTranslations(ProjectExplorer::Project *project);
void updateFiles();
void runTest();
void appendMessage(const QString &message, Utils::OutputFormat format);
void clear();
@@ -81,6 +84,7 @@ private:
QRadioButton *m_singleFileButton = nullptr;
QRadioButton *m_multipleFileButton = nullptr;
ProjectFileSelectionsWidget *m_checkableProjectFileView = nullptr;
QPushButton *m_runTestButton = nullptr;
Utils::FilePath m_currentFilePath;

View File

@@ -1164,6 +1164,10 @@ void TextEditorWidgetPrivate::print(QPrinter *printer)
if (!p.isActive())
return;
QRectF pageRect(printer->pageRect());
if (pageRect.isEmpty())
return;
doc = doc->clone(doc);
Utils::ExecuteOnDestruction docDeleter([doc]() { delete doc; });
@@ -1217,7 +1221,6 @@ void TextEditorWidgetPrivate::print(QPrinter *printer)
fmt.setMargin(margin);
doc->rootFrame()->setFrameFormat(fmt);
QRectF pageRect(printer->pageRect());
QRectF body = QRectF(0, 0, pageRect.width(), pageRect.height());
QFontMetrics fontMetrics(doc->defaultFont(), p.device());
@@ -4724,8 +4727,7 @@ void TextEditorWidgetPrivate::setupSelections(const PaintEventData &data,
const QTextCharFormat selectionFormat = data.fontSettings.toTextCharFormat(C_SELECTION);
if (selectionFormat.background().style() != Qt::NoBrush)
o.format.setBackground(selectionFormat.background());
if (selectionFormat.foreground().style() != Qt::NoBrush)
o.format.setForeground(selectionFormat.foreground());
o.format.setForeground(selectionFormat.foreground());
}
if ((data.textCursor.hasSelection() && i == data.context.selections.size() - 1)
|| (o.format.foreground().style() == Qt::NoBrush

View File

@@ -240,7 +240,8 @@ void TextEditorActionHandlerPrivate::createActions()
m_deleteEndOfWordCamelCaseAction = registerAction(DELETE_END_OF_WORD_CAMEL_CASE,
[] (TextEditorWidget *w) { w->deleteEndOfWordCamelCase(); }, true, tr("Delete Word Camel Case from Cursor On"));
m_deleteStartOfLineAction = registerAction(DELETE_START_OF_LINE,
[] (TextEditorWidget *w) { w->deleteStartOfLine(); }, true, tr("Delete Line up to Cursor"));
[] (TextEditorWidget *w) { w->deleteStartOfLine(); }, true, tr("Delete Line up to Cursor"),
Core::useMacShortcuts ? QKeySequence(tr("Ctrl+Backspace")) : QKeySequence());
m_deleteStartOfWordAction = registerAction(DELETE_START_OF_WORD,
[] (TextEditorWidget *w) { w->deleteStartOfWord(); }, true, tr("Delete Word up to Cursor"));
m_deleteStartOfWordCamelCaseAction = registerAction(DELETE_START_OF_WORD_CAMEL_CASE,

View File

@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 Denis Mingulov, The Qt Company Ltd.
** Copyright (C) 2016 Denis Mingulov, The Qt Company Ltd.
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -14,35 +13,13 @@
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/