From 7844c83493bb2380440e4d74b21b9a6c9f1d2c92 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 19 Dec 2017 14:05:54 +0100 Subject: [PATCH 01/13] QmlDesigner: Add checkKeyframesType This works inside copy/paste models in which we do not have instances. Change-Id: I71f08a68d62c3f7a66eabb47f7399eb6fb5847aa Reviewed-by: Knud Dollereder Reviewed-by: Thomas Hartmann --- .../designercore/include/qmltimelinekeyframes.h | 1 + .../designercore/model/qmltimelinekeyframes.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/include/qmltimelinekeyframes.h b/src/plugins/qmldesigner/designercore/include/qmltimelinekeyframes.h index 32d53a5b004..f34e74e5ace 100644 --- a/src/plugins/qmldesigner/designercore/include/qmltimelinekeyframes.h +++ b/src/plugins/qmldesigner/designercore/include/qmltimelinekeyframes.h @@ -66,6 +66,7 @@ public: const QList keyframePositions() const; static bool isValidKeyframe(const ModelNode &node); + static bool checkKeyframesType(const ModelNode &node); static QmlTimelineFrames keyframesForKeyframe(const ModelNode &node); void moveAllFrames(qreal offset); diff --git a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframes.cpp b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframes.cpp index 90f6224021b..b4613281e88 100644 --- a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframes.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframes.cpp @@ -55,8 +55,7 @@ bool QmlTimelineFrames::isValid() const bool QmlTimelineFrames::isValidQmlTimelineFrames(const ModelNode &modelNode) { - return isValidQmlModelNodeFacade(modelNode) - && modelNode.metaInfo().isValid() + return modelNode.isValid() && modelNode.metaInfo().isValid() && modelNode.metaInfo().isSubclassOf("QtQuick.Timeline.Keyframes"); } @@ -219,6 +218,11 @@ bool QmlTimelineFrames::isValidKeyframe(const ModelNode &node) && node.metaInfo().isSubclassOf("QtQuick.Timeline.Keyframe"); } +bool QmlTimelineFrames::checkKeyframesType(const ModelNode &node) +{ + return node.isValid() && node.type() == "QtQuick.Timeline.Keyframes"; +} + QmlTimelineFrames QmlTimelineFrames::keyframesForKeyframe(const ModelNode &node) { if (isValidKeyframe(node) && node.hasParentProperty()) { From c166e8a9bf62dc75479cc25d384783df23ccabdb Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Jan 2018 15:40:55 +0100 Subject: [PATCH 02/13] QmlDesigner: Cleanup code Change-Id: Ie6954e3cac3cdadcaaf53e349f6c884b1ddf8d23 Reviewed-by: Tim Jenssen --- .../components/integration/designdocumentview.cpp | 10 ++++++++++ .../components/integration/designdocumentview.h | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp index a69cd2dcdd6..cfa432cc0b7 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp @@ -44,6 +44,16 @@ DesignDocumentView::~DesignDocumentView() { } +ModelNode DesignDocumentView::insertModel(const ModelNode &modelNode) +{ + return m_modelMerger.insertModel(modelNode); +} + +void DesignDocumentView::replaceModel(const ModelNode &modelNode) +{ + m_modelMerger.replaceModel(modelNode); +} + static QStringList arrayToStringList(const QByteArray &byteArray) { QString str(QString::fromUtf8(byteArray)); diff --git a/src/plugins/qmldesigner/components/integration/designdocumentview.h b/src/plugins/qmldesigner/components/integration/designdocumentview.h index d3fc45c38da..dd3346b6af2 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentview.h +++ b/src/plugins/qmldesigner/components/integration/designdocumentview.h @@ -37,10 +37,8 @@ public: DesignDocumentView(QObject *parent = 0); ~DesignDocumentView(); - ModelNode insertModel(const ModelNode &modelNode) - { return m_modelMerger.insertModel(modelNode); } - void replaceModel(const ModelNode &modelNode) - { m_modelMerger.replaceModel(modelNode); } + ModelNode insertModel(const ModelNode &modelNode); + void replaceModel(const ModelNode &modelNode); void toClipboard() const; void fromClipboard(); From 9e2908df41c2b881738044addcd57c5ab3f6d22b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Jan 2018 15:55:19 +0100 Subject: [PATCH 03/13] QmlDesigner: Forward declare class Change-Id: Ib9efffdd8befb254bb4a7e83f84a9265459d454d Reviewed-by: Tim Jenssen --- .../components/integration/designdocumentview.cpp | 7 ++++--- .../components/integration/designdocumentview.h | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp index cfa432cc0b7..a4178e615cc 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp @@ -26,6 +26,7 @@ #include "designdocumentview.h" #include #include +#include #include #include @@ -36,7 +37,7 @@ namespace QmlDesigner { DesignDocumentView::DesignDocumentView(QObject *parent) - : AbstractView(parent), m_modelMerger(this) + : AbstractView(parent), m_modelMerger(new ModelMerger(this)) { } @@ -46,12 +47,12 @@ DesignDocumentView::~DesignDocumentView() ModelNode DesignDocumentView::insertModel(const ModelNode &modelNode) { - return m_modelMerger.insertModel(modelNode); + return m_modelMerger->insertModel(modelNode); } void DesignDocumentView::replaceModel(const ModelNode &modelNode) { - m_modelMerger.replaceModel(modelNode); + m_modelMerger->replaceModel(modelNode); } static QStringList arrayToStringList(const QByteArray &byteArray) diff --git a/src/plugins/qmldesigner/components/integration/designdocumentview.h b/src/plugins/qmldesigner/components/integration/designdocumentview.h index dd3346b6af2..41fbfd5626e 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentview.h +++ b/src/plugins/qmldesigner/components/integration/designdocumentview.h @@ -26,10 +26,13 @@ #pragma once #include -#include + +#include namespace QmlDesigner { +class ModelMerger; + class DesignDocumentView : public AbstractView { Q_OBJECT @@ -47,7 +50,7 @@ public: void fromText(QString text); private: - ModelMerger m_modelMerger; + std::unique_ptr m_modelMerger; }; }// namespace QmlDesigner From 63cd9cd7801e3d18dc962b71293df9eaec81a415 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 19 Dec 2017 14:10:12 +0100 Subject: [PATCH 04/13] QmlDesigner: Refactor DesignDocument and DesignDocumentView We want to be able to reuse the copy and paste code in other parts. Therefore we move most of the code to DesignDocumentView. Change-Id: Ia0de109e92b128aef4c18255621767280e0dcfef Reviewed-by: Tim Jenssen --- .../components/integration/designdocument.cpp | 67 +------------ .../integration/designdocumentview.cpp | 97 +++++++++++++++++++ .../integration/designdocumentview.h | 5 +- .../designercore/include/viewmanager.h | 2 +- 4 files changed, 107 insertions(+), 64 deletions(-) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 0e78864c140..2235e984a1d 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -382,60 +382,11 @@ void DesignDocument::deleteSelected() void DesignDocument::copySelected() { - QScopedPointer copyModel(Model::create("QtQuick.Rectangle", 1, 0, currentModel())); - copyModel->setFileUrl(currentModel()->fileUrl()); - copyModel->changeImports(currentModel()->imports(), {}); - - Q_ASSERT(copyModel); - DesignDocumentView view; currentModel()->attachView(&view); - if (view.selectedModelNodes().isEmpty()) - return; - - QList selectedNodes(view.selectedModelNodes()); - - foreach (const ModelNode &node, selectedNodes) { - foreach (const ModelNode &node2, selectedNodes) { - if (node.isAncestorOf(node2)) - selectedNodes.removeAll(node2); - } - } - - if (selectedNodes.count() == 1) { - ModelNode selectedNode(selectedNodes.first()); - - if (!selectedNode.isValid()) - return; - - currentModel()->detachView(&view); - - copyModel->attachView(&view); - view.replaceModel(selectedNode); - - Q_ASSERT(view.rootModelNode().isValid()); - Q_ASSERT(view.rootModelNode().type() != "empty"); - - view.toClipboard(); - } else { //multi items selected - currentModel()->detachView(&view); - copyModel->attachView(&view); - - foreach (ModelNode node, view.rootModelNode().directSubModelNodes()) { - node.destroy(); - } - view.changeRootNodeType("QtQuick.Rectangle", 1, 0); - view.rootModelNode().setIdWithRefactoring(QLatin1String("designer__Selection")); - - foreach (const ModelNode &selectedNode, selectedNodes) { - ModelNode newNode(view.insertModel(selectedNode)); - view.rootModelNode().nodeListProperty("data").reparentHere(newNode); - } - - view.toClipboard(); - } + DesignDocumentView::copyModelNodes(view.selectedModelNodes()); } void DesignDocument::cutSelected() @@ -479,28 +430,21 @@ static void scatterItem(const ModelNode &pastedNode, const ModelNode &targetNode void DesignDocument::paste() { - QScopedPointer pasteModel(Model::create("empty", 1, 0, currentModel())); - pasteModel->setFileUrl(currentModel()->fileUrl()); - pasteModel->changeImports(currentModel()->imports(), {}); - - Q_ASSERT(pasteModel); + QScopedPointer pasteModel(DesignDocumentView::pasteToModel()); if (!pasteModel) return; DesignDocumentView view; pasteModel->attachView(&view); - - view.fromClipboard(); - ModelNode rootNode(view.rootModelNode()); + QList selectedNodes = rootNode.directSubModelNodes(); + pasteModel->detachView(&view); if (rootNode.type() == "empty") return; - if (rootNode.id() == QLatin1String("designer__Selection")) { - QList selectedNodes = rootNode.directSubModelNodes(); - pasteModel->detachView(&view); + if (rootNode.id() == "designer__Selection") { currentModel()->attachView(&view); ModelNode targetNode; @@ -546,7 +490,6 @@ void DesignDocument::paste() try { RewriterTransaction transaction(rewriterView(), QByteArrayLiteral("DesignDocument::paste2")); - pasteModel->detachView(&view); currentModel()->attachView(&view); ModelNode pastedNode(view.insertModel(rootNode)); ModelNode targetNode; diff --git a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp index a4178e615cc..b371fe3fe6e 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentview.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentview.cpp @@ -28,12 +28,18 @@ #include #include +#include "designdocument.h" +#include +#include + #include #include #include #include #include +#include + namespace QmlDesigner { DesignDocumentView::DesignDocumentView(QObject *parent) @@ -151,4 +157,95 @@ void DesignDocumentView::fromText(QString text) } } +static Model *currentModel() +{ + DesignDocument *document = QmlDesignerPlugin::instance()->viewManager().currentDesignDocument(); + if (document) + return document->currentModel(); + + return 0; +} + +Model *DesignDocumentView::pasteToModel() +{ + Model *parentModel = currentModel(); + + QTC_ASSERT(parentModel, return 0); + + Model *pasteModel(Model::create("empty", 1, 0, parentModel)); + + pasteModel->setFileUrl(parentModel->fileUrl()); + pasteModel->changeImports(parentModel->imports(), {}); + + Q_ASSERT(pasteModel); + + if (!pasteModel) + return 0; + + DesignDocumentView view; + pasteModel->attachView(&view); + + view.fromClipboard(); + + return pasteModel; +} + +void DesignDocumentView::copyModelNodes(const QList &nodesToCopy) +{ + Model *parentModel = currentModel(); + + QTC_ASSERT(parentModel, return); + + QScopedPointer copyModel(Model::create("QtQuick.Rectangle", 1, 0, parentModel)); + + copyModel->setFileUrl(parentModel->fileUrl()); + copyModel->changeImports(parentModel->imports(), {}); + + Q_ASSERT(copyModel); + + QList selectedNodes = nodesToCopy; + + if (selectedNodes.isEmpty()) + return; + + foreach (const ModelNode &node, selectedNodes) { + foreach (const ModelNode &node2, selectedNodes) { + if (node.isAncestorOf(node2)) + selectedNodes.removeAll(node2); + } + } + + DesignDocumentView view; + copyModel->attachView(&view); + + if (selectedNodes.count() == 1) { + ModelNode selectedNode(selectedNodes.first()); + + if (!selectedNode.isValid()) + return; + + view.replaceModel(selectedNode); + + Q_ASSERT(view.rootModelNode().isValid()); + Q_ASSERT(view.rootModelNode().type() != "empty"); + + view.toClipboard(); + } else { //multi items selected + + foreach (ModelNode node, view.rootModelNode().directSubModelNodes()) { + node.destroy(); + } + view.changeRootNodeType("QtQuick.Rectangle", 2, 0); + view.rootModelNode().setIdWithRefactoring("designer__Selection"); + + foreach (const ModelNode &selectedNode, selectedNodes) { + ModelNode newNode(view.insertModel(selectedNode)); + view.rootModelNode().nodeListProperty("data").reparentHere(newNode); + } + + view.toClipboard(); + } + +} + }// namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/integration/designdocumentview.h b/src/plugins/qmldesigner/components/integration/designdocumentview.h index 41fbfd5626e..6abc92df09b 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentview.h +++ b/src/plugins/qmldesigner/components/integration/designdocumentview.h @@ -33,7 +33,7 @@ namespace QmlDesigner { class ModelMerger; -class DesignDocumentView : public AbstractView +class QMLDESIGNERCORE_EXPORT DesignDocumentView : public AbstractView { Q_OBJECT public: @@ -49,6 +49,9 @@ public: QString toText() const; void fromText(QString text); + static Model *pasteToModel(); + static void copyModelNodes(const QList &nodesToCopy); + private: std::unique_ptr m_modelMerger; }; diff --git a/src/plugins/qmldesigner/designercore/include/viewmanager.h b/src/plugins/qmldesigner/designercore/include/viewmanager.h index f69f714f0a7..b1a8077202e 100644 --- a/src/plugins/qmldesigner/designercore/include/viewmanager.h +++ b/src/plugins/qmldesigner/designercore/include/viewmanager.h @@ -96,6 +96,7 @@ public: void toggleStatesViewExpanded(); QString qmlJSEditorHelpId() const; + DesignDocument *currentDesignDocument() const; private: // functions Q_DISABLE_COPY(ViewManager) @@ -107,7 +108,6 @@ private: // functions Model *currentModel() const; Model *documentModel() const; - DesignDocument *currentDesignDocument() const; QString pathToQt() const; void switchStateEditorViewToBaseState(); From 1e77f48251f8881cdcdcc3734d4d7ec0b2f40e6b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 10 Jan 2018 15:31:20 +0100 Subject: [PATCH 05/13] Fix that translations did not work after setting IDE_ID We currently do not actually rename any resources. Change-Id: I4ebaa4924d6358af63dca7611e64fe53835252d6 Reviewed-by: Tim Jenssen --- src/app/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 90eae94f2bf..e9a863946a3 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -414,7 +414,7 @@ int main(int argc, char **argv) const QString &creatorTrPath = resourcePath() + "/translations"; foreach (QString locale, uiLanguages) { locale = QLocale(locale).name(); - if (translator.load(QString::fromLatin1(Core::Constants::IDE_ID) + "_" + locale, creatorTrPath)) { + if (translator.load("qtcreator_" + locale, creatorTrPath)) { const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); const QString &qtTrFile = QLatin1String("qt_") + locale; // Binary installer puts Qt tr files into creatorTrPath From 0be914853bdeb539d5b4c1cfbf9d969c0d7a5279 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 10 Jan 2018 15:32:28 +0100 Subject: [PATCH 06/13] Use IDE_ID for user resource path We should not share these settings with a different IDE_ID Change-Id: If50102606722f40ab64c9c7fe01c74a9f0dda06e Reviewed-by: Tim Jenssen --- src/plugins/coreplugin/icore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 99f2a2f7da0..33b5beeee25 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -410,7 +410,7 @@ QString ICore::userResourcePath() { // Create qtcreator dir if it doesn't yet exist const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path(); - const QString urp = configDir + QLatin1String("/qtcreator"); + const QString urp = configDir + '/' + QLatin1String(Constants::IDE_ID); if (!QFileInfo::exists(urp + QLatin1Char('/'))) { QDir dir; From ee70917f292bb16effc0aff7932db0a80ff810f7 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 10 Jan 2018 13:57:07 +0100 Subject: [PATCH 07/13] Add qtwebengine backend to qbs help plugin build rules Change-Id: I924637581741dc68d94270cc680df20499778b03 Reviewed-by: Christian Kandeler --- src/plugins/help/help.qbs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/help/help.qbs b/src/plugins/help/help.qbs index c4f0754561b..56f5c4fbd02 100644 --- a/src/plugins/help/help.qbs +++ b/src/plugins/help/help.qbs @@ -5,6 +5,7 @@ QtcPlugin { Depends { name: "Qt"; submodules: ["help", "network", "sql"]; } Depends { name: "Qt.printsupport" } + Depends { name: "Qt.webenginewidgets"; required: false } Depends { name: "Aggregation" } Depends { name: "Utils" } @@ -16,6 +17,8 @@ QtcPlugin { cpp.defines: { var defines = base.concat(["QT_CLUCENE_SUPPORT"]); + if (Qt.webenginewidgets.present) + defines.push("QTC_WEBENGINE_HELPVIEWER"); return defines; } @@ -50,6 +53,14 @@ QtcPlugin { ] } + Group { + name: "WebEngine Sources" + condition: Qt.webenginewidgets.present + files: [ + "webenginehelpviewer.cpp", "webenginehelpviewer.h" + ] + } + Group { id: sharedSources name: "Shared Sources" From 319990d7c562a240311b9d7b53f8591744271c3b Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 10 Jan 2018 10:23:18 +0100 Subject: [PATCH 08/13] Core: return QMainWindow * from Core::mainWindow ... instead of QWidget * Change-Id: Ibe38814ae26524a9ffa4c14d170d5aa487a40931 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/icore.cpp | 2 +- src/plugins/coreplugin/icore.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 33b5beeee25..e62843b8a44 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -486,7 +486,7 @@ QWidget *ICore::currentContextWidget() } -QWidget *ICore::mainWindow() +QMainWindow *ICore::mainWindow() { return m_mainwindow; } diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 6f7991466dc..b466a7f0db5 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -28,6 +28,7 @@ #include "core_global.h" #include "id.h" +#include #include #include #include @@ -99,7 +100,7 @@ public: static QString versionString(); static QString buildCompatibilityString(); - static QWidget *mainWindow(); + static QMainWindow *mainWindow(); static QWidget *dialogParent(); static QStatusBar *statusBar(); /* Raises and activates the window for the widget. This contains workarounds for X11. */ From ec9c2f78d8adf849425a83691e870c1796580cdb Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 10 Jan 2018 15:34:51 +0100 Subject: [PATCH 09/13] Bookmark: const correct BookmarkManager::gotoBookmark Change-Id: Id6118c741d0f21b9c6b968939769ca2ab3d683fd Reviewed-by: Eike Ziller --- src/plugins/bookmarks/bookmarkmanager.cpp | 2 +- src/plugins/bookmarks/bookmarkmanager.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 028c1462346..3ced12e1791 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -500,7 +500,7 @@ Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) const return m_bookmarksList.at(index.row()); } -bool BookmarkManager::gotoBookmark(Bookmark *bookmark) +bool BookmarkManager::gotoBookmark(const Bookmark *bookmark) const { if (IEditor *editor = EditorManager::openEditorAt(bookmark->fileName(), bookmark->lineNumber())) return editor->currentLine() == bookmark->lineNumber(); diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index 3689d59d064..7de5b60d776 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -96,7 +96,7 @@ public: void moveDown(); void edit(); void editByFileAndLine(const Utils::FileName &fileName, int lineNumber); - bool gotoBookmark(Bookmark *bookmark); + bool gotoBookmark(const Bookmark *bookmark) const; signals: void updateActions(bool enableToggle, int state); From 57e27915f444c95e845b3b2790e2e97fde4c465c Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 9 Jan 2018 13:42:06 +0100 Subject: [PATCH 10/13] Fix includes The missing headers were included indirectly through the QHeaderView, QButtonGroup or QAction inside the generated ui files. Now, the generated ui files won't include QHeaderView, QButtonGroup nor QAction, so we need to include the missing headers explicitly. Change-Id: Ife6c4e2c39b2b2b7d8365cc5ae2dbb6de4b3ac66 Reviewed-by: Eike Ziller --- src/libs/qmleditorwidgets/contextpanewidgetimage.cpp | 1 + src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp | 1 + src/plugins/coreplugin/find/findtoolbar.cpp | 1 + src/plugins/macros/macrooptionswidget.cpp | 1 + .../devicesupport/desktopdeviceconfigurationwidget.cpp | 2 ++ src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp | 1 + 6 files changed, 7 insertions(+) diff --git a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp index 188e19ae7db..e503c1078c7 100644 --- a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp +++ b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp index 2b7b054a8d0..15039e5d7a5 100644 --- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp +++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index 8b9016d8f29..f376bc702ca 100644 --- a/src/plugins/coreplugin/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -47,6 +47,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/macros/macrooptionswidget.cpp b/src/plugins/macros/macrooptionswidget.cpp index a55849d50bc..b49d6eeab09 100644 --- a/src/plugins/macros/macrooptionswidget.cpp +++ b/src/plugins/macros/macrooptionswidget.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.cpp b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.cpp index c791e8ac80d..fdac2ab2301 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdeviceconfigurationwidget.cpp @@ -31,6 +31,8 @@ #include #include +#include + using namespace ProjectExplorer::Constants; namespace ProjectExplorer { diff --git a/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp b/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp index 83a25c9c388..6ea510db4ac 100644 --- a/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp +++ b/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp @@ -34,6 +34,7 @@ #include #include #include +#include static const char SettingsApplication[] = "QtCreator"; static const char SettingsKeySkipWarningAbortingBacktrace[] From f3d7208aa9b65af06da79bbdf95bb7e6d099a776 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 11 Jan 2018 10:23:58 +0100 Subject: [PATCH 11/13] Use IDE_ID in sdktool Change-Id: I83d5e13b57cf6c358506c1f07459632bfa4bff52 Reviewed-by: Tobias Hunger --- src/tools/sdktool/settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/sdktool/settings.cpp b/src/tools/sdktool/settings.cpp index a809a3b845f..fa57542fbe3 100644 --- a/src/tools/sdktool/settings.cpp +++ b/src/tools/sdktool/settings.cpp @@ -51,7 +51,7 @@ Settings::Settings() : sdkPath.appendPath(QLatin1String(DATA_PATH)); sdkPath = Utils::FileName::fromString(QDir::cleanPath(sdkPath.toString())); sdkPath.appendPath(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR) - + QLatin1String("/qtcreator")); + + '/' + Core::Constants::IDE_ID); } Utils::FileName Settings::getPath(const QString &file) From f42ea09b74878edc215b317cba08c1f7c7b48a47 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 10 Jan 2018 17:29:27 +0100 Subject: [PATCH 12/13] Do not construct settings/resource paths from QSettings object These paths are controlled by ICore. Add ICore::installerResourcePath() to replace constructions with settings(SystemScope) Replace constructions with settings()->fileName() by usage of ICore::userResourcePath(). Change-Id: I5a9fa9d09f2563c39dc5d11a4586da825c62f9ac Reviewed-by: Tobias Hunger --- src/plugins/android/androidconfigurations.cpp | 3 +-- .../baremetal/gdbserverprovidermanager.cpp | 10 ++-------- .../cmakeprojectmanager/cmaketoolmanager.cpp | 10 ++++------ src/plugins/coreplugin/icore.cpp | 6 ++++++ src/plugins/coreplugin/icore.h | 1 + src/plugins/debugger/debuggeritemmanager.cpp | 16 ++++++---------- .../devicesupport/devicemanager.cpp | 7 +++---- src/plugins/projectexplorer/kitmanager.cpp | 8 +++----- src/plugins/projectexplorer/toolchainmanager.cpp | 10 ++++------ src/plugins/projectexplorer/userfileaccessor.cpp | 6 ++---- src/plugins/qtsupport/qtversionmanager.cpp | 10 +++------- 11 files changed, 35 insertions(+), 52 deletions(-) diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 9720fda932b..3a31ca90af8 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -127,8 +127,7 @@ namespace { static QString sdkSettingsFileName() { - return QFileInfo(Core::ICore::settings(QSettings::SystemScope)->fileName()).absolutePath() - + QLatin1String("/qtcreator/android.xml"); + return Core::ICore::installerResourcePath() + "/android.xml"; } static bool is32BitUserSpace() diff --git a/src/plugins/baremetal/gdbserverprovidermanager.cpp b/src/plugins/baremetal/gdbserverprovidermanager.cpp index 84af4b5c3f9..fa18a024001 100644 --- a/src/plugins/baremetal/gdbserverprovidermanager.cpp +++ b/src/plugins/baremetal/gdbserverprovidermanager.cpp @@ -47,19 +47,13 @@ namespace Internal { const char dataKeyC[] = "GdbServerProvider."; const char countKeyC[] = "GdbServerProvider.Count"; const char fileVersionKeyC[] = "Version"; -const char fileNameKeyC[] = "/qtcreator/gdbserverproviders.xml"; - -static Utils::FileName settingsFileName(const QString &path) -{ - const QFileInfo settingsLocation(Core::ICore::settings()->fileName()); - return Utils::FileName::fromString(settingsLocation.absolutePath() + path); -} +const char fileNameKeyC[] = "/gdbserverproviders.xml"; static GdbServerProviderManager *m_instance = 0; GdbServerProviderManager::GdbServerProviderManager(QObject *parent) : QObject(parent) - , m_configFile(settingsFileName(QLatin1String(fileNameKeyC))) + , m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC)) , m_factories({new DefaultGdbServerProviderFactory, new OpenOcdGdbServerProviderFactory, new StLinkUtilGdbServerProviderFactory}) diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp index 6d72b10c303..d7af9c454f8 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp @@ -46,7 +46,7 @@ const char CMAKETOOL_COUNT_KEY[] = "CMakeTools.Count"; const char CMAKETOOL_DEFAULT_KEY[] = "CMakeTools.Default"; const char CMAKETOOL_DATA_KEY[] = "CMakeTools."; const char CMAKETOOL_FILE_VERSION_KEY[] = "Version"; -const char CMAKETOOL_FILENAME[] = "/qtcreator/cmaketools.xml"; +const char CMAKETOOL_FILENAME[] = "/cmaketools.xml"; class CMakeToolManagerPrivate { @@ -71,8 +71,7 @@ static void addCMakeTool(CMakeTool *item) static FileName userSettingsFileName() { - QFileInfo settingsLocation(ICore::settings()->fileName()); - return FileName::fromString(settingsLocation.absolutePath() + QLatin1String(CMAKETOOL_FILENAME)); + return FileName::fromString(ICore::userResourcePath() + CMAKETOOL_FILENAME); } static QList readCMakeTools(const FileName &fileName, Core::Id *defaultId, bool fromSDK) @@ -325,9 +324,8 @@ void CMakeToolManager::restoreCMakeTools() { Core::Id defaultId; - QFileInfo systemSettingsFile(ICore::settings(QSettings::SystemScope)->fileName()); - FileName sdkSettingsFile = FileName::fromString(systemSettingsFile.absolutePath() - + QLatin1String(CMAKETOOL_FILENAME)); + FileName sdkSettingsFile = FileName::fromString(ICore::installerResourcePath() + + CMAKETOOL_FILENAME); QList toolsToRegister = readCMakeTools(sdkSettingsFile, &defaultId, true); diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index e62843b8a44..1f9d400985c 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -421,6 +421,12 @@ QString ICore::userResourcePath() return urp; } +QString ICore::installerResourcePath() +{ + return QFileInfo(settings(QSettings::SystemScope)->fileName()).path() + '/' + + Constants::IDE_ID; +} + QString ICore::documentationPath() { return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DOC_PATH); diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index b466a7f0db5..925b84d0103 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -94,6 +94,7 @@ public: static QString resourcePath(); static QString userResourcePath(); + static QString installerResourcePath(); static QString documentationPath(); static QString libexecPath(); diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index bc3f0010e89..9f543f01ab7 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -71,9 +71,9 @@ namespace Internal { const char DEBUGGER_COUNT_KEY[] = "DebuggerItem.Count"; const char DEBUGGER_DATA_KEY[] = "DebuggerItem."; -const char DEBUGGER_LEGACY_FILENAME[] = "/qtcreator/profiles.xml"; +const char DEBUGGER_LEGACY_FILENAME[] = "/profiles.xml"; const char DEBUGGER_FILE_VERSION_KEY[] = "Version"; -const char DEBUGGER_FILENAME[] = "/qtcreator/debuggers.xml"; +const char DEBUGGER_FILENAME[] = "/debuggers.xml"; const char debuggingToolsWikiLinkC[] = "http://wiki.qt.io/Qt_Creator_Windows_Debugging"; class DebuggerItemModel; @@ -821,8 +821,7 @@ void DebuggerItemManagerPrivate::readLegacyDebuggers(const FileName &file) static FileName userSettingsFileName() { - QFileInfo settingsLocation(ICore::settings()->fileName()); - return FileName::fromString(settingsLocation.absolutePath() + QLatin1String(DEBUGGER_FILENAME)); + return FileName::fromString(ICore::userResourcePath() + DEBUGGER_FILENAME); } DebuggerItemManagerPrivate::DebuggerItemManagerPrivate() @@ -918,8 +917,7 @@ void DebuggerItemManagerPrivate::readDebuggers(const FileName &fileName, bool is void DebuggerItemManagerPrivate::restoreDebuggers() { // Read debuggers from SDK - QFileInfo systemSettingsFile(ICore::settings(QSettings::SystemScope)->fileName()); - readDebuggers(FileName::fromString(systemSettingsFile.absolutePath() + DEBUGGER_FILENAME), true); + readDebuggers(FileName::fromString(ICore::installerResourcePath() + DEBUGGER_FILENAME), true); // Read all debuggers from user file. readDebuggers(userSettingsFileName(), false); @@ -929,10 +927,8 @@ void DebuggerItemManagerPrivate::restoreDebuggers() autoDetectGdbOrLldbDebuggers(); // Add debuggers from pre-3.x profiles.xml - QFileInfo systemLocation(ICore::settings(QSettings::SystemScope)->fileName()); - readLegacyDebuggers(FileName::fromString(systemLocation.absolutePath() + QLatin1String(DEBUGGER_LEGACY_FILENAME))); - QFileInfo userLocation(ICore::settings()->fileName()); - readLegacyDebuggers(FileName::fromString(userLocation.absolutePath() + QLatin1String(DEBUGGER_LEGACY_FILENAME))); + readLegacyDebuggers(FileName::fromString(ICore::installerResourcePath() + DEBUGGER_LEGACY_FILENAME)); + readLegacyDebuggers(FileName::fromString(ICore::userResourcePath() + DEBUGGER_LEGACY_FILENAME)); } void DebuggerItemManagerPrivate::saveDebuggers() diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp index 900f6d283ac..1b87f03b99a 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp @@ -150,7 +150,7 @@ void DeviceManager::load() // read devices file from global settings path QHash defaultDevices; QList sdkDevices; - if (reader.load(systemSettingsFilePath(QLatin1String("/qtcreator/devices.xml")))) + if (reader.load(systemSettingsFilePath(QLatin1String("/devices.xml")))) sdkDevices = fromMap(reader.restoreValues().value(DeviceManagerKey).toMap(), &defaultDevices); // read devices file from user settings path QList userDevices; @@ -230,9 +230,8 @@ Utils::FileName DeviceManager::settingsFilePath(const QString &extension) Utils::FileName DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath) { - return Utils::FileName::fromString( - QFileInfo(Core::ICore::settings(QSettings::SystemScope)->fileName()).absolutePath() - + deviceFileRelativePath); + return Utils::FileName::fromString(Core::ICore::installerResourcePath() + + deviceFileRelativePath); } void DeviceManager::addDevice(const IDevice::ConstPtr &_device) diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index 91b2529e8dc..ade2064935e 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -53,12 +53,11 @@ const char KIT_DATA_KEY[] = "Profile."; const char KIT_COUNT_KEY[] = "Profile.Count"; const char KIT_FILE_VERSION_KEY[] = "Version"; const char KIT_DEFAULT_KEY[] = "Profile.Default"; -const char KIT_FILENAME[] = "/qtcreator/profiles.xml"; +const char KIT_FILENAME[] = "/profiles.xml"; static FileName settingsFileName() { - QFileInfo settingsLocation(ICore::settings()->fileName()); - return FileName::fromString(settingsLocation.absolutePath() + QLatin1String(KIT_FILENAME)); + return FileName::fromString(ICore::resourcePath() + KIT_FILENAME); } // -------------------------------------------------------------------------- @@ -131,8 +130,7 @@ void KitManager::restoreKits() QList sdkKits; // read all kits from SDK - QFileInfo systemSettingsFile(ICore::settings(QSettings::SystemScope)->fileName()); - QFileInfo kitFile(systemSettingsFile.absolutePath() + QLatin1String(KIT_FILENAME)); + QFileInfo kitFile(ICore::installerResourcePath() + KIT_FILENAME); if (kitFile.exists()) { KitList system = restoreKits(FileName(kitFile)); // make sure we mark these as autodetected and run additional setup logic diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index 87ad2f2b30d..c2681826c15 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -44,14 +44,13 @@ static const char TOOLCHAIN_DATA_KEY[] = "ToolChain."; static const char TOOLCHAIN_COUNT_KEY[] = "ToolChain.Count"; static const char TOOLCHAIN_FILE_VERSION_KEY[] = "Version"; -static const char TOOLCHAIN_FILENAME[] = "/qtcreator/toolchains.xml"; +static const char TOOLCHAIN_FILENAME[] = "/toolchains.xml"; using namespace Utils; static FileName settingsFileName(const QString &path) { - QFileInfo settingsLocation(Core::ICore::settings()->fileName()); - return FileName::fromString(settingsLocation.absolutePath() + path); + return FileName::fromString(Core::ICore::resourcePath() + path); } namespace ProjectExplorer { @@ -304,9 +303,8 @@ void ToolChainManager::restoreToolChains() QList ToolChainManager::readSystemFileToolChains() { - QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName()); - QList systemTcs - = restoreFromFile(FileName::fromString(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME))); + QList systemTcs = restoreFromFile( + FileName::fromString(Core::ICore::installerResourcePath() + TOOLCHAIN_FILENAME)); foreach (ToolChain *tc, systemTcs) tc->setDetection(ToolChain::AutoDetection); diff --git a/src/plugins/projectexplorer/userfileaccessor.cpp b/src/plugins/projectexplorer/userfileaccessor.cpp index fb7a8c7e51a..b86392a273e 100644 --- a/src/plugins/projectexplorer/userfileaccessor.cpp +++ b/src/plugins/projectexplorer/userfileaccessor.cpp @@ -1571,8 +1571,7 @@ static QString maddeRoot(const QString &qmakePath) void UserFileVersion11Upgrader::parseQtversionFile() { PersistentSettingsReader reader; - QFileInfo settingsLocation = QFileInfo(Core::ICore::settings()->fileName()); - reader.load(FileName::fromString(settingsLocation.absolutePath() + "/qtversion.xml")); + reader.load(FileName::fromString(Core::ICore::userResourcePath() + "/../qtversion.xml")); QVariantMap data = reader.restoreValues(); int count = data.value("QtVersion.Count", 0).toInt(); @@ -1610,8 +1609,7 @@ void UserFileVersion11Upgrader::parseQtversionFile() void UserFileVersion11Upgrader::parseToolChainFile() { PersistentSettingsReader reader; - QFileInfo settingsLocation(Core::ICore::settings()->fileName()); - reader.load(FileName::fromString(settingsLocation.absolutePath() + "/toolChains.xml")); + reader.load(FileName::fromString(Core::ICore::userResourcePath() + "/../toolChains.xml")); QVariantMap data = reader.restoreValues(); int count = data.value("ToolChain.Count", 0).toInt(); for (int i = 0; i < count; ++i) { diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 621cfa6878d..b7c50fa02ce 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -63,7 +63,7 @@ using namespace Internal; const char QTVERSION_DATA_KEY[] = "QtVersion."; const char QTVERSION_TYPE_KEY[] = "QtVersion.Type"; const char QTVERSION_FILE_VERSION_KEY[] = "Version"; -const char QTVERSION_FILENAME[] = "/qtcreator/qtversion.xml"; +const char QTVERSION_FILENAME[] = "/qtversion.xml"; static QMap m_versions; static int m_idcount = 0; @@ -77,16 +77,12 @@ enum { debug = 0 }; static FileName globalSettingsFileName() { - QSettings *globalSettings = ExtensionSystem::PluginManager::globalSettings(); - return FileName::fromString(QFileInfo(globalSettings->fileName()).absolutePath() - + QLatin1String(QTVERSION_FILENAME)); + return FileName::fromString(Core::ICore::installerResourcePath() + QTVERSION_FILENAME); } static FileName settingsFileName(const QString &path) { - QSettings *settings = ExtensionSystem::PluginManager::settings(); - QFileInfo settingsLocation(settings->fileName()); - return FileName::fromString(settingsLocation.absolutePath() + path); + return FileName::fromString(Core::ICore::resourcePath() + path); } From b65c13c6a5c1d9447b6b04cef5a14b2204dadcf9 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 11 Jan 2018 14:15:03 +0100 Subject: [PATCH 13/13] Improve failure message when usable libclang is not found Change-Id: Id541206c6b284be7a1068533825c88c9352f9d7f Reviewed-by: Christian Kandeler --- qbs/modules/libclang/libclang.qbs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qbs/modules/libclang/libclang.qbs b/qbs/modules/libclang/libclang.qbs index 44096275b1b..e4253cc105e 100644 --- a/qbs/modules/libclang/libclang.qbs +++ b/qbs/modules/libclang/libclang.qbs @@ -55,9 +55,10 @@ Module { validate: { if (!clangProbe.found) { - console.warn("Set LLVM_INSTALL_DIR to build the Clang Code Model." + console.warn("No usable libclang version found." + + " Set LLVM_INSTALL_DIR to build the Clang Code Model." + " For details, see doc/src/editors/creator-clang-codemodel.qdoc."); - throw "No usable libclang found"; + throw new Error(); } } }