diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-10 15:09:37 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-12 15:03:03 +0100 |
commit | 26c5243491f495194f04b449128dae36118e28da (patch) | |
tree | 7fb14678a6fc9e44a10c9224d005e2cbdc6bcb63 /src/plugins | |
parent | 1c7d264e3b2e9a2f0021786ea6967185f8282af0 (diff) | |
parent | c24c5baeda4101b0058689adf9200b77a722c3a2 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts:
dependencies.yaml
src/qml/qml/qqmlengine.cpp
Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
Diffstat (limited to 'src/plugins')
10 files changed, 181 insertions, 10 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index a3d19841cf..d435e82390 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -94,9 +94,12 @@ qint64 NullDevice::writeData(const char *data, qint64 len) // (otherwise we assert in QVariant::operator<< when actually saving it) static bool isSaveable(const QVariant &value) { + const int valType = static_cast<int>(value.userType()); + if (valType >= QMetaType::User) + return false; NullDevice nullDevice; QDataStream fakeStream(&nullDevice); - return QMetaType::save(fakeStream, static_cast<int>(value.userType()), value.constData()); + return QMetaType::save(fakeStream, valType, value.constData()); } QQmlEngineDebugServiceImpl::QQmlEngineDebugServiceImpl(QObject *parent) : diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index 61fea96e2f..333ce4b26f 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -66,7 +66,6 @@ void JavaScriptJob::run() QV4::ScopedContext ctx(scope, engine->currentStackFrame ? engine->currentContext() : engine->scriptContext()); - QObject scopeObject; QV4::CppStackFrame *frame = engine->currentStackFrame; @@ -76,9 +75,10 @@ void JavaScriptJob::run() ctx = static_cast<QV4::ExecutionContext *>(&frame->jsFrame->context); if (context >= 0) { - QQmlContext *extraContext = qmlContext(QQmlDebugService::objectForId(context)); + QObject *forId = QQmlDebugService::objectForId(context); + QQmlContext *extraContext = qmlContext(forId); if (extraContext) - ctx = QV4::QmlContext::create(ctx, QQmlContextData::get(extraContext), &scopeObject); + ctx = QV4::QmlContext::create(ctx, QQmlContextData::get(extraContext), forId); } else if (frameNr < 0) { // Use QML context if available QQmlEngine *qmlEngine = engine->qmlEngine(); if (qmlEngine) { @@ -99,7 +99,7 @@ void JavaScriptJob::run() } } if (!engine->qmlContext()) - ctx = QV4::QmlContext::create(ctx, QQmlContextData::get(qmlRootContext), &scopeObject); + ctx = QV4::QmlContext::create(ctx, QQmlContextData::get(qmlRootContext), nullptr); } } diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index bf73440a39..c504ea605a 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -183,7 +183,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector() : m_blockingMode(false) { const QString args = commandLineArguments(); - const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), QString::SkipEmptyParts); + const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), Qt::SkipEmptyParts); QStringList services; for (const QStringRef &strArgument : lstjsDebugArguments) { if (strArgument == QLatin1String("block")) { diff --git a/src/plugins/qmltooling/qmldbg_preview/qmldbg_preview.pro b/src/plugins/qmltooling/qmldbg_preview/qmldbg_preview.pro index 08686a43e3..e1cbc393f7 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qmldbg_preview.pro +++ b/src/plugins/qmltooling/qmldbg_preview/qmldbg_preview.pro @@ -3,6 +3,7 @@ QT += core-private qml-private packetprotocol-private network quick-private gui- TARGET = qmldbg_preview SOURCES += \ + $$PWD/qqmldebugtranslationservice.cpp \ $$PWD/qqmlpreviewblacklist.cpp \ $$PWD/qqmlpreviewfileengine.cpp \ $$PWD/qqmlpreviewfileloader.cpp \ @@ -12,6 +13,7 @@ SOURCES += \ $$PWD/qqmlpreviewservicefactory.cpp HEADERS += \ + $$PWD/qqmldebugtranslationservice.h \ $$PWD/qqmlpreviewblacklist.h \ $$PWD/qqmlpreviewfileengine.h \ $$PWD/qqmlpreviewfileloader.h \ diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp new file mode 100644 index 0000000000..1561777202 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qqmldebugtranslationservice.h" + +QT_BEGIN_NAMESPACE + +QQmlDebugTranslationServiceImpl::QQmlDebugTranslationServiceImpl(QObject *parent) : + QQmlDebugTranslationService(1, parent) +{ +} + +void QQmlDebugTranslationServiceImpl::messageReceived(const QByteArray &message) +{ + Q_UNUSED(message) +} + +QString QQmlDebugTranslationServiceImpl::foundElidedText(QObject *textObject, const QString &layoutText, const QString &elideText) +{ + Q_UNUSED(textObject) + Q_UNUSED(layoutText) + return elideText; +} + +void QQmlDebugTranslationServiceImpl::foundTranslationBinding(QQmlTranslationBinding *binding, QObject *scopeObject, QQmlContextData *contextData) +{ + Q_UNUSED(binding) + Q_UNUSED(scopeObject) + Q_UNUSED(contextData) +} + +QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.h b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.h new file mode 100644 index 0000000000..a337a937a5 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDEBUGMESSAGESERVICE_H +#define QDEBUGMESSAGESERVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qqmldebugserviceinterfaces_p.h> + +#include <QtCore/qlogging.h> +#include <QtCore/qmutex.h> +#include <QtCore/qelapsedtimer.h> + +QT_BEGIN_NAMESPACE + +class QQmlDebugTranslationServicePrivate; + +class QQmlDebugTranslationServiceImpl : public QQmlDebugTranslationService +{ + Q_OBJECT +public: + //needs to be in sync with QQmlDebugTranslationClient in qqmldebugtranslationclient_p.h + enum Command { + ChangeLanguage, + ChangeWarningColor, + ChangeElidedTextWarningString, + SetDebugTranslationServiceLogFile, + EnableElidedTextWarning, + DisableElidedTextWarning, + TestAllLanguages + }; + QQmlDebugTranslationServiceImpl(QObject *parent = 0); + + QString foundElidedText(QObject *textObject, const QString &layoutText, const QString &elideText) override; + void foundTranslationBinding(QQmlTranslationBinding *binding, QObject *scopeObject, QQmlContextData *contextData) override; + void messageReceived(const QByteArray &message) override; +}; + +QT_END_NAMESPACE + +#endif // QDEBUGMESSAGESERVICE_H diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.json b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.json index d7e1ef1f10..5e148f8101 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.json +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservice.json @@ -1,3 +1,3 @@ { - "Keys" : [ "QmlPreview" ] + "Keys" : [ "QmlPreview", "DebugTranslation" ] } diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp index f0aa3226c8..6ff9805bbe 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewservicefactory.cpp @@ -39,12 +39,18 @@ #include "qqmlpreviewservicefactory.h" #include "qqmlpreviewservice.h" +#include "qqmldebugtranslationservice.h" QT_BEGIN_NAMESPACE QQmlDebugService *QQmlPreviewServiceFactory::create(const QString &key) { - return key == QQmlPreviewServiceImpl::s_key ? new QQmlPreviewServiceImpl(this) : nullptr; + if (key == QQmlPreviewServiceImpl::s_key) + return new QQmlPreviewServiceImpl(this); + if (key == QQmlDebugTranslationServiceImpl::s_key) + return new QQmlDebugTranslationServiceImpl(this); + + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index cc663cd6b3..4d68a4508b 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -345,7 +345,7 @@ void QQmlDebugServerImpl::parseArguments() QString fileName; QStringList services; - const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), QString::SkipEmptyParts); + const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), Qt::SkipEmptyParts); for (auto argsIt = lstjsDebugArguments.begin(), argsItEnd = lstjsDebugArguments.end(); argsIt != argsItEnd; ++argsIt) { const QStringRef &strArgument = *argsIt; if (strArgument.startsWith(QLatin1String("port:"))) { @@ -422,6 +422,11 @@ void QQmlDebugServerImpl::parseArguments() << tr("Sends qDebug() and similar messages over the QML debug\n" "\t\t connection. QtCreator uses this for showing debug\n" "\t\t messages in the debugger console.") << '\n' + << '\n' << QQmlDebugTranslationService::s_key << "\t- " + //: Please preserve the line breaks and formatting + << tr("helps to see if a translated text\n" + "\t\t will result in an elided text\n" + "\t\t in QML elements.") << '\n' << tr("Other services offered by qmltooling plugins that implement " "QQmlDebugServiceFactory and which can be found in the standard plugin " "paths will also be available and can be specified. If no \"services\" " diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index 30097be77b..b5b6e5d7aa 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -36,7 +36,7 @@ qtHaveModule(quick) { qmldbg_inspector \ qmldbg_quickprofiler - qtConfig(qml-network): SUBDIRS += qmldbg_preview + qtConfig(settings):qtConfig(qml-network): SUBDIRS += qmldbg_preview qmldbg_inspector.depends = packetprotocol qmldbg_quickprofiler.depends = packetprotocol |