Merge remote-tracking branch 'origin/7.0'

Conflicts:
	src/plugins/android/androiddevice.h
	src/plugins/android/androidplugin.cpp
	src/plugins/android/androidplugin.h

Change-Id: I1a68354415283fe4a7450706520a576d2a1775e0
This commit is contained in:
Eike Ziller
2022-03-23 14:16:07 +01:00
37 changed files with 644 additions and 122 deletions

View File

@@ -140,8 +140,9 @@ void LauncherInterfacePrivate::doStop()
m_server->close();
QTC_ASSERT(m_process, return);
m_socket->shutdown();
m_process->waitForFinished(3000);
ProcessReaper::reap(m_process);
m_process->waitForFinished(-1); // Let the process interface finish so that it finishes
// reaping any possible processes it has started.
delete m_process;
m_process = nullptr;
}

View File

@@ -195,6 +195,7 @@ void ProcessReaper::reap(QProcess *process, int timeoutMs)
return;
}
ProcessReaper::instance();
new Internal::Reaper(process, timeoutMs);
}

View File

@@ -88,18 +88,15 @@ static bool isTimedOut(const chrono::high_resolution_clock::time_point &start,
return timedOut;
}
static qint64 extractPID(const QByteArray &output, const QString &packageName)
static qint64 extractPID(const QString &output, const QString &packageName)
{
qint64 pid = -1;
foreach (auto tuple, output.split('\n')) {
tuple = tuple.simplified();
if (!tuple.isEmpty()) {
auto parts = tuple.split(':');
QString commandName = QString::fromLocal8Bit(parts.first());
if (parts.length() == 2 && commandName == packageName) {
pid = parts.last().toLongLong();
break;
}
for (const QString &tuple : output.split('\n')) {
// Make sure to remove null characters which might be present in the provided output
const QStringList parts = tuple.simplified().remove('\0').split(':');
if (parts.length() == 2 && parts.first() == packageName) {
pid = parts.last().toLongLong();
break;
}
}
return pid;
@@ -126,7 +123,7 @@ static void findProcessPID(QFutureInterface<qint64> &fi, QStringList selector,
QtcProcess proc;
proc.setCommand({adbPath, args});
proc.runBlocking();
const QByteArray out = proc.allRawOutput();
const QString out = proc.allOutput();
if (preNougat) {
processPID = extractPID(out, packageName);
} else {

View File

@@ -1018,9 +1018,12 @@ public:
m_started = true;
m_finalized = false;
qCDebug(clangdLogTiming).noquote().nospace() << m_task << ": starting";
// Used by ThreadedSubtaskTimer to mark the end of the whole highlighting operation
m_startTimer.restart();
}
qCDebug(clangdLogTiming).noquote().nospace() << m_task << ": subtask started at "
<< QDateTime::currentDateTime().toString();
<< QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz");
QTC_CHECK(!m_timer.isValid());
m_timer.start();
}
@@ -1033,7 +1036,7 @@ public:
if (--m_subtasks > 0) // See startSubtask().
return;
qCDebug(clangdLogTiming).noquote().nospace() << m_task << ": subtask stopped at "
<< QDateTime::currentDateTime().toString();
<< QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz");
QTC_CHECK(m_timer.isValid());
m_elapsedMs += m_timer.elapsed();
m_timer.invalidate();
@@ -1041,9 +1044,12 @@ public:
stopTask();
}
QElapsedTimer startTimer() const { return m_startTimer; }
private:
const QString m_task;
QElapsedTimer m_timer;
QElapsedTimer m_startTimer;
qint64 m_elapsedMs = 0;
int m_subtasks = 0;
bool m_started = false;
@@ -1073,7 +1079,7 @@ public:
class ThreadedSubtaskTimer
{
public:
ThreadedSubtaskTimer(const QString &task) : m_task(task)
ThreadedSubtaskTimer(const QString &task, const TaskTimer &taskTimer) : m_task(task), m_taskTimer(taskTimer)
{
qCDebug(clangdLogTiming).noquote().nospace() << m_task << ": starting thread";
m_timer.start();
@@ -1083,10 +1089,15 @@ public:
{
qCDebug(clangdLogTiming).noquote().nospace() << m_task << ": took " << m_timer.elapsed()
<< " ms in dedicated thread";
qCDebug(clangdLogTiming).noquote().nospace() << m_task << ": Start to end: "
<< m_taskTimer.startTimer().elapsed() << " ms";
}
private:
const QString m_task;
QElapsedTimer m_timer;
const TaskTimer &m_taskTimer;
};
class MemoryTreeModel;
@@ -1212,6 +1223,13 @@ public:
: LanguageClientCompletionAssistProcessor(client, snippetsGroup)
, m_client(client)
{
m_timer.start();
}
~ClangdCompletionAssistProcessor()
{
qCDebug(clangdLogTiming).noquote().nospace()
<< "ClangdCompletionAssistProcessor took: " << m_timer.elapsed() << " ms";
}
private:
@@ -1229,6 +1247,7 @@ private:
const QList<LanguageServerProtocol::CompletionItem> &items) const override;
ClangdClient * const m_client;
QElapsedTimer m_timer;
};
QList<AssistProposalItemInterface *>
@@ -2757,9 +2776,10 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
const QList<ExpandedSemanticToken> &tokens,
const QString &docContents, const AstNode &ast,
const QPointer<TextDocument> &textDocument,
int docRevision, const QVersionNumber &clangdVersion)
int docRevision, const QVersionNumber &clangdVersion,
const TaskTimer &taskTimer)
{
ThreadedSubtaskTimer t("highlighting");
ThreadedSubtaskTimer t("highlighting", taskTimer);
if (future.isCanceled()) {
future.reportFinished();
return;
@@ -3025,9 +3045,10 @@ void ClangdClient::Private::handleSemanticTokens(TextDocument *doc,
const auto runner = [tokens, filePath = doc->filePath(),
text = doc->document()->toPlainText(), ast,
doc = QPointer(doc), rev = doc->document()->revision(),
clangdVersion = q->versionNumber()] {
clangdVersion = q->versionNumber(),
this] {
return Utils::runAsync(semanticHighlighter, filePath, tokens, text, ast, doc, rev,
clangdVersion);
clangdVersion, highlightingTimer);
};
if (isTesting) {

View File

@@ -2394,8 +2394,9 @@ void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context)
// the locator line edit) first activates the window and sets focus to its focus widget.
// Only afterwards the focus is shifted to the widget that received the click.
d->m_scheduledCurrentEditor = editor;
QMetaObject::invokeMethod(d, &EditorManagerPrivate::setCurrentEditorFromContextChange,
Qt::QueuedConnection);
QTimer::singleShot(QApplication::doubleClickInterval() + 10,
d,
&EditorManagerPrivate::setCurrentEditorFromContextChange);
} else {
updateActions();
}

View File

@@ -141,8 +141,10 @@ QString DoxygenGenerator::generate(QTextCursor cursor,
QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl)
{
if (const TemplateDeclarationAST * const templDecl = decl->asTemplateDeclaration())
if (const TemplateDeclarationAST * const templDecl = decl->asTemplateDeclaration();
templDecl && templDecl->declaration) {
decl = templDecl->declaration;
}
SpecifierAST *spec = nullptr;
DeclaratorAST *decltr = nullptr;

View File

@@ -416,15 +416,6 @@ QQmlComponent *PropertyEditorContextObject::specificQmlComponent()
return m_qmlComponent;
}
void PropertyEditorContextObject::setGlobalBaseUrl(const QUrl &newBaseUrl)
{
if (newBaseUrl == m_globalBaseUrl)
return;
m_globalBaseUrl = newBaseUrl;
emit globalBaseUrlChanged();
}
void PropertyEditorContextObject::setSpecificsUrl(const QUrl &newSpecificsUrl)
{
if (newSpecificsUrl == m_specificsUrl)

View File

@@ -42,7 +42,6 @@ class PropertyEditorContextObject : public QObject
{
Q_OBJECT
Q_PROPERTY(QUrl globalBaseUrl READ globalBaseUrl WRITE setGlobalBaseUrl NOTIFY globalBaseUrlChanged)
Q_PROPERTY(QUrl specificsUrl READ specificsUrl WRITE setSpecificsUrl NOTIFY specificsUrlChanged)
Q_PROPERTY(QString specificQmlData READ specificQmlData WRITE setSpecificQmlData NOTIFY specificQmlDataChanged)
@@ -68,7 +67,6 @@ class PropertyEditorContextObject : public QObject
public:
PropertyEditorContextObject(QObject *parent = nullptr);
QUrl globalBaseUrl() const {return m_globalBaseUrl; }
QUrl specificsUrl() const {return m_specificsUrl; }
QString specificQmlData() const {return m_specificQmlData; }
QString stateName() const {return m_stateName; }
@@ -122,7 +120,6 @@ public:
bool hasAliasExport() const { return m_aliasExport; }
signals:
void globalBaseUrlChanged();
void specificsUrlChanged();
void specificQmlDataChanged();
void stateNameChanged();
@@ -139,7 +136,6 @@ signals:
void hasActiveTimelineChanged();
public slots:
void setGlobalBaseUrl(const QUrl &newBaseUrl);
void setSpecificsUrl(const QUrl &newSpecificsUrl);
@@ -161,7 +157,6 @@ public slots:
void setHasAliasExport(bool hasAliasExport);
private:
QUrl m_globalBaseUrl;
QUrl m_specificsUrl;
QString m_specificQmlData;

View File

@@ -549,8 +549,6 @@ void PropertyEditorQmlBackend::initialSetup(const TypeName &typeName, const QUrl
contextObject()->setIsBaseState(true);
contextObject()->setSpecificQmlData(QStringLiteral(""));
contextObject()->setGlobalBaseUrl(QUrl());
}
QString PropertyEditorQmlBackend::propertyEditorResourcesPath()

View File

@@ -119,18 +119,13 @@ void PropertyEditorView::setupPane(const TypeName &typeName)
if (!qmlBackend) {
qmlBackend = new PropertyEditorQmlBackend(this);
qmlBackend->context()->setContextProperty("finishedNotify", QVariant(false) );
qmlBackend->initialSetup(typeName, qmlSpecificsFile, this);
qmlBackend->setSource(qmlFile);
qmlBackend->context()->setContextProperty("finishedNotify", QVariant(true) );
m_stackedWidget->addWidget(qmlBackend->widget());
m_qmlBackendHash.insert(qmlFile.toString(), qmlBackend);
} else {
qmlBackend->context()->setContextProperty("finishedNotify", QVariant(false) );
qmlBackend->initialSetup(typeName, qmlSpecificsFile, this);
qmlBackend->context()->setContextProperty("finishedNotify", QVariant(true) );
}
}
@@ -499,14 +494,12 @@ void PropertyEditorView::setupQmlBackend()
} else {
qmlObjectNode.reset(new QmlObjectNode);
}
currentQmlBackend->context()->setContextProperty("finishedNotify", QVariant(false));
if (specificQmlData.isEmpty())
currentQmlBackend->contextObject()->setSpecificQmlData(specificQmlData);
currentQmlBackend->contextObject()->setGlobalBaseUrl(qmlFile);
currentQmlBackend->contextObject()->setSpecificQmlData(specificQmlData);
currentQmlBackend->setSource(qmlFile);
currentQmlBackend->context()->setContextProperty("finishedNotify", QVariant(true));
} else {
QScopedPointer<QmlObjectNode> qmlObjectNode;
if (m_selectedNode.isValid())
@@ -514,18 +507,14 @@ void PropertyEditorView::setupQmlBackend()
else
qmlObjectNode.reset(new QmlObjectNode);
currentQmlBackend->context()->setContextProperty("finishedNotify", QVariant(false));
if (specificQmlData.isEmpty())
currentQmlBackend->contextObject()->setSpecificQmlData(specificQmlData);
currentQmlBackend->setup(*qmlObjectNode, currentStateName, qmlSpecificsFile, this);
currentQmlBackend->contextObject()->setGlobalBaseUrl(qmlFile);
currentQmlBackend->contextObject()->setSpecificQmlData(specificQmlData);
}
m_stackedWidget->setCurrentWidget(currentQmlBackend->widget());
currentQmlBackend->context()->setContextProperty("finishedNotify", QVariant(true));
currentQmlBackend->contextObject()->triggerSelectionChanged();
m_qmlBackEndForCurrentType = currentQmlBackend;

