diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-01-23 15:49:14 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-02-22 05:45:47 +0000 |
commit | 2acf0922cfb90db48ecf4fdbc7fecbf1289aa5e6 (patch) | |
tree | 8abafbd05c5eb25a41519c82ca7c5e65094b529d | |
parent | 26f518eab625ecf239b0d70de9a9d99e91475c48 (diff) | |
parent | f51ea3b93c350325c240e762b13dbfe14a721efa (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-6.2.8' into tqtc/lts-6.2-opensource
Conflicts solved in a file:
dependencies.yaml
Change-Id: Ib7798d4e9fc26d53ce4d4eaddd021c7036796933
-rw-r--r-- | .cmake.conf | 2 | ||||
-rw-r--r-- | coin/module_config.yaml | 1 | ||||
-rw-r--r-- | dependencies.yaml | 8 | ||||
-rw-r--r-- | doc/external-pages.qdoc | 31 | ||||
-rw-r--r-- | doc/qtapplicationmanager-project.qdocconf | 2 | ||||
-rw-r--r-- | src/common-lib/configcache_p.h | 2 | ||||
-rw-r--r-- | src/common-lib/qtyaml.cpp | 144 | ||||
-rw-r--r-- | src/manager-lib/applicationmanager.cpp | 21 | ||||
-rw-r--r-- | tests/auto/yaml/data/test.yaml | 1 | ||||
-rw-r--r-- | tests/auto/yaml/tst_yaml.cpp | 2 |
10 files changed, 130 insertions, 84 deletions
diff --git a/.cmake.conf b/.cmake.conf index f6f7fed3..55ff681c 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1 +1 @@ -set(QT_REPO_MODULE_VERSION "6.2.7") +set(QT_REPO_MODULE_VERSION "6.2.8") diff --git a/coin/module_config.yaml b/coin/module_config.yaml index a7e75089..6d02833b 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -1,4 +1,5 @@ version: 2 +tags: ["documentation"] accept_configuration: condition: and conditions: diff --git a/dependencies.yaml b/dependencies.yaml index 28db2c74..b696d905 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,13 +1,13 @@ dependencies: ../tqtc-qtbase: - ref: 694575a59b5370afc494fbf700eee8db1d1ec091 + ref: 67934c103800bae50c2ec1977758d40fa8e4e507 required: true ../tqtc-qtdeclarative: - ref: 02277e3753613d9e19bbb36367c7d2b1d13d7545 + ref: 302ab20d46280e11042f3896460c55d8b8146e41 required: true ../tqtc-qttools: - ref: 0f75d2b2e6c4a049682c2cc520cfc9184ef52454 + ref: 925864c123ba736618af49f4ee0d2ebb25aa403b required: false ../tqtc-qtwayland: - ref: 009790624bf0619ffc6a1bb7f95cd3144c0e5c63 + ref: 26ed4eb3599128785ccfb60e7f5f1642d045d029 required: false diff --git a/doc/external-pages.qdoc b/doc/external-pages.qdoc new file mode 100644 index 00000000..b1a2314d --- /dev/null +++ b/doc/external-pages.qdoc @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \externalpage https://doc-snapshots.qt.io/qtdltlogging/ + \title Qt DLT Logging +*/ diff --git a/doc/qtapplicationmanager-project.qdocconf b/doc/qtapplicationmanager-project.qdocconf index 65fe8a1f..da115e40 100644 --- a/doc/qtapplicationmanager-project.qdocconf +++ b/doc/qtapplicationmanager-project.qdocconf @@ -61,7 +61,7 @@ sourcedirs += \ imagedirs += ../doc/images exampledirs = ../examples -depends += qtcore qtquick qtqml qtdoc qtwaylandcompositor qtwidgets qtdltlogging +depends += qtcore qtquick qtqml qtdoc qtwaylandcompositor qtwidgets qhp.projects = QtApplicationManager qhp.QtApplicationManager.file = qtapplicationmanager.qhp qhp.QtApplicationManager.namespace = org.qt-project.qtapplicationmanager.$QT_VERSION_TAG diff --git a/src/common-lib/configcache_p.h b/src/common-lib/configcache_p.h index 5fa9cc07..a7490fde 100644 --- a/src/common-lib/configcache_p.h +++ b/src/common-lib/configcache_p.h @@ -46,7 +46,7 @@ struct ConfigCacheEntry struct CacheHeader { enum { Magic = 0x23d39366, // dd if=/dev/random bs=4 count=1 status=none | xxd -p - Version = 3 }; + Version = 3 | (QT_VERSION_MAJOR << 24) }; quint32 magic = Magic; quint32 version = Version; diff --git a/src/common-lib/qtyaml.cpp b/src/common-lib/qtyaml.cpp index 9e67cece..5f5f931c 100644 --- a/src/common-lib/qtyaml.cpp +++ b/src/common-lib/qtyaml.cpp @@ -316,9 +316,8 @@ QVariant YamlParser::parseScalar() const { QString scalar = parseString(); - if (scalar.isEmpty() - || d->event.data.scalar.style == YAML_SINGLE_QUOTED_SCALAR_STYLE - || d->event.data.scalar.style == YAML_DOUBLE_QUOTED_SCALAR_STYLE) { + if (d->event.data.scalar.style == YAML_SINGLE_QUOTED_SCALAR_STYLE + || d->event.data.scalar.style == YAML_DOUBLE_QUOTED_SCALAR_STYLE) { return scalar; } @@ -563,79 +562,84 @@ QStringList YamlParser::parseStringOrStringList() } } -void YamlParser::parseFields(const std::vector<Field> &fields) +static QString mapEventNames(const QVector<yaml_event_type_t> &events) { - if (!isMap()) - throw YamlParserException(this, "Expected a map (type %1) to parse fields from, but got type %2") - .arg(YAML_MAPPING_START_EVENT).arg(d->event.type); + static const QHash<yaml_event_type_t, const char *> eventNames = { + { YAML_NO_EVENT, "nothing" }, + { YAML_STREAM_START_EVENT, "stream start" }, + { YAML_STREAM_END_EVENT, "stream end" }, + { YAML_DOCUMENT_START_EVENT, "document start" }, + { YAML_DOCUMENT_END_EVENT, "document end" }, + { YAML_ALIAS_EVENT, "alias" }, + { YAML_SCALAR_EVENT, "scalar" }, + { YAML_SEQUENCE_START_EVENT, "sequence start" }, + { YAML_SEQUENCE_END_EVENT, "sequence end" }, + { YAML_MAPPING_START_EVENT, "mapping start" }, + { YAML_MAPPING_END_EVENT, "mapping end" } + }; + QString names; + for (int i = 0; i < events.size(); ++i) { + if (i) + names.append(i == (events.size() - 1) ? qL1S(" or ") : qL1S(", ")); + names.append(qL1S(eventNames.value(events.at(i), "<unknown>"))); + } + return names; +}; +void YamlParser::parseFields(const std::vector<Field> &fields) +{ QVector<QString> fieldsFound; - while (true) { - nextEvent(); // read key - if (d->event.type == YAML_MAPPING_END_EVENT) - break; - QString key = parseMapKey(); - if (fieldsFound.contains(key)) - throw YamlParserException(this, "Found duplicate key '%1' in mapping").arg(key); - - auto field = fields.cbegin(); - for (; field != fields.cend(); ++field) { - if (key == qL1S(field->name)) - break; - } - if (field == fields.cend()) - throw YamlParserException(this, "Field '%1' is not valid in this context").arg(key); - fieldsFound << key; - - nextEvent(); // read value - QVector<yaml_event_type_t> allowedEvents; - if (field->types & YamlParser::Scalar) - allowedEvents.append(YAML_SCALAR_EVENT); - if (field->types & YamlParser::Map) - allowedEvents.append(YAML_MAPPING_START_EVENT); - if (field->types & YamlParser::List) - allowedEvents.append(YAML_SEQUENCE_START_EVENT); - - if (!allowedEvents.contains(d->event.type)) { // ALIASES MISSING HERE! - auto mapEventNames = [](const QVector<yaml_event_type_t> &events) -> QString { - static const QHash<yaml_event_type_t, const char *> eventNames = { - { YAML_NO_EVENT, "nothing" }, - { YAML_STREAM_START_EVENT, "stream start" }, - { YAML_STREAM_END_EVENT, "stream end" }, - { YAML_DOCUMENT_START_EVENT, "document start" }, - { YAML_DOCUMENT_END_EVENT, "document end" }, - { YAML_ALIAS_EVENT, "alias" }, - { YAML_SCALAR_EVENT, "scalar" }, - { YAML_SEQUENCE_START_EVENT, "sequence start" }, - { YAML_SEQUENCE_END_EVENT, "sequence end" }, - { YAML_MAPPING_START_EVENT, "mapping start" }, - { YAML_MAPPING_END_EVENT, "mapping end" } - }; - QString names; - for (int i = 0; i < events.size(); ++i) { - if (i) - names.append(i == (events.size() - 1) ? qL1S(" or ") : qL1S(", ")); - names.append(qL1S(eventNames.value(events.at(i), "<unknown>"))); - } - return names; - }; - - throw YamlParserException(this, "Field '%1' expected to be of type '%2', but got '%3'") - .arg(field->name).arg(mapEventNames(allowedEvents)).arg(mapEventNames({ d->event.type })); + if (!isMap()) { + // an empty document is ok - we just have to check for required fields below + if (!isScalar() || (parseScalar() != QVariant::fromValue(nullptr))) { + throw YamlParserException(this, "Expected a map (type '%1') to parse fields from, but got type '%2'") + .arg(mapEventNames({ YAML_MAPPING_START_EVENT })).arg(mapEventNames({ d->event.type })); } + } else { + while (true) { + nextEvent(); // read key + if (d->event.type == YAML_MAPPING_END_EVENT) + break; + QString key = parseMapKey(); + if (fieldsFound.contains(key)) + throw YamlParserException(this, "Found duplicate key '%1' in mapping").arg(key); + + auto field = fields.cbegin(); + for (; field != fields.cend(); ++field) { + if (key == qL1S(field->name)) + break; + } + if (field == fields.cend()) + throw YamlParserException(this, "Field '%1' is not valid in this context").arg(key); + fieldsFound << key; + + nextEvent(); // read value + QVector<yaml_event_type_t> allowedEvents; + if (field->types & YamlParser::Scalar) + allowedEvents.append(YAML_SCALAR_EVENT); + if (field->types & YamlParser::Map) + allowedEvents.append(YAML_MAPPING_START_EVENT); + if (field->types & YamlParser::List) + allowedEvents.append(YAML_SEQUENCE_START_EVENT); + + if (!allowedEvents.contains(d->event.type)) { // ALIASES MISSING HERE! + throw YamlParserException(this, "Field '%1' expected to be of type '%2', but got '%3'") + .arg(field->name).arg(mapEventNames(allowedEvents)).arg(mapEventNames({ d->event.type })); + } - yaml_event_type_t typeBefore = d->event.type; - yaml_event_type_t typeAfter; - switch (typeBefore) { - case YAML_MAPPING_START_EVENT: typeAfter = YAML_MAPPING_END_EVENT; break; - case YAML_SEQUENCE_START_EVENT: typeAfter = YAML_SEQUENCE_END_EVENT; break; - default: typeAfter = typeBefore; break; - } - field->callback(this); - if (d->event.type != typeAfter) { - throw YamlParserException(this, "Invalid YAML event state after field callback for '%3': expected %1, but got %2") - .arg(typeAfter).arg(d->event.type).arg(key); + yaml_event_type_t typeBefore = d->event.type; + yaml_event_type_t typeAfter; + switch (typeBefore) { + case YAML_MAPPING_START_EVENT: typeAfter = YAML_MAPPING_END_EVENT; break; + case YAML_SEQUENCE_START_EVENT: typeAfter = YAML_SEQUENCE_END_EVENT; break; + default: typeAfter = typeBefore; break; + } + field->callback(this); + if (d->event.type != typeAfter) { + throw YamlParserException(this, "Invalid YAML event state after field callback for '%3': expected %1, but got %2") + .arg(typeAfter).arg(d->event.type).arg(key); + } } } QStringList fieldsMissing; diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index 2b71342d..958ba265 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -616,7 +616,7 @@ bool ApplicationManager::startApplicationInternal(const QString &appId, const QS { if (d->shuttingDown) throw Exception("Cannot start applications during shutdown"); - Application *app = fromId(appId); + QPointer<Application> app = fromId(appId); if (!app) throw Exception("Cannot start application: id '%1' is not known").arg(appId); if (app->isBlocked()) @@ -787,10 +787,14 @@ bool ApplicationManager::startApplicationInternal(const QString &appId, const QS return false; } - connect(runtime, &AbstractRuntime::stateChanged, this, [this, app](Am::RunState newRuntimeState) { - app->setRunState(newRuntimeState); - emit applicationRunStateChanged(app->id(), newRuntimeState); - emitDataChanged(app, QVector<int> { IsRunning, IsStartingUp, IsShuttingDown }); + // if an app is stopped because of a removal and the container is slow to stop, we might + // end up with a dead app pointer in this callback at some point + connect(runtime, &AbstractRuntime::stateChanged, this, [this, app, appId](Am::RunState newRuntimeState) { + if (app) + app->setRunState(newRuntimeState); + emit applicationRunStateChanged(appId, newRuntimeState); + if (app) + emitDataChanged(app, QVector<int> { IsRunning, IsStartingUp, IsShuttingDown }); }); if (!documentUrl.isNull()) @@ -818,8 +822,11 @@ bool ApplicationManager::startApplicationInternal(const QString &appId, const QS // object plus the per-app state. Relying on 2 lambdas is the easier choice for now. auto doStartInContainer = [this, app, attachRuntime, runtime]() -> bool { - bool successfullyStarted = attachRuntime ? runtime->attachApplicationToQuickLauncher(app) - : runtime->start(); + bool successfullyStarted = false; + if (app) { + successfullyStarted = attachRuntime ? runtime->attachApplicationToQuickLauncher(app) + : runtime->start(); + } if (successfullyStarted) emitActivated(app); else diff --git a/tests/auto/yaml/data/test.yaml b/tests/auto/yaml/data/test.yaml index b16e3d39..7b2e5e84 100644 --- a/tests/auto/yaml/data/test.yaml +++ b/tests/auto/yaml/data/test.yaml @@ -15,6 +15,7 @@ bool-false: false bool-no: no null-literal: null null-tilde: ~ +null-empty: string-unquoted: unquoted string-singlequoted: 'singlequoted' string-doublequoted: "doublequoted" diff --git a/tests/auto/yaml/tst_yaml.cpp b/tests/auto/yaml/tst_yaml.cpp index b189142d..d613dec1 100644 --- a/tests/auto/yaml/tst_yaml.cpp +++ b/tests/auto/yaml/tst_yaml.cpp @@ -77,6 +77,7 @@ void tst_Yaml::parser() { "bool-no", false }, { "null-literal", vnull }, { "null-tilde", vnull }, + { "null-empty", vnull }, { "string-unquoted", QVariant::fromValue<QString>(qSL("unquoted")) }, { "string-singlequoted", QVariant::fromValue<QString>(qSL("singlequoted")) }, { "string-doublequoted", QVariant::fromValue<QString>(qSL("doublequoted")) }, @@ -201,6 +202,7 @@ static const QVariantMap testMainDoc = { { qSL("bool-no"), false }, { qSL("null-literal"), vnull }, { qSL("null-tilde"), vnull }, + { qSL("null-empty"), vnull }, { qSL("string-unquoted"), qSL("unquoted") }, { qSL("string-singlequoted"), qSL("singlequoted") }, { qSL("string-doublequoted"), qSL("doublequoted") }, |