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

Conflicts:
	CMakeLists.txt

Change-Id: I799060da2cb299bb0c49a3da3530fad18427a23c
This commit is contained in:
Eike Ziller
2020-08-21 10:08:55 +02:00
138 changed files with 4023 additions and 3663 deletions

View File

@@ -118,6 +118,8 @@ AutotestPlugin::AutotestPlugin()
qRegisterMetaType<TestResult>();
qRegisterMetaType<TestTreeItem *>();
qRegisterMetaType<TestCodeLocationAndType>();
// warm up meta type system to be able to read Qt::CheckState with persistent settings
qRegisterMetaType<Qt::CheckState>();
}
AutotestPlugin::~AutotestPlugin()

View File

@@ -58,15 +58,15 @@ public:
void clear() { m_cache.clear(); }
bool isEmpty() const { return m_cache.isEmpty(); }
QVariantHash toSettings() const
QVariantMap toSettings() const
{
QVariantHash result;
QVariantMap result;
for (auto it = m_cache.cbegin(), end = m_cache.cend(); it != end; ++it)
result.insert(it.key(), QVariant::fromValue(it.value().value));
return result;
}
void fromSettings(const QVariantHash &stored)
void fromSettings(const QVariantMap &stored)
{
m_cache.clear();
for (auto it = stored.cbegin(), end = stored.cend(); it != end; ++it)

View File

@@ -94,7 +94,7 @@ void TestProjectSettings::load()
const QVariant runAfterBuild = m_project->namedSettings(SK_RUN_AFTER_BUILD);
m_runAfterBuild = runAfterBuild.isValid() ? RunAfterBuildMode(runAfterBuild.toInt())
: RunAfterBuildMode::None;
m_checkStateCache.fromSettings(m_project->namedSettings(SK_CHECK_STATES).toHash());
m_checkStateCache.fromSettings(m_project->namedSettings(SK_CHECK_STATES).toMap());
}
void TestProjectSettings::save()
@@ -106,8 +106,7 @@ void TestProjectSettings::save()
activeFrameworks.insert(it.key()->id().toString(), it.value());
m_project->setNamedSettings(SK_ACTIVE_FRAMEWORKS, activeFrameworks);
m_project->setNamedSettings(SK_RUN_AFTER_BUILD, int(m_runAfterBuild));
if (!m_checkStateCache.isEmpty())
m_project->setNamedSettings(SK_CHECK_STATES, m_checkStateCache.toSettings());
m_project->setNamedSettings(SK_CHECK_STATES, m_checkStateCache.toSettings());
}
} // namespace Internal

View File