View File

@@ -91,31 +91,4 @@ void Quick2PropertyEditorView::registerQmlTypes()
}
}
bool Quick2PropertyEditorView::event(QEvent *e)
{
static std::vector<QKeySequence> overrideSequences = { QKeySequence(Qt::SHIFT + Qt::Key_Up),
QKeySequence(Qt::SHIFT + Qt::Key_Down),
QKeySequence(Qt::CTRL + Qt::Key_Up),
QKeySequence(Qt::CTRL + Qt::Key_Down)
};
if (e->type() == QEvent::ShortcutOverride) {
auto keyEvent = static_cast<QKeyEvent *>(e);
static const Qt::KeyboardModifiers relevantModifiers = Qt::ShiftModifier
| Qt::ControlModifier
| Qt::AltModifier
| Qt::MetaModifier;
QKeySequence keySqeuence(keyEvent->key() | (keyEvent->modifiers() & relevantModifiers));
for (const QKeySequence &overrideSequence : overrideSequences)
if (keySqeuence.matches(overrideSequence)) {
keyEvent->accept();
return true;
}
}
return QQuickWidget::event(e);
}
} //QmlDesigner

View File

@@ -38,9 +38,6 @@ public:
explicit Quick2PropertyEditorView(QWidget *parent = nullptr);
static void registerQmlTypes();
protected:
bool event(QEvent *e) override;
};
} //QmlDesigner