@@ -262,8 +262,10 @@ QList<void *> CMakeProjectImporter::examineDirectory(const Utils::FilePath &impo
qCDebug(cmInputLog) << "Failed to read configuration from" << cacheFile << errorMessage;
return { };
}
const auto homeDir
= Utils::FilePath::fromUserInput(QString::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", config)));
const auto homeDir = Utils::FilePath::fromUserInput(
QString::fromUtf8(
CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", config)))
.canonicalPath();
const Utils::FilePath canonicalProjectDirectory = projectDirectory().canonicalPath();
if (homeDir != canonicalProjectDirectory) {
qCDebug(cmInputLog) << "Wrong source directory:" << homeDir.toUserOutput()

View File

@@ -193,3 +193,13 @@ extend_qtc_plugin(Core
SOURCES
locator/javascriptfilter.cpp locator/javascriptfilter.h
)
if ((NOT WIN32) AND (NOT APPLE))
# install logo
foreach(size 16 24 32 48 64 128 256 512)
install(
FILES images/logo/${size}/QtProject-qtcreator.png
DESTINATION share/icons/hicolor/${size}x${size}/apps
)
endforeach()
endif()

View File

@@ -557,7 +557,9 @@ void VariableChooserPrivate::updatePositionAndShow(bool)
void VariableChooserPrivate::updateFilter(const QString &filterText)
{
m_sortModel->setFilterRegularExpression(QRegularExpression::wildcardToRegularExpression(filterText));
const QString pattern = QRegularExpression::escape(filterText);
m_sortModel->setFilterRegularExpression(
QRegularExpression(pattern, QRegularExpression::CaseInsensitiveOption));
m_variableTree->expandAll();
}

View File

@@ -67,7 +67,16 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context)
m_zoomAction = new QAction(this);
ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context);
connect(m_zoomAction, &QAction::triggered, m_window, &QWidget::showMaximized);
connect(m_zoomAction, &QAction::triggered, m_window, [this] {
if (m_window->isMaximized()) {
// similar to QWidget::showMaximized
m_window->ensurePolished();
m_window->setWindowState(m_window->windowState() & ~Qt::WindowMaximized);
m_window->setVisible(true);
} else {
m_window->showMaximized();
}
});
m_closeAction = new QAction(this);
ActionManager::registerAction(m_closeAction, Constants::CLOSE_WINDOW, context);

View File

@@ -397,6 +397,8 @@ void CdbEngine::setupEngine()
debugger.addArgs({"-y", QChar('"') + stringListSetting(CdbSymbolPaths).join(';') + '"'});
debugger.addArgs(expand(stringSetting(CdbAdditionalArguments)), CommandLine::Raw);
switch (sp.startMode) {
case StartInternal:
case StartExternal:

View File

@@ -297,7 +297,7 @@ public:
void saveGeometry()
{
SessionManager::setValue("DebuggerSeparateWidgetGeometry", geometry());
SessionManager::setValue("DebuggerSeparateWidgetGeometry", QVariant(geometry()));
}
~SeparatedView() override

View File

@@ -8,8 +8,6 @@
<file>wizards/icon@2x.png</file>
<file>wizards/application/CMakeLists.txt</file>
<file>wizards/application/project.qmlproject.tpl</file>
<file>wizards/application/BareMetal/main.cpp.tpl</file>
<file>wizards/application/FreeRTOS/main.cpp.tpl</file>
<file>wizards/application/main.qml.tpl</file>
<file>wizards/application/wizard.json</file>
</qresource>

View File

@@ -607,7 +607,9 @@ static void setKitCMakeOptions(ProjectExplorer::Kit *k, const McuTarget* mcuTarg
(qulDir + "/lib/cmake/Qul/QulGenerators.cmake").toUtf8()));
config.append(CMakeConfigItem("QUL_PLATFORM",
mcuTarget->qulPlatform().toUtf8()));
if (mcuTarget->os() == McuTarget::OS::FreeRTOS)
if (mcuTarget->qulVersion() <= QVersionNumber{1,3} // OS variable was removed in Qul 1.4
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
config.append(CMakeConfigItem("OS", "FreeRTOS"));
if (mcuTarget->colorDepth() >= 0)
config.append(CMakeConfigItem("QUL_COLOR_DEPTH",
@@ -627,8 +629,12 @@ static void setKitQtVersionOptions(ProjectExplorer::Kit *k)
QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
{
const QString os = QLatin1String(mcuTarget->os()
== McuTarget::OS::FreeRTOS ? " FreeRTOS" : "");
QString os;
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())
: "";
@@ -637,8 +643,12 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop
? "Desktop"
: mcuTarget->qulPlatform();
return QString::fromLatin1("Qt for MCUs %1 - %2%3%4")
.arg(mcuTarget->qulVersion().toString(), targetName, os, colorDepth);
return QString::fromLatin1("Qt for MCUs %1.%2 - %3%4%5")
.arg(QString::number(mcuTarget->qulVersion().majorVersion()),
QString::number(mcuTarget->qulVersion().minorVersion()),
targetName,
os,
colorDepth);
}
QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)

View File

@@ -150,7 +150,6 @@ static McuPackage *createRGLPackage()
static McuPackage *createStm32CubeProgrammerPackage()
{
QString defaultPath = QDir::homePath();
if (Utils::HostOsInfo::isWindowsHost()) {
const QString programPath =
@@ -202,20 +201,52 @@ static McuPackage *createMcuXpressoIdePackage()
return result;
}
static McuPackage *createBoardSdkPackage(const QString &envVar)
struct McuTargetDescription
{
const QString envVarPrefix = envVar.chopped(strlen("_SDK_PATH"));
QString qulVersion;
QString platform;
QString platformVendor;
QVector<int> colorDepths;
QString toolchainId;
QString boardSdkEnvVar;
QString boardSdkName;
QString boardSdkDefaultPath;
QString freeRTOSEnvVar;
QString freeRTOSBoardSdkSubDir;
};
const QString defaultPath =
qEnvironmentVariableIsSet(envVar.toLatin1()) ?
qEnvironmentVariable(envVar.toLatin1()) : QDir::homePath();
static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
{
const auto generateSdkName = [](const QString& envVar) {
auto postfixPos = envVar.indexOf("_SDK_PATH");
if (postfixPos < 0) {
postfixPos = envVar.indexOf("_DIR");
}
auto sdkName = postfixPos > 0 ? envVar.left(postfixPos) : envVar;
return QString::fromLatin1("MCU SDK (%1)").arg(sdkName);
};
const QString sdkName = desc.boardSdkName.isEmpty() ? generateSdkName(desc.boardSdkEnvVar) : desc.boardSdkName;
const QString defaultPath = [&] {
const auto envVar = desc.boardSdkEnvVar.toLatin1();
if (qEnvironmentVariableIsSet(envVar)) {
return qEnvironmentVariable(envVar);
}
if (!desc.boardSdkDefaultPath.isEmpty()) {
QString defaultPath = QDir::rootPath() + desc.boardSdkDefaultPath;
if (QFileInfo::exists(defaultPath)) {
return defaultPath;
}
}
return QDir::homePath();
}();
auto result = new McuPackage(
QString::fromLatin1("MCU SDK (%1)").arg(envVarPrefix),
sdkName,
defaultPath,
{},
envVar);
result->setEnvironmentVariableName(envVar);
desc.boardSdkEnvVar);
result->setEnvironmentVariableName(desc.boardSdkEnvVar);
return result;
}
@@ -242,56 +273,54 @@ static McuPackage *createFreeRTOSSourcesPackage(const QString &envVar, const QSt
return result;
}
struct McuTargetDescription
struct McuTargetFactory
{
QString qulVersion;
QString platform;
QString platformVendor;
QVector<int> colorDepths;
QString toolchainId;
QString boardSdkEnvVar;
QString freeRTOSEnvVar;
QString freeRTOSBoardSdkSubDir;
};
McuTargetFactory(const QHash<QString, McuToolChainPackage *> &tcPkgs,
const QHash<QString, McuPackage *> &vendorPkgs)
: tcPkgs(tcPkgs)
, vendorPkgs(vendorPkgs)
{}
static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescription> &descriptions,
QVector<McuPackage *> *packages)
{
const QHash<QString, McuToolChainPackage *> tcPkgs = {
{{"armgcc"}, createArmGccPackage()},
{{"greenhills"}, createGhsToolchainPackage()},
{{"desktop"}, createDesktopToolChainPackage()},
};
const QHash<QString, McuPackage *> vendorPkgs = {
{{"ST"}, createStm32CubeProgrammerPackage()},
{{"NXP"}, createMcuXpressoIdePackage()},
{{"Renesas"}, createRGLPackage()}
};
QHash<QString, McuPackage *> boardSdkPkgs;
QHash<QString, McuPackage *> freeRTOSPkgs;
QVector<McuTarget *> mcuTargets;
for (const auto &desc : descriptions) {
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchainId);
if (desc.toolchainId == "desktop") {
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
desc.platformVendor, desc.platform,
McuTarget::OS::Desktop, {}, tcPkg);
mcuTargets.append(mcuTarget);
continue;
QVector<McuTarget *> createTargets(const McuTargetDescription& description)
{
if (description.toolchainId == "desktop") {
return createDesktopTargets(description);
}
auto qulVersion = QVersionNumber::fromString(description.qulVersion);
if (qulVersion <= QVersionNumber({1,3})) {
// There was a platform backends related refactoring in Qul 1.4
// This requires different processing of McuTargetDescriptions
return createMcuTargetsLegacy(description);
}
return createMcuTargets(description);
}
QVector<McuPackage *> getMcuPackages() const
{
QVector<McuPackage *> packages;
packages.append(boardSdkPkgs.values().toVector());
packages.append(freeRTOSPkgs.values().toVector());
return packages;
}
protected:
// Implementation for Qul version <= 1.3
QVector<McuTarget *> createMcuTargetsLegacy(const McuTargetDescription& desc)
{
QVector<McuTarget *> mcuTargets;
auto tcPkg = tcPkgs.value(desc.toolchainId);
for (auto os : {McuTarget::OS::BareMetal, McuTarget::OS::FreeRTOS}) {
for (int colorDepth : desc.colorDepths) {
QVector<McuPackage*> required3rdPartyPkgs = {
vendorPkgs.value(desc.platformVendor), tcPkg
};
QVector<McuPackage*> required3rdPartyPkgs = { tcPkg };
if (vendorPkgs.contains(desc.platformVendor)) {
required3rdPartyPkgs.push_back(vendorPkgs.value(desc.platformVendor));
}
QString boardSdkDefaultPath;
if (!desc.boardSdkEnvVar.isEmpty()
&& desc.boardSdkEnvVar != "RGL_DIR") { // Already included in vendorPkgs
if (!desc.boardSdkEnvVar.isEmpty()) {
if (!boardSdkPkgs.contains(desc.boardSdkEnvVar)) {
auto boardSdkPkg = createBoardSdkPackage(desc.boardSdkEnvVar);
auto boardSdkPkg = desc.boardSdkEnvVar != "RGL_DIR"
? createBoardSdkPackage(desc)
: createRGLPackage();
boardSdkPkgs.insert(desc.boardSdkEnvVar, boardSdkPkg);
}
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdkEnvVar);
@@ -319,13 +348,92 @@ static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescrip
mcuTargets.append(mcuTarget);
}
}
return mcuTargets;
}
QVector<McuTarget *> createMcuTargets(const McuTargetDescription& desc)
{
QVector<McuTarget *> mcuTargets;
auto tcPkg = tcPkgs.value(desc.toolchainId);
for (int colorDepth : desc.colorDepths) {
QVector<McuPackage*> required3rdPartyPkgs = { tcPkg };
if (vendorPkgs.contains(desc.platformVendor)) {
required3rdPartyPkgs.push_back(vendorPkgs.value(desc.platformVendor));
}
QString boardSdkDefaultPath;
if (!desc.boardSdkEnvVar.isEmpty()) {
if (!boardSdkPkgs.contains(desc.boardSdkEnvVar)) {
auto boardSdkPkg = createBoardSdkPackage(desc);
boardSdkPkgs.insert(desc.boardSdkEnvVar, boardSdkPkg);
}
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdkEnvVar);
boardSdkDefaultPath = boardSdkPkg->defaultPath();
required3rdPartyPkgs.append(boardSdkPkg);
}
auto os = McuTarget::OS::BareMetal;
if (!desc.freeRTOSEnvVar.isEmpty()) {
os = McuTarget::OS::FreeRTOS;
if (!freeRTOSPkgs.contains(desc.freeRTOSEnvVar)) {
freeRTOSPkgs.insert(desc.freeRTOSEnvVar, createFreeRTOSSourcesPackage(
desc.freeRTOSEnvVar, boardSdkDefaultPath,
desc.freeRTOSBoardSdkSubDir));
}
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOSEnvVar));
}
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
desc.platformVendor, desc.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;
QHash<QString, McuPackage *> boardSdkPkgs;
QHash<QString, McuPackage *> freeRTOSPkgs;
};
static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescription> &descriptions,
QVector<McuPackage *> *packages)
{
const QHash<QString, McuToolChainPackage *> tcPkgs = {
{{"armgcc"}, createArmGccPackage()},
{{"greenhills"}, createGhsToolchainPackage()},
{{"desktop"}, createDesktopToolChainPackage()},
};
const QHash<QString, McuPackage *> vendorPkgs = {
{{"ST"}, createStm32CubeProgrammerPackage()},
{{"NXP"}, createMcuXpressoIdePackage()},
};
McuTargetFactory targetFactory(tcPkgs, vendorPkgs);
QVector<McuTarget *> mcuTargets;
for (const auto &desc : descriptions) {
auto newTargets = targetFactory.createTargets(desc);
mcuTargets.append(newTargets);
}
packages->append(Utils::transform<QVector<McuPackage *> >(
tcPkgs.values(), [&](McuToolChainPackage *tcPkg) { return tcPkg; }));
packages->append(vendorPkgs.values().toVector());
packages->append(boardSdkPkgs.values().toVector());
packages->append(freeRTOSPkgs.values().toVector());
packages->append(targetFactory.getMcuPackages());
return mcuTargets;
}
@@ -357,6 +465,8 @@ static McuTargetDescription parseDescriptionJson(const QByteArray &data)
colorDepthsVector,
toolchain.value("id").toString(),
boardSdk.value("envVar").toString(),
boardSdk.value("name").toString(),
boardSdk.value("defaultPath").toString(),
freeRTOS.value("envVar").toString(),
freeRTOS.value("boardSdkSubDir").toString()
};
@@ -378,11 +488,21 @@ void targetsAndPackages(const Utils::FilePath &dir, QVector<McuPackage *> *packa
}
// Workaround for missing JSON file for Desktop target:
if (dir.pathAppended("/lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib").exists()) {
const QString qulVersion = descriptions.empty() ?
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;
descriptions.prepend({qulVersion, {"Qt"}, {"Qt"}, {32}, {"desktop"}, {}, {}, {}});
desktopDescription.platform = desktopDescription.platformVendor = "Qt";
desktopDescription.colorDepths = {32};
desktopDescription.toolchainId = "desktop";
descriptions.prepend(desktopDescription);
}
mcuTargets->append(targetsFromDescriptions(descriptions, packages));

View File

@@ -1,14 +0,0 @@
#include "%{ProjectName}.h"
#include <qul/application.h>
#include <qul/qul.h>
int main()
{
Qul::initPlatform();
Qul::Application app;
static %{ProjectName} item;
app.setRootItem(&item);
app.exec();
return 0;
}

View File

@@ -4,8 +4,10 @@ project(%{ProjectName} VERSION 0.0.1 LANGUAGES C CXX ASM)
find_package(Qul)
add_executable(%{ProjectName} ${OS}/main.cpp)
add_executable(%{ProjectName})
qul_target_qml_sources(%{ProjectName} %{MainQmlFile})
target_link_libraries(%{ProjectName} Qul::QuickUltralite)
app_target_setup_os(%{ProjectName})
app_target_default_main(%{ProjectName} %{RootItemName})

View File

@@ -1,38 +0,0 @@
#include "%{ProjectName}.h"
#include <qul/application.h>
#include <qul/qul.h>
#include <cstdio>
#include <FreeRTOS.h>
#include <task.h>
#ifndef QUL_STACK_SIZE
#error QUL_STACK_SIZE must be defined.
#endif
static void Qul_Thread(void *argument);
int main()
{
Qul::initPlatform();
if (xTaskCreate(Qul_Thread, "QulExec", QUL_STACK_SIZE, 0, 4, 0) != pdPASS) {
std::printf("Task creation failed!.\\r\\n");
configASSERT(false);
}
vTaskStartScheduler();
// Should not reach this point
configASSERT(false);
return 0;
}
static void Qul_Thread(void *argument)
{
Qul::Application app;
static %{ProjectName} item;
app.setRootItem(&item);
app.exec();
}