View File

@@ -30,10 +30,16 @@
#include "iwidgetplugin.h"
#include <coreplugin/messagebox.h>
#include <coreplugin/icore.h>
#include <utils/filepath.h>
#include "pluginmanager/widgetpluginmanager.h"
#include <QDebug>
#include <QMessageBox>
#include <QDir>
#include <QDirIterator>
#include <QMutex>
enum {
@@ -43,6 +49,30 @@ enum {
namespace QmlDesigner {
namespace Internal {
static QString globalMetaInfoPath()
{
#ifdef SHARE_QML_PATH
if (qEnvironmentVariableIsSet("LOAD_QML_FROM_SOURCE"))
return QLatin1String(SHARE_QML_PATH) + "/globalMetaInfo";
#endif
return Core::ICore::resourcePath("qmldesigner/globalMetaInfo").toString();
}
Utils::FilePaths allGlobalMetaInfoFiles()
{
static Utils::FilePaths paths;
if (!paths.isEmpty())
return paths;
QDirIterator it(globalMetaInfoPath(), { "*.metainfo" }, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext())
paths.append(Utils::FilePath::fromString(it.next()));
return paths;
}
class MetaInfoPrivate
{
Q_DISABLE_COPY(MetaInfoPrivate)
@@ -99,6 +129,19 @@ void MetaInfoPrivate::parseItemLibraryDescriptions()
errorMessage);
}
}
const Utils::FilePaths allMetaInfoFiles = allGlobalMetaInfoFiles();
for (const Utils::FilePath &path : allMetaInfoFiles) {
Internal::MetaInfoReader reader(*m_q);
try {
reader.readMetaInfoFile(path.toString());
} catch (const InvalidMetaInfoException &e) {
qWarning() << e.description();
const QString errorMessage = path.toString() + QLatin1Char('\n') + QLatin1Char('\n') + reader.errors().join(QLatin1Char('\n'));
Core::AsynchronousMessageBox::warning(QCoreApplication::translate("QmlDesigner::Internal::MetaInfoPrivate", "Invalid meta info"),
errorMessage);
}
}
#endif
}

View File

@@ -196,7 +196,8 @@ static bool isIdToAvoid(const QString& id)
"texture",
"shaderInfo",
"sprite",
"spriteSequence"
"spriteSequence",
"baseState"
};
return ids.contains(id);

View File

@@ -335,7 +335,7 @@ QmlObjectNode QmlVisualNode::createQmlObjectNode(AbstractView *view,
if (!newQmlObjectNode.isValid())
return;
newQmlObjectNode.setId(view->model()->generateNewId(itemLibraryEntry.name()));
newQmlObjectNode.modelNode().setIdWithoutRefactoring(view->model()->generateNewId(itemLibraryEntry.name()));
for (const auto &propertyBindingEntry : propertyBindingList)
newQmlObjectNode.modelNode().bindingProperty(propertyBindingEntry.first).setExpression(propertyBindingEntry.second);

View File

@@ -958,6 +958,12 @@ static QList<QmlDesigner::Import> generatePossibleLibraryImports(const QHash<QSt
int majorVersion = importKey.majorVersion;
if (majorVersion >= 0) {
int minorVersion = (importKey.minorVersion == LanguageUtils::ComponentVersion::NoVersion) ? 0 : importKey.minorVersion;
if (libraryName.contains("QtQuick.Studio")) {
majorVersion = 1;
minorVersion = 0;
}
QString version = QStringLiteral("%1.%2").arg(majorVersion).arg(minorVersion);
if (!libraryName.endsWith(".impl"))
possibleImports.append(QmlDesigner::Import::createLibraryImport(libraryName, version));

View File

@@ -26,7 +26,14 @@ MetaInfo {
"QtQuick.Controls.Imagine",
"QtQuick.Controls.Universal",
"QtQuick.Controls.Material",
"QtQuick.Controls.NativeStyle"
"QtQuick.Controls.NativeStyle",
"QtQuick.NativeStyle",
"QtRemoteObjects",
"Qt5Compat.GraphicalEffects",
"QtQuick.Templates",
"QtQuick.Shapes",
"QtQuick.Studio.EventSystem",
"QtQuick.Studio.EventSimulator"
]
showTagsForImports: [

View File

@@ -99,6 +99,8 @@ QdsNewDialog::QdsNewDialog(QWidget *parent)
QObject::connect(&m_wizard, &WizardHandler::statusMessageChanged, this, &QdsNewDialog::onStatusMessageChanged);
QObject::connect(&m_wizard, &WizardHandler::projectCanBeCreated, this, &QdsNewDialog::onProjectCanBeCreatedChanged);
m_dialog->installEventFilter(this);
QObject::connect(&m_wizard, &WizardHandler::wizardCreationFailed, this, [this]() {
QMessageBox::critical(m_dialog, tr("New project"), tr("Failed to initialize data"));
reject();
@@ -110,6 +112,17 @@ QdsNewDialog::QdsNewDialog(QWidget *parent)
});
}
bool QdsNewDialog::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_dialog && event->type() == QEvent::KeyPress
&& static_cast<QKeyEvent *>(event)->key() == Qt::Key_Escape) {
reject();
return true;
}
return false;
}
void QdsNewDialog::onDeletingWizard()
{
m_screenSizeModel->setBackendModel(nullptr);

View File

@@ -42,6 +42,7 @@ class QStandardItemModel;
QT_END_NAMESPACE
namespace StudioWelcome {
class QdsNewDialog : public QObject, public Core::NewDialog
{
Q_OBJECT
@@ -151,6 +152,7 @@ private:
QString projectDescription() const { return m_qmlProjectDescription; }
void updateScreenSizes();
bool eventFilter(QObject *obj, QEvent *ev) override;
private slots:
void onDeletingWizard();

View File

@@ -256,7 +256,7 @@ extend_qtc_executable(qml2puppet
qmlprivategate_56.cpp qmlprivategate.h
)
if(DEFINED MULTILANGUAGE_SUPPORT_SUBDIRECTORY)
if(DEFINED MULTILANGUAGE_SUPPORT_SUBDIRECTORY AND Qt6_VERSION VERSION_GREATER_EQUAL 6.2.1)
add_subdirectory(${MULTILANGUAGE_SUPPORT_SUBDIRECTORY} multilanguagesupport_static_build)
endif()