View File

@@ -12,6 +12,7 @@
"options":
[
{ "key": "MainQmlFile", "value": "%{ProjectName}.qml" },
{ "key": "RootItemName", "value": "%{ProjectName}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }
],
@@ -52,16 +53,6 @@
"target": "%{ProjectDirectory}/%{ProjectName}.qmlproject",
"openInEditor": false
},
{
"source": "BareMetal/main.cpp.tpl",
"target": "%{ProjectDirectory}/BareMetal/main.cpp",
"openInEditor": false
},
{
"source": "FreeRTOS/main.cpp.tpl",
"target": "%{ProjectDirectory}/FreeRTOS/main.cpp",
"openInEditor": false
},
{
"source": "main.qml.tpl",
"target": "%{ProjectDirectory}/%{MainQmlFile}",

View File

@@ -1,23 +1,28 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd
** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Asset Importer module.
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** If you have questions regarding the use of this file, please use
** contact form at http://www.qt.io/contact-us
** 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.
**
******************************************************************************/
****************************************************************************/
#include "exportnotification.h"
#include "assetexportpluginconstants.h"

View File

@@ -1,23 +1,28 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd
** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Asset Importer module.
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** If you have questions regarding the use of this file, please use
** contact form at http://www.qt.io/contact-us
** 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.
**
******************************************************************************/
****************************************************************************/
#pragma once
#include <QString>

View File

@@ -277,7 +277,7 @@ bool DesignDocument::isQtForMCUsProject() const
if (m_currentTarget)
return m_currentTarget->additionalData("CustomQtForMCUs").toBool();
return true;
return false;
}
void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textModifer)

View File

@@ -7,7 +7,7 @@ DEFINES += DESIGNER_CORE_LIBRARY
INCLUDEPATH += $$PWD \
$$PWD/include
include (instances/instances.pri)
include (instances/instances-lib.pri)
include (../../../../share/qtcreator/qml/qmlpuppet/interfaces/interfaces.pri)
include (../../../../share/qtcreator/qml/qmlpuppet/commands/commands.pri)
include (../../../../share/qtcreator/qml/qmlpuppet/container/container.pri)

View File

@@ -29,6 +29,7 @@
#include <QDebug>
#include <QDataStream>
#include "qmldesignercorelib_global.h"
#include "nodeinstanceglobal.h"
namespace QmlDesigner {
@@ -38,7 +39,7 @@ static const PropertyName annotationProperty = {("annotation")};
static const PropertyName globalAnnotationProperty = {("globalAnnotation")};
static const PropertyName globalAnnotationStatus = {("globalAnnotationStatus")};
class GlobalAnnotationStatus
class QMLDESIGNERCORE_EXPORT GlobalAnnotationStatus
{
public:
enum Status {
@@ -64,7 +65,7 @@ private:
Status m_status;
};
class Comment
class QMLDESIGNERCORE_EXPORT Comment
{
public:
Comment();
@@ -109,7 +110,7 @@ private:
qint64 m_timestamp;
};
class Annotation
class QMLDESIGNERCORE_EXPORT Annotation
{
public:
Annotation();

View File

@@ -41,6 +41,8 @@
#include <QTime>
#include <QtGui/qevent.h>
#include <memory>
namespace ProjectExplorer {
class Target;
}

View File

@@ -0,0 +1,22 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/../include/nodeinstance.h \
$$PWD/baseconnectionmanager.h \
$$PWD/connectionmanager.h \
$$PWD/connectionmanagerinterface.h \
$$PWD/nodeinstanceserverproxy.h \
$$PWD/puppetcreator.h \
$$PWD/puppetbuildprogressdialog.h \
$$PWD/qprocessuniqueptr.h
SOURCES += $$PWD/nodeinstanceserverproxy.cpp \
$$PWD/baseconnectionmanager.cpp \
$$PWD/connectionmanager.cpp \
$$PWD/connectionmanagerinterface.cpp \
$$PWD/nodeinstance.cpp \
$$PWD/nodeinstanceview.cpp \
$$PWD/puppetcreator.cpp \
$$PWD/puppetbuildprogressdialog.cpp
FORMS += $$PWD/puppetbuildprogressdialog.ui

View File

@@ -1,25 +1,7 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/../include/nodeinstance.h \
$$PWD/baseconnectionmanager.h \
$$PWD/capturingconnectionmanager.h \
$$PWD/connectionmanager.h \
$$PWD/connectionmanagerinterface.h \
$$PWD/interactiveconnectionmanager.h \
$$PWD/nodeinstanceserverproxy.h \
$$PWD/puppetcreator.h \
$$PWD/puppetbuildprogressdialog.h \
$$PWD/qprocessuniqueptr.h
HEADERS += $$PWD/capturingconnectionmanager.h \
$$PWD/interactiveconnectionmanager.h
SOURCES += $$PWD/nodeinstanceserverproxy.cpp \
$$PWD/baseconnectionmanager.cpp \
$$PWD/capturingconnectionmanager.cpp \
$$PWD/connectionmanager.cpp \
$$PWD/connectionmanagerinterface.cpp \
$$PWD/interactiveconnectionmanager.cpp \
$$PWD/nodeinstance.cpp \
$$PWD/nodeinstanceview.cpp \
$$PWD/puppetcreator.cpp \
$$PWD/puppetbuildprogressdialog.cpp
FORMS += $$PWD/puppetbuildprogressdialog.ui
SOURCES += $$PWD/capturingconnectionmanager.cpp \
$$PWD/interactiveconnectionmanager.cpp

View File

@@ -535,18 +535,16 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node,
if (hasInstanceForModelNode(node)) {
NodeInstance instance = instanceForModelNode(node);
if (value.isValid() || name == "invisible") {
PropertyValueContainer container(instance.instanceId(), name, value, TypeName());
ChangeAuxiliaryCommand changeAuxiliaryCommand({container});
m_nodeInstanceServer->changeAuxiliaryValues(changeAuxiliaryCommand);
PropertyValueContainer container{instance.instanceId(), name, value, TypeName()};
m_nodeInstanceServer->changeAuxiliaryValues({{container}});
} else {
if (node.hasVariantProperty(name)) {
PropertyValueContainer container(instance.instanceId(), name, node.variantProperty(name).value(), TypeName());
ChangeValuesCommand changeValueCommand({container});
m_nodeInstanceServer->changePropertyValues(changeValueCommand);
} else if (node.hasBindingProperty(name)) {
PropertyBindingContainer container(instance.instanceId(), name, node.bindingProperty(name).expression(), TypeName());
ChangeBindingsCommand changeValueCommand({container});
m_nodeInstanceServer->changePropertyBindings(changeValueCommand);
PropertyBindingContainer container{instance.instanceId(), name, node.bindingProperty(name).expression(), TypeName()};
m_nodeInstanceServer->changePropertyBindings({{container}});
}
}
}
@@ -1105,7 +1103,7 @@ ReparentInstancesCommand NodeInstanceView::createReparentInstancesCommand(const
ChangeFileUrlCommand NodeInstanceView::createChangeFileUrlCommand(const QUrl &fileUrl) const
{
return ChangeFileUrlCommand(fileUrl);
return {fileUrl};
}
ChangeValuesCommand NodeInstanceView::createChangeValueCommand(const QList<VariantProperty>& propertyList) const
@@ -1132,7 +1130,7 @@ ChangeBindingsCommand NodeInstanceView::createChangeBindingCommand(const QList<B
{
QVector<PropertyBindingContainer> containerList;
foreach (const BindingProperty &property, propertyList) {
for (const BindingProperty &property : propertyList) {
ModelNode node = property.parentModelNode();
if (node.isValid() && hasInstanceForModelNode(node)) {
NodeInstance instance = instanceForModelNode(node);
@@ -1142,13 +1140,13 @@ ChangeBindingsCommand NodeInstanceView::createChangeBindingCommand(const QList<B
}
return ChangeBindingsCommand(containerList);
return {containerList};
}
ChangeIdsCommand NodeInstanceView::createChangeIdsCommand(const QList<NodeInstance> &instanceList) const
{
QVector<IdContainer> containerList;
foreach (const NodeInstance &instance, instanceList) {
for (const NodeInstance &instance : instanceList) {
QString id = instance.modelNode().id();
if (!id.isEmpty()) {
IdContainer container(instance.instanceId(), id);
@@ -1156,7 +1154,7 @@ ChangeIdsCommand NodeInstanceView::createChangeIdsCommand(const QList<NodeInstan
}
}
return ChangeIdsCommand(containerList);
return {containerList};
}

View File

@@ -10,6 +10,7 @@ include(../../qtcreatorplugin.pri)
include(qmldesignerplugin.pri)
include(designercore/designercore-lib.pri)
include(designercore/instances/instances.pri)
include(components/componentcore/componentcore.pri)
include(components/integration/integration.pri)
include(components/propertyeditor/propertyeditor.pri)

View File

@@ -139,6 +139,9 @@ QmlMultiLanguageAspect *QmlMultiLanguageAspect::current(ProjectExplorer::Project
QmlMultiLanguageAspect *QmlMultiLanguageAspect::current(ProjectExplorer::Target *target)
{
if (!target)
return {};
if (auto runConfiguration = target->activeRunConfiguration()) {
if (auto multiLanguageAspect = runConfiguration->aspect<QmlProjectManager::QmlMultiLanguageAspect>())
return multiLanguageAspect;

View File

@@ -63,12 +63,16 @@ void Magnifier::showEvent(QShowEvent *e)
{
QWidget::showEvent(e);
grabMouse();
qApp->installEventFilter(this);
emit visibilityChanged(true);
}
void Magnifier::hideEvent(QHideEvent *e)
{
QWidget::hideEvent(e);
releaseMouse();
qApp->removeEventFilter(this);
emit visibilityChanged(false);
}
void Magnifier::mousePressEvent(QMouseEvent *e)
@@ -98,6 +102,20 @@ void Magnifier::wheelEvent(QWheelEvent *e)
m_ui.m_graphicsView->centerOn(m_mainView->mapToScene(pos() - m_topLeft + rect().center()));
}
bool Magnifier::eventFilter(QObject * /*obj*/, QEvent *event)
{
if (event->type() == QEvent::KeyRelease
&& static_cast<QKeyEvent *>(event)->key() == Qt::Key_Alt) {
setVisible(false);
}
if (event->type() == QEvent::ApplicationStateChange
&& QGuiApplication::applicationState() != Qt::ApplicationActive) {
setVisible(false);
}
return false;
}
void Magnifier::moveEvent(QMoveEvent *e)
{
QWidget::moveEvent(e);

View File

@@ -51,8 +51,11 @@ public:
void setCurrentScene(PluginInterface::GraphicsScene *scene);
void setTopLeft(const QPoint &topLeft);
bool eventFilter(QObject *obj, QEvent *event) override;
signals:
void clicked(double zoomLevel);
void visibilityChanged(bool hidden);
protected:
void resizeEvent(QResizeEvent *e) override;

View File

@@ -513,6 +513,7 @@ void MainWidget::addStateView(BaseItem *item)
});
connect(view->view(), &GraphicsView::panningChanged, m_actionHandler->action(ActionPan), &QAction::setChecked);
connect(view->view(), &GraphicsView::magnifierChanged, m_actionHandler->action(ActionMagnifier), &QAction::setChecked);
connect(m_magnifier, &Magnifier::visibilityChanged, m_actionHandler->action(ActionMagnifier), &QAction::setChecked);
connect(view->scene(), &GraphicsScene::openStateView, this, &MainWidget::addStateView, Qt::QueuedConnection);
connect(view->scene(), &GraphicsScene::selectedStateCountChanged, this, [this](int count) {
bool currentView = sender() == m_views.last()->scene();

View File

@@ -186,21 +186,24 @@ void Highlighter::rememberDefinitionForDocument(const Highlighter::Definition &d
const QString &path = document->filePath().toFileInfo().canonicalFilePath();
QSettings *settings = Core::ICore::settings();
settings->beginGroup(Constants::HIGHLIGHTER_SETTINGS_CATEGORY);
if (!mimeType.isEmpty()) {
const Definitions &fileNameDefinitions = definitionsForFileName(document->filePath());
if (fileNameDefinitions.contains(definition)) {
if (!fileExtension.isEmpty()) {
const QString id(kDefinitionForExtension);
QMap<QString, QVariant> map = settings->value(id).toMap();
map.insert(fileExtension, definition.name());
settings->setValue(id, map);
} else if (!path.isEmpty()) {
const QString id(kDefinitionForFilePath);
QMap<QString, QVariant> map = settings->value(id).toMap();
map.insert(document->filePath().toFileInfo().absoluteFilePath(), definition.name());
settings->setValue(id, map);
}
} else if (!mimeType.isEmpty()) {
const QString id(kDefinitionForMimeType);
QMap<QString, QVariant> map = settings->value(id).toMap();
map.insert(mimeType, definition.name());
settings->setValue(id, map);
} else if (!fileExtension.isEmpty()) {
const QString id(kDefinitionForExtension);
QMap<QString, QVariant> map = settings->value(id).toMap();
map.insert(fileExtension, definition.name());
settings->setValue(id, map);
} else if (!path.isEmpty()) {
const QString id(kDefinitionForFilePath);
QMap<QString, QVariant> map = settings->value(id).toMap();
map.insert(document->filePath().toFileInfo().absoluteFilePath(), definition.name());
settings->setValue(id, map);
}
settings->endGroup();
